cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

abhinav_golas
Journeyman III

Problem using OpenCL Image3D

I'm trying to create and use a 3D image in OpenCL, using the C++ extensions. I have the latest APP SDK, running on a Radeon HD 6870. I use the following command to create an image at the host end:

var = cl::Image3D(context, CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS | CL_MEM_COPY_HOST_PTR, cl::ImageFormat(CL_R, CL_FLOAT), static_cast<size_t>(m), static_cast<size_t>(n), static_cast<size_t>(o), static_cast<size_t>(0u), static_cast<size_t>(0u), (void*)data, &err);

where m=n=o=102. The data pointer is a float* of size m*n*o exactly. However, when at the kernel end, I query the image size using get_image_dim or get_image_{depth,height,width} I get a value of 1 for the depth. I've verified this by looking at the interpolated values returned by read_imagef that it is not accessing all of the data. The image var is passed to the kernel as "read_only image3d_t ...".

I checked that, as expected, the card supports images with a maximum size of 2048 along any dimension.

Can anyone advise on the possible causes and corrections?

0 Likes
3 Replies
abhinav_golas
Journeyman III

I found the source of the error, the cl.hpp file supplied with the SDK. the constructor supplied for cl::Image3D sets the parameter incorrectly, setting the descriptor to CL_MEM_OBJECT_IMAGE2D instead of CL_MEM_OBJECT_IMAGE3D. I've corrected my copy but this bug should be addressed

0 Likes

I've forwarded your message to the right person.

0 Likes

Fixed. It'll be in the next version uploaded to Khronos.org.