recomp: enable whole-wave branches and dead-SCC elision in split wave64 #2203
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!2203
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2203/head"
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?
@zondy1i on GitHub · 2026-11-25 09:32 UTC · original
zondy1i:recomp/per-lane-split-wave-branches→main· +174 −6 · 3 files · 1 commits · merged 2026-11-25 10:38 UTCWhat is in it
wave_branches) in theXCL_PER_LANE=1split-wave64 compute form when the console wave's partner half is present or spin-synced (Partner::Present | Partner::SpinviaIr::can_wave_branch()).self.tails[self.cur] = self.lw.cur()after split-wave64ballotandread_laneexchanges inDxilIrso successor PHI incoming blocks track the post-exchange join block underPartner::Spin(same 2-line fix as #1928, needed here for multi-wave threadgroups to pass DXIL validation).compute_scc_liveness) overSummary::blocksand routes mask-op SCC writes (saveexec, bitwise mask ops, 64-bit mask compares,S_WQM) throughmask_nonzero_sccso dead SCC writes skip emitting whole-wave ballots (and split-wave64 exchange barriers).lower_dxil.rs:split_wave64_wave_branches_on_the_gpu(all 8wave_branch_caseson both[64, 1, 1]/Partner::Presentand[128, 1, 1]/Partner::Spin, validated withdxil.dlland checked for 128-thread GPU parity againstdxil::kernel::translate_compute) andsplit_wave64_dead_scc_skips_exchange_barrier(verifying barrier elimination and GPU output).Impact on a 2,000-program sample (
--direct --lanes --split 1 --sample 2000 --max-bytes 0, 205 compute programs):26 / 205to39 / 205(+50%), matching native wave64 (--split 0:39 / 205)."a branch on whether any lane of a"drop from35to2(the remaining 2 have partial threadgroup sizes wherethreads % 64 != 0, matching native wave64).dxil.dll 1.9validation in debug builds (0validator errors,0panics).50625695d2e6cbe7,206ed63b96be21a1,a9f2cd53943d5dc4), the whole-wave branch refusal is cleared (remaining refusals are downstreamIMAGE_SAMPLE_LZ/IMAGE_LOAD).Tested
rustc 1.100.0, DXC /dxil.dll1.9.2602.17, debug & release builds.cargo test --workspace -- --test-threads=4: 1156 passed, 0 failed, 46 ignored (SKIPPED GPU tests: 20 native wave64 tests on 32-lane NVIDIA GPU, 3 pre-existing f16/f32-to-f16 per-lane refusals, 1 driver-cache test without Windows Developer Mode, 1 heap-window test).cargo test -p xcl --lib gpu::recomp::lower: 55 passed, 0 failed (including both new split-wave64 GPU/validator tests).cargo test -p xcl --lib gpu::recomp::lane_masks: 13 passed, 0 failed.xcl shaders <pack> --direct --lanes --split 1 --sample 2000 --max-bytes 16384(debug build, validating every per-lane output viadxil.dll): 39/39 per-lane split-wave64 compute shaders validated with 0 errors.xcl shaders <pack> --direct --lanes --split 1 --sample 2000 --max-bytes 0vs--split 0(release build): 39/205 vs 39/205 compute programs, 0 validator errors, 0 panics.Regression run
Baseline (
main568e7db):PR (
283068c, run withXCL_PER_LANE=1):Not tested
AI use
Ir::can_wave_branch,compute_scc_liveness, thelower_dxil.rstail updates and unit/GPU tests, and running the validation@Kalmarv on GitHub · 2026-11-25 09:35 UTC · original
Heads-up from #1912, which changes the same call.
git merge-treeof this head against #1912'sc4f00e5conflicts inlower.rsatwave_branches/analyze_branches. This PR replaces the!ir.whole_needs_exchange()condition withir.can_wave_branch()and addscompute_scc_liveness. #1912 adds a fifth argument toanalyze_branches(!graphics, for its proven-empty loop exits). The resolution keeps both:&& ir.can_wave_branch()andanalyze_branches(insts, wave64, launch, wave_branches, !graphics). Whichever lands second needs that one-hunk rebase.AI use: Claude Code (Claude Opus 5.5) ran the merge check and wrote this note.
@DarkPanda69 on GitHub · 2026-11-25 10:07 UTC · original
AMD running the split wave64 form ("AMD split-wave64 drivers" is listed as untested), paired against
main.On the RX 9070 XT,
XCL_SPLIT_WAVE64=1makes xcl use the split form instead of native wave64, so the change runs on an AMD driver. Head283068capplied onmain568e7db, debug, Windows 11 Pro 26200, RX 9070 XT (RDNA4, driver 32.0.32029.2010),XCL_SPLIT_WAVE64=1 cargo test -p xcl --lib -- gpu:: --test-threads=4:mainsplit_wave64_wave_branches_on_the_gpuandsplit_wave64_dead_scc_skips_exchange_barrier.main.Not tested: native wave64 with this PR (I only ran the forced split form here), Intel, a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@iGoldenNinja on GitHub · 2026-11-25 09:55 UTC · original · edited 2026-11-25 10:33 UTC
Independent RTX 5080 16 GB check on Windows 11 Pro 25H2 (26200.9974), driver 617.14, Rust 1.98.1 and DXC/DXIL 1.9.2609.5. Both new tests passed on clean
283068c8d7bc78aec3d6481c90613701a8d9df1ausingXCL_ADAPTER=5080andXCL_REQUIRE_GPU=wave64, with no skips. That covers all eight branch cases at 64 and 128 threads, direct-translator output parity for the 128-thread tests, and correct split-half readback for both SCC cases.On direct parent
568e7db7729c8fa6c8f0f4b32d798faaf11462bbwith only those two test functions copied, the first 64-thread branch and the live mask-SCC fixture both failed during lowering. Last verified stage on the PR was synthetic D3D12 dispatch and readback. Pinned test reportOffline follow-up on the same RTX 5080 and revisions. The uncapped seeded sweep reproduced 26/205 → 39/205 per-lane compute programs and 35 → 2 whole-wave branch refusals. A separate 16 KiB-capped probe validated all 39 PR outputs, retained all 26 parent successes and created a D3D12 compute pipeline for each of the 13 newly emitted Wave64 programs on the RTX 5080.
On seven separately matched compute programs previously investigated in the NVIDIA fork, the PR cleared the branch refusal in six. The per-lane path still emitted 0/7 due to SDWA half conversion, LDS or buffer atomics, and one unchanged
IMAGE_STORErefusal. The per-instruction backend validated and created 7/7 compute pipelines on both XCL revisions. The last verified stage for these inputs was offline pipeline creation. Matched-input report@tiagonleal on GitHub · 2026-11-25 11:56 UTC · original
Test report on
XCL_PER_LANE=1after #2203: process memory jumps from ~8 GB to ~19 GB working set, one giant compute program is the likely cause.Setup: unmodified
mainat5478c4a7c1ae5adba127c8d27018d7fdbf3a8725(release build), Windows 11 Pro 10.0.26300, RTX 5070 Ti 16 GB (driver 32.0.16.1742), Ryzen 7 9800X3D, 32 GB RAM, 64 GB page file. Env:XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_PROFILE=1, A pressed at 30 s, 300 s planned; compute blobs precompiled for the used set (the per-lane runs were made with that same cache, built withoutXCL_PER_LANE).Fact (n = 2 with
XCL_PER_LANE=1, n = 2 without as control): in the title's menus, withXCL_PER_LANE=1, the working set sat at 8.2-8.7 GB and then rose by about 2 GB every 2 s: 8.3 -> 19.6 GB in 8 s (second run, at ~129 s of the run), 8.7 -> 18.9 GB in 10 s (first run, at ~164 s). Process commit went from 38 to 53-55 GB system-wide; my guard killed both at free RAM < 1 GB (0.77 GB and 0.06 GB). The two runs withoutXCL_PER_LANEstayed flat (working set 7.3-7.7 GB, commit 17.5 GB) for the full 300 s.What the logs show: the growth is process-private memory in many 8-32 MB regions (about 50 per second); image, mapped files, the heaps and the sparse windows do not change, and video memory stays at 6.5 GB local. In the 30 s before the jump only graphics pipelines compile (1.8-3.3 s each), as in the control runs. The one difference in compile activity is the compute program
56c0cd3b82a00c6e: with per-lane it is 4 273 472 B of DXIL with no blob, and its driver compile started (at 4.8 s and at 41.5 s) and never finished in either run; without per-lane it is 455 056 B and comes from the blob at once. On the CPU (shaders <pack> --direct --hash 56c0cd3b82a00c6e --lanes --windows 260),5478c4a7accepts it in per-lane form (9.4x the split form's DXIL), while a build before #2203 refuses it ("a branch on whether any lane of a mask is set"). So #2203 seems to be what lets it in. I have not proven the program is the cause: the ramp starts 125-165 s after its compile starts, and I have no run with it excluded. The delay does match what I measured this morning for the same program's 4.32 MB switch form compiled alone outside the title on an oldermain(flat for 170 s, then +18 GiB in 18 s, never finished; in my comment on #2088).Not identified: which allocation exactly (driver or process); the other four programs I checked (50625695d2e6cbe7, 206ed63b96be21a1, a9f2cd53943d5dc4, 4097cf4856634349) are still refused for IMAGE_SAMPLE_LZ / IMAGE_LOAD.
Not tested: the commit before #2203 with per-lane in the game, runs in the world, AMD, a per-lane precompiled cache. One thing that could be tried is a size cap on the per-lane form (fall back to the split form above some DXIL size); I have not tried it.
Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).