'\" t .\" Title: clEnqueueNativeKernel .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "CLENQUEUENATIVEKERNE" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" clEnqueueNativeKernel \- Enqueues a command to execute a native C/C++ function not compiled using the OpenCL compiler\&. .SH "" .HP \w'cl_int\ clEnqueueNativeKernel('u .BI "cl_int clEnqueueNativeKernel(cl_command_queue\ " "command_queue" ", void\ " "(*user_func)(void\ *)" ", void\ *" "args" ", size_t\ " "cb_args" ", cl_uint\ " "num_mem_objects" ", const\ cl_mem\ *" "mem_list" ", const\ void\ *" "*args_mem_loc" ", cl_uint\ " "num_events_in_wait_list" ", const\ cl_event\ *" "event_wait_list" ", cl_event\ *" "event" ");" .SH "PARAMETERS" .PP \fI command_queue \fR .RS 4 A valid command\-queue\&. A native user function can only be executed on a command\-queue created on a device that has \fBCL_EXEC_NATIVE_KERNEL\fR capability set in \fBCL_DEVICE_EXECUTION_CAPABILITIES\fR as specified in the table of OpenCL Device Queries for \fBclGetDeviceInfo\fR(3clc)\&. .RE .PP \fI user_func \fR .RS 4 A pointer to a host\-callable user function\&. .RE .PP \fI args \fR .RS 4 A pointer to the args list that \fIuser_func\fR should be called with\&. .RE .PP \fI cb_args \fR .RS 4 The size in bytes of the args list that \fIargs\fR points to\&. .sp The data pointed to by \fIargs\fR and \fIcb_args\fR bytes in size will be copied and a pointer to this copied region will be passed to \fIuser_func\fR\&. The copy needs to be done because the memory objects (\fBcl_mem\fR values) that \fIargs\fR may contain need to be modified and replaced by appropriate pointers to global memory\&. When \fBclEnqueueNativeKernel\fR returns, the memory region pointed to by \fIargs\fR can be reused by the application\&. .RE .PP \fI num_mem_objects \fR .RS 4 The number of buffer objects that are passed in \fIargs\fR\&. .RE .PP \fI mem_list \fR .RS 4 A list of valid buffer objects, if \fInum_mem_objects\fR > 0\&. The buffer object values specified in \fImem_list\fR are memory object handles (\fBcl_mem\fR values) returned by \fBclCreateBuffer\fR(3clc) or NULL\&. .RE .PP \fI args_mem_loc \fR .RS 4 A pointer to appropriate locations that \fIargs\fR points to where memory object handles (\fBcl_mem\fR values) are stored\&. Before the user function is executed, the memory object handles are replaced by pointers to global memory\&. .RE .PP \fI \fR\fI\fR\fI event_wait_list \fR and \fI \fR\fI\fR\fI num_events_in_wait_list \fR .RS 4 Specify events that need to complete before this particular command can be executed\&. If \fIevent_wait_list\fR is NULL, then this particular command does not wait on any event to complete\&. If \fIevent_wait_list\fR is NULL, \fInum_events_in_wait_list\fR must be 0\&. If \fIevent_wait_list\fR is not NULL, the list of events pointed to by \fIevent_wait_list\fR must be valid and \fInum_events_in_wait_list\fR must be greater than 0\&. The events specified in \fIevent_wait_list\fR act as synchronization points\&. The context associated with events in \fIevent_wait_list\fR and \fIcommand_queue\fR must be the same\&. The memory associated with \fIevent_wait_list\fR can be reused or freed after the function returns\&. .RE .SH "NOTES" .PP The total number of read\-only images specified as arguments to a kernel cannot exceed \fBCL_DEVICE_MAX_READ_IMAGE_ARGS\fR\&. Each 2D image array argument to a kernel declared with the read_only qualifier counts as one image\&. .PP The total number of write\-only images specified as arguments to a kernel cannot exceed \fBCL_DEVICE_MAX_WRITE_IMAGE_ARGS\fR\&. Each 2D image array argument to a kernel declared with the write\-only qualifier counts as one image\&. .SH "ERRORS" .PP Returns CL_SUCCESS if the user function execution instance was successfully queued, or one of the errors below: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_COMMAND_QUEUE if \fIcommand_queue\fR is not a valid command\-queue\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_CONTEXT if context associated with \fIcommand_queue\fR and events in \fIevent\-wait_list\fR are not the same\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fIuser_func\fR is NULL\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fIargs\fR is a NULL value and \fIcb_args\fR > 0, or if \fIargs\fR is a NULL value and \fInum_mem_objects\fR > 0\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fIargs\fR is not NULL and \fIcb_args\fR is 0\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fInum_mem_objects\fR > 0 and \fImem_list\fR or \fIargs_mem_loc\fR are NULL\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fInum_mem_objects\fR = 0 and \fImem_list\fR or \fIargs_mem_loc\fR are not NULL\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_OPERATION if the device associated with \fIcommand_queue\fR cannot execute the native kernel\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_MEM_OBJECT if one or more memory objects specified in \fImem_list\fR are not valid or are not buffer objects\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_RESOURCES if there is a failure to queue the execution instance of \fIkernel\fR on the command\-queue because of insufficient resources needed to execute the kernel\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for data store associated with buffer objects specified as arguments to \fIkernel\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_EVENT_WAIT_LIST if \fIevent_wait_list\fR is NULL and \fInum_events_in_wait_list\fR > 0, or \fIevent_wait_list\fR is not NULL and \fInum_events_in_wait_list\fR is 0, or if event objects in \fIevent_wait_list\fR are not valid events\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host\&. .RE .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBclEnqueueNDRangeKernel\fR(3clc), \fBclEnqueueNativeKernel\fR(3clc), \fBclCreateCommandQueue\fR(3clc), \fBclCreateBuffer\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 174, section 5.8 - Executing Kernels (updated for 1.2 rev 14) .RE