C Specification
To set a SVM pointer as the argument value for a specific argument of a kernel, call the function
// Provided by CL_VERSION_2_0
cl_int clSetKernelArgSVMPointer(
cl_kernel kernel,
cl_uint arg_index,
const void* arg_value);
| clSetKernelArgSVMPointer is missing before version 2.0. |
Parameters
-
kernel is a valid kernel object.
-
arg_index is the argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to n - 1, where n is the total number of arguments declared by a kernel.
-
arg_value is the SVM pointer that should be used as the argument value for argument specified by arg_index. The SVM pointer specified is the value used by all API calls that enqueue kernel (clEnqueueNDRangeKernel and clEnqueueTask) until the argument value is changed by a call to clSetKernelArgSVMPointer for kernel. The SVM pointer can only be used for arguments that are declared to be a pointer to
globalorconstantmemory. The SVM pointer value must be aligned according to the arguments type. For example, if the argument is declared to beglobal float4 *p, the SVM pointer value passed forpmust be at a minimum aligned to afloat4. The SVM pointer value specified as the argument value can be the pointer returned by clSVMAlloc or can be a pointer offset into the SVM region.
Description
clSetKernelArgSVMPointer returns CL_SUCCESS if the function was executed
successfully.
Otherwise, it returns one of the following errors:
-
CL_INVALID_if kernel is not a valid kernel object.KERNEL -
CL_INVALID_if no devices in the context associated with kernel support SVM.OPERATION -
CL_INVALID_if arg_index is not a valid argument index.ARG_ INDEX -
CL_INVALID_if arg_value specified is not a valid value.ARG_ 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
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.