write_imagef and image1d


So far, I was using an image2d to store a 1D look-up table. I’ve logically decided to put it into an image1d. However, my kernel cannot be build (CL_BUILD_PROGRAM_FAILURE). The following code works for an image2d :

write_imagef(myImage, (int2)(col,0), (float4)(value));

And this one, which is essentially the same, doesn’t work for an image1d :

write_imagef(myImage, col, (float4)(value));

In the first case (1D), myImage was defined as “__write_only image2d_t myImage” and in the second one (2D) “__write_only image1d_t myImage”.

Any help?


I don’t know why it isn’t working, but when you get build failures you should definitely look at the build log to see what the compiler is telling you. There are also command-line tools for this (e.g. onlineclc, clcc) which I often find to be more convenient.

image1d is an OpenCL 1.2 feature. Are you sure your device supports OpenCL 1.2?