Kernel Compile-time "adjustable" constant

Discussion created by psath on Aug 6, 2010
Latest reply on Aug 6, 2010 by LeeHowes

Hi guys, I'm working with memory coalescing in my kernel and I'm trying to write things generically as possible. I want to allocate a local array like "__local float coalesce[get_local_size(0)]" I know that this operation isn't permitted (variable length array), but the only time I need it to "vary" is right when I compile the kernel. Local sizes must be adjustable on a per-run basis in the host code, but will never change after their first initialization.

Is there anyway of passing a variable down to the OpenCL compiler other than simply appending the rest of the source to a string like "#define localSize %d\n" +




Oh now I feel silly... "-D name=definition" preprocessor option to clbuildprogram.