pointers between buffers  - illegal or OK?

Discussion created by antzrhere on Aug 25, 2011
Latest reply on Aug 30, 2011 by laobrasuca

Just a quick question is pointers betwen global memory buffers permitted?


__kernel void TraceRays(__global const float* buf1, __global const float* buf2)

int value;

ptrdiff_t OffsetToBuffer2 = buf2-buf1;

// access buf2 data - illegal?
value = buf1[ OffsetToBuffer2 ];



The code works, however I read in an nVidia OpenCL guide that pointers between two buffers is not permitted according to the OpenCL spec. The thing is, this code atleast works on my ATI 5870 and is massively quicker than reading from an array of buffers (i.e. buf[bufferOffset + dataoffset] is faster than buf[bufferselectflag][dataoffset]). I imagine this would probably not present any issues on an x86 platform, but GPU memory space is probably another thing. Would this code present some incompatiblity problems on other hardware?