Skip to content

Commit 02b5bd3

Browse files
authored
error code consistency for clEnqueueNDRangeKernel (KhronosGroup#1501)
* error code consistency for clEnqueueNDRangeKernel Also, for clGetKernelSuggestedLocalWorkSizeKHR, while we're at it. * address review comment for CL_IMAGE_FORMAT_NOT_SUPPORTED
1 parent 5211e88 commit 02b5bd3

1 file changed

Lines changed: 125 additions & 117 deletions

File tree

api/opencl_runtime_layer.asciidoc

Lines changed: 125 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -11942,45 +11942,57 @@ local work size.
1194211942
executed successfully.
1194311943
Otherwise, it returns one of the following errors:
1194411944

11945-
* {CL_INVALID_COMMAND_QUEUE} if _command_queue_ is not a valid host
11946-
command-queue.
11947-
* {CL_INVALID_KERNEL} if _kernel_ is not a valid kernel object.
11948-
* {CL_INVALID_CONTEXT} if the context associated with _kernel_ is not the
11949-
same as the context associated with _command_queue_.
11950-
* {CL_INVALID_PROGRAM_EXECUTABLE} if there is no successfully built
11951-
program executable available for _kernel_ for the device associated with
11945+
* {CL_INVALID_COMMAND_QUEUE}
11946+
** if _command_queue_ is not a valid host command-queue
11947+
* {CL_INVALID_KERNEL}
11948+
** if _kernel_ is not a valid kernel
11949+
* {CL_INVALID_PROGRAM_EXECUTABLE}
11950+
** if there is no successfully built program executable available for the device associated with _command_queue_
11951+
* {CL_INVALID_CONTEXT}
11952+
** if the context associated with _command_queue_ and _kernel_ are not the same
11953+
* {CL_INVALID_KERNEL_ARGS}
11954+
** if any kernel arguments for _kernel_ have not been set
11955+
* {CL_INVALID_WORK_DIMENSION}
11956+
** if _work_dim_ is not valid for the device associated with _command_queue_ (is greater than the value returned for {CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS})
11957+
* {CL_INVALID_GLOBAL_OFFSET}
11958+
** if _global_work_offset_ is not `NULL`.
11959+
This error condition does not apply when the device associated with
11960+
_command_queue_ supports OpenCL 1.1 or newer.
11961+
** if the value specified in _global_work_size_ plus the corresponding value
11962+
in _global_work_offset_ for any dimensions is greater than the maximum value
11963+
representable by {size_t_TYPE} on the device associated with _command_queue_
11964+
* {CL_INVALID_GLOBAL_WORK_SIZE}
11965+
** if _global_work_size_ is `NULL`
11966+
** if any of the values specified in _global_work_size_[0], ...
11967+
_global_work_size_[_work_dim_ - 1] are zero
11968+
** if any of the values specified in _global_work_size_[0], ...
11969+
_global_work_size_[_work_dim_ - 1] exceed the maximum value representable by
11970+
{size_t_TYPE} on the device associated with _command_queue_
11971+
* {CL_MISALIGNED_SUB_BUFFER_OFFSET}
11972+
** if a kernel argument for _kernel_ is a sub-buffer object and the offset
11973+
specified when the sub-buffer object is created is not aligned to
11974+
{CL_DEVICE_MEM_BASE_ADDR_ALIGN} for the device associated with
1195211975
_command_queue_.
11953-
* {CL_INVALID_KERNEL_ARGS} if all argument values for _kernel_ have not
11954-
been set.
11955-
* {CL_MISALIGNED_SUB_BUFFER_OFFSET} if a sub-buffer object is set as an
11956-
argument to _kernel_ and the offset specified when the sub-buffer object
11957-
was created is not aligned to {CL_DEVICE_MEM_BASE_ADDR_ALIGN} for the
11958-
device associated with _command_queue_.
11959-
* {CL_INVALID_IMAGE_SIZE} if an image object is set as an argument to
11960-
_kernel_ and the image dimensions are not supported by device associated
11961-
with _command_queue_.
11962-
* {CL_IMAGE_FORMAT_NOT_SUPPORTED} if an image object is set as an argument
11963-
to _kernel_ and the image format is not supported by the device
11964-
associated with _command_queue_.
11965-
* {CL_INVALID_OPERATION} if an SVM pointer is set as an argument to
11966-
_kernel_ and the device associated with _command_queue_ does not support
11967-
SVM or the required SVM capabilities for the SVM pointer.
11968-
* {CL_INVALID_WORK_DIMENSION} if _work_dim_ is not a valid value (i.e. a
11969-
value between 1 and {CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS}).
11970-
* {CL_INVALID_GLOBAL_WORK_SIZE} if _global_work_size_ is NULL or if any of
11971-
the values specified in _global_work_size_ are 0.
11972-
* {CL_INVALID_GLOBAL_WORK_SIZE} if any of the values specified in
11973-
_global_work_size_ exceed the maximum value representable by `size_t` on
11974-
the device associated with _command_queue_.
11975-
* {CL_INVALID_GLOBAL_OFFSET} if the value specified in _global_work_size_
11976-
plus the corresponding value in _global_work_offset_ for dimension
11977-
exceeds the maximum value representable by `size_t` on the device
11978-
associated with _command_queue_.
11979-
* {CL_INVALID_VALUE} if _suggested_local_work_size_ is NULL.
11980-
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources
11981-
required by the OpenCL implementation on the device.
11982-
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources
11983-
required by the OpenCL implementation on the host.
11976+
This error code is <<unified-spec, missing before>> version 1.1.
11977+
* {CL_INVALID_IMAGE_SIZE}
11978+
** if a kernel argument for _kernel_ is an image and the dimensions of the
11979+
image, such as the image width or image height, are not supported by the
11980+
device associated with _command_queue_
11981+
* {CL_IMAGE_FORMAT_NOT_SUPPORTED}
11982+
** if a kernel argument for _kernel_ is an image and the format of the
11983+
image, such as the image channel order or image channel data type, are not
11984+
supported by the device associated with _command_queue_
11985+
* {CL_INVALID_OPERATION}
11986+
** if SVM pointers are set as arguments for _kernel_ and the device associated with _command_queue_ does not support SVM
11987+
** if system pointers are set as arguments for _kernel_ and the device associated with _command_queue_ does not support fine-grain system SVM
11988+
* {CL_INVALID_VALUE}
11989+
** if _suggested_local_work_size_ is `NULL`
11990+
* {CL_OUT_OF_RESOURCES}
11991+
** if there is a failure to allocate resources required by the OpenCL
11992+
implementation on the device
11993+
* {CL_OUT_OF_HOST_MEMORY}
11994+
** if there is a failure to allocate resources required by the OpenCL
11995+
implementation on the host
1198411996

1198511997
NOTE: These error conditions are consistent with error conditions for
1198611998
{clEnqueueNDRangeKernel}.
@@ -12115,90 +12127,86 @@ The starting local ID is always (0, 0, ..., 0).
1211512127
successfully queued.
1211612128
Otherwise, it returns one of the following errors:
1211712129

12118-
* {CL_INVALID_PROGRAM_EXECUTABLE} if there is no successfully built program
12119-
executable available for the device associated with _command_queue_.
12120-
* {CL_INVALID_COMMAND_QUEUE} if _command_queue_ is not a valid host
12121-
command-queue.
12122-
* {CL_INVALID_KERNEL} if _kernel_ is not a valid kernel object.
12123-
* {CL_INVALID_CONTEXT} if context associated with _command_queue_ and
12124-
_kernel_ are not the same or if the context associated with
12125-
_command_queue_ and events in _event_wait_list_ are not the same.
12126-
* {CL_INVALID_KERNEL_ARGS} if the kernel argument values have not been
12127-
specified.
12128-
* {CL_INVALID_WORK_DIMENSION} if _work_dim_ is not a valid value (i.e. a
12129-
value between 1 and {CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS}).
12130-
* {CL_INVALID_GLOBAL_WORK_SIZE} if _global_work_size_ is NULL or if any of
12131-
the values specified in _global_work_size_[0], ...
12130+
* {CL_INVALID_COMMAND_QUEUE}
12131+
** if _command_queue_ is not a valid host command-queue
12132+
* {CL_INVALID_KERNEL}
12133+
** if _kernel_ is not a valid kernel
12134+
* {CL_INVALID_PROGRAM_EXECUTABLE}
12135+
** if there is no successfully built program executable available for the device associated with _command_queue_
12136+
* {CL_INVALID_CONTEXT}
12137+
** if the context associated with _command_queue_ and _kernel_ are not the same
12138+
** if the context associated with _command_queue_ and events in _event_wait_list_ are not the same
12139+
* {CL_INVALID_KERNEL_ARGS}
12140+
** if any kernel arguments for _kernel_ have not been set
12141+
* {CL_INVALID_WORK_DIMENSION}
12142+
** if _work_dim_ is not valid for the device associated with _command_queue_ (is greater than the value returned for {CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS})
12143+
* {CL_INVALID_GLOBAL_OFFSET}
12144+
** if _global_work_offset_ is not `NULL`.
12145+
This error condition does not apply when the device associated with
12146+
_command_queue_ supports OpenCL 1.1 or newer.
12147+
** if the value specified in _global_work_size_ plus the corresponding value
12148+
in _global_work_offset_ for any dimensions is greater than the maximum value
12149+
representable by {size_t_TYPE} on the device associated with _command_queue_
12150+
* {CL_INVALID_GLOBAL_WORK_SIZE}
12151+
** if _global_work_size_ is `NULL`.
12152+
This error condition does not apply when the device associated with
12153+
_command_queue_ supports OpenCL 2.1 or newer.
12154+
** if any of the values specified in _global_work_size_[0], ...
1213212155
_global_work_size_[_work_dim_ - 1] are zero.
1213312156
This error condition does not apply when the device associated with
1213412157
_command_queue_ supports OpenCL 2.1 or newer.
12135-
* {CL_INVALID_GLOBAL_WORK_SIZE} if any of the values specified in
12136-
_global_work_size_[0], ... _global_work_size_[_work_dim_ - 1] exceed the
12137-
maximum value representable by {size_t_TYPE} on the device on which the
12138-
kernel-instance will be enqueued.
12139-
* {CL_INVALID_GLOBAL_OFFSET} if the value specified in _global_work_size_
12140-
{plus} the corresponding values in _global_work_offset_ for any
12141-
dimensions is greater than the maximum value representable by size t on
12142-
the device on which the kernel-instance will be enqueued, or if
12143-
_global_work_offset_ is non-`NULL` <<unified-spec, before>> version 1.1.
12144-
* {CL_INVALID_WORK_GROUP_SIZE} if _local_work_size_ is specified and does
12145-
not match the required work-group size for _kernel_ in the program
12146-
source.
12147-
* {CL_INVALID_WORK_GROUP_SIZE} if _local_work_size_ is specified and is not
12148-
consistent with the required number of sub-groups for _kernel_ in the
12149-
program source.
12150-
* {CL_INVALID_WORK_GROUP_SIZE} if _local_work_size_ is specified and the
12151-
total number of work-items in the work-group computed as
12152-
_local_work_size_[0] {times} ... _local_work_size_[_work_dim_ - 1] is
12153-
greater than the value specified by {CL_KERNEL_WORK_GROUP_SIZE} in the
12154-
<<kernel-workgroup-info-table,Kernel Object Device Queries>> table.
12155-
* {CL_INVALID_WORK_GROUP_SIZE} if the work-group size must be uniform and
12156-
the _local_work_size_ is not `NULL`, is not equal to the required
12157-
work-group size specified in the kernel source, or the
12158-
_global_work_size_ is not evenly divisible by the _local_work_size_.
12159-
* {CL_INVALID_WORK_ITEM_SIZE} if the number of work-items specified in any
12160-
of _local_work_size_[0], ... _local_work_size_[_work_dim_ - 1] is
12161-
greater than the corresponding values specified by
12162-
{CL_DEVICE_MAX_WORK_ITEM_SIZES}[0], ...,
12163-
{CL_DEVICE_MAX_WORK_ITEM_SIZES}[_work_dim_ - 1].
12164-
* {CL_MISALIGNED_SUB_BUFFER_OFFSET} if a sub-buffer object is specified as
12165-
the value for an argument that is a buffer object and the _offset_
12158+
** if any of the values specified in _global_work_size_[0], ...
12159+
_global_work_size_[_work_dim_ - 1] exceed the maximum value representable by
12160+
{size_t_TYPE} on the device associated with _command_queue_
12161+
* {CL_INVALID_WORK_GROUP_SIZE}
12162+
** if _local_work_size_ is not `NULL`, if the work-group size must be uniform, and if the _global_work_size_ is not evenly divisible by the _local_work_size_
12163+
** if _local_work_size_ is not `NULL` and if the total number of work-items in the work-group is greater than the maximum work-group size supported for _kernel_ on the device associated with _command_queue_ (is greater than the value returned for {CL_KERNEL_WORK_GROUP_SIZE})
12164+
** if _local_work_size_ is not `NULL` and if the _local_work_size_ does not match the required work-group size for _kernel_
12165+
** if _local_work_size_ is not `NULL` and if the _local_work_size_ is not consistent with the required number of sub-groups for _kernel_
12166+
* {CL_INVALID_WORK_ITEM_SIZE}
12167+
** if the number of work-items specified in any dimension of _local_work_size_ is not valid for the device associated with _command_queue_ (is greater than the corresponding value returned for {CL_DEVICE_MAX_WORK_ITEM_SIZES})
12168+
* {CL_MISALIGNED_SUB_BUFFER_OFFSET}
12169+
** if a kernel argument for _kernel_ is a sub-buffer object and the offset
1216612170
specified when the sub-buffer object is created is not aligned to
12167-
{CL_DEVICE_MEM_BASE_ADDR_ALIGN} value for device associated with _queue_.
12171+
{CL_DEVICE_MEM_BASE_ADDR_ALIGN} for the device associated with
12172+
_command_queue_.
1216812173
This error code is <<unified-spec, missing before>> version 1.1.
12169-
* {CL_INVALID_IMAGE_SIZE} if an image object is specified as an argument
12170-
value and the image dimensions (image width, height, specified or
12171-
compute row and/or slice pitch) are not supported by device associated
12172-
with _queue_.
12173-
* {CL_IMAGE_FORMAT_NOT_SUPPORTED} if an image object is specified as an
12174-
argument value and the image format (image channel order and data type)
12175-
is not supported by device associated with _queue_.
12176-
* {CL_OUT_OF_RESOURCES} if there is a failure to queue the execution
12177-
instance of _kernel_ on the command-queue because of insufficient
12178-
resources needed to execute the kernel.
12179-
For example, the explicitly specified _local_work_size_ causes a failure
12180-
to execute the kernel because of insufficient resources such as
12181-
registers or local memory.
12182-
Another example would be the number of read-only image args used in
12183-
_kernel_ exceed the {CL_DEVICE_MAX_READ_IMAGE_ARGS} value for device or
12184-
the number of write-only and read-write image args used in _kernel_
12185-
exceed the {CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS} value for device or the
12186-
number of samplers used in _kernel_ exceed {CL_DEVICE_MAX_SAMPLERS} for
12187-
device.
12188-
* {CL_MEM_OBJECT_ALLOCATION_FAILURE} if there is a failure to allocate
12189-
memory for data store associated with image or buffer objects specified
12190-
as arguments to _kernel_.
12191-
* {CL_INVALID_EVENT_WAIT_LIST} if _event_wait_list_ is `NULL` and
12192-
_num_events_in_wait_list_ > 0, or _event_wait_list_ is not `NULL` and
12193-
_num_events_in_wait_list_ is 0, or if event objects in _event_wait_list_
12194-
are not valid events.
12195-
* {CL_INVALID_OPERATION} if SVM pointers are passed as arguments to a kernel
12196-
and the device does not support SVM, or if system pointers are passed as
12197-
arguments to a kernel and the device does not support fine-grain system SVM.
12198-
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required
12199-
by the OpenCL implementation on the device.
12200-
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources
12201-
required by the OpenCL implementation on the host.
12174+
* {CL_INVALID_IMAGE_SIZE}
12175+
** if a kernel argument for _kernel_ is an image and the dimensions of the
12176+
image, such as the image width or image height, are not supported by the
12177+
device associated with _command_queue_
12178+
* {CL_IMAGE_FORMAT_NOT_SUPPORTED}
12179+
** if a kernel argument for _kernel_ is an image and the format of the
12180+
image, such as the image channel order or image channel data type, are not
12181+
supported by the device associated with _command_queue_
12182+
* {CL_MEM_OBJECT_ALLOCATION_FAILURE}
12183+
** if there is a failure to allocate memory for the data store associated with any buffer or image object kernel arguments for _kernel_
12184+
* {CL_INVALID_EVENT_WAIT_LIST}
12185+
** if _event_wait_list_ is `NULL` and _num_events_in_wait_list_ is greater than zero
12186+
** if _event_wait_list_ is not `NULL` and _num_events_in_wait_list_ is zero
12187+
** if event objects in _event_wait_list_ are not valid events
12188+
* {CL_INVALID_OPERATION}
12189+
** if SVM pointers are set as arguments for _kernel_ and the device associated with _command_queue_ does not support SVM
12190+
** if system pointers are set as arguments for _kernel_ and the device associated with _command_queue_ does not support fine-grain system SVM
12191+
// TODO: Do we still need these explicit examples?
12192+
// * {CL_OUT_OF_RESOURCES} if there is a failure to queue the execution
12193+
// instance of _kernel_ on the command-queue because of insufficient
12194+
// resources needed to execute the kernel.
12195+
// For example, the explicitly specified _local_work_size_ causes a failure
12196+
// to execute the kernel because of insufficient resources such as
12197+
// registers or local memory.
12198+
// Another example would be the number of read-only image args used in
12199+
// _kernel_ exceed the {CL_DEVICE_MAX_READ_IMAGE_ARGS} value for device or
12200+
// the number of write-only and read-write image args used in _kernel_
12201+
// exceed the {CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS} value for device or the
12202+
// number of samplers used in _kernel_ exceed {CL_DEVICE_MAX_SAMPLERS} for
12203+
// device.
12204+
* {CL_OUT_OF_RESOURCES}
12205+
** if there is a failure to allocate resources required by the OpenCL
12206+
implementation on the device
12207+
* {CL_OUT_OF_HOST_MEMORY}
12208+
** if there is a failure to allocate resources required by the OpenCL
12209+
implementation on the host
1220212210
--
1220312211

1220412212
[open,refpage='clEnqueueTask',desc='Enqueues a command to execute a kernel, using a single work-item, on a device.',type='protos']

0 commit comments

Comments
 (0)