perf(shader): skip the f32 flush after results that cannot be denormal #8958
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8958"
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 xXPBSXx on 2026-10-21T07:15:04Z.
What
Carries #4278 (@Friesmaniac) onto current
main, as the maintainers asked on that PR (rebase onto currentmain;mainalready skips the flush for floor/ceil/min/max/med, the sign-bit masks and phis). It keeps only whatmaindoes not cover yet: the flush afterFPTrunc32,FPRoundEven32,FPSqrtandFPRecipSqrt32(their results cannot be denormal) and after aBitwiseOr32with an exponent bit set.FPFract32andFPRecip32keep their flush, and the tests say so. Based on the head of #4278; the original author is kept.The change claims no speed difference; no performance numbers were measured.
Tested
Windows 10 19045, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON, onmain7ce3b1df3eplus this commit:ctest -R '^agc_denormal_flush_elimination$'passes 3 of 3.core/shader/recompiler/Optimization/src/DenormalFlushEliminator.cpprestored tomain(the new test cases kept), the same test fails 3 of 3.-R 'denormal|_f32', 35 tests, missing executables built first) passes 35 of 35.python tools/check_conventions.py --base upstream/mainpasses;git merge-treeagainstmainis clean.Checklist
main; no other open PR implements the same functions (the original #4278 is the same change; this PR replaces it if the author does not update it).mdfiles or images added to the repositoryctest -Vprints no GPU selection)AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T07:35:08Z.
The code/test change looks narrowly scoped, and the reported Windows regression and negative-control runs are useful. One overlap question before I approve: #4278 is still open and changes the same two files for the same denormal-flush elimination. This PR says it carries that work onto current
main; could you mark #4278 superseded (or clarify the intended merge order) so maintainers do not merge both copies?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T07:35:09Z.
Review: COMMENTED
Reviewed the optimization logic and tests. The newly recognized outputs are not subnormal after the backend flushes inputs for sqrt/rsqrt, and the bitwise cases preserve a nonzero exponent as asserted. I am holding approval pending clarification of the still-open overlapping #4278.
Imported from boykopovar/AnyPS5. Originally posted by imellag on 2026-10-28T18:45:03Z.
Review: APPROVED
macOS / MoltenVK data point. Apple M4 Pro, macOS 27.2, MoltenVK 1.4.2, x86_64 Release under Rosetta.
maindoesn't run titles on macOS yet, so the base is a support branch, notmain:main750cf6cf48+ only the macOS boot PRs #7631 #10552 #11249 #11447 #11554 #10669 #7804, + #12529 (the revert of #10337, which roughly doubles the GPU time on this GPU and would hide smaller changes). Change: that base + eight open shader performance PRs merged together (#12287 #11952 #12299 #12280 #11368 #11265 #8716 #8958, all clean merges). I did not measure each PR alone.Two alternated runs per side, warm shader cache,
APS5_TRACE_SUMMARY_EVERY=10:Together they don't raise the GPU time on MoltenVK. I'm checking open shader performance PRs on this GPU because #10337 was measured on RADV and doubled it here.
Focused tests below ran with
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationon the same two trees; the layer was found and both logs have the sameVUID-lines (12VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605, 20VUID-vkCreateDescriptorSetLayout-support-09582, from tests that fail the same way on the base).This PR on MoltenVK:
agc_denormal_flush_eliminationpasses with the change, and the group above shows no GPU cost. Each newly skipped flush follows a result that can't be denormal (rounded to integral, square root and reciprocal square root of flushed inputs, an OR with an exponent bit set), and the tests keep the flush afterFPFract32andFPRecip32. Approving from the macOS side.AI-assisted: yes (Claude Code ran the builds, runs and tests and drafted this review)