In-Lining Constant Array into source It works, but is it the best or only way?

[codebox]constant char data[10] = {1,-1,2,1,1,1,1,-2,1,2};

kernel void foo(){




I wish to make use of the 64k constant memory by replacing a small Global with a small array like above, except length 2500.

The above example works, and I should mention that I build / assemble my OpenCL on the fly, so doing this is no problem. Would doing this affect compile time very badly? If multiple kernels needed the same array is in-lining the wrong way to go? Is there even another way? All I see are ways to load & pass as parameters Globals & Images (plus initial Locals).

Ok, section 5.5.2 describes passing a constant *float. Still how do you load it?

Well finally just tried changing from global to constant in kernel argument list. It works, and probably easiest. Wish the spec would make that more obvious. (printed the 5/16/09 revision, so may is better by now).