Needed: information about kernel parameters

What we need is to be able to look at a given kernel (cl_kernel) and tell not only how many parameters it has using
[ul] clGetKernelInfo(param_name=CL_KERNEL_NUM_ARGS)[/ul]

but for each parameter to also query its type, which could be one of the following:

  1. local
  2. a memory-object
  3. a sampler
  4. data - in which case we also need to know the data-size

Any plans to support this in OpenCL-1.2?

Aka “kernel args reflection”.
Yep, we need this.

Why do you need this? What can you do with it?

Why do you need this? What can you do with it?
Our cluster-wide OpenCL platform handles 3rd-party OpenCL applications, so it has no advance knowledge about kernel arguments and their type (and we do not have our own parser either to try to analyze the kernel source-codes ourselves).

Our implementation of “clSetKernelArg” needs to look at the kernel argument that is supplied by the application, return an appropriate error-code to the calling application if necessary, then convert memory-objects and samplers to its internal representation.

While the platform is operational, it currently needs to rely on dirty and expensive tricks to find the necessary information, and those tricks also happen to differ from one SDK to the next, which is not good at all. We need a simple way, once a program is built (which would generally be on a different computer) to send back information about all its kernel-argument types and sizes to the computer where the application is running.

I also support this idea. Personally, I would write a wrapper function using varargs to simplify kernel calls.

+1. I was just looking for the same thing as I have a similar case where the kernel is out of my control and I need to check it against incoming data.

It helps greatly when you are creating OpenCL bindings from another language. It provides easier run-time type checking to ensure that a parameter in the language binding is correctly type mapped to a kernel parameter.

I’d like to thank you for adding clGetKernelArgInfo(). One thing though: it is not listed in the sidetable of the online reference.