__kernel definitions

Hi all,

I’m trying to use a C++ source-to-source translator to optimize my OpenCL code with respect to the inputs and other parameters such as grid and work sizes. I have been successful in doing this for the host cpp file. However, currently I cannot optimize the kernel (.cl) file. Particularly I’m interested in studying the sensitivity of loop unrolling in the kernel routines. I can perhaps attempt to do it - but I would have to let my C++ source-to-source translator know where the keywords __kernel or __global etc. are defined. Does anyone know where these are defined?

Since the kernel functions are not C++ constructs, I guess I cannot accomplish this. Could someone confirm that this cannot be done or suggest an alternative?

Thanks,
Poornima

I would have to let my C++ source-to-source translator know where the keywords __kernel or __global etc. are defined. Does anyone know where these are defined?

Some implementations in fact #define these in a file somewhere. However, a proper implementation of OpenCL will not #define them anywhere: they will be deeply embedded into the lexical analyzer.

Your best bet is probably creating a header file of your own with a bunch of macros for these keywords and builtin functions.