Set a SVM pointer as the argument value for a specific argument of a kernel.
cl_int clSetKernelArgSVMPointer(cl_kernel kernel,
cl_uint arg_index,
const void *arg_value)kernel-
A valid kernel object.
arg_index-
The argument index. Arguments to the kernel are referred by indices that go from 0 for the leftmost argument to
n- 1, wherenis the total number of arguments declared by a kernel. arg_value-
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 enqueuekernel(clEnqueueNDRangeKernel) until the argument value is changed by a call toclSetKernelArgSVMPointerforkernel. The SVM pointer can only be used for arguments that are declared to be a pointer toglobalorconstantmemory. The SVM pointer value must be aligned according to the argument 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 byclSVMAllocor can be a pointer + offset into the SVM region.
clSetKernelArgSVMPointer returns CL_SUCCESS if the function is executed successfully.
Otherwise, it returns one of the following errors:
-
CL_INVALID_KERNELifkernelis not a valid kernel object. -
CL_INVALID_ARG_INDEXifarg_indexis not a valid argument index. -
CL_INVALID_ARG_VALUEifarg_valuespecified is not a valid value. -
CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device. -
CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.