Results 1 to 3 of 3

Thread: Kernel precompilation

  1. #1

    Kernel precompilation

    Hi,

    In OpenCL, to perfom some computations, we have basically to:

    1. create the program from source
    2. compile the program
    3. create the kernel
    4. set the kernel arguments
    5. launch the kernel

    At step 2, we can ask OpenCL to give us a char* containing the binary.
    We can then replace 1. and 2. by one step consisting in compiling the program from the binary.

    Now, imagine we have an inifite loop and at each iteration, we use our kernels.
    It is of course not very optimal to do the 5 steps in the loop.
    But what is the best save in a variable outside the loop?
    - program binary?
    - program?
    - kernel?

    I would say that it's better to save the kernel and the program so that we can release them properly at the end of the program.
    But maybe, if we have a lot of kernels, saving them in variables will use too much memory on the device for nothing.
    I don't know what's the best. What would you do?

    Thanks,

    Vincent

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

    Re: Kernel precompilation

    If you need to repeat a similar computation many times, you only need to redo steps 4 and 5. All the others can be done "outside of the loop".
    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

    Re: Kernel precompilation

    That was my guess too. Thank you!

Similar Threads

  1. SPIR kernel precompilation tool
    By pelotoescogorciao in forum Suggestions for next release
    Replies: 0
    Last Post: 01-05-2013, 11:33 AM
  2. Replies: 4
    Last Post: 08-06-2012, 01:18 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
  •