Recompiler: wave-local remap and null guard cut cold compute PSO compiles #2554
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2554
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2554"
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?
@brandostrong on GitHub · 2026-11-25 22:45 UTC · original
brandostrong:wave-local-remap→main· +380 −48 · 10 files · 1 commits · openCold
CreateComputePipelineStatefor a large split-wave64 compute program (a 1.5 MB cascade-shadowresolve) was 38.3 s on an RTX 4090. Driver time tracks control-flow complexity, not bytes. Two
XCL-generated constructs dominate it: the wave64 exchange's spin loop (~16 s, its mere presence)
and the per-accessor out-of-window guard branch (~6 s, duplicated at every heap access). This PR
removes both, losslessly, for the programs where they are not needed.
What is in it
Memory: null descriptors for out-of-window heap accesses—console_heap.rsadds two nullraw UAVs just past the window slots (
MEM_NULL_LOADreads 0,MEM_NULL_STOREdiscards writes);general allocation starts after them. No behaviour change until the emit path uses them.
Recompiler: branchless window guard via null descriptors—emit.rsmem_accessorsredirectsout-of-window load/store to the null descriptors with a
select(no divergent branch);interlocked accessors keep the guard (they must return 0 and not modify). Differential test:
out-of-window load/store/interlocked semantics unchanged.
Recompiler: wave-local compute runs one console wave per group— a split-wave64 compute programthat shares nothing across its console waves (no LDS, no
s_barrier) gets one console wave perhardware group, so the exchange's two halves are the whole group and meet with a group barrier
instead of the spin loop. The console view is preserved (group id = hw id / ratio, thread id
adds the wave offset);
dispatch_ratio/dispatch_dimtell the runtime to launchratiohardware groups per console group along
dim, applied atdispatch_chain::dispatch. Indirectdispatch (
ExecuteIndirect) reads group counts from the title's buffer on the GPU, so the CPU ratiocannot scale them: a lazily-built non-remapped fallback PSO (
remap_fallbackinreal.rs, swappedin at
bind.rs) is bound instead for a remapped pipeline, driven byOptions.no_remap.forget_psonow clears the per-PSO dispatch ratio, so a reused PSO address no longer inherits a stale one.
Differential test: a wave-local compute program gives identical output remapped; a non-wave-local one
is unchanged.
Tested
rustc 1.100.0, release
cargo test --workspace --release -- --test-threads=4: 1220 passed, 1 failed, 26 ignored (the 26are wave64 GPU tests that skip on this 32-lane NVIDIA adapter; the 1 failure is the same
pre-existing
lower_dxiltest below)cargo test -p xcl --lib --release recomp: 373 passed, 1 failed, 19 ignored — the 1 failure islower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, pre-existingon this NVIDIA adapter (present on clean
main68a284a; CI has no GPU), not from this changexcl shaders shaders.rpf --measure-pso 062468c09af883b9 --windows 4withXCL_HEAP_WINDOWS=1: median 12.33 s / 13.79 s over two runs (was 38.3 s), DXIL 1.50 MB → 1.08 MB--measure-pso(repeat 1, same run window, uncontended), the 4 largest computerecords: cascade-shadow
73fb752d7f62c3a517.9 s vs 53.1 s (−66 %),062468c09af883b919.4 s vs42.5 s (−54 %); irradiance
517e7bab67ece93f21.9 s vs 23.4 s (−6 %),193d9a08bf6784bd20.2 s vs21.1 s (−4 %). The win is concentrated on the wave64-spin cascade class; the irradiance records are
not spin-dominated. Single cold samples are load-sensitive (the target's repeat-3 median above is 12.33 s)
Regression run
scripts/smoke.ps1on a retail title was not executed for this PR (see Not tested).Help wanted: a
scripts/smoke.ps1 -Game <title>run onmainand on this head from anyone with aretail title (wave64 or wave32 adapter) would close the regression gap — post the two
xcl-smokeblocks to #42.
Not tested
driver-general by construction, but not measured on AMD)
test (no title in the suite indirect-dispatches a wave-local remapped program); the fallback's
translation is covered by the
no_remapunit testXCL_DIRECT_DXIL=1) — remap is in the HLSL path onlyscripts/smoke.ps1not run); the change is validated by therecomp GPU suite and the head-vs-main compile benchmark above
AI use
@DavidM1911 on GitHub · 2026-11-25 23:06 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main(crates/xcl/src/gpu/recomp/pso.rs) — needs a rebase before it can be tested.@DarkPanda69 on GitHub · 2026-11-25 23:15 UTC · original
AMD run (listed as untested) on an RX 9070 XT, plus an RTX 3060: no failure from this PR in the GPU suite. I did not measure cold PSO compile times, which is what the "not measured on AMD" line is about.
Head
ca6f17btested as is (on its base68a284a), because it no longer applies on currentmain08db802:emit.rsandpso.rsconflict. Debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- gpu:: --test-threads=4, card chosen withXCL_ADAPTER:The remaining failure on both cards is
gpu::recomp::lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier(group barriers in the program: left 3, right 1). It fails the same way on the base68a284awithout this PR, on both cards, and it passes on currentmain. So it comes from the old base, and a rebase should clear it.Not tested: cold
--measure-psotimings on AMD (no retail pack used here), Intel, a title.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@bielfreedom on GitHub · 2026-11-26 01:55 UTC · original
AMD Windows, for the "not measured on AMD" line: on an RX 9070 XT (native wave64) this PR does not change the DXIL of any of the 2,689 retail compute programs, with switch or heap windows. So there is no AMD driver time to measure; the gain is on the split-wave64 path, which GPUs with 64-lane waves do not take.
Setup
ca6f17band its base68a284a, each with a local patch inxcl shadersthat writes every program's DXIL size and hash to a file.xcl shaders <retail shaders.rpf> --precompile --only cswithXCL_DIRECT_DXIL=1, a fresh translation cache per run.68a284aXCL_HEAP_WINDOWS=1)I did not run the GPU suite (DarkPanda69 did, above) or a title.
AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it.
github-bot referenced this pull request2026-11-26 12:40:17 +00:00
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.