Results 1 to 2 of 2

Thread: cl.hpp: KernelFunctor gone,replaced with KernelFunctorGlobal

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    1

    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

  2. #2

    Re: cl.hpp: KernelFunctor gone,replaced with KernelFunctorGl

    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:

    Code :
    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:perator() would be most appropriate. Just my opinion, would love more feedback on it.

Similar Threads

  1. OpenCL 1.2 cl.hpp
    By Meteorhead in forum OpenCL
    Replies: 16
    Last Post: 05-10-2013, 06:54 PM
  2. Is glut similar ug or egl and can be replaced each other?
    By qqrilxk in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 05-11-2007, 12:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •