Recompiler/D3D12.X: rebase #2353 (multi-wave/LDS dispatch chains) and split two-pass mesh producers #3504
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3504"
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-30T03:44:47Z.
Rebases #2353 (by @zohaiblazuli, @joeypercia, @Saintwolf — multi-wave & guest-LDS compute dispatch chains) cleanly onto current
mainand stacks two-pass mesh-producerDispatchChainsplitting (using the early-exit-safe barrier) on top.What is in it
[32, 1, 1], carry wave64 partner exchanges across dispatch pieces, keep exited guest waves in dispatch checkpoints, split direct compute programs with guest LDS of any shape, and reconcile spin exchanges with the timeout path.crates/xcl/src/gpu/dxil/module/split.rs: cut dispatch chains with the early-exit-safe barrier.crates/xcl/src/hle/d3d12x/: build and run two-pass mesh producers as dispatch chains.Tested
scripts/smoke.ps1on this exact head queued next.Regression run
main:PR head:
Not tested
AI use
Imported from ivall/xcl. Originally posted by ettehn on 2026-11-30T07:24:41Z.
Independent Windows Release check of
dac937862be3b5083765e05cef5719607e02bdcfmerged cleanly intod52ff48caade1f5350d513bfffd370396dadfeb6. RTX 5070 Ti Laptop (621.24), Windows 11 25H2, Rust 1.97.1 MSVC, DXC 1.8.2502.11. WithXCL_ADAPTER=NVIDIAand one test thread, the selected dispatch-chain, mesh and indirect tests gave 37 passed, 0 failed, 0 ignored, zero SKIPPED lines. The early-exit case compared 2,048 words and 16 guards over seven pieces. The safe-barrier case checked 384 words and 16 guards over 14 pieces. The native wave32 geometries and split wave64 LDS cases also ran.The mesh fixture's pixel and record checks use an ordinary compute producer. Its direct-backend slice passes
direct.dxilto the runner, leaving the newly chained two-pass producer outside that check. The indirect fixtures here cover argument scaling and record ownership. As noted in the mesh commit, indirect mesh uses the whole form; where a positiveXCL_CS_PSO_WAIT_MSpermitsWhole::Late, the cold call skips both passes. That last point is source-traced. The local run was synthetic, and the smoke block in the PR currently names2bbfff6.OpenAI Codex (GPT-6.2 Sol) assisted with source review and Windows verification.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-30T14:36:59Z.
Thank you @ettehn for the independent RTX 5070 Ti verification on
dac937862! I've updated the PR description'sxcl-smoke v1block todac937862be3b5083765e05cef5719607e02bdcf(1717 frames, 0 device removals, 0 crashes, 16681 MB peak commit).Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:38:58Z.
merge-check
base:
d0832e614fhead:
dac937862bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2907 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (split.rs, kernel.rs, lanes.rs, module.rs, pso.rs, bind.rs, real.rs, dispatch_chain.rs, docs). It changes the default path: large programs that stayed whole on main now run as dispatch chains (split wave64 groups of any multiple of 64 threads, the single-wave64 spin case, native wave32 groups of several waves or 2D/3D shapes, single-wave programs with LDS, two-pass mesh producers). Findings, most serious first: (1) early exits and the early-exit-safe barrier across cuts (likely, from reading; not reproduced). A wave that ends early branches to the shared exit block, the only place
safe_barrier_exitdrops it fromXCL_BAR_ALIVE, and that block is in the last piece. So in a group where one wave exits before ans_barrierthat sits in an earlier piece, the other waves poll that barrier until its budget runs out instead of seeing the wave leave. That costs a stall per group per barrier, possibly a GPU timeout.dispatch_chain_safe_barrier_crosses_cutshas no early exit; a variant with one would settle it. (2) Indirect two-pass draws are skipped until the whole form is built (bind.rs ~3683), and that build is the long compile the PR avoids, queued on the one whole-form worker (or on the title thread withcs_goes_onoff). On main the compute pipeline was ready with the mesh one, so geometry can go missing for seconds; a smoke run won't show it. (3) kernel.rs ~367 only splits a wave64 program with LDS when the group is 64 threads (!uses_lds || total == 64), so the planner's multi-wave LDS rules and thedispatch_chain_lds_two/three/four_wave64stests cover a path no title takes. (4) Every cut saves and restores all of LDS for every group, on by default, and no perf number is given; the PR's own peak commit is +10 % (15133 -> 16681 MB), unexplained. (5) Process: ~1246 lines and at least three logical changes with no reason given for not splitting; fixup commits not squashed (from03d2e1btodac9378the tests don't compile, which breaks bisect); one subject usesDXIL:, not an existing area; Tested has no cargo test counts and blank numbers; AI use says "Claude Opus / Gemini" while the commits name other models too;a_split_wave64_compute_program_stays_wholenow asserts that the program splits (rename it). Fine: credit and Co-authored-by lines from #2353 are kept, the scratch layout reuses slots consistently, the save/restore barriers and the lane-counter sync are right, returned threads still take part in the checkpoint, the chain's root signature matches the two-pass binding, and PSO release clears the chain entry.performance: 60 s smoke of a retail title, main
d0832e61vs this merge (f8d48d1d): 1516 -> 1469 frames shown (97 %; 60 presents per 2 s in both), peak commit 18133 -> 15737 MB, no device removal, no crash. The title doesn't show whether it reaches dispatch chains, early exits before a cut, or indirect two-pass draws, so findings (1) and (2) are not exercised here.verdict: not yet: early exits across cuts can stall the safe barrier (finding 1), indirect two-pass draws are dropped while the whole form builds (finding 2), and ~1246 lines with at least three changes and unsquashed fixups should be split
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T07:04:18Z.
merge-check claim
head:
dac937862bImported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T07:10:02Z.
merge-check claim
head:
dac937862bImported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T07:16:18Z.
merge-check
base:
7d86c5d2b7head:
dac937862bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2912 passed, 1 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T08:02:18Z.
Ran the
gpu::dxil::module::split::testsmodule atdac93786on an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build,
XCL_ADAPTER=NVIDIA, detached worktree at the exact PR head, no local patches.All 28 tests in that module pass here, including the dispatch-chain cases of the description (
dispatch_chain_carries_uav_add_result_to_later_load,dispatch_chain_safe_barrier_crosses_cuts,dispatch_chain_lds_cuts_before_a_guest_wave_returns,dispatch_chain_lds_poll_loop_keeps_several_waves_whole). This is a synthetic check of the recompiler module only.Not tested: the full workspace suite, the 24-thread cold archive precompile, the 29-minute live title run, a retail title in Series X mode, native wave64 hosts, AMD and Intel GPUs, Wine, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:57:47Z.
Code review location:
crates/xcl/src/gpu/dxil/module/split.rs; line 228The rule that cuts only where the whole group meets is applied only to programs with guest LDS (
lds.filter(|_| multi)). Multi-wave programs whose only shared state isxcl_bar(the early-exit-safe barrier) are planned withuniform = None, so a cut can fall where waves are on different paths to their next S_BARRIER. Take native wave32 [64,1,1], or split wave64 [128,1,1] with no LDS, where wave 0 reaches ans_barrierin block X and wave 1 one in block Y, which is legal on RDNA since any barrier counts. If X lands in piece k and Y in piece k+1, wave 0 pollsxcl_barin piece k while wave 1 has already gone to the checkpoint at the end of piece k. Wave 0 spins 2^20 iterations, takes the timeout path, decrementsaliveand stops counting, so later barriers don't wait for it. The result is wrong values and a large GPU stall per group. Applying the uniform-cut rule whenever the group has more than one wave, LDS or not, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:57:47Z.
Code review location:
crates/xcl/src/hle/d3d12x/bind.rs; line 3684Two-pass ExecuteIndirect of a chained mesh producer now needs the separately built whole form. While it's Late, the draw is skipped with an Err, and when
cs_goes_on()is false the title thread compiles it synchronously. Before,finish_two_passbuilt one whole compute PSO that indirect mesh draws used. Now the pieces are built at PSO creation, and the first indirect draw queues a second compile of the whole program: the PR's own 253 KB producer takes 5.1 s on NVIDIA. Until then, every ExecuteIndirect(DispatchMesh) with that PSO logs "still being built" and is dropped, so geometry is missing for seconds. Withcs_goes_on()off, the render thread stalls ~5 s, the stall this PR set out to remove, and driver work roughly doubles. Running the companion dispatch throughdispatch_chain::execute_indirect(as compute indirect does), or not chaining producers that are only drawn indirectly, would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T08:57:47Z.
Review: COMMENTED
Review of
dac93786: 2 finding(s). 2 are inline.These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-12-02T13:52:17Z.
Closing as superseded: all 11 commits from this PR landed on
mainvia merged #3655 (d71578f85).Thanks @bmjask for the two inline correctness findings (
split.rs:228uniform = Noneon non-LDS multi-wavexcl_barprograms, andbind.rs:3684indirect mesh whole-form stall) — tracking both as follow-up fixes onmain.Pull request closed