Kernels and the GPL. Are we safe and linking?

Disclaimer: I am not a lawyer and below is my humble opinion only. The post is for insights only, not for legal matters.

GPL was always a protection that somebody or some company does not run away with your code and makes the money with it. Or at least force that improvements get back into the community. For unprepared companies this was quite some stress when they were forced to give their software away. Now we have host-kernels-languages such as OpenCL, CUDA, DirectCompute, RenderScript don’t really link a kernel, but load it and launch it. As GPL is quite complicated if it comes to mixing with commercial code, I try to give a warning that GPL might not be prepared for this.

If your software is dual-licensed, you cannot assume the GPL is not chosen when eventually used in commercial software. Read below why not.

I hope we can have a discussion here, so we get to the bottom of this.


The claim is that if a kernel is a independent piece of software that does not get linked but loaded, then GPL does not protect the code. The GPL FAQ says this about GPL-plugins for non-free software:

If the program uses fork and exec to invoke plug-ins, then the plug-ins are separate programs, so the license for the main program makes no requirements for them. So you can use the GPL for a plug-in, and there are no special requirements.

If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. This means that combination of the GPL-covered plug-in with the non-free main program would violate the GPL. However, you can resolve that legal problem by adding an exception to your plug-in’s license, giving permission to link it with the non-free main program.

From the first paragraph we can conclude that if the kernel is generalised to a standard plugin (for instance all have “kernel void performFilter()“) and is accompanied with the GPL-license, that it is permitted to load that kernel from non-free software. And yes, ‘exec’ seems to be a better description of launching a kernel than ‘linking’.

The second paragraph describes what happens when loading&launching a kernel would be the same as linking. I can only think of certain cases, but those are avoidable.

What makes it more difficult is that lot of existing software has complete functionality and GPGPU-code is truly a plugin which replaces existing functionality. Meaning the software is not dependent on it and the faster code.

How to get legal protection?

Always be explicit. If you really want to be sure, extend the GPL by stating that loading the kernel-file is seen as dynamic linking and as such the GPL is applied, etc. etc. How exactly this can be done, ask your lawyer. For commercial kernels I would recommend you to check licenses that go with Java code – as jar-files can be decompiled.

Which license do you use yourself?