Repository navigation
fix(shader): handle ordered NaN comparisons - #3541
Conversation
|
I also compiled the existing register-operand comparison shader offline through |
…than On the AMD Windows driver 32.0.13058.8001 (Radeon 860M), a NaN compared less than +infinity, or +infinity greater than a NaN, gives 1 when the infinity reaches the shader as a constant, as in agc_driver_f32_compare_constant's register operand case (boykopovar#3536). The same driver returns 1 for a NaN in an ordered not-equal (boykopovar#825), which is presumably what its compiler turns these compares into. FPOrdLessThan32 and FPOrdGreaterThan32 now AND their result with the integer NaN check FPOrdNotEqual32 already uses, which gives the same result for every input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 1cfbde5)
f106957 to
d668b7c
Compare
|
Cross-GPU verification on Windows (this is the data your container couldn't produce — no Vulkan device there). Setup: Windows 11, WinLibs MinGW-w64 GCC 15.2.0 r7, Release; NVIDIA RTX 5090 and AMD Radeon iGPU; On
With this PR:
So the added Written with AI assistance. |
|
Thanks @MarcZX100. The final tree of this head (
Closing #3595 in favour of this one. |
|
Checked: the change is an AND of the native ordered compare with a bit-level "both operands ordered" check, so results are identical for every input; |
What
Fixes #3536. The AMD Radeon 860M Windows driver returns true for ordered less-than or greater-than when one operand is NaN and the other is
+infinitysupplied as a shader constant. The existingagc_driver_f32_compare_constanttest covers both operations.FPOrdLessThan32andFPOrdGreaterThan32now AND their native ordered comparison with an integer bit check that both operands are ordered. This returns false for every NaN input while preserving results for all ordered values. The same bit check is shared withFPOrdNotEqual32, covering the earlier AMD ordered not-equal issue (#825). This handles bothNaN < +infinityand+infinity > NaNwithout a constant-specific specialization.Tested
agc_driver_f32_compare_constant_tests.Recompileof the existing register-operand comparison shader confirmed the+infinitycomparison path; the integrated checks also cover the symmetric greater-than case.agc_driver_f32_compare_constantwas skipped locally because this container has no Vulkan device. The fix(shader): check NaN on the bits for ordered less-than and greater-than #3595 author reported this test passing 3/3 on AMD Windows with the shared ordered NaN check; issue agc_driver_f32_compare_constant fails on the AMD Windows driver: v_cmp_lt_f32 NaN < +inf from a register gives 1 #3536 records the failing baseline.python3 tools/check_conventions.py --base upstream/mainpassed.git diff --check upstream/main...HEADpassed.Checklist
main; no other open PR implements the same behavior