Recompiler: wave-local remap and null guard cut cold compute PSO compiles #2544
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by brandostrong on 2026-11-25T22:45:55Z.
Cold
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
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T23:06:59Z.
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.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T23:15:38Z.
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.
Imported from ivall/xcl. Originally posted by bielfreedom on 2026-11-26T01:55:15Z.
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.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:58Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:22:36Z.
Triage (#1607) – head
ca6f17bBoth parts of this PR are already on main. The null raw-UAV descriptors and branchless out-of-window load/store guard in
mem_accessorslanded as409cf07(its message says it was adapted from this PR), and the wave-local split-wave64 remap (Em::remap,Options.no_remap,remap_fallbackfor indirect dispatch, the dispatch scaling indispatch_chain) landed as4ec5d49with the same eligibility rules (no LDS, nos_barrier, x or y split).Recommendation: close (superseded by main commits
409cf07and4ec5d49).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:53:42Z.
Closing as superseded: this change is already on
main(409cf071). both halves on main: branchless null-descriptor window guard (409cf071, MEM_NULL_LOAD/STORE) and wave-local remap (4ec5d490, Em::remap with no_remap)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed