fix(shader): quiet signaling NaN cube results in IEEE mode #2043
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2043"
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 CouchRiv on 2026-10-09T05:44:44Z.
What
Part of #981, a follow-up to #1867. In a shader with
IEEE_MODE=1, the cube instructions return a signaling NaN unchanged:With IEEE=1 the hardware quiets a signaling NaN result of
v_cubesc/cubetc/cubema_f32, and keeps the sign the instruction gives it (cubescabove returns-z). With IEEE=0 the bits pass through. This is the rule #1867 measured for the unary instructions.floatCubepicks the NaN operand itself, so these bits never came from the driver: #1867 recordedv_cubemaas "left to the driver", but the code always returned the signaling NaN as it was.floatCubenow passes a NaN result throughquietNan32. IEEE=0, shaders without a known float mode andv_cubeid_f32behave as before. WithDX10_CLAMP=1 a clamped NaN still becomes 0; withDX10_CLAMP=0 it keeps its sign and payload and is quieted only with IEEE=1 (row 2v_cubema_f32 ... clamp:7f800001at IEEE=0,7fc00001at IEEE=1 on gfx1036).Which title needs it
No known title needs it yet. It extends the rule #1867 measured to three more instructions, and it only changes shaders running with IEEE=1, which titles we know do not use (they use 0xc0, IEEE=0).
Tested
CachyOS Linux, GCC 16.2, RTX 4070 Ti (NVIDIA 615.71) and Radeon 610M (RADV, Mesa 26.2.4). Measured on RDNA2 (gfx1036) with the HW oracle.
agc_driver_vop3_cube_clampnow also runs at IEEE=0 and IEEE=1. Its 16 forms × 32 rows were captured on hardware in both modes. The IEEE=0 capture equals the existing table. At IEEE=1, 12 of the 512 cells differ, all signaling NaN results of sc/tc/ma, with and without source modifiers.lane 2 IEEE=1 v_cubema_f32 v13, v4, v5, v6 is 0x7f800001, expected 0x7fc00001.cubesc), 278 (cubetc) and 196 (cubema) rows differed with IEEE=1 before, 0 after, on both drivers.v_cubeid_f32still matches.check_conventions.pyandgit diff --checkpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by popcoder565 on 2026-10-09T15:24:15Z.
Native Windows run, since no Windows results were posted. Setup: Windows 10 (19045), RTX 3060 Laptop (NVIDIA 616.92), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release. Head
f3660a0c, merged ontomaind70b8998in one build with 33 other AGC/shader PRs that had no Windows run.agc_driver_vop3_cube_clamp. None of them reported skipping a case.PATHsetup.No title was run.
🤖 Addressed by Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:11:23Z.
Rebased on current
main(only conflict: theSignaling NaN inputsline in TechnicalDebt.md, now keeps main's text plus the cube sentence). The red linux/windows jobs failed buildingagc_shader_fusion_tests(spirv/unified1/spirv.hppmissing), which this PR doesn't touch.Checked on the rebased head: full build and ctest 633/633;
agc_driver_vop3_cube_clampfails without the change; the HW-oracle rows on RDNA2 (gfx1035) match bit for bit in both IEEE modes. Merging once the rebase is pushed.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:18:31Z.
Rebased on current
main(conflict in theSignaling NaN inputsline of TechnicalDebt.md after #2042's sentence: kept main's text plus the cube sentence). Added one commit: that line still listedv_cubemaamong the instructions whose NaN bits are left to the driver, which this PR makes false; removed it.Checked on the rebased head: scoped build and ctest 324/324 (libSceAgc, libSceAgcDriver);
agc_driver_vop3_cube_clampfails without the change; HW-oracle rows on RDNA2 (gfx1035) match bit for bit in both IEEE modes. Windows run by @popcoder565 passes too. Merging once CI is green.