OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

clSetKernelArg arg_value as NULL object.

dpshamonin
Beginner
463 Views
Hi,

According OpenCL 1.1 specification clSetKernelArg arg_value could be NULL object.
http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clSetKernelArg.html

So, the construction (below) is valid:

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

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

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?

Thanks,
-Denis
0 Kudos
4 Replies
Evgeny_F_Intel
Employee
463 Views
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.

Thanks,
Evgeny

dpshamonin
Beginner
463 Views
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?
Thanks,

-Denis
Shiri_M_Intel
Employee
463 Views
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

Burlachenko_Konstant
463 Views
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.
Reply