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

Valid Size Arguments to clEnqueueSVMMemFill and clEnqueueSVMMemcpy

Open bashbaug opened this issue 5 months ago • 1 comments

Currently, the spec is unclear whether zero should be allowed for the size argument to clEnqueueSVMMemFill and clEnqueueSVMMemcpy.

For the cl_khr_unified_svm extension, we are leaning towards allowing the size to be zero for clEnqueueSVMMemFill and clEnqueueSVMMemcpy. Much like a zero-sized enqueue, when the size is zero the command will behave similarly to an enqueued marker.

Should we clarify that a size of zero is valid in general, independent of the cl_khr_unified_svm extension?

bashbaug avatar Jul 01 '25 21:07 bashbaug

Here are some draft tests to check how an implementation behaves when it is passed a size of zero for these SVM APIs and a few others:

  • https://github.com/KhronosGroup/OpenCL-CTS/pull/2431

Most of the implementations I've tested return an error in at least a few cases.

bashbaug avatar Jul 01 '25 22:07 bashbaug

Discussed in the November 4th memory subgroup:

  • We aren't going to require any new behavior for implementations that do not support cl_khr_unified_svm.
  • We are going to test this behavior for implementations that do support cl_khr_unified_svm, even if the allocations are made via the older SVM APIs and not the newer unified SVM APIs.

For more detail, please see the linked CTS PR.

bashbaug avatar Nov 04 '25 19:11 bashbaug