There doesn’t appear to be any way to link cl files together (useful for making code modularly).

Correct. There is no way to link. clBuildProgram() both compiles and links.

Is there any chance this will be included in future specifications?

The committee has a policy of not discussing what new features will be added to each new revision.

That said, the committee is well aware of this particular topic you have raised :slight_smile:

I agree,

For us it is a CRITICAL feature, I explain…

Our OpenCL application use a “shading language” like HSL, GLSL, Cg, … and so, the OpenCL code is generated at run-time.

The complete kernel request 12 minutes to compile today for the GPU.

99% of the code is in the library, this part of the code never change and must be recompiled each time ! 1% of the code is dynamic and so the application recompile everything !!!

We can’t release an application like this !!! :frowning: It is really a critical problem for our company ! It is really a problem that can kill our company business !

Would it be possible to move some of that 99% of the code into a separate program and using precompiled binaries?

I think it is not possible David,

Imagine the following example :

float random() { .... }
float projection() { .... }


__kernel void emptyKernel() {}

The I can create a precompiled binary with clCreateProgramWithBinary.

Later, I generate the following code

__kernel void runtimeKernel_01()
   float r = random();

But random is in the first program !!! The second kernel will not compile because it does not know the ‘random’ function. It is why we need something to link the second kernel with the first one.

Do you agree ?

If the 1% of the code that changes dynamically calls directly or indirectly all the other 99% of the code, then yes, you will need some form of linking. It may still be possible to either reduce the amount of code that needs to be compiled, cache some frequently-used variations of the code, etc.


I have no idea to reduce the 99% of the code !!! each function is useful and different and will be used in most situations !

I think that this kind of feature will be welcomed in OpenCL 1.2 ?!

In my case the kernel request 12 minutes to compile for the GPU !! and the dynamic part of the code is minimal. What will happend when I will have a lot of dynamic code !

I have today an unusable software !!! My customers cannot wait 10 minutes each time it start a rendering and change a settings !

OpenCL has to evolve urgently… at least for business.

What can I do ?