@@ -10948,112 +10948,79 @@ include::{generated}/api/protos/clSetKernelArg.txt[]
1094810948include::{generated}/api/version-notes/clSetKernelArg.asciidoc[]
1094910949
1095010950 * _kernel_ is a valid kernel object.
10951- * _arg_index_ is the argument index.
10952- Arguments to the kernel are referred by indices that go from 0 for the
10953- leftmost argument to _n_ - 1, where _n_ is the total number of arguments
10954- declared by a kernel (see below).
10955- * _arg_size_ specifies the size of the argument value.
10956- If the argument is a memory object, the _arg_size_ value must be equal to
10957- `sizeof({cl_mem_TYPE})`.
10958- For arguments declared with the `local` qualifier, the size specified will
10959- be the size in bytes of the buffer that must be allocated for the `local`
10960- argument.
10961- If the argument is of type _sampler_t_, the _arg_size_ value must be equal
10962- to `sizeof({cl_sampler_TYPE})`.
10963- If the argument is of type _queue_t_, the _arg_size_ value must be equal to
10964- `sizeof({cl_command_queue_TYPE})`.
10965- For all other arguments, the size will be the size of argument type.
10966- * _arg_value_ is a pointer to data that should be used as the argument value
10967- for argument specified by _arg_index_.
10951+ * _arg_index_ is the kernel argument index.
10952+ Kernel arguments are referred to by indices that go from zero to
10953+ _n - 1_, where _n_ is the total number of arguments declared by the kernel.
10954+ * _arg_size_ specifies the size of the kernel argument value.
10955+ * _arg_value_ is a pointer to the data for the kernel argument.
1096810956 The argument data pointed to by _arg_value_ is copied and the _arg_value_
1096910957 pointer can therefore be reused by the application after {clSetKernelArg}
1097010958 returns.
10971- The argument value specified is the value used by all API calls that enqueue
10972- _kernel_ ({clEnqueueNDRangeKernel} and {clEnqueueTask}) until the argument
10973- value is changed by a call to {clSetKernelArg} for _kernel_.
10959+ The argument data is used by all API calls that enqueue the kernel until the
10960+ argument is changed by another call to {clSetKernelArg} for the kernel.
10961+
10962+ If the kernel argument being set is a pointer to the `global` or `constant`
10963+ address space, then _arg_value_ must point to a buffer memory object or `NULL`,
10964+ or _arg_value_ must be `NULL`.
10965+ If _arg_value_ is `NULL` or points to `NULL`, then the kernel argument will be
10966+ set to `NULL`.
10967+
10968+ If the kernel argument being set is a pointer to the `local` address space, then
10969+ _arg_value_ must be `NULL`, and _arg_size_ specifies the amount of local memory
10970+ in bytes that are allocated for the kernel argument.
10971+
10972+ If the kernel argument being set is an image object, then _arg_value_ must point
10973+ to an image memory object.
10974+ Additionally:
10975+
10976+ * If the kernel argument is a 1D image, then the image memory object must be of
10977+ image type {CL_MEM_OBJECT_IMAGE1D}.
10978+ * If the kernel argument is a 2D image, then the image memory object must be of
10979+ image type {CL_MEM_OBJECT_IMAGE2D}.
10980+ * If the kernel argument is a 3D image, then the image memory object must be of
10981+ image type {CL_MEM_OBJECT_IMAGE3D}.
10982+ * If the kernel argument is a 1D image buffer, then the image memory object must
10983+ be of image type {CL_MEM_OBJECT_IMAGE1D_BUFFER}.
10984+ * If the kernel argument is a 1D image array, then the image memory object must
10985+ be of image type {CL_MEM_OBJECT_IMAGE1D_ARRAY}.
10986+ * If the kernel argument is a 2D image array, then the image memory object must
10987+ be of image type {CL_MEM_OBJECT_IMAGE2D_ARRAY}.
10988+ * If the kernel argument is a 2D depth image, then the image memory object must
10989+ be of image type {CL_MEM_OBJECT_IMAGE2D} and image channel order {CL_DEPTH}.
10990+ * If the kernel argument is a 2D depth image array, then the image memory object
10991+ must be of image type {CL_MEM_OBJECT_IMAGE2D_ARRAY} and image channel order
10992+ {CL_DEPTH}.
10993+ ifdef::cl_khr_gl_msaa_sharing[]
10994+ * If the kernel argument is a 2D MSAA image, then the image memory object must
10995+ be of image type {CL_MEM_OBJECT_IMAGE2D}.
10996+ * If the kernel argument is a 2D MSAA image array, then the image memory object
10997+ must be of image type {CL_MEM_OBJECT_IMAGE2D_ARRAY}.
10998+ * If the kernel argument is a 2D MSAA depth image, then the image memory object
10999+ must be of image type {CL_MEM_OBJECT_IMAGE2D} and image channel order
11000+ {CL_DEPTH}.
11001+ * If the kernel argument is a 2D MSAA depth image array, then the image memory
11002+ object must be of image type {CL_MEM_OBJECT_IMAGE2D_ARRAY} and image channel
11003+ order {CL_DEPTH}.
11004+ endif::cl_khr_gl_msaa_sharing[]
1097411005
10975- For example, consider the following kernel:
11006+ Behavior is undefined if the same image memory object is passed as both a
11007+ `read_only` image and a `write_only` image, or as a `read_write` image and
11008+ either a `read_only` image or a `write_only` image.
1097611009
10977- [source,opencl_c]
10978- ----
10979- kernel void image_filter (int n,
10980- int m,
10981- constant float *filter_weights,
10982- read_only image2d_t src_image,
10983- write_only image2d_t dst_image)
10984- {
10985- ...
10986- }
10987- ----
11010+ If the kernel argument being set is a sampler, then _arg_value_ must point to a
11011+ sampler object.
1098811012
10989- Argument index values for `image_filter` will be 0 for `n`, 1 for `m`, 2 for
10990- `filter_weights`, 3 for `src_image` and 4 for `dst_image`.
10991-
10992- If the argument is a memory object (buffer, pipe, image or image array), the
10993- _arg_value_ entry will be a pointer to the appropriate buffer, pipe, image
10994- or image array object.
10995- The memory object must be created with the context associated with the
10996- kernel object.
10997- If the argument is a buffer object, the _arg_value_ pointer can be `NULL` or
10998- point to a `NULL` value in which case a `NULL` value will be used as the
10999- value for the argument declared as a pointer to `global` or `constant`
11000- memory in the kernel.
11001- If the argument is declared with the `local` qualifier, the _arg_value_
11002- entry must be `NULL`.
11003- If the argument is of type _sampler_t_, the _arg_value_ entry must be a
11004- pointer to the sampler object.
11005- If the argument is of type _queue_t_, the _arg_value_ entry must be a
11006- pointer to the device queue object.
11013+ If the kernel argument being set is a device queue, then _arg_value_ must point
11014+ to a device queue object.
1100711015
11008- ifdef::cl_khr_gl_msaa_sharing[]
11009- If the {cl_khr_gl_msaa_sharing_EXT} extension is supported, then:
11010- If the argument is a multi-sample 2D image, the _arg_value_ entry must be a
11011- pointer to a multi-sample image object.
11012- If the argument is a multi-sample 2D depth image, the _arg_value_ entry must
11013- be a pointer to a multisample depth image object.
11014- If the argument is a multi-sample 2D image array, the _arg_value_ entry must
11015- be a pointer to a multi-sample image array object.
11016- If the argument is a multi-sample 2D depth image array, the _arg_value_
11017- entry must be a pointer to a multi-sample depth image array object.
11018- endif::cl_khr_gl_msaa_sharing[]
11016+ If the kernel argument being set is a pipe, then _arg_value_ must point to a
11017+ pipe memory object.
11018+
11019+ For all other kernel arguments, _arg_value_ points to the data that is used as
11020+ the kernel argument value.
1101911021
11020- If the argument is declared to be a pointer of a built-in scalar or vector
11021- type, or a user defined structure type in the global or constant address
11022- space, the memory object specified as argument value must be a buffer object
11023- (or `NULL`).
11024- If the argument is declared with the `constant` qualifier, the size in bytes
11025- of the memory object cannot exceed {CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE} and
11026- the number of arguments declared as pointers to `constant` memory cannot
11027- exceed {CL_DEVICE_MAX_CONSTANT_ARGS}.
11028-
11029- The memory object specified as argument value must be a pipe object if the
11030- argument is declared with the _pipe_ qualifier.
11031-
11032- The memory object specified as argument value must be a 2D image object if
11033- the argument is declared to be of type _image2d_t_.
11034- The memory object specified as argument value must be a 2D image object with
11035- image channel order = {CL_DEPTH} if the argument is declared to be of type
11036- _image2d_depth_t_.
11037- The memory object specified as argument value must be a 3D image object if
11038- argument is declared to be of type _image3d_t_.
11039- The memory object specified as argument value must be a 1D image object if
11040- the argument is declared to be of type _image1d_t_.
11041- The memory object specified as argument value must be a 1D image buffer
11042- object if the argument is declared to be of type _image1d_buffer_t_.
11043- The memory object specified as argument value must be a 1D image array
11044- object if argument is declared to be of type _image1d_array_t_.
11045- The memory object specified as argument value must be a 2D image array
11046- object if argument is declared to be of type _image2d_array_t_.
11047- The memory object specified as argument value must be a 2D image array
11048- object with image channel order = {CL_DEPTH} if argument is declared to be of
11049- type _image2d_array_depth_t_.
11050-
11051- Behavior is undefined if the same memory object is passed as both a `read_only`
11052- image and a `write_only` image, or as a `read_write` image and either a
11053- `read_only` image or a `write_only` image.
11054-
11055- For all other kernel arguments, the _arg_value_ entry must be a pointer to
11056- the actual data to be used as argument value.
11022+ All OpenCL objects set as kernel arguments must be created from the same context
11023+ as the kernel object.
1105711024
1105811025[NOTE]
1105911026====
@@ -11073,55 +11040,63 @@ the {cl_mem_TYPE} backing store used with {CL_MEM_USE_HOST_PTR}.
1107311040
1107411041// refError
1107511042
11076- {clSetKernelArg} returns {CL_SUCCESS} if the function was executed
11077- successfully.
11043+ {clSetKernelArg} returns {CL_SUCCESS} if the function is executed successfully.
1107811044Otherwise, it returns one of the following errors:
1107911045
11080- * {CL_INVALID_KERNEL} if _kernel_ is not a valid kernel object.
11081- * {CL_INVALID_ARG_INDEX} if _arg_index_ is not a valid argument index.
11082- * {CL_INVALID_ARG_VALUE} if _arg_value_ specified is not a valid value.
11083- * {CL_INVALID_MEM_OBJECT} for an argument declared to be a memory object
11084- when the specified _arg_value_ is not a valid memory object.
11085- ifdef::cl_khr_depth_images,cl_khr_gl_msaa_sharing[]
11086- * {CL_INVALID_MEM_OBJECT} for an argument declared to be a
11087- ifdef::cl_khr_depth_images[]
11088- depth image, depth image array,
11089- endif::cl_khr_depth_images[]
11090- ifdef::cl_khr_gl_msaa_sharing[]
11091- multi-sample image, multi-sample image array, multi-sample depth image,
11092- or a multi-sample depth image array
11093- endif::cl_khr_gl_msaa_sharing[]
11094- when the specified _arg_value_ does not follow the rules described above
11095- for a depth memory object or memory array object argument.
11096- endif::cl_khr_depth_images,cl_khr_gl_msaa_sharing[]
11097- * {CL_INVALID_SAMPLER} for an argument declared to be of type _sampler_t_
11098- when the specified _arg_value_ is not a valid sampler object.
11099- * {CL_INVALID_DEVICE_QUEUE} for an argument declared to be of type _queue_t_
11100- when the specified _arg_value_ is not a valid device queue object.
11046+ * {CL_INVALID_KERNEL}
11047+ ** if _kernel_ is not a valid kernel
11048+ * {CL_INVALID_ARG_INDEX}
11049+ ** if _arg_index_ is not a valid argument index
11050+ * {CL_INVALID_CONTEXT}
11051+ ** if the context associated with _kernel_ and an OpenCL object pointed to
11052+ by _arg_value_ are not the same
11053+ * {CL_INVALID_MEM_OBJECT}
11054+ ** if _arg_value_ is `NULL` and it must point to a valid memory object
11055+ ** if _arg_value_ points to `NULL` and it must point to a valid memory object
11056+ ** if _arg_value_ is not `NULL`, and does not point to `NULL`, and does not
11057+ point to a valid memory object
11058+ ** if _arg_value_ points to a valid memory object, but the memory object is
11059+ not valid for the kernel argument specified by _arg_index_
11060+ * {CL_INVALID_SAMPLER}
11061+ ** if the kernel argument is a sampler, but _arg_value_ does not point to a
11062+ valid sampler object
11063+ * {CL_INVALID_DEVICE_QUEUE}
11064+ ** if the kernel argument is a device queue, but _arg_value_ does not point
11065+ to a valid device queue object.
1110111066 This error code is <<unified-spec, missing before>> version 2.0.
1110211067 * {CL_INVALID_ARG_SIZE}
11103- ** if _arg_size_ does not match the size of the data type for an argument
11104- that is not a memory object, or
11105- ** if the argument is a memory object and _arg_size_ != `sizeof({cl_mem_TYPE})`, or
11106- ** if _arg_size_ is zero and the argument is declared with the `local` qualifier, or
11107- ** if the argument is a sampler and _arg_size_ != `sizeof({cl_sampler_TYPE})`.
11108- * {CL_MAX_SIZE_RESTRICTION_EXCEEDED} if the size in bytes of the memory
11109- object (if the argument is a memory object) or _arg_size_ (if the
11110- argument is declared with `local` qualifier) exceeds a language-
11111- specified maximum size restriction for this argument, such as the
11112- *MaxByteOffset* SPIR-V decoration.
11113- This error code is <<unified-spec, missing before>> version 2.2.
11068+ ** if _arg_value_ points to a memory object and _arg_size_ is not equal to
11069+ `sizeof({cl_mem_TYPE})`
11070+ ** if _arg_value_ points to a sampler object and _arg_size_ is not equal to
11071+ `sizeof({cl_sampler_TYPE})`
11072+ ** if _arg_value_ points to a device queue object and _arg_size_ is not
11073+ equal to `sizeof({cl_command_queue_TYPE})`
11074+ ** if the kernel argument is a pointer to the the `local` address space and
11075+ _arg_size_ is zero
11076+ ** if _arg_value_ points to the data to be used as the kernel argument value
11077+ and _arg_size_ does not match the size of the data type for the argument
1111411078 * {CL_INVALID_ARG_VALUE}
11115- ** if the argument is an image declared with the `read_only` qualifier and
11116- _arg_value_ refers to an image object created with _cl_mem_flags_ of
11117- {CL_MEM_WRITE_ONLY}, or
11118- ** if the image argument is declared with the `write_only` qualifier and
11119- _arg_value_ refers to an image object created with _cl_mem_flags_ of
11120- {CL_MEM_READ_ONLY}.
11121- * {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required
11122- by the OpenCL implementation on the device.
11123- * {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources
11124- required by the OpenCL implementation on the host.
11079+ ** if the argument is an image declared with the `read_only` qualifier and
11080+ _arg_value_ points to an image object created with the memory flag
11081+ {CL_MEM_WRITE_ONLY}
11082+ ** if the argument is an image declared with the `write_only` qualifier and
11083+ _arg_value_ points to an image object created with the memory flag
11084+ {CL_MEM_READ_ONLY}
11085+ ifdef::cl_ext_immutable_memory_objects[]
11086+ or {CL_MEM_IMMUTABLE_EXT}
11087+ endif::cl_ext_immutable_memory_objects[]
11088+ * {CL_MAX_SIZE_RESTRICTION_EXCEEDED}
11089+ ** if the size in bytes of the memory object (if the argument is a memory
11090+ object) or _arg_size_ (if the argument is declared with `local` qualifier)
11091+ exceeds a language-specified maximum size restriction for this argument,
11092+ such as the *MaxByteOffset* SPIR-V decoration.
11093+ This error code is <<unified-spec, missing before>> version 2.2.
11094+ * {CL_OUT_OF_RESOURCES}
11095+ ** if there is a failure to allocate resources required by the OpenCL
11096+ implementation on the device
11097+ * {CL_OUT_OF_HOST_MEMORY}
11098+ ** if there is a failure to allocate resources required by the OpenCL
11099+ implementation on the host
1112511100
1112611101When {clSetKernelArg} returns an error code different from {CL_SUCCESS}, the
1112711102internal state of _kernel_ may only be modified when that error code is
@@ -11162,7 +11137,7 @@ include::{generated}/api/version-notes/clSetKernelArgSVMPointer.asciidoc[]
1116211137
1116311138// refError
1116411139
11165- {clSetKernelArgSVMPointer} returns {CL_SUCCESS} if the function was executed
11140+ {clSetKernelArgSVMPointer} returns {CL_SUCCESS} if the function is executed
1116611141successfully.
1116711142Otherwise, it returns one of the following errors:
1116811143
@@ -12544,7 +12519,7 @@ clReleaseMemObject(buf2);
1254412519
1254512520// refError
1254612521
12547- {clSetUserEventStatus} returns {CL_SUCCESS} if the function was executed
12522+ {clSetUserEventStatus} returns {CL_SUCCESS} if the function is executed
1254812523successfully.
1254912524Otherwise, it returns one of the following errors:
1255012525
0 commit comments