fix(shader): flush v_div_fixup_f64 src1 and src2 by the f64 denormal field #7041
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7041"
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 thuanquang on 2026-10-17T07:15:56Z.
What
v_div_fixup_f64ignored theFLOAT_MODEf16/f64 denormal field. On the GPU, f16/f64 denormal mode 0 or 2 (bit 6 clear) flushes src1 (the denominator) and src2 (the numerator) to a zero of the same sign before the fixup, and keeps a denormal src0 and result in every mode, the same splitv_div_fixup_f32has with the f32 field and #7030 measures forv_div_fixup_f16. Sov_div_fixup_f64 0, 2^-1074, 0is the default NaN0xfff8000000000000there wheremaingives+0, andv_div_fixup_f64 0, 0, 2^-1074is the default NaN wheremaingives+inf.vDivFixupF64now flushes src1 and src2 in those modes, before its zero, infinity and exponent-difference checks. Modes 1 and 3, and shaders without a known float mode, are translated as before.The flush is a local lambda: #7036 adds a shared
flushF64Bitshelper, and this PR stays independent of it; whichever lands second can switch to the helper.Measured
The same instruction was run directly on the GPU with the
tools/hw-oracletemplate, launched through the driver's HIP runtime, at IEEE 0 and 1 over the 1728 triples of 12 f64 values (±0, 2^-1074, -0x000fffffffffffff, 0x0008000000000000, 2^-1022, ±1, 0x7fefffffffffffff, +inf, a quiet and a signaling NaN), and compared with the fixup rule applied to unflushed, src1/src2-flushed and all-flushed sources:Against the recompiler: on
main597 of 1584 rows of a second operand set differ in modes 0 and 2 (0 in modes 1 and 3); with this change 0 in every mode, also for-src0, |src1|, -src2over the 1728 triples.Tested
Windows 11 26200, AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.5002, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ANYPS5_REQUIRE_VULKAN=1:agc_driver_div_fixup_f64_denormal_modes: the 1000 triples of 10 of those values in f64 denormal modes 0 to 3 at IEEE 0 and 1 and without a known float mode, against the src1/src2-flushed rule above. Onmainit fails:v_div_fixup_f64 f64 denormal mode 0, IEEE mode on of 0x0000000000000000, 0x0000000000000000, 0x0000000000000001 is 0x7ff0000000000000, expected 0xfff8000000000000. With this change it passes.ctest --parallel 4 --timeout 120onmainf8b22edfbwith this change: 1368 tests, 2 fail, both failing onmainon this GPU too:agc_driver_lds_mixed_width_atomics(#5271) andagc_driver_layered_volume_vertex_no_gpl(#4768).agc_driver_f64_division,agc_driver_f64_division_modifiersandagc_driver_divisionpass.python tools/check_conventions.py --base origin/mainwith this title and body passes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T07:30:33Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/shader.mdL91-92Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
docs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mddocs/dev/debt/shader.mdImported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-17T08:09:03Z.
Another AMD driver, since the description lists other AMD drivers as untested.
Windows 11 (26300), Radeon 860M (RDNA 3.5,
1002:1114), driver 32.0.13058.8001, WinLibs GCC 15.2.0, Release,ANYPS5_REQUIRE_VULKAN=1. Tree:main17cfb1f4cwith #7018, #7034, #7036, #7038, #7040, #7041 and #7042 merged together (onlydocs/dev/debt/shader.mdconflicted, for #7040); "main" is the same tree with the six recompiler files reverted tomainand the tests kept.agc_driver_div_fixup_f64_denormal_modes: fails onmain, passes 3 of 3 with this change.AI-assisted: yes (Claude Code).