According to the documentation on clSetKernelArg
on arg_value
“A NULL value can also be specified if the argument is a buffer object in which case a NULL value will be used as the value for the argument declared as a pointer to __global or __constant memory in the kernel”
So is possible to pass a NULL __global pointer to a kernel
On this situation arg_size, assuming that the word “argument” mean “kernel argument” like on all document, I assume
clSetKernelArg(kernel, n , sizeof(cl_mem), NULL) OK
clSetKernelArg(kernel, n , 0, NULL) WRONG
clSetKernelArg(kernel, n , sizeof(cl_mem), &zero_buffer) ??
When i follow to read reaching Errors section i see
CL_INVALID_ARG_VALUE if arg_value specified is NULL for an argument that is not declared with the __local qualifier or vice-versa
This mean
clSetKernelArg(kernel, n , sizeof(cl_mem), NULL) WRONG
clSetKernelArg(kernel, n , 0, NULL) WRONG
clSetKernelArg(kernel, n , sizeof(cl_mem), &zero_buffer) ??
CL_INVALID_MEM_OBJECT for an argument declared to be a memory object when the specified arg_value is not a valid memory object
clSetKernelArg(kernel, n , sizeof(cl_mem), NULL) WRONG
clSetKernelArg(kernel, n , 0, NULL) WRONG
clSetKernelArg(kernel, n , sizeof(cl_mem), &zero_buffer) WRONG?
Is Null a valid memory object ? For Nvidia the answer is YES and the third call work, for AMD the answer is NO, no one of this call work and there is no way to set a pointer kernel argument to NULL