Recompiler: take a wave64 reduction whose seed selects with the saved EXEC #3803
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3803"
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 ivall/xcl. Originally posted by BBareth on 2026-12-03T17:53:03Z.
graphics_reductionsrebuilds the console compiler's whole-wave reductions in vertex and pixel shaders as wave operations. For wave64 it requires the seedv_cndmaskto select with the saved EXEC narrowed by ans_and_b64. A retail title's lighting pixel shader selects with the saved EXEC itself:That form was left to the step-by-step translation. Lanes of a 32-lane hardware wave that were never launched do not run the seed, and the DPP steps read 0 from them. So in a partly covered wave the minimum light index came out 0: the same failure afpruivo found for the wave32 form with
BOUND_CTRL(https://github.com/xcl-dev/xcl/pull/3089#issuecomment-7363243132). The saved EXEC holds no never-launched lane, so its seed already gives them the identity: the proof the narrowed form makes. This change takes that form too, when nothing between the save and the seed writes the saved pair.What is in it
crates/xcl/src/gpu/recomp/mod.rs:graphics_reductionsaccepts a wave64 seed whose mask is the saved EXEC, unwritten since the save, as well as the narrowed one.crates/xcl/src/gpu/recomp/tests.rs:whole_reductioncan build that form (clobber204) and the same with the saved EXEC overwritten before the seed (205).graphics_whole_reductions_use_wave_opschecks the first becomesxcl_red64_minand the second does not.Tested
cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4on430d5f5b: 3019 passed, 0 failed, 57 ignored. 28 SKIPPED: 22 no wave64, 2 nod3d12SDKLayers.dll, 2 no heap windows, 1 no D3D12 debug layer, 1 driver cache (Developer Mode).cargo test -p xcl --lib graphics_whole_reductions_use_wave_opswith this test andmain'smod.rs: fails (the unnarrowed form is not taken); with this change: passes.main395405e4+ #3094 + #3282 + #3625 + afpruivo'sBOUND_CTRLcommite8b24228, without and with this change): the lighting pixel shader that has this form is now built withxcl_red64_min. The gold speckles it left on a door frame and beside it in the HDR target are gone, apart from a few spots. Presents per minute at 600–1200 s: 82–90 with it, on the same tree without it 93–98 in one run and 84–92 in another with #3089 added, so no cost I can measure. No device removal and no crash.Regression run
main
078358a0:This PR (
430d5f5b):Not tested
v_readlane 32read for real.gpu_wave64_ps_whole_wave_reductionsruns the narrowed form through the same emitter (xcl_red64_*). This change only widens the match.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T17:55:26Z.
Review of
430d5f5b(code reading only, not a merge-check) · no findingsIn short:
graphics_reductionsnow also takes a wave64 whole-wave reduction whose seedv_cndmaskselects with the saved EXEC itself, not only with the saved EXEC narrowed by ans_and_b64, provided nothing overwrites the saved pair before the seed. The proof the narrowed form needs, that no never-launched lane is in the mask, holds just the same for the saved EXEC. The change is small and right, and the tests cover the accepted form and the refused one. Nothing blocks it.Checked and fine
unnarrowedrequiresmask == saved(the seed'sSRC2is thes_or_saveexec_b64destination) and no write to either half of that pair between the save and the seed (overwritesoveropen + 1..i). Never-launched lanes are not in the old EXEC, so their seed is the identity, exactly as withsaved & x.is_some_andclosure, and the two "not overwritten" checks are still on their ranges.v_readlaneof lane 32. A seed that only looks like this still has to pass the whole sequence check.whole_reduction(…, Some(204))builds the seed with the saved EXEC and nos_and, and checks it becomesxcl_red64_min.Some(205)overwrites the saved pair withs_mov_b64 s[30:31], -1before the seed, and is in the refused list. Tested shows the first failing withmain'smod.rs.430d5f5b(3019 passed, 0 failed, 57 ignored, 28 SKIPPED) and a 120 s smoke pair on a retail title (3046 against 3031 frames, less peak commit). A world run shows the lighting shader built withxcl_red64_minand the speckles mostly gone.xcl_red64_*) is already covered bygpu_wave64_ps_whole_wave_reductions.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.