Accessors missing interfaces for non-quad-channel image types

#1

Trying to create an accessor for an image with a pixel type anything other than float4, half4, int4 or uint4 fails, because the relevant methods are missing.

Creating textures of such high bitness are hard enough, as it rules out many OpenGL implementations. Many times, (Conways game of life) we only need to store boolean values in textures. Using 128-bits to store a boolean seems luxurious.

Please implement all other accesors for images.

#2

Hi Máté,

If I understand the problem here correctly, you are trying to create the appropriate accessor for an image of lower channel size and channel order such as image_channel_order::r and image_channel_type::int8, where each pixel is a single 8bit element.

In SYCL, like in OpenCL, there is not a one-to-one mapping of an image’s channel order and type to the in-kernel type that represents a pixel. Images are always read as either a cl_float4, cl_half4, cl_int4 or cl_uint4, so these are the only valid data types for an image accessor. The image data in memory will be interpreted in the image’s channel order and type, but pixels are always read from or written to as a 4-dimensional vector.

So in the case where you have an image with image_channel_order::r and image_channel_type::int8, you would use the data type cl_int4, which would map to {r, 0.0, 0.0, 1.0}. The OpenCL 1.2 specification describes the mapping of the different channel orders and types in more detail in section 6.12.14.6.

I hope this helps.

Gordon

1 Like
Error compiling kernel containing image accessor
#3

Thank you Gordon for the guidance. There were a few things to clean up, but everything’s working now and it’s become a clean and nice sample code. Should you want to take a peek at the final version, it can be found here.

Getting all of this to work was good experience and definitely fuels my motivation for cleaning up graphics-compute interop once and for all. :slight_smile:

#4

Hi Máté,

No problem, I’m glad you managed to get everything working now.

Thanks,

Gordon