Results 1 to 5 of 5

Thread: unique kernel names?

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    26

    unique kernel names?

    Do the kernel function names have to be unique? Is it ok, if I pass different source code strings to clCreateProgramWithSource but all with the same kernel name? Looks like I will be able to get unique kernel handles with clCreateKernel despite the fact that all kernel functions have the same name. Is it correct?

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: unique kernel names?

    Within one program all kernel names must be different. However, you can repeat the same kernel names in different programs.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    26

    Re: unique kernel names?

    thank you!

    what are pro's and con's of both approaches?
    what was the idea to divide everything into programs?
    how will putting one kernel per program impact 1) performance 2) use of resources 3) logic of the code?

  4. #4
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: unique kernel names?

    what was the idea to divide everything into programs?
    Imagine we didn't have programs. Then a kernel would not be able to call into other auxiliary functions or kernels. That's perhaps the easiest example of why we need them.

    how will putting one kernel per program impact 1) performance 2) use of resources 3) logic of the code?
    Performance depends on a lot of factors, including hardware, OpenCL driver and your application. I can imagine examples were putting everything in one program would work best and other examples where one kernel per program would be best. Read your hardware vendor's (AMD, Intel, Nvidia, etc) programming guides, which should give you some rules of thumb.

    I would expect the use of resources will be roughly the same.

    If you are asking whether this would have an impact on the complexity of the OpenCL API calls, I don't think so. At the end of the day what you enqueue are kernels, not programs, so there's no difference whether they are all in the same program or not.

    Generally speaking, if I wanted to get the best performance I would try to maximize locality. If you know that kernel A is always followed by kernel B and that both of them are small, then put A and B in the same program. If you know that kernel A and B do not follow each other very often and/or one of them is large, then put the large one in a separate program.

    This advice assumes that all kernels are independent of each other. In reality they will share auxiliary functions which you will need to keep into account when you group kernels into programs.

    If performance is less of a concern, then you can group kernels into programs by functionality. I.e. kernels that are naturally related go into the same program. This will make the code easier to read and maintain.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  5. #5
    Junior Member
    Join Date
    Dec 2010
    Posts
    26

    Re: unique kernel names?

    thank you very much for the help!

Similar Threads

  1. GLSL uniform array names?
    By JoshKlint in forum OpenGL ES general technical discussions
    Replies: 1
    Last Post: 06-11-2013, 09:12 PM
  2. Unique device/implementation name
    By matrem in forum OpenCL
    Replies: 5
    Last Post: 04-16-2010, 04:40 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
  •