gpuopencl

Is possible to compile OpenCL code for all current video cards?


I need to distribute my program, which use opencl code without opencl sources. So i need to compile it to binary and load program from binary. This is simple, but each video card compile different binary for it self. How can i avoid this, and compile my source code for different videocards, whitout having this videocards. Maybe some compiler exist, where i can set spesific video card and get binary code for it?


Solution

  • SPIR is designed for this http://www.khronos.org/registry/spir/

    At least AMD cards support it. But you cannot use that in general right now.

    Right now there is really no other way than just providing the kernels as text with your program if you want to distribute it generally to consumers. I wouldn't worry too much about the kernels being visible. Without the OpenCL API calls and documentation they are simply useless. It takes more time for someone to reverse-engineer them than to do the same from scratch. It's like OpenGL shaders in games which also are in raw text format.