C Specification
To query a suggested local work size for a kernel object, call the function
// Provided by cl_khr_suggested_local_work_size
cl_int clGetKernelSuggestedLocalWorkSizeKHR(
cl_command_queue command_queue,
cl_kernel kernel,
cl_uint work_dim,
const size_t* global_work_offset,
const size_t* global_work_size,
size_t* suggested_local_work_size);
clGetKernelSuggestedLocalWorkSizeKHR is provided by the cl_khr_suggested_local_work_size extension.
|
Parameters
-
command_queue specifies the command-queue and device for the query.
-
kernel specifies the kernel object and kernel arguments for the query. The OpenCL context associated with kernel and command_queue must the same.
-
work_dim specifies the number of work dimensions in the input global work offset and global work size, and the output suggested local work size.
-
global_work_offset can be used to specify an array of at least work_dim global ID offset values for the query. This is optional and may be
NULLto indicate there is no global ID offset. -
global_work_size is an array of at least work_dim values describing the global work size for the query.
-
suggested_local_work_size is an output array of at least work_dim values that will contain the result of the query.
Description
The returned suggested local work size is expected to match the local work
size that would be chosen if the specified kernel object, with the same
kernel arguments, were enqueued into the specified command-queue with the
specified global work size, specified global work offset, and with a NULL
local work size.
clGetKernelSuggestedLocalWorkSizeKHR returns CL_SUCCESS if the query
executed successfully.
Otherwise, it returns one of the following errors:
-
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 the context associated with kernel is not the same as the context associated with command_queue.CONTEXT -
CL_INVALID_if there is no successfully built program executable available for kernel for the device associated with command_queue.PROGRAM_ EXECUTABLE -
CL_INVALID_if all argument values for kernel have not been set.KERNEL_ ARGS -
CL_MISALIGNED_if a sub-buffer object is set as an argument to kernel and the offset specified when the sub-buffer object was created is not aligned toSUB_ BUFFER_ OFFSET CL_DEVICE_for the device associated with command_queue.MEM_ BASE_ ADDR_ ALIGN -
CL_INVALID_if an image object is set as an argument to kernel and the image dimensions are not supported by device associated with command_queue.IMAGE_ SIZE -
CL_IMAGE_if an image object is set as an argument to kernel and the image format is not supported by the device associated with command_queue.FORMAT_ NOT_ SUPPORTED -
CL_INVALID_if an SVM pointer is set as an argument to kernel and the device associated with command_queue does not support SVM or the required SVM capabilities for the SVM pointer.OPERATION -
CL_INVALID_if work_dim is not a valid value (i.e. a value between 1 andWORK_ DIMENSION CL_DEVICE_).MAX_ WORK_ ITEM_ DIMENSIONS -
CL_INVALID_if global_work_size is NULL or if any of the values specified in global_work_size are 0.GLOBAL_ WORK_ SIZE -
CL_INVALID_if any of the values specified in global_work_size exceed the maximum value representable byGLOBAL_ WORK_ SIZE size_ton the device associated with command_queue. -
CL_INVALID_if the value specified in global_work_size plus the corresponding value in global_work_offset for dimension exceeds the maximum value representable byGLOBAL_ OFFSET size_ton the device associated with command_queue. -
CL_INVALID_if suggested_local_work_size is NULL.VALUE -
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
| These error conditions are consistent with error conditions for clEnqueueNDRangeKernel. |
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.