recompiler: NVIDIA's shader compiler crashes (SIGILL) on an always-true unordered f32 compare against an infinity; agc_driver_f32_compare_constant fails on main #3355
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T08:39:57Z.
On
main7b5214d4agc_driver_f32_compare_constantdies with SIGILL on Linux with an RTX 5080 (NVIDIA 615.78.08), 4 of 4 runs, and passes on RADV (Radeon 610M). Theud2is in the driver's shader compiler (libnvidia-gpucomp.so, called fromvkCreateComputePipelinesinVulkanDevice::dispatch).The fold in #2408 is not the cause, the test is just the first to compare against +inf with
ngt/nlt. WithCompareInstructions.cppput back to42692dee^ the test still crashes, and it passes on NVIDIA once the0x7f800000constant is masked out. Of the 24 compares against +inf exactly two crash, each alone in a shader:v_cmp_ngt_f32 x, +infandv_cmp_nlt_f32 +inf, x, which becomeOpFUnordLessThanEqual %bool %x %float_0x1p_128.A hand-written compute module with only
OpCapability Shaderand no float-controls mode (load a uint,OpBitcastto float, the compare,OpSelect, store) reproduces it.spirv-val --target-env vulkan1.3accepts every variant.OpFUnordLessThanEqual x, +infOpFUnordGreaterThanEqual x, -infOpFUnordGreaterThanEqual +inf, xOpFUnordLessThanEqual -inf, xOpFOrdLessThanEqual x, +infOpFUnordLessThan x, +infOpFUnordLessThanEqual x, FLT_MAXOpFUnordLessThanEqual x, -infSo the driver crashes on an unordered
<=/>=against an infinity that is true for every input, and any guest shader with that compare would take the process down at pipeline creation on this driver. Not run for this table: other driver versions, Windows, f64, vector operands. Later runs: an f16 compare against half infinity and an f32 compare against an infinity computed in the shader (FLT_MAX + FLT_MAX) crash the same way, so replacing only immediate infinities is not enough.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:55:20Z.
Fixed in part by #3441: the four always-true unordered f32 compares against an immediate infinity are folded to true, covered by
vector_compare_const; computed-infinity and f16 cases are still open.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-11T15:36:12Z.
The two remaining cases pass on
maina11c8f7f. #3357 changed the emitter for the unordered relations to the negated ordered form, so the f16 and computed-infinity compares no longer reach the driver asOpFUnordLessThanEqual/OpFUnordGreaterThanEqual.Checked on the RTX 5080 with 615.78.08: a test with a half-float infinity and with
FLT_MAX + FLT_MAX(https://github.com/fma-rc/AnyPS5/blob/test/float-compare-infinity/core/libs/prx/libSceAgcDriver/tests/execution/FloatCompareInfinity.cpp) passes on that commit, and so doesagc_driver_f32_compare_constant. With the two emitters put back to the unordered opcodes both die with SIGILL again. Closing.