Results 1 to 7 of 7

Thread: OpenCL 1.2 clCreateImage(...)

  1. #1
    Junior Member
    Join Date
    Oct 2012
    Posts
    4

    OpenCL 1.2 clCreateImage(...)

    Hello maybe somebody can enlighten me on why my software is crashing.

    I switched over to OpenCL 1.2 (AMD's implementation). When I call the new clCreateImage(...) function the software hangs...then crashes. I have no idea why whatsoever. With my debugger i noticed that it calls this function then looks into the OpenCL.dll file (the one i got from AMD v1.2) and calls clCreateImage3D. I specified in the image descriptor to use image2D. I am not sure if this is the issue. The software was working before I switched over to OpenCL v1.2 and was using clCreateImage2D. I'll post the applicable code below.

    Thanks in advance for all your help,
    Julian

    Code :
        //image format
        cl_image_format image_format;
        image_format.image_channel_order = CL_RGBA;
        image_format.image_channel_data_type = CL_FLOAT;
     
        //OPENCL 1.2
        //image descriptor (for opencl v1.2)
        cl_image_desc image_desc;
        image_desc.image_type = CL_MEM_OBJECT_IMAGE2D;
        image_desc.image_width = width;
        image_desc.image_height = height;
        image_desc.image_array_size = 1;
        image_desc.image_row_pitch = 0;
        image_desc.image_slice_pitch = 0;
        image_desc.num_mip_levels = 0;
        image_desc.num_samples = 0;
        image_desc.buffer = NULL;
     
        //OPENCL 1.2
        mem_image = clCreateImage(context, CL_MEM_WRITE_ONLY, &image_format, &image_desc, NULL, &error);
        //--- doesn't make it past here ---
        //OPENCL 1.1 (what I used to call) mem_image = clCreateImage2D(context, CL_MEM_WRITE_ONLY, &image_format, width, height, 0, NULL, &error);

  2. #2
    Junior Member
    Join Date
    Oct 2012
    Posts
    4

    Re: OpenCL 1.2 clCreateImage(...)

    I should mention I am using an NVIDIA GPU and Intel CPU.

  3. #3
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: OpenCL 1.2 clCreateImage(...)

    You didn't set cl_image_desc.image_depth to anything.

  4. #4
    Junior Member
    Join Date
    Oct 2012
    Posts
    4

    Re: OpenCL 1.2 clCreateImage(...)

    Quote Originally Posted by notzed
    You didn't set cl_image_desc.image_depth to anything.
    No need; not used for 2D images...only 3D ones.

  5. #5
    Senior Member
    Join Date
    Dec 2011
    Posts
    126

    Re: OpenCL 1.2 clCreateImage(...)

    Still, poster has a good point; you should set even unused members.

    Have you verified that your device supports OpenCL 1.2? Just because the SDK does doesn't mean the device does, and new APIs won't exist on old devices.

  6. #6
    Junior Member
    Join Date
    Oct 2012
    Posts
    4

    Re: OpenCL 1.2 clCreateImage(...)

    Quote Originally Posted by Dithermaster
    Still, poster has a good point; you should set even unused members.

    Have you verified that your device supports OpenCL 1.2? Just because the SDK does doesn't mean the device does, and new APIs won't exist on old devices.
    My thinking is that if i'm linking to the 1.2 libs and it compiles and my GPU runs all the code up to this function then it would not be an incompatibility issue. However, I am using the 460GTX, which as far as I know supports 1.1 and no information is given about it running 1.2. So you may be right. Do you know how it is possible that I could even run the software?

  7. #7
    Senior Member
    Join Date
    Dec 2011
    Posts
    126

    Re: OpenCL 1.2 clCreateImage(...)

    Quote Originally Posted by JVillella
    Quote Originally Posted by Dithermaster
    My thinking is that if i'm linking to the 1.2 libs and it compiles and my GPU runs all the code up to this function then it would not be an incompatibility issue. However, I am using the 460GTX, which as far as I know supports 1.1 and no information is given about it running 1.2. So you may be right. Do you know how it is possible that I could even run the software?
    That's the problem. NVIDIA doesn't support OpenCL 1.2. If you call 1.2 APIs, you'll crash because the ICD doesn't have functions to jump to. You have to check the device support before using the new APIs.

    The OpenCL 1.1 Image Creation APIs are supported on all current OpenCL 1.2 devices; just use them instead of the new 1.2 APIs. The compiler might whine that they are deprecated, but they will still work.

Similar Threads

  1. clCreateImage : 'host_ptr_max_size' argument
    By polar01 in forum Suggestions for next release
    Replies: 0
    Last Post: 09-20-2012, 07:57 AM
  2. clCreateImage{,2D,3D} vs the ICD loader
    By inducer77 in forum OpenCL
    Replies: 6
    Last Post: 08-27-2012, 03:40 AM

Posting Permissions

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