C Specification
To enqueue a command to execute a kernel on a device, using a single work-item, call the function
// Provided by CL_VERSION_1_0
cl_int clEnqueueTask(
cl_command_queue command_queue,
cl_kernel kernel,
cl_uint num_events_in_wait_list,
const cl_event* event_wait_list,
cl_event* event);
| clEnqueueTask is deprecated by version 2.0. |
Parameters
-
command_queue is a valid host command-queue. The kernel will be queued for execution on the device associated with command_queue.
-
kernel is a valid kernel object. The OpenCL context associated with kernel and command-queue must be the same.
-
event_wait_list and num_events_in_wait_list specify events that need to complete before this particular command can be executed. If event_wait_list is
NULL, then this particular command does not wait on any event to complete. If event_wait_list isNULL, num_events_in_wait_list must be 0. If event_wait_list is notNULL, the list of events pointed to by event_wait_list must be valid and num_events_in_wait_list must be greater than 0. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_queue must be the same. The memory associated with event_wait_list can be reused or freed after the function returns. -
event returns an event object that identifies this command and can be used to query or wait for this command to complete. If event is
NULLor the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are notNULL, event must not refer to an element of the event_wait_list array.
Description
clEnqueueTask is equivalent to calling clEnqueueNDRangeKernel with
work_dim set to 1, global_work_offset set to NULL, global_work_size[0]
set to 1, and local_work_size[0] set to 1.
clEnqueueTask returns CL_SUCCESS if the kernel-instance was successfully
queued.
Otherwise, it returns one of the following errors:
-
CL_INVALID_if there is no successfully built program executable available for device associated with command_queue.PROGRAM_ EXECUTABLE -
CL_INVALID_if command_queue is not a valid host command-queue.COMMAND_ QUEUE -
CL_INVALID_if kernel is not a valid kernel object.KERNEL -
CL_INVALID_if context associated with command_queue and kernel are not the same or if the context associated with command_queue and events in event_wait_list are not the same.CONTEXT -
CL_INVALID_if the kernel argument values have not been specified.KERNEL_ ARGS -
CL_INVALID_if a work-group size is specified for kernel in the program source and it is not (1, 1, 1).WORK_ GROUP_ SIZE -
CL_INVALID_if the required number of sub-groups is specified for kernel in the program source and is not consistent with a work-group size of (1, 1, 1).WORK_ GROUP_ SIZE -
CL_MISALIGNED_if a sub-buffer object is specified as the value for an argument that is a buffer object and the offset specified when the sub-buffer object is created is not aligned toSUB_ BUFFER_ OFFSET CL_DEVICE_value for device associated with queue. This error code is missing before version 1.1.MEM_ BASE_ ADDR_ ALIGN -
CL_INVALID_if an image object is specified as an argument value and the image dimensions (image width, height, specified or compute row and/or slice pitch) are not supported by device associated with queue.IMAGE_ SIZE -
CL_IMAGE_if an image object is specified as an argument value and the image format (image channel order and data type) is not supported by device associated with queue.FORMAT_ NOT_ SUPPORTED -
CL_OUT_if there is a failure to queue the execution instance of kernel on the command-queue because of insufficient resources needed to execute the kernel. See how this error code is used with clEnqueueNDRangeKernel for examples.OF_ RESOURCES -
CL_MEM_if there is a failure to allocate memory for data store associated with image or buffer objects specified as arguments to kernel.OBJECT_ ALLOCATION_ FAILURE -
CL_INVALID_if event_wait_list isEVENT_ WAIT_ LIST NULLand num_events_in_wait_list > 0, or event_wait_list is notNULLand num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events. -
CL_INVALID_if SVM pointers are passed as arguments to a kernel and the device does not support SVM, or if system pointers are passed as arguments to a kernel and the device does not support fine-grain system SVM.OPERATION -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.