Skip to content

Commit 1c3c918

Browse files
authored
rephrase and correct the descriptions for clSetKernelExecInfo (#1245)
* rephrase and correct the descriptions for clSetKernelExecInfo * further wordsmithing clarify that CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM does not affect kernel arguments * fix typo * simplify CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM
1 parent 34e58fe commit 1c3c918

1 file changed

Lines changed: 48 additions & 90 deletions

File tree

api/opencl_runtime_layer.asciidoc

Lines changed: 48 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -10475,16 +10475,15 @@ Otherwise, it returns one of the following errors:
1047510475
required by the OpenCL implementation on the host.
1047610476
--
1047710477

10478-
[open,refpage='clSetKernelExecInfo',desc='Pass additional information other than argument values to a kernel.',type='protos']
10478+
[open,refpage='clSetKernelExecInfo',desc='Set additional execution information for a kernel.',type='protos']
1047910479
--
10480-
To pass additional information other than argument values to a kernel, call
10481-
the function
10480+
To set additional execution information for a kernel, call the function
1048210481

1048310482
include::{generated}/api/protos/clSetKernelExecInfo.txt[]
1048410483
include::{generated}/api/version-notes/clSetKernelExecInfo.asciidoc[]
1048510484

10486-
* _kernel_ specifies the kernel object being queried.
10487-
* _param_name_ specifies the information to be passed to kernel.
10485+
* _kernel_ is a valid kernel object.
10486+
* _param_name_ specifies the type of information to set.
1048810487
The list of supported _param_name_ types and the corresponding values passed
1048910488
in _param_value_ is described in the <<kernel-exec-info-table,Kernel
1049010489
Execution Properties>> table.
@@ -10502,22 +10501,46 @@ include::{generated}/api/version-notes/clSetKernelExecInfo.asciidoc[]
1050210501

1050310502
include::{generated}/api/version-notes/CL_KERNEL_EXEC_INFO_SVM_PTRS.asciidoc[]
1050410503
| {void_TYPE}*[]
10505-
| SVM pointers must reference locations contained entirely within
10506-
buffers that are passed to kernel as arguments, or that are passed
10507-
through the execution information.
10508-
10509-
Non-argument SVM buffers must be specified by passing pointers to
10510-
those buffers via {clSetKernelExecInfo} for coarse-grain and
10511-
fine-grain buffer SVM allocations but not for finegrain system SVM
10512-
allocations.
10504+
| Specifies a set of pointers to SVM allocations that may be accessed
10505+
by the kernel in addition to those set directly as kernel arguments.
10506+
Each of the pointers can be the pointer returned by {clSVMAlloc} or can
10507+
be a pointer to the middle of an SVM allocation.
10508+
It is sufficient to specify one pointer for each SVM allocation.
10509+
10510+
Behavior is undefined if the kernel accesses a coarse-grain or
10511+
fine-grain buffer SVM allocation that is not set as a kernel argument
10512+
and is not in the set specified by {CL_KERNEL_EXEC_INFO_SVM_PTRS}.
10513+
10514+
The complete set of pointers is specified by each call to
10515+
{clSetKernelExecInfo} and replaces any previously specified set of
10516+
pointers.
10517+
To specify that no SVM allocations will be accessed by a kernel other
10518+
than those set as kernel arguments, specify an empty set by passing
10519+
_param_value_size_ equal to zero and _param_value_ equal to `NULL`.
10520+
10521+
Non-argument pointers to SVM allocations must be specified for
10522+
coarse-grain and fine-grain buffer SVM allocations, but not for
10523+
fine-grain system SVM allocations.
1051310524
| {CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_anchor}
1051410525

1051510526
include::{generated}/api/version-notes/CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM.asciidoc[]
1051610527
| {cl_bool_TYPE}
10517-
| This flag indicates whether the kernel uses pointers that are fine
10518-
grain system SVM allocations.
10519-
These fine grain system SVM pointers may be passed as arguments or
10520-
defined in SVM buffers that are passed as arguments to _kernel_.
10528+
| Specifies whether the kernel may use pointers to system allocations
10529+
that are not set directly as kernel arguments on devices that support
10530+
fine-grain system SVM allocations.
10531+
10532+
When a device supports fine-grain system SVM allocations and
10533+
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} is {CL_TRUE}, the kernel may
10534+
access system allocations that are not set directly as kernel arguments.
10535+
10536+
Otherwise, if a device does not support fine-grain system SVM
10537+
allocations or when {CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} is
10538+
{CL_FALSE}, behavior is undefined if the kernel accesses a system
10539+
allocation that is not set as a kernel argument.
10540+
10541+
If {clSetKernelExecInfo} has not been called with a value for
10542+
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM}, the default value is
10543+
{CL_TRUE}.
1052110544
|====
1052210545

1052310546
// refError
@@ -10528,80 +10551,19 @@ Otherwise, it returns one of the following errors:
1052810551

1052910552
* {CL_INVALID_KERNEL} if _kernel_ is a not a valid kernel object.
1053010553
* {CL_INVALID_OPERATION} if no devices in the context associated with _kernel_ support SVM.
10531-
* {CL_INVALID_VALUE} if _param_name_ is not valid, if _param_value_ is
10532-
`NULL` or if the size specified by _param_value_size_ is not valid.
1053310554
* {CL_INVALID_OPERATION} if _param_name_ is
1053410555
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} and _param_value_ is {CL_TRUE}
10535-
but no devices in context associated with _kernel_ support fine-grain
10556+
and no devices in the context associated with _kernel_ support fine-grain
1053610557
system SVM allocations.
10558+
* {CL_INVALID_VALUE} if _param_name_ is not valid, if _param_value_ is
10559+
`NULL` and _param_value_size_ is greater than zero, or if the size specified
10560+
by _param_value_size_ is not valid.
1053710561
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required
1053810562
by the OpenCL implementation on the device.
1053910563
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources
1054010564
required by the OpenCL implementation on the host.
1054110565
--
1054210566

10543-
[NOTE]
10544-
====
10545-
Coarse-grain or fine-grain buffer SVM pointers used by a kernel which
10546-
are not passed as a kernel arguments must be specified using
10547-
{clSetKernelExecInfo} with {CL_KERNEL_EXEC_INFO_SVM_PTRS}.
10548-
For example, if SVM buffer A contains a pointer to another SVM buffer B,
10549-
and the kernel dereferences that pointer, then a pointer to B must
10550-
either be passed as an argument in the call to that kernel or it must be
10551-
made available to the kernel using {clSetKernelExecInfo}.
10552-
For example, we might pass extra SVM pointers as follows:
10553-
10554-
[source,opencl]
10555-
----
10556-
clSetKernelExecInfo(kernel,
10557-
CL_KERNEL_EXEC_INFO_SVM_PTRS,
10558-
num_ptrs * sizeof(void *),
10559-
extra_svm_ptr_list);
10560-
----
10561-
10562-
Here `num_ptrs` specifies the number of additional SVM pointers while
10563-
`extra_svm_ptr_list` specifies a pointer to memory containing those SVM
10564-
pointers.
10565-
10566-
When calling {clSetKernelExecInfo} with {CL_KERNEL_EXEC_INFO_SVM_PTRS} to
10567-
specify pointers to non-argument SVM buffers as extra arguments to a kernel,
10568-
each of these pointers can be the SVM pointer returned by {clSVMAlloc} or
10569-
can be a pointer + offset into the SVM region.
10570-
It is sufficient to provide one pointer for each SVM buffer used.
10571-
10572-
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} is used to indicate whether
10573-
SVM pointers used by a kernel will refer to system allocations or not.
10574-
10575-
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} = {CL_FALSE} indicates that the
10576-
OpenCL implementation may assume that system pointers are not passed as
10577-
kernel arguments and are not stored inside SVM allocations passed as kernel
10578-
arguments.
10579-
10580-
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM} = {CL_TRUE} indicates that the
10581-
OpenCL implementation must assume that system pointers might be passed as
10582-
kernel arguments and/or stored inside SVM allocations passed as kernel
10583-
arguments.
10584-
In this case, if the device to which the kernel is enqueued does not support
10585-
system SVM pointers, {clEnqueueNDRangeKernel} and {clEnqueueTask} will return a
10586-
{CL_INVALID_OPERATION} error.
10587-
If none of the devices in the context associated with kernel support
10588-
fine-grain system SVM allocations, {clSetKernelExecInfo} will return a
10589-
{CL_INVALID_OPERATION} error.
10590-
10591-
If {clSetKernelExecInfo} has not been called with a value for
10592-
{CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM}, the default value is used for
10593-
this kernel attribute.
10594-
The default value depends on whether the device on which the kernel is
10595-
enqueued supports fine-grain system SVM allocations.
10596-
If so, the default value used is {CL_TRUE} (system pointers might be passed);
10597-
otherwise, the default is {CL_FALSE}.
10598-
10599-
A call to {clSetKernelExecInfo} for a given value of _param_name_
10600-
replaces any prior value passed for that value of _param_name_.
10601-
Only one _param_value_ will be stored for each value of _param_name_.
10602-
====
10603-
10604-
1060510567
=== Copying Kernel Objects
1060610568

1060710569
NOTE: Copying kernel objects is <<unified-spec, missing before>> version 2.1.
@@ -11488,10 +11450,8 @@ Otherwise, it returns one of the following errors:
1148811450
_num_events_in_wait_list_ is 0, or if event objects in _event_wait_list_
1148911451
are not valid events.
1149011452
* {CL_INVALID_OPERATION} if SVM pointers are passed as arguments to a kernel
11491-
and the device does not support SVM or if system pointers are passed as
11492-
arguments to a kernel and/or stored inside SVM allocations passed as
11493-
kernel arguments and the device does not support fine grain system SVM
11494-
allocations.
11453+
and the device does not support SVM, or if system pointers are passed as
11454+
arguments to a kernel and the device does not support fine-grain system SVM.
1149511455
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required
1149611456
by the OpenCL implementation on the device.
1149711457
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources
@@ -11583,10 +11543,8 @@ Otherwise, it returns one of the following errors:
1158311543
_num_events_in_wait_list_ is 0, or if event objects in _event_wait_list_
1158411544
are not valid events.
1158511545
* {CL_INVALID_OPERATION} if SVM pointers are passed as arguments to a kernel
11586-
and the device does not support SVM or if system pointers are passed as
11587-
arguments to a kernel and/or stored inside SVM allocations passed as
11588-
kernel arguments and the device does not support fine grain system SVM
11589-
allocations.
11546+
and the device does not support SVM, or if system pointers are passed as
11547+
arguments to a kernel and the device does not support fine-grain system SVM.
1159011548
* {CL_OUT_OF_RESOURCES} if there is a failure to allocate resources required
1159111549
by the OpenCL implementation on the device.
1159211550
* {CL_OUT_OF_HOST_MEMORY} if there is a failure to allocate resources

0 commit comments

Comments
 (0)