Results 1 to 8 of 8

Thread: Needed: information about kernel parameters

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    14

    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
    • 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?

  2. #2

    Re: Needed: information about kernel parameters

    Aka "kernel args reflection".
    Yep, we need this.

  3. #3

    Re: Needed: information about kernel parameters

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

  4. #4
    Junior Member
    Join Date
    Nov 2009
    Posts
    14

    Re: Needed: information about kernel parameters

    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.

  5. #5

    Re: Needed: information about kernel parameters

    Quote Originally Posted by bwatt
    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.

  6. #6

    Re: Needed: information about kernel parameters

    Quote Originally Posted by Amnon
    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.

  7. #7
    Junior Member
    Join Date
    Aug 2009
    Posts
    4

    Re: Needed: information about kernel parameters

    Quote Originally Posted by bwatt
    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.

  8. #8

    Re: Needed: information about kernel parameters

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

Similar Threads

  1. The order of parameters in kernel function
    By firemars in forum OpenCL
    Replies: 0
    Last Post: 07-29-2011, 01:22 PM
  2. Describing kernel parameters
    By eXandr in forum Suggestions for next release
    Replies: 1
    Last Post: 01-18-2011, 10:06 AM

Posting Permissions

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