How to protect OpenCL kernel code

I use OpenCL for Intel integrated GPU. Everything is ready, except how to protect kernel code. I know this is an old topic.

I have tried to translate the kernel code to SPIR code. but anybody can get II code through SPIR , using llvm-dsi. Because integrated GPUs only support OpenCL1.2, GPU can’t use SPIR-V code. So is there a better way to protect kernel code?

Intel GPU supports OpenCL 2.1 and SPIR-V. Reference: Intel Developer Zone

With the caveat that it depends which OS your application is targeting. Intel’s OpenCL support on Linux is much inferior to its Windows offering, unlike most other implementations which have relative feature parity across supported platforms.

You can compile the kernel into binary format. The disadvantage is that you must build a binary for each architecture you would like to support.

You can build a binary format kernel (not the .cl file)for specific architecture, and then you could build program with binary source using this API

clCreateProgramWithBinary();

You can build a binary format kernel (not the .cl file)for specific architecture, and then you could build program with binary source using this API

clCreateProgramWithBinary();

We use SPIR (OpenCL 1.2) for source code protection, but there is no support for SPIR on Nvidia GPUs and on ANY GPU on Mac OS X, even on Mac Pro with AMD D500/D700, even on Mac mini with Intel Iris Pro!

For Nvidia support - we ported kernels to CUDA, but what to do for Mac? Have anybody ideas? Or maybe Apple will enable support for SPIR soon?

I was thinking that only Nvidia has bad OpenCL (and SPIR) support because of CUDA, but Apple also has its Metal :(, and it looks better to drop Mac OS X support in our application, than to support Metal.