The following code uses a struct, passed into the kernel, containing a global pointer. The pointer however is not used inside the kernel until initialized to point to the floats0 global float * array. Is there anything in the OpenCL 1.2 spec that says this is/isnt legal?
Seems legal to me as long as you’re not trying to pass a host pointer in there. If you initialize the value and use the value only on the device side, seems completely legit.
The thing is, pointers are not guaranteed to remain consistent on a GPU between kernel runs. It can be valid for some particular architecture, but using an undefined behavior is always iffy.