Open bashbaug opened 2 months ago
Discussed in the April 16th teleconference:
- Need to check if there is precedent for other APIs to mandate nullptr when the size is zero, or whether it is preferable to ignore the pointer when the size is zero.
I did a quick check and as far as I can see we usually mandate nullptr when the size is zero. Some examples:
I didn't find any pointer values that are ignored when a size is zero.
Therefore, unless someone wants to argue strongly that we break precedent and allow a non-NULL pointer in this case, I think we should require a NULL pointer, even if it requires special-case handling for an empty std::vector.
One of our engineers raised a question internally: if a set of indirectly accesseed SVM (or USM) pointers are set using
clSetKernelExecInfo(CL_KERNEL_EXEC_INFO_SVM_PTRS)
, how are they "un-set"? To "un-set" all SVM pointers should an empty set be passed toclSetKernelExecInfo
, specifically one whereparam_value_size
is zero (and, possibly,param_value
isnullptr
)?For reference: https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#clSetKernelExecInfo
The spec describes an error condition for invalid values, but never describes what values are considered invalid.
I think we should clarify:
param_name
isCL_KERNEL_EXEC_INFO_SVM_PTRS
, passing zero forparam_value_size
is valid.param_name
isCL_KERNEL_EXEC_INFO_SVM_PTRS
, passingnullptr
forparam_value
is valid if and only ifparam_value_size
is zero.TBD: When
param_name
isCL_KERNEL_EXEC_INFO_SVM_PTRS
, is it valid to pass zero forparam_value_size
, and a non-nullptr
value forparam_value
, or is this an error?