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.
Or why not use the run-time specification of local allocation as an alternative? Does it really need to be compile-time at all?
I only ever use the run-time version because I think the scoping makes more sense. That is pass a __local float *coalesce pointer to the kernel.