AnsweredAssumed Answered

Device-side enqueue, block syntax, and local kernel variables

Question asked by ginquo on Jan 2, 2015
Latest reply on Jan 5, 2015 by ginquo



I'm currently in the process of updating my code to make use of the new OpenCL 2.0 features. At the moment I'm implementing a kernel that enqueues some of my existing kernels from the device. In order to enqueue a kernel from the device, this kernel needs to be wrapped in a block, which is then passed to enqueue_kernel(). What this essentially does is that it creates a new anonymous kernel in which the actual kernel is called as a function.


However, this fails when the kernel defines some local variables. This is because OpenCL C requires local variables to be defined at kernel-scope and the kernel is actually treated as a function in the block.


You can find a minimal example of this here:


What I wonder is if there is any other way to make use of device-side enqueue without having to rip out all local definitions out of a kernel and having to pass them as arguments. I'd like to avoid this, because I want to keep calling the kernels from the host if necessary. Exposing all internal local variables would also mess with encapsulation.


PS: Is there any way to get a linker output log from a failed call to clLinkProgram()? I thought I'd use clGetProgramBuildInfo(), but since clLinkProgram() doesn't return a valid program on error, I don't know what to pass as argument.