image_readf with and without a sampler - what's the behavior for subnormals?
10:02 13 Jan 2026

The OpenCL spec defines several image_read functions - with a suffix for the element data type; with variants for 2D and 3D images; and variants taking a sampler, or not taking one.

The spec says that no-sampler read functions behave just as though you've provided a certain kind of sampler, except for the case of denormal/sub-normal values; to quote from the spec:

The sampler-less image read functions behave exactly as the corresponding built-in image read functions that take integer coordinates and a sampler with filter mode set to CLK_FILTER_NEAREST, normalized coordinates set to CLK_NORMALIZED_COORDS_FALSE and addressing mode to CLK_ADDRESS_NONE. There is one exception when the image_channel_data_type is a floating-point type (such as CL_FLOAT). In this exceptional case, when channel data values are denormalized, the sampler-less image read function may return the denormalized data, while the image read function with a sampler argument may flush the denormalized channel data values to zero.

I don't understand the last sentence. That is, it would make sense to me if it said: "Sampler-less read functions may or may not flush the data, but with-sampler read functions always flush". Saying that both "may" do something means that both may also do the other - so that apparently there is no difference.

So, am I misreading? Is this a glitch in the spec? And what actually happens with denormals in various OpenCL implementations?

image-processing language-lawyer opencl denormal-numbers api-lawyer