How to protect/hide my OpenCL C code?
I want to protect/hide my code and avoid users can see my kernel program.
I worry that if users implement their own OpenCL API/driver, and I use on-line compiler, my kernel code can not be hidden because they will access my code easily and directly...
How can I protect my OpenCL C code?
How to let people be disable to see my program?
I think I may use off-line compiler, but is it really safe?
Thank you very much.
Option 1: Obfuscate your source and continue to use clCreateProgramWithSource. Remove all comments and make variable and function names meaningless. This will still work on all platforms and devices.
Option 2: Only ship binary and use clCreateProgramWithBinary. The downside is that you'll have to pre-compile your program for all supported platforms and devices ahead of time and if your user has an unsupported device, you won't run on their hardware.
Option 3: Wait for OpenCL SPIR to be available everywhere. This is a portable intermediate representation that is lower-level than source but higher level than binary. It is not well supported yet, so not really an option yet.
Thank you very much! I will try them