OpenCL-Docs icon indicating copy to clipboard operation
OpenCL-Docs copied to clipboard

Clarify clSetKernelArgSVMPointer invalid arg values

Open bashbaug opened this issue 9 months ago • 0 comments

From a discussion in the March 18th memory subgroup: Regardless whether we decide to allow any SVM pointer to be set as a kernel argument as part of the unified SVM extension, we should clarify what is considered a valid SVM pointer kernel argument and when an implementation is expected to return an error code due to an invalid argument value.

clSetKernelArgSVMPointer currently says:

arg_value is the SVM pointer that should be used as the argument value for argument specified by arg_index. [...] 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.

And, the error code is:

CL_INVALID_ARG_VALUE if arg_value specified is not a valid value.

As one possible clarification, we could consider adopting some text from cl_intel_unified_shared_memory, which says more explicitly for clSetKernelArgMemPointerINTEL:

arg_value is the pointer value that should be used as the argument specified by arg_index. [...] For devices supporting shared system allocations, any pointer value is valid. Otherwise, the pointer value must be NULL or must point into a Unified Shared Memory allocation returned by clHostMemAllocINTEL, clDeviceMemAllocINTEL, or clSharedMemAllocINTEL.

bashbaug avatar Mar 18 '25 18:03 bashbaug