PDA

View Full Version : Needed: information about kernel parameters



Amnon
04-07-2011, 09:43 PM
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
clGetKernelInfo(param_name=CL_KERNEL_NUM_ARGS)

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?

pelotoescogorciao
04-25-2011, 02:26 PM
Aka "kernel args reflection".
Yep, we need this.

bwatt
04-25-2011, 08:57 PM
Why do you need this? What can you do with it?

Amnon
04-25-2011, 10:21 PM
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.

matthiasv
07-23-2011, 11:37 AM
Why do you need this? What can you do with it?

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

Spulenpfeifen
08-08-2011, 11:31 AM
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
clGetKernelInfo(param_name=CL_KERNEL_NUM_ARGS)

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?


+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.

3dmashup
10-22-2011, 01:24 PM
Why do you need this? What can you do with it?

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.

matthiasv
11-18-2011, 02:43 PM
I'd like to thank you for adding clGetKernelArgInfo(). One thing though: it is not listed in the sidetable of the online reference.