PDA

View Full Version : Linking



IRWolfie-
03-11-2011, 08:28 AM
There doesn't appear to be any way to link cl files together (useful for making code modularly).

david.garcia
03-11-2011, 09:42 AM
Correct. There is no way to link. clBuildProgram() both compiles and links.

IRWolfie-
03-11-2011, 10:01 AM
Is there any chance this will be included in future specifications?

david.garcia
03-11-2011, 11:11 AM
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 :)

polar01
09-13-2011, 12:34 AM
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 !!! :-( It is really a critical problem for our company ! It is really a problem that can kill our company business !

david.garcia
09-13-2011, 04:06 PM
Would it be possible to move some of that 99% of the code into a separate program and using precompiled binaries (http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clCreateProgramWithBinary.html)?

polar01
09-13-2011, 11:10 PM
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 ?

david.garcia
09-14-2011, 05:12 AM
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.

polar01
09-14-2011, 05:27 AM
Thanks,

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

polar01
09-23-2011, 07:20 AM
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 ?

Thanks