Results 1 to 9 of 9

Thread: OpenCL write_imagei problem

  1. #1
    Newbie
    Join Date
    Jul 2013
    Posts
    5

    OpenCL write_imagei problem

    Hi,
    I have a very strange issue when try to write data into a 2d integer image.
    This are the important parts of the code (I'm useing the C++ wrapper cl.hpp):
    Code :
        cl_int err = 0;
        cl::ImageFormat format(CL_RGBA, CL_SIGNED_INT32);
        cl::Image2D border(mContext, CL_MEM_READ_WRITE, format, 1, 1, 0, NULL, &err);

    And read it back with this lines (this code is not very clean, but it's there just for debug):
    Code :
        int *im = new int[4];
        cl::size_t<3> o; o[0] = o[1] = o[2] = 0;
        cl::size_t<3> s; s[0] = s[1] = s[2] = 1;
        err = mCommandQueue.enqueueReadImage(border, CL_TRUE, o, s, 0, 0, im)

    And finally the kernel (again just a test kernel):
    Code :
    kernel void generateVertexBuffer(write_only image2d_t borders){
        int4 b = {1, 2, 3, 4};
        if(get_global_id(0) == 0)
            write_imagei(border, (int2)(0, 0), b);
    }

    When try to run this code the enqueueReadImage always return -5: CL_OUT_OF_RESOURCES.
    The code works if I change the image format to CL_[UN]SIGNED_INT[8|16], the problem arise only with 32 bit integer formats, which is odd considering that clGetSupportedImageFormats with CL_MEM_READ_WRITE and CL_MEM_OBJECT_IMAGE2D tells me that four channel 32bit images are supported.
    Lasts informations: OS: windows 8 64bit, GeForce GTX 470, driver version: 320.49.

    Any ideas?
    Thanks!

  2. #2
    Senior Member
    Join Date
    Oct 2012
    Posts
    165
    Where is your sampler definition?

    without that, noone can tell i think

  3. #3
    Newbie
    Join Date
    Jul 2013
    Posts
    5
    Which sampler? write_imagei doesn't require a sampler as parameter.

  4. #4
    Newbie
    Join Date
    Jun 2013
    Posts
    7
    Is it possible your reading/writing past the end of the image? That's usually the case when -5 is thrown from a read buffer command.

  5. #5
    Newbie
    Join Date
    Jul 2013
    Posts
    5
    At first i thought that, but then I got the same error with the kernel in the first post wher i'm writing at 0,0. And if I change the data type to CL_SIGNED_INT8 or CL_SIGNED_INT16 the code works perfectly.

  6. #6
    Senior Member
    Join Date
    Oct 2012
    Posts
    165
    Have you queryied the image format you are trying to use?
    cl_int clGetSupportedImageFormats in [5.3.2] in opelCL 1.1 spec

    Should be returned because its in the minimum supported list. Strange...
    Last edited by clint3112; 07-15-2013 at 03:43 AM.

  7. #7
    Newbie
    Join Date
    Jul 2013
    Posts
    5
    I did it, and the strage thing is that the CL_RGBA, CL_SIGNED_INT32 combination is in the returned list. I'm thinking at a driver bug at this point...

  8. #8
    Senior Member
    Join Date
    Oct 2012
    Posts
    112
    I've checked your code on my system (same OS, same driver but with a GeForce GT 650M) and it just works fine...

  9. #9
    Newbie
    Join Date
    Jul 2013
    Posts
    5
    Well, considering this I guess that it is a driver bug that presents with the gtx 470...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •