1 Reply Latest reply on Sep 16, 2011 2:38 AM by settle

    confused by clEnqueueWriteBufferRect

    jasno
      using AMD_APP_2.5_RC2 on CPU

      I am trying to use this function but it always segfaults for me. If I use the same memory pointers and call clEnqueueWriteBuffer then it doesn't seg fault so I think that I have allocated memory OK, I can only assume it is the values I have in region[3] that are somehow wrong (I am copying from/to the start of the host array / memory buffer so all entries in buffer_origin and host_origin are 0).

      When I read the docs for region at

      http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html

      it says

      "The (width, height, depth) in bytes of the 2D or 3D rectangle being read or written. For a 2D rectangle copy, the depth value given by region[2] should be 1."

      but I don't understand how to describe the rectangle width, height and depth "in bytes", surely it should be in terms of numbers of entries ? I can just about think about describing one of the dimension in bytes, but surely not all three?

      Later in the doc for "buffer_slice_pitch" it says

      "The length of each 2D slice in bytes to be used for the memory region associated with buffer. If buffer_slice_pitch is 0, buffer_slice_pitch is computed as region[1] * buffer_row_pitch"

      which means that it may compute the buffer_slice_pitch as width(in bytes)*height(in bytes) which surely is wrong ?

      Jason

        • confused by clEnqueueWriteBufferRect
          settle

           

          Originally posted by: jasno

          When I read the docs for region at

          http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueWriteBufferRect.html

          it says

          "The (width, height, depth) in bytes of the 2D or 3D rectangle being read or written. For a 2D rectangle copy, the depth value given by region[2] should be 1." but I don't understand how to describe the rectangle width, height and depth "in bytes", surely it should be in terms of numbers of entries ? I can just about think about describing one of the dimension in bytes, but surely not all three?



           

          Try downloading the pdf of the OpenCL specification (Version: 1.1, Revision: 44).  In there you'll find this issue has been clarified:

          "region defines the (width in bytes, height in rows, depth in slices) of the 2D or 3D rectangle being read or written. For a 2D rectangle copy, the depth value given by region[2] should be 1."