[Mesa-dev] [PATCH 03/13] docs: Initial version of INTEL_shader_atomic_float_minmax spec

Ian Romanick idr at freedesktop.org
Mon Aug 20 18:36:05 UTC 2018

On 08/16/2018 06:02 PM, Caio Marcelo de Oliveira Filho wrote:
> Hello,
>> +    (add a new row after the exiting "atomicMax" table row, p. 179)
>> +
>> +        float atomicMax(inout float mem, float data)
>> +
>> +        Computes a new value by taking the maximum of the value of data and
>> +	the contents of mem.  If one of these is an IEEE signaling NaN (i.e.,
> The two lines above have different indentations, maybe the
> "Computes..." line should be starting with a TAB.

I'll check the indentation.  It should all be spaces, but there may be

>> +Interactions with OpenGL 4.6 and ARB_gl_spirv
>> +
>> +    If OpenGL 4.6 or ARB_gl_spirv is supported, then
>> +    SPV_INTEL_shader_atomic_float_minmax must also be supported.
> Couldn't find the SPIR-V extension, but I guess is work in
> progress.  Is there a Vulkan extension too?

Both are in-progress, yeah.

>> +    * atomicMin and atomicMax implement the IEEE specification with respect to
>> +      NaN.  IEEE considers two different kinds of NaN: signaling NaN and quiet
>> +      NaN.  A quiet NaN has the most significant bit of the mantissa set, and
>> +      a signaling NaN does not.  This concept does not exist in SPIR-V,
>> +      Vulkan, or OpenGL.  Let qNaN denote a quiet NaN and sNaN denote a
>> +      signaling NaN.  atomicMin and atomicMax specifically implement
>> +
>> +      - fmin(qNaN, x) = fmin(x, qNaN) = fmax(qNaN, x) = fmax(x, qNaN) = x
>> +      - fmin(sNaN, x) = fmin(x, sNaN) = fmax(sNaN, x) = fmax(x, sNaN) = sNaN
>> +      - fmin(sNaN, qNaN) = fmin(qNaN, sNaN) = fmax(sNaN, qNaN) =
>> +        fmax(qNaN, sNaN) = sNaN
> For the two items above, is it implicit that the result will be
> quietized?  This matters when using such result with other operation
> with a real value, e.g. is "fmin(fmin(x, sNaN), y)" equals to "y" or
> to "sNaN"?
> The PRM for Skylake says
>     "Max(x, sNaN) = Max(sNaN, x) = qNaN (quietized value corresponding
>     to the input sNaN) and signal the Invalid Operation exception."

That is interesting... the Bspec says something similar, but it has an
extra note that sNaN is not quieted on SKL+.  It /seems/ like this was
intention and won't be changed.  My tests on SKL seem to confirm that,
with respect to fmin and fmax, once you have sNaN, you will always have

> Thanks,
> Caio

More information about the mesa-dev mailing list