Recompiler: split direct compute programs that use global atomic adds #2123
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!2123
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2123"
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?
@Kalmarv on GitHub · 2026-11-25 05:23 UTC · original
Kalmarv:direct-split-atomic-add→main· +101 −1 · 2 files · 1 commits · openPart of #1269. #2080, the split this builds on, is merged; this PR is one commit on
mainafc5ee8,655885e. It was7f4b22dand before thatbad5f04, stacked on #2080.#2080 splits a program with atomics only when they are 32-bit AND or OR whose old value is unused (the sub-dword stores). It declines every other atomic. For a global (UAV) 32-bit add that is safe to cut around. The add still runs exactly once per lane, in the piece where it stands. The UAV barrier between dispatches orders it before every later piece. Its old value is a live value like any other. The title's meshlet-cull program 1ada490879c33c0e (48,191 DXIL instructions; two guest add sites, which become eight DXIL atomic adds across its heap windows) was declined for this alone. With this change it splits into 4 pieces and builds cold in 0.86 s instead of 1.93 s.
What is in it
crates/xcl/src/gpu/dxil/module/split.rs:dx.op.atomicBinOp.i32with ADD is now admitted. Each add stays at its original site and runs once whenever control reaches it, as before. Its old value goes to later pieces in an existing continuation slot when it is live there. The rule against polling is conservative. If a program has an add and any loop (including a self-loop) contains an atomic or a raw-buffer, typed-buffer or texture load, it keeps the whole pipeline, because such a loop could poll memory the add changes. It doesn't try to prove that the load aliases the add or decides the loop's exit.Tested
Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 build 26200, release, DXC 1.9.2609.
Cold pipeline build of 1ada490879c33c0e as the title emits it (the whole binary is byte-identical to the title's cache, and so are its samplers), fresh process, implicit caches off, split pieces on 16 threads:
2.2× faster. All 4 pieces pass the DXC 1.9 validator, and the chain uses 7,488 scratch dwords per group.
cargo test --release --offline --workspace -- --test-threads=4one3c50c1, the same change before #2080's README-only rebase ontomainf5c5bdf: 1160 passed, 0 failed, 46 ignored, with 25 skip notices across 15 tests (no native wave64, unsupported per-lane forms, no heap windows). All fivedispatch_chainGPU tests ran. Four passed with their output read back: the newdispatch_chain_carries_uav_add_result_to_later_load, pluswave32_live_loops,divergent_forward_edges_3dandwave64_live_loops_and_exchange.native_wave64_builds_wholeskipped its GPU part as expected on this card. The CPU refusal test passed. Onbad5f04the sixdispatch_chaintests pass again.AMD Radeon (native wave64) and RTX 5090, measured by @nnonno91 (comment) on
bad5f04with DXC 1.8.2502: the sixdispatch_chaintests pass on both. On the Radeon none skip, and the native-wave64 test checks its GPU output. On both GPUs the new atomic-add test matches all 64 expected words for the whole shader and the split chain.AMD RDNA4, measured by @bielfreedom (comment), RX 9070 XT, on
bad5f04: on that adapter this change splits only 2 more of the title's 2,689 compute programs (462 → 464), both about 125 KB in 2 pieces, 2.7 → 2.1 s for the pair. 1ada490879c33c0e is not among them there; why hasn't been checked. Thedispatch_chainandsplit::teststests pass, 6 of 6, with no skips.AMD Radeon RX 9070, regression pair by @Toons29 (comment), Ryzen 7 7800X3D, on
d43468f(this branch before the latest rebase), 60 s of a title on the default route:main568e7db1566 frames and this PR 1635, peak commit 14592 / 14592 MB, no crash or device removal in either.cargo test --workspace -- --test-threads=4(debug) on655885e: 1265 passed, 0 failed, 46 ignored. 25 SKIPPED notices: no native wave64 on this card, three per-lane FP16 forms the per-lane lowering refuses, and no heap windows. The split tests alone with the DXC 1.9 validator: 33 passed, 0 failed, 1 ignored, no skips.RTX 3080 Ti, checked by @thehollowedone (comment) on
655885e, DXC 1.8: 1,265 passed, 0 failed, 46 ignored. Two extra controls of theirs pass with no skips: a contended 32-lane UAV add reaches 225 with all 32 expected old values in both forms, and a loop with a UAV read keeps the whole pipeline.AMD RDNA4 on Linux, tested by @ClosetPie107 (comment), RX 9070 (RADV, native wave64) under Proton Experimental with vkd3d-proton,
655885emerged ontomainb49be18:gpu::dxil::module::split::10 passed, 0 failed, 0 ignored, no skips, so the GPU dispatch-chain tests, the new atomic-add one included, ran on that card. A 300 s retail run ofmainb49be18with 7 PRs stacked (this one and #1540, #1675, #1844, #1899, #2369, #2422): exit 0, 0 crashes, 0 device removals, 2,014 presents, 44,546 chained split-compute dispatches across 245 split programs. That run is of the whole stack, not of this PR alone.Regression run
The branch was rebased onto
mainafc5ee8, which has #2080, #2107 and #2126. The conflicts were insplit.rsand the README, both with #2107. The planner now checks this PR's polling rule first, then #2107's four-times ceiling. Both PRs' tests are kept.scripts/smoke.ps1 -Seconds 120, the same retail title, one after the other on the machine under Tested, release builds from clean trees.mainafc5ee8(this PR's base):this PR,
655885e:PR vs
main: 1320 / 1287 frames (103 %), peak commit 29075 / 28897 MB (101 %); device removals 0 and crashes 0 on the PR run, 0 and 0 onmain.Both runs use
XCL_DIRECT_DXIL=1and start with the same private XCL pipeline cache, holding only the pipeline list; the driver's own cache was left alone.mainnow splits too, and loggedcompute split: 8 programs split, 42 pieces built, 52 chained dispatches issuedat 120 s. This PR logged24 programs split, 103 pieces built, 70 chained dispatches issued(0 chains by 60 s, 68 by 70 s), and neither run logged apiece ... refusedwarning. How far the title gets before it stops varies between runs, so the difference in split programs isn't all this change. Both runs present no frames in their last 6 s, for a reason this change doesn't touch. The log doesn't say whether 1ada490879c33c0e was among the split programs, so this run checks for regressions but doesn't show the build gain.Not tested
AI use
OpenAI Codex (GPT-6) wrote the change and the tests. Claude Code (Claude Opus 5.5) helpers ran the driver timings, and Claude Code wrote this description and opened the PR.
🤖 Generated with Claude Code
@nnonno91 on GitHub · 2026-11-25 06:01 UTC · original
Independent Radeon and RTX 5090 verification of exact PR head
bad5f04f2a5291c2c911cbd3368e13db204094ee.Tested
cargo test --locked -p xcl --lib dispatch_chain -- --nocapture --test-threads=1in separate processes withXCL_ADAPTER=AMD RadeonandXCL_ADAPTER=NVIDIA GeForce RTX 5090. The dispatch-chain test log confirmed both adapter selections.XCL_REQUIRE_GPU=wave64): 6 passed, 0 failed, 0 ignored and no skips. The native-wave64 test kept its shader whole and checked its GPU output.dispatch_chain_native_wave64_builds_wholeskipped GPU execution withno wave64.Not tested
Retail inputs, title smoke, compile-time or GPU timing, and the full workspace suite in this run.
AI use
OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the logs and wrote this report.
@DavidM1911 on GitHub · 2026-11-25 06:17 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@bielfreedom on GitHub · 2026-11-25 06:55 UTC · original
AMD RDNA4 data for #2123. On the RX 9070 XT this change splits 2 more retail compute programs (462 → 464 of 2,689). Both are about 125 KB of direct DXIL, in 2 pieces each, and build 1.3× faster split (2.7 s → 2.1 s for the pair). The PR's tests pass on this card.
Setup
bad5f04(on #2080), plus the local timing patch from my #2080 report. It builds the whole DXIL, then the pieces in parallel, and times everyCreateComputePipelineState.Method
XCL_DIRECT_DXIL=1, default split target,XCL_PSO_DISK_CACHE=0.Results (mean of 2 rounds)
Tests on this card (
XCL_REQUIRE_GPU=1,XCL_ADAPTER=9070)cargo test --release -p xcl --lib -- dispatch_chain split::tests --test-threads=1: 6 passed, 0 failed, no SKIPPED notices.dispatch_chain_carries_uav_add_result_to_later_loadanddispatch_chain_declines_uav_add_with_a_polling_loop.Not tested
AI use: Claude Code (Claude Opus 5.5) ran the census, timings and tests and drafted this. Counts and timings only, no game data.
@JJAutoCompare on GitHub · 2026-11-25 07:12 UTC · original
Tested
bad5f04f2a5291c2c911cbd3368e13db204094eeon Intel Arc A770 (driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 25H2 (26200.9974). Rust/Cargo 1.100.0 x64 MSVC and DXC/DXIL 1.9.2609.5. Unoptimized test build, debuginfo and incremental compilation disabled.cargo test --locked -p xcl --lib -j 2 --no-run --message-format=json. WithXCL_ADAPTER=A770, ran the Cargo-reported test executable under the Arc mutex using& $fixtureExe --exact gpu::dxil::module::split::tests::dispatch_chain_carries_uav_add_result_to_later_load --nocapture --test-threads=1. Its SHA-256 matched before and after lock acquisition and after exit.Not tested
Polling-loop refusal, other GPUs or wave modes, workspace suite, retail inputs, title smoke, and performance.
AI use
T3 Code / Codex (gpt-6.2-sol) ran the fixture, verified the logs, and wrote this report.
@Toons29 on GitHub · 2026-11-25 11:19 UTC · original
Regression run of
d43468f3on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon568e7db7, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 104 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@thehollowedone on GitHub · 2026-11-25 13:13 UTC · original · edited 2026-11-25 15:27 UTC
Independent RTX 3080 Ti recheck of the clean 655885e rebase onto afc5ee8. Windows 11 build 26300, NVIDIA 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC and DXC 1.8.2502.11.
cargo build --offline --locked --workspace -j 6passed.cargo test --offline --locked --workspace -j 6 --no-fail-fast -- --test-threads=4 --nocapturefinished with 1,265 passed, 0 failed, 46 ignored. The pass count includes 26 runtime skips. Both stock atomic split tests passed.cargo test --offline --locked -p xcl --lib -j 6 local_split_add -- --test-threads=1 --nocapture.I also merged this head locally onto 0829441, which includes the new dispatch scratch sizing. The workspace built and reported 1,274 passed, 0 failed and 46 ignored, including 26 runtime skips. The dispatch-chain filter reported 11 passes including one native-wave64 skip. The atomic-add GPU readback and polling-loop guard both passed.
A separate test-only check called the runtime allocator on the RTX 3080 Ti. With an 8 MiB total target, three live allocations used 6, 2 and 2 MiB. The first recording reused its buffer, and after release the next recording got 4 MiB. Live scratch returned to zero once the test released all buffers. The 10 MiB peak includes the intentional 2 MiB minimum for a new recording. This was a serial allocation check, separate from the dispatch readback.
Synthetic tests only. No retail smoke or pipeline timing on this revision.
AI-assisted. Codex (GPT-6, exact variant unavailable) reran the tests and drafted this report.
@oni-swr on GitHub · 2026-11-25 21:39 UTC · original
AMD RDNA3 on native Windows: full suite of
655885emerged ontomain6d12f58Test report for head
655885ec578a156bef587002e23f439722bf897f. The PR's base is older thanmain, so I tested the PR head merged ontomain6d12f58a(a local merge commit, no conflicts; the diff againstmainis only this PR's two files) and compared it withmainitself.Tested
cargo test --workspace --no-fail-fast -j 4 -- --test-threads=4, both trees in the same target dir, one after the other; the log showsCompiling xclfrom the tested worktree.main6d12f58a: 1422 passed, 1 failed, 46 ignored.main: 1424 passed, 1 failed, 46 ignored. The 2 extra passes are this PR's new tests.gpu::dxil::module::split::tests::dispatch_chain_carries_uav_add_result_to_later_loadgpu::dxil::module::split::tests::dispatch_chain_declines_uav_add_with_a_polling_loopmainand on the PR:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1(seed 722,res[30] = 0x1, CPU 0x7fffffff). It also fails alone onmain, so it is not caused by this PR; it looks like an RDNA3-specific mismatch in the fuzz test and may deserve its own issue.SKIPPED, identical on both trees:gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpuandf32_programs_on_the_gpu(the f16 / f32 conversion cases refused as unsupported, 6 lines) andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Not tested
scripts/smoke.ps1regression run on a retail title, so there is noxcl-smokeblock here.AI use: this run and report were done by Claude Code (Claude Sonnet 5.5), driven by
oni-swr. The commands and counts are from the run above, not edited by hand.@Kalmarv on GitHub · 2026-11-26 01:00 UTC · original
I'm closing and reopening this right away only to get a CI run on today's
main(b49be18). #2371 changedsplit.rsafter this PR's last run, and the head655885estill merges intob49be18without conflicts.AI use: Claude Code (Claude Opus 5.5) checked the merge with
git merge-treeand wrote this.github-bot referenced this pull request2026-11-26 06:18:31 +00:00
@ClosetPie107 on GitHub · 2026-11-26 06:49 UTC · original
AMD RDNA4 / Linux (Proton Experimental) test report on head
655885ec(merged cleanly ontomainb49be183):Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnuIsolated unit / GPU tests (
mainb49be183+ #2123655885ec, debug,--test-threads=1,WINEDLLOVERRIDES="d3d12,d3d12core=n"):xcl.exe gpu::dxil::module::split:: -- --test-threads=1: 10 passed, 0 failed, 0 ignored (0 skipped — all GPU dispatch-chain tests includingdispatch_chain_carries_uav_add_result_to_later_loadran on the RX 9070).Combined 300 s retail sanity run (release,
mainb49be183+ #1540 + #1675 + #1844 + #1899 + #2123 + #2369 + #2422, retail 1.0.2.1 pressingApast menus):exit=0), 0 crashes, 0 device removals,2,014PresentXframes,131,072translated draws,660,943dispatches,44,546chained split-compute dispatches across245split programs (2,575pieces),102,631Opus packets (0 errors).Not tested
AI use
main, ran the Proton GPU/unit tests and combined retail run on this machine, and drafted this report.@Kalmarv on GitHub · 2026-11-26 06:55 UTC · original
@ClosetPie107 thank you for the RDNA4 run under Proton. It's the first one on Linux, and the 300 s retail run issued 44,546 chained dispatches with no crash or device removal. It's in the description under Tested with your name, along with the note that the retail run is of the 7-PR stack, not this PR alone.
AI use: Claude Code (Claude Opus 5.5) updated the description and wrote this.
@DavidM1911 on GitHub · 2026-11-26 07:28 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
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.