Writing 3D Images - compile error Error on pragma when I try to enable extensions

I’m trying to write to a 3D image and I get the following error when I try to compile the .cl file:

[codebox]

:1: warning: unknown ‘#pragma OPENCL EXTENSION’ - ignored

#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable

                     ^

:81: warning: incompatible pointer types passing ‘image3d_t’, expected 'image2d_

t’

    write_imagef(dev_vol_write, vp, vol_data);

                 ^~~~~~~~~~~~~

:81: error: incompatible type passing ‘float4’, expected ‘int2’

    write_imagef(dev_vol_write, vp, vol_data);

[/codebox]

In the SDK, I found the use of pragma in DTXCompression.cl and I compiled and ran that sample just fine. Any thoughts?

My .cl file starts as follows

[codebox]

#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable

[/codebox]

Does the NVidia OpenCL implementation support cl_khr_3d_image_writes ?

Hi,

I just wanted to say that I’ve got the exact same problem. I manage to use other extensions (though I haven’t tried them all), but this one doesn’t seem to be recognized by the nvidia drivers I use.

Here is the pragma I used :

[codebox]

#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable

[/codebox]

And the error code I got :

[codebox]

#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable

                     ^

:908: warning: incompatible pointer types passing ‘image3d_t’, expected ‘image2d_t’

     write_imagef(image3d, coord, color);

                  ^~~~~~~

:908: error: incompatible type passing ‘int4’, expected ‘int2’

     write_imagef(image3d, coord, color);

                           ^~~~~

[/codebox]

Any help will be greatly appreciated !

Thanks.

Not only are Extensions optional between vendors, not all devices of a vendor need support the same extensions. There is a CL_DEVICE_EXTENSIONS value that can be specified in the clGetDeviceInfo call to get the extensions supported. If you are writing code for others to run, it would be a good idea to make that call right in the application, so you can manage a graceful failure.

I do not know what to say about DTXCompression.cl . The above test should be definitive though.

From the last printout I did, 195.39, my 8800GTX did not list cl_khr_3d_image_writes as an extension it supported.

Wait, I think you might be focusing on the wrong problem. Look at the “Compilation error when using atomic functions” a couple down. Different extension, but got 2 warnings & an error, just like you. Fix the error, ignore the warning.

Everything I said in my previous post is still valid, I think.

Thanks for the information, I guess I misinterpreted the word “optional” in the specification.

Indeed, a printout from the card i use with drivers 195.17 clearly indicates the extension ‘cl_khr_3d_image_writes’ is not supported. I guess I’ll just use an array of 2D images then…

Thanks again.

Thanks, I just realized that a 9500M does not support the extension. I didn’t think to look into that.

I know the previous post is very old but it seems that even on a new nVidia 660 GTX this particular extension (cl_khr_3d_image_writes) is not supported. It is supported on (some?) AMD hardware.