2 Replies Latest reply on Sep 26, 2013 3:03 AM by realhet

    buffer offset and opencl

    sajis997

      Hello forum,

       

      I found the following points discussed in the link : http://www.cc.gatech.edu/~vetter/keeneland/tutorial-2012-02-20/08-opencl.pdf

       

      1. Buffer offsets are not allowed in OpenCL.

      2. Must use pointer arithmetic for pointer traversal in OpenCL.

       

      Could some one explain what they mean ? Specially the first point.

       

       

      Thanks

      Sajjadul

        • Re: buffer offset and opencl
          himanshu.gautam

          Hi

          I really dont know in what context the above statements are defined.

          Please refer opencl spec for any technical stuff.

          • Re: buffer offset and opencl
            realhet

            Hi,

             

            Imagine you have a kernel declared like: testkernel(global float *array)

            And you have an OpenCL buffer allocated for that float array.

            Then you can't call the kernel like testkernel(&buffer[15]).

            On OpenCL you have to send a reference to the whole buffer (that's the only way right now), and specify the '15' offset manually with a constant parameter in the kernel's parameter list.

             

            I guess OpenCL 2.0 will have an answer for this in the future.