cl.hpp: Kernel::getWorkGroupInfo bugs

Hi all,

I recently started using the cl.hpp C++ bindings under Mac OS X 10.6, but I experience some problems with the Kernel::getWorkGroupInfo methods.

First, the utility method


template <cl_int name> typename
    detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
    getWorkGroupInfo(cl_int* err = NULL) const

should include also a const Device& parameter in order to meaningfully pass information to the full getWorkGroupInfo method.

Second, this latter method


cl_int getWorkGroupInfo(
        const Device& device, cl_kernel_work_group_info name, T* param) const

does not compile under Mac OS X, raising the following errors:


/Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:787:0 /Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:787:   instantiated from 'static cl_int cl::detail::GetInfoHelper<Functor, T>::get(Functor, cl_uint, T*) [with Functor = cl::detail::GetInfoFunctor1<cl_int (*)(_cl_kernel*, _cl_device_id*, cl_kernel_work_group_info, size_t, void*, size_t*), _cl_device_id*, _cl_kernel*>, T = long unsigned int]'
/Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:1015:0 /Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:1015:   instantiated from 'cl_int cl::detail::getInfo(Func, const Arg0&, const Arg1&, cl_uint, T*) [with Func = cl_int (*)(_cl_kernel*, _cl_device_id*, cl_kernel_work_group_info, size_t, void*, size_t*), Arg0 = _cl_device_id*, Arg1 = _cl_kernel*, T = size_t]'
/Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:3146:0 /Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:3146:   instantiated from 'cl_int cl::Kernel::getWorkGroupInfo(const cl::Device&, cl_kernel_work_group_info, T*) const [with T = size_t]'
/Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:997:0 /Users/digasper/Documents/Development/GraphColoringOpenCL/cl.hpp:997: error: cannot convert '_cl_device_id* const' to '_cl_kernel*' in argument passing

Since they are some errors due to functors and other meta-programming stuff, I am not so confortable in understanding them.

It is a bug. the sequence of arguments does NOT match clGetKernelWorkGroupInfo.
so here is a patch to fix it.


@@ -3142,7 +3142,7 @@
     {
         return detail::errHandler(
             detail::getInfo(
-                &::clGetKernelWorkGroupInfo, device(), object_, name, param),
+			    &::clGetKernelWorkGroupInfo, object_, device(), name, param),
                 __GET_KERNEL_WORK_GROUP_INFO_ERR);
     }
 
@@ -3166,11 +3166,11 @@
      */
     template <cl_int name> typename
     detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
-    getWorkGroupInfo(cl_int* err = NULL) const
+    getWorkGroupInfo(const Device& dev, cl_int* err = NULL) const
     {
         typename detail::param_traits<
             detail::cl_kernel_work_group_info, name>::param_type param;
-        cl_int result = getWorkGroupInfo(name, &param);
+        cl_int result = getWorkGroupInfo(dev, name, &param);
         if (err != NULL) {
             *err = result;
         }

Please bring this to Ben’s attention at viewtopic.php?f=28&t=1415

I have updated the C++ bindings to fix this and other issue, and have requested that they be uploaded.