clSetKernelArg arg_value as NULL object.

clSetKernelArg arg_value as NULL object.


According OpenCL 1.1 specification clSetKernelArg arg_value could be NULL object.

So, the construction (below) is valid:

cl_mem null_buffer = NULL;
errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, sizeof(cl_mem), &null_buffer);

However, on Intel OpenCL SDK 1.5, I am keep getting error:

I've tried same construction on Nvidia OpenCL 1.1, it works fine. no error at all.
Am I missing something or that could be a bug?

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Denis,

According to the spec. you can pass the NULL pointer toas anargument if target parameter is a buffer.

From the spec:
"If the argument is a buffer object, the arg_value pointer can be

NULL or point to a NULL value 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"

We will try to reproduce the issue and update your accordingly.


Hi Again,

I've just recently checked this issue again with latest Intel 2012 x64 SDK.
It is still there!!!

We need this feature sometimes, otherwise we have to make different kernels with different number of arguments to work around it.

Could you please make a bug report and hopefully fix it for next release?


Hi Denis

Thank you for your report.
This is a real bug.
We opened a ticket. It will be fixed in future releases...
Thanks, Shiri

Hello. Small advertisment: I'm a guy from Russia, Moscow, Fitting Reality company.
We also need this feature sometimes.

The solution(small technical workaround) that can possible can help you:
1. You should insert AMD videocard in your system
2. Install AMD-APP-SDK-v2.7 for your system
3. You can remove your videocard from the system
4. Select Intel CPU from Amd OpenCL context "AMD Accelerated Parallel Processing" from your code. And do that you need.

It works fine and was tested for Windows x86/x64.

Problem is that you cannot simply install AMD-APP-SDK-v2.7 without having AMD videocard in your system.
Steps #1, and #3 need for you to have an AMD videocard, and have potentional possibility to insert it.

Leave a Comment

Please sign in to add a comment. Not a member? Join today