Recompiler: split direct compute programs that use global atomic adds #2113
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-25T05:23:30Z.
Part 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
main:PR head:
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
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T06:01:36Z.
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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:17:48Z.
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!
Imported from ivall/xcl. Originally posted by bielfreedom on 2026-11-25T06:55:15Z.
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.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T07:12:19Z.
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.
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T11:19:47Z.
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.Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-25T13:13:55Z.
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.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T21:39:13Z.
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.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T01:00:48Z.
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.Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-26T06:49:04Z.
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.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-26T06:55:43Z.
@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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T07:28:48Z.
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
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T20:52:45Z.
merge-check claim
head:
655885ec57Imported from ivall/xcl. Originally posted by throny on 2026-11-27T21:10:41Z.
merge-check
base:
6089122ahead:
655885ec57merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1467 passed, 0 failed, 47 ignored (26 SKIPPED lines); base alone: 1465 passed, 0 failed, 47 ignored
review: none. The opcode is matched like the existing AND / OR arm; each add runs once in its own piece; polling programs are declined; the scan also counts dead instructions, which is conservative. Both tests fail without the change (by reading; not run on main here).
performance: opt-in direct-DXIL path only: more programs become dispatch chains there (more dispatches and barriers against faster cold builds) (reasoned).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T01:12:11Z.
merge-check claim
head:
655885ec57Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-28T02:44:17Z.
merge-check
base:
753e8b1a25head:
655885ec57merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1514 passed, 0 failed, 47 ignored, 25 SKIPPED: 21 no wave64, 3 per-lane f16/f32 forms refused (#1426 semantics), 1 no heap windows; failing: none. The suite ran on this PC at the same time as 6 other PRs' suites, in one queued job.
review: none. Whole diff read (README, split.rs: UAV integer ADD admitted at its original site, whole pipeline kept when a loop reads writable global memory and the program has such an ADD, 2 tests). The ADD stays in its piece and executes once; its returned value crosses cuts through the continuation slots like other scalars; a polling loop (atomics, raw/typed buffer or texture loads inside a cyclic component) makes the plan decline.
Re-frozen on main
753e8b1abefore posting (main changed this PR's files: README / build.rs / pso.rs / pso_async.rs, in code this PR does not touch); the merge diff was read again against it.performance: reasoned, not measured: more compute programs with UAV adds can now be split into pieces (smaller driver compiles), the rest unchanged.
verdict: safe to merge
hardware / tool and model: Windows 11 build 26300.9974, NVIDIA GeForce RTX 2070 SUPER 8 GB (driver 621.40, wave32 only), AMD Ryzen 5 3600XT; rustc 1.100.1 (20ddd0171 2026-11-25) x86_64-pc-windows-msvc, debug test profile; trial merge e698c28b68ebca50e74145d93bd3989fe7be307b (local, not pushed). Claude Code: Claude Opus 5.5 (coordination, full-diff review, draft).