Repository navigation
fix(shader): flush v_div_fixup_f32 src1 and src2 denormals - #2045
Merged
Merged
Conversation
With f32 denormals flushed, as in the 0xc0 float mode titles use, the hardware flushes the denominator and numerator of v_div_fixup_f32 but keeps a denormal quotient and result. The recompiler kept all three, so a denormal divisor gave the quotient back instead of an infinity. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
9 tasks done
8 of 9 tasks
Contributor
|
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
No title was run. 🤖 Addressed by Claude Code |
This was referenced Oct 9, 2026
Merged
Collaborator
|
Checked |
SleglJan
pushed a commit
to SleglJan/AnyPS5
that referenced
this pull request
Oct 10, 2026
…-flush fix(shader): flush v_div_fixup_f32 src1 and src2 denormals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(shader): flush v_div_fixup_f32 src1 and src2 denormals
What
Part of #981 (FLOAT_MODE family), a follow-up to #1850. With f32 denormals flushed,
v_div_fixup_f32gave other bits than the hardware whenever its divisor (src1) or dividend (src2) was a denormal:main0,0,0x000000010xffc000000x7f8000000,0x00000001,0x3f8000000x7f8000000x000000000x3f800000,0x00012345,0x800000010xffc000000xbf800000#1850 left the division steps out of its classification, and TechnicalDebt already noted that on hardware
v_div_fixup_f32flushes only src1 and src2. The recompiler read all three sources unchanged.v_div_fixup_f32is now in the "only inputs flushed" group off32DenormalFlushFor, and reads src1 and src2 throughflushF32Denormal. src0 (the quotient) is read as raw bits, so a denormal quotient and the result are kept, as on hardware:(0x80400000, 1.0, 2^-126)still gives0x00400000. With f32 denormals kept nothing changes.Measured on RDNA2 (gfx1036, the same family as the gfx1035 used for #1850) with the HW oracle, all float controls set: 6859 rows (19 values per operand, 5 of them denormals) with f32 denormals flushed and kept, at IEEE=0 and IEEE=1. Flushing src1 and src2 matches every row. Flushing src0 too, or also the result, misses 300 rows in each flushing mode.
Which title needs it
Titles run their shaders with f32 denormals flushed: TechnicalDebt's float mode entry records it for Astro's Playroom's 0xc0, and a shader without a known float mode is translated the same way. This changes the result of
v_div_fixup_f32in that mode, the last step of the precise f32 division sequence (v_div_scale,v_div_fmas,v_div_fixup). No specific title run was done: we have no title copy to run.Tested
CachyOS Linux, GCC 16.2, RTX 4070 Ti (NVIDIA 615.71.09) and Radeon 610M (RADV, Mesa 26.2.4).
agc_driver_f32_denormal_flushgets a 17th result,v_div_fixup_f32 v26, v4, v5, v6, on the test's 32 rows, captured on hardware with f32 denormals flushed. 16 of the 32 lanes differ from the hardware's result with denormals kept. Onmainit fails on both drivers (lane 2 no float mode v_div_fixup_f32 v26, v4, v5, v6 is 0xbf800000, expected a NaN); with the change it passes, in under a second.agc_driver_division(denormals kept) andagc_driver_nan_quieting(0xc0) pass unchanged.main, none now, on NVIDIA and RADV.check_conventions.pyandgit diff --checkpass.Not tested: a title run; f32 denormal modes 1 and 2 still throw, as before.
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)v_mullit_f32flush PR (fix(shader): flush v_mullit_f32 denormals in the float modes that flush them #2046) extends the same test kernel; whichever lands second needs a small rebase.🤖 Generated with Claude Code