[Mesa-dev] SpvOpSelect w/ float operands
brianp at vmware.com
Tue Nov 17 20:55:57 UTC 2020
On 11/17/2020 11:49 AM, Ian Romanick wrote:
> On 11/17/20 9:25 AM, Brian Paul wrote:
>> Using the Intel Vulkan driver, we've found some cases where SpvOpSelect
>> is returning -0.0 (negative zeros) instead of normal 0.0 depending on
>> the arguments.
> Do you have a specific test case that fails?
Yeah, but as with the NMin/NMax issue it's not a simple test case. It
comes from a Windows WHCK test suite.
> It seems like on some platforms there was an errata about the version of
> the SEL instruction that is used for min or max that can return the
> wrong signed zero in some cases.
> It's also possible that some optimizations are causing problems. I
> don't remember exactly how it works in SPIR-V, but does marking those
> SPIR-V instructions as precise (that's what it was in GLSL) make a
AFAIK, there's only a SPIR-V decoration for tagging things for relaxed
>> I'm wondering if "SpvOpSelect x, a, b" for floats is being implemented
>> with something like "a*x + b*(1-x)" ? That might explain where the
>> negative zeros are coming from.
>> Our work-around is to implement selection with bitwise operations: (a &
>> x) | (b & ~x)
>> It seems to me that SpvOpSelect shouldn't interpret the bits and just
>> return an exact copy of the argument.
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
More information about the mesa-dev