cl.hpp: KernelFunctor gone,replaced with KernelFunctorGlobal

Hi everybody,

The KernelFunctor class in cl.hpp has been removed (and moved to the new KernelFunctorGlobal template class) basically breaking our code. We have therefore been using the older OpenCL 1.1 cl.hpp header still containing KernelFunctor.

Why has it been removed? Were there some inconsistencies or bugs attached to it that made a new concept necessary or was it rather convenience of specifying the arguments as templates?

Is there something like a revision log for the header files? Currently there is no way to tell, when something important was changed.

Best regards and thanks for your time,
Timo

The KernelFunctor was technically never part of the OpenCL 1.1 C++ bindings specification: http://www.khronos.org/registry/cl/spec … us-1.1.pdf

This was because the design of this feature is still under debate. The new feature to replace KernelFunctor is actually cl::make_kernel that can be used like the following:


cl::make_kernel<int, 
               cl::Buffer,
               cl::LocalSpaceArg,
               cl::Image3D> func(kernel);

cl::EnqueueArgs eargs(queue, cl::NDRange(1024), cl::NDRange(32));

func(12, buffer, cl::Local(32), image).wait();

The major improvement over KernelFunctor being that the functor’s operator() is now typesafe. Though it would have been cooler if this could have been accomplished by introspecting the kernel arguments directly using the new OpenCL 1.2 features. Not sure if that could have been accomplished in a simple header file. Would probably require an auxiliary program to generate the stubs.

cl::make_kernel also still suffers problems with the functor not being usable from multiple threads in a safe manner. So I don’t think cl::make_kernel will even be the final iteration of this approach.

As a stop gap measure till we figure out a good stubbing/functor system for C++, I think a cl::Kernel::setArgs template method duplicating the KernelFunctor::operator() would be most appropriate. Just my opinion, would love more feedback on it.