7 Replies Latest reply on Jun 13, 2013 7:09 PM by amcelroy

    clEnqueueWriteBufferRect crashes 7970

    amcelroy

      Howdy folks,

       

      Ran into a nasty issue and was wondering if I could get some help.  OpenCL device is an AMD7970 running Catalyst 13.4 release.  As the title of the post states, I'm either crashing the OS or causing a driver display timeout when trying to use  clEnqueueWriteBufferRect. 

       

      This thread (http://devgurus.amd.com/thread/160312) seems to be along a similar vein, but the thread author reported the issue fixed at the end. A basic example of the code causing the problem is:

       

      #include <CL/cl.h>

      void main(){

        int Width = 4096;

        int Height = 1;

        int Depth = 1;

        int Error = 0;

       

        float *WriteData = new float[Width*Height*Depth];

        float *ReadData = new float[Width*Height*Depth];

       

        for(int i = 0; i < Width*Height*Depth; i++){

        WriteData[i] = i;

        }

       

        cl_context Context;

        cl_command_queue Queue;

       

        /*****YOU MUST SETUP A DEVICE HERE*****/

       

        /****END DEVICE SETUP*****/

       

        size_t Region[3] = {sizeof(float)*Width, Height, Depth};

        size_t DevOrigin[3] = {0, 0, 0};

        size_t HostOrigin[3] = {0, 0, 0};

       

        cl_mem DeviceTestData = clCreateBuffer(Context, CL_MEM_READ_WRITE, sizeof(float)*Width*Height*Depth, NULL, NULL);

        Error = clEnqueueWriteBufferRect(Queue, DeviceTestData, true, DevOrigin, HostOrigin, Region, 0, 0, 0, 0, WriteData, NULL, NULL, NULL);

        Error = clEnqueueReadBufferRect(Queue, DeviceTestData, true, DevOrigin, HostOrigin, Region, 0, 0, 0, 0, ReadData, NULL, NULL, NULL);    

      }

       

      As noted in the code, please setup your device however needed.  Save your work though!

       

      Thanks,

      Austin

        • Re: clEnqueueWriteBufferRect crashes 7970
          amcelroy

          Update:  The AMD OpenCL drivers on the Intel i5-2400 processor works perfectly and doesn't freeze/crash.

          • Re: clEnqueueWriteBufferRect crashes 7970
            amcelroy

            Hey sorry to bump a post and bug folks,

             

            Were you able to reproduce the error?  If not, can I give you more info or does anyone have any suggestions?

             

            Thanks,

            Austin

              • Re: clEnqueueWriteBufferRect crashes 7970
                himanshu.gautam

                its been little busy these days, so there is this lag. I will give you some update today.

                • Re: clEnqueueWriteBufferRect crashes 7970
                  himanshu.gautam

                  Looks like the hang is happening when we try to read/write the complete buffer using the *Rect API. Forwarding that to Engg team. you can use clEnqueueWriteBuffer for this purpose as of now. Seems to be windows only issue.

                  The following code works for me:

                  size_t Region[3] = {sizeof(float)*(Width - 1), Height, Depth};

                      size_t DevOrigin[3] = {0, 0, 0};

                      size_t HostOrigin[3] = {0, 0, 0};

                   

                      cl_mem DeviceTestData = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(float)*Width*Height*Depth, NULL, &Error);

                      if(Error)

                      {

                      std::cout << "CreateBuffer returns:" << Error;

                      exit(1);

                      }

                      Error = clEnqueueWriteBufferRect(commandQueue, DeviceTestData, CL_TRUE, DevOrigin, HostOrigin, Region, Width * sizeof(float), Width * Height * sizeof(float), Width * sizeof(float), Width * Height * sizeof(float), WriteData, NULL, NULL, NULL);

                      if(Error)

                      {

                      std::cout << "WriteBufferRect returns:" << Error;

                      exit(1);

                      }

                   

                      //Region[0] = sizeof(float)*(Width - 1), Region[1] = Height, Region[2] = Depth;

                      Error = clEnqueueReadBufferRect(commandQueue, DeviceTestData, true, DevOrigin, HostOrigin, Region, 0, 0, 0, 0, ReadData, NULL, NULL, NULL);  

                      if(Error)

                      {

                      std::cout << "ReadBufferRect returns:" << Error;

                      exit(1);

                      }