Recompiler/D3D12.X: rebase #2353 (multi-wave/LDS dispatch chains) and split two-pass mesh producers #3504

Closed
Kalmarv wants to merge 11 commits from upstream-pr/3504 into main
Kalmarv commented 2026-11-30 03:44:47 +00:00 (Migrated from github.com)

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 main and stacks two-pass mesh-producer DispatchChain splitting (using the early-exit-safe barrier) on top.

What is in it

  • Rebased commits from #2353: split native wave32 compute groups beyond [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

  • Hardware: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1074), AMD Ryzen 9 9950X, Windows 11, DXC 1.9.2609
  • Verified in full 24-thread cold archive precompile (2,162 split programs / 8,907 pieces, errors, refused) and 29-min live title run (695 split programs running 3,819 pieces / 95,737 chained dispatches, crashes).
  • scripts/smoke.ps1 on this exact head queued next.

Regression run

main:

xcl-smoke v1
commit: 91244db94d2f402237c6a8e428dbe5da07673c48
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1514 (PresentX 1514)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 15133 MB

PR head:

xcl-smoke v1
commit: dac937862be3b5083765e05cef5719607e02bdcf
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1717 (PresentX 1717)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 16681 MB

Not tested

  • AMD / Intel GPUs

AI use

  • Rebased and verified with Claude Opus / Gemini coding assistants; base multi-wave/LDS splitting by @zohaiblazuli, @joeypercia, and @Saintwolf (#2353).
<!-- greyfinch-sync:ivall/xcl:issue:5558587849 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-11-30T03:44:47Z. --- Rebases #2353 (by @zohaiblazuli, @joeypercia, @Saintwolf — multi-wave & guest-LDS compute dispatch chains) cleanly onto current `main` and stacks two-pass mesh-producer `DispatchChain` splitting (using the early-exit-safe barrier) on top. **What is in it** - Rebased commits from #2353: split native wave32 compute groups beyond `[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** - Hardware: NVIDIA GeForce RTX 5070 Ti (driver 32.0.16.1074), AMD Ryzen 9 9950X, Windows 11, DXC 1.9.2609 - Verified in full 24-thread cold archive precompile (2,162 split programs / 8,907 pieces, errors, refused) and 29-min live title run (695 split programs running 3,819 pieces / 95,737 chained dispatches, crashes). - `scripts/smoke.ps1` on this exact head queued next. **Regression run** `main`: ``` xcl-smoke v1 commit: 91244db94d2f402237c6a8e428dbe5da07673c48 gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1514 (PresentX 1514) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 15133 MB ``` PR head: ``` xcl-smoke v1 commit: dac937862be3b5083765e05cef5719607e02bdcf gpu: NVIDIA GeForce RTX 5070 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1717 (PresentX 1717) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 16681 MB ``` **Not tested** - AMD / Intel GPUs **AI use** - Rebased and verified with Claude Opus / Gemini coding assistants; base multi-wave/LDS splitting by @zohaiblazuli, @joeypercia, and @Saintwolf (#2353).
ettehn commented 2026-11-30 07:24:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ettehn on 2026-11-30T07:24:41Z.


Independent Windows Release check of dac937862be3b5083765e05cef5719607e02bdcf merged cleanly into d52ff48caade1f5350d513bfffd370396dadfeb6. RTX 5070 Ti Laptop (621.24), Windows 11 25H2, Rust 1.97.1 MSVC, DXC 1.8.2502.11. With XCL_ADAPTER=NVIDIA and 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.dxil to 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 positive XCL_CS_PSO_WAIT_MS permits Whole::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 names 2bbfff6.

OpenAI Codex (GPT-6.2 Sol) assisted with source review and Windows verification.

<!-- greyfinch-sync:ivall/xcl:comment:7271701733 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7271701733). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-30T07:24:41Z. --- Independent Windows Release check of `dac937862be3b5083765e05cef5719607e02bdcf` merged cleanly into `d52ff48caade1f5350d513bfffd370396dadfeb6`. RTX 5070 Ti Laptop (621.24), Windows 11 25H2, Rust 1.97.1 MSVC, DXC 1.8.2502.11. With `XCL_ADAPTER=NVIDIA` and 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.dxil` to 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 positive `XCL_CS_PSO_WAIT_MS` permits `Whole::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 names `2bbfff6`. OpenAI Codex (GPT-6.2 Sol) assisted with source review and Windows verification.
Kalmarv commented 2026-11-30 14:36:59 +00:00 (Migrated from github.com)

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's xcl-smoke v1 block to dac937862be3b5083765e05cef5719607e02bdcf (1717 frames, 0 device removals, 0 crashes, 16681 MB peak commit).

<!-- greyfinch-sync:ivall/xcl:comment:7281655945 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7281655945). Originally posted by [Kalmarv](https://github.com/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's `xcl-smoke v1` block to `dac937862be3b5083765e05cef5719607e02bdcf` (1717 frames, 0 device removals, 0 crashes, 16681 MB peak commit).
Foniass commented 2026-12-01 03:38:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:38:58Z.


merge-check
base: d0832e614f
head: dac937862b
merge: 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_exit drops it from XCL_BAR_ALIVE, and that block is in the last piece. So in a group where one wave exits before an s_barrier that 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_cuts has 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 with cs_goes_on off). 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 the dispatch_chain_lds_two/three/four_wave64s tests 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 (from 03d2e1b to dac9378 the tests don't compile, which breaks bisect); one subject uses DXIL:, 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_whole now 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 d0832e61 vs 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.

<!-- greyfinch-sync:ivall/xcl:comment:7299923105 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7299923105). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:38:58Z. --- merge-check base: d0832e614fa7d6ae027bb4feb27ccb9121f54a8f head: dac937862be3b5083765e05cef5719607e02bdcf merge: 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_exit` drops it from `XCL_BAR_ALIVE`, and that block is in the last piece. So in a group where one wave exits before an `s_barrier` that 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_cuts` has 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 with `cs_goes_on` off). 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 the `dispatch_chain_lds_two/three/four_wave64s` tests 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 (from 03d2e1b to dac9378 the tests don't compile, which breaks bisect); one subject uses `DXIL:`, 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_whole` now 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 d0832e61 vs 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.
brainhay5 commented 2026-12-01 07:04:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T07:04:18Z.


merge-check claim
head: dac937862b

<!-- greyfinch-sync:ivall/xcl:comment:7303611235 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7303611235). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T07:04:18Z. --- merge-check claim head: dac937862be3b5083765e05cef5719607e02bdcf
brainhay5 commented 2026-12-01 07:10:02 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T07:10:02Z.


merge-check claim
head: dac937862b

<!-- greyfinch-sync:ivall/xcl:comment:7303722993 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7303722993). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T07:10:02Z. --- merge-check claim head: dac937862be3b5083765e05cef5719607e02bdcf
brainhay5 commented 2026-12-01 07:16:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brainhay5 on 2026-12-01T07:16:18Z.


merge-check
base: 7d86c5d2b7
head: dac937862b
merge: 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

<!-- greyfinch-sync:ivall/xcl:comment:7303851922 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7303851922). Originally posted by [brainhay5](https://github.com/brainhay5) on 2026-12-01T07:16:18Z. --- merge-check base: 7d86c5d2b7845695031eeea1327aa81b6c439323 head: dac937862be3b5083765e05cef5719607e02bdcf merge: 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
Aniseto commented 2026-12-01 08:02:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Aniseto on 2026-12-01T08:02:18Z.


Ran the gpu::dxil::module::split::tests module at dac93786 on 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.

XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib gpu::dxil::module::split::tests -- --test-threads=1
28 passed; 0 failed; 0 ignored; 2754 filtered out      (exit 0)

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.

<!-- greyfinch-sync:ivall/xcl:comment:7304792872 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7304792872). Originally posted by [Aniseto](https://github.com/Aniseto) on 2026-12-01T08:02:18Z. --- Ran the `gpu::dxil::module::split::tests` module at `dac93786` on 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. ``` XCL_ADAPTER=NVIDIA cargo test -q -p xcl --lib gpu::dxil::module::split::tests -- --test-threads=1 28 passed; 0 failed; 0 ignored; 2754 filtered out (exit 0) ``` 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.
bmjask commented 2026-12-02 08:57:47 +00:00 (Migrated from github.com)

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 228

@@ -136,7 +218,14 @@ impl Shader {
             }
             if exchange != 0 { return None; }
         }
-        let plan = self.m.dispatch_plan(limit)?;
+        // One console wave follows the guest's scalar control flow: its threads
+        // diverge only in guarded per-lane accesses, which hold no barrier or
+        // return, so any cut keeps its guest barriers paired. Several waves
+        // can branch apart and return apart, so they are cut only where the
+        // whole group passes. A loop that reads the LDS (a load or an atomic)
+        // may poll it until another wave writes past a cut, so such a loop
+        // keeps the program whole.
+        let plan = self.m.dispatch_plan(limit, lds.filter(|_| multi).map(|_| &reads))?;

The 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 is xcl_bar (the early-exit-safe barrier) are planned with uniform = 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 an s_barrier in 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 polls xcl_bar in 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, decrements alive and 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.

<!-- greyfinch-sync:ivall/xcl:review-comment:4766988342 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#discussion_r4766988342). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T08:57:47Z. **Code review location:** `crates/xcl/src/gpu/dxil/module/split.rs`; line 228 ~~~~diff @@ -136,7 +218,14 @@ impl Shader { } if exchange != 0 { return None; } } - let plan = self.m.dispatch_plan(limit)?; + // One console wave follows the guest's scalar control flow: its threads + // diverge only in guarded per-lane accesses, which hold no barrier or + // return, so any cut keeps its guest barriers paired. Several waves + // can branch apart and return apart, so they are cut only where the + // whole group passes. A loop that reads the LDS (a load or an atomic) + // may poll it until another wave writes past a cut, so such a loop + // keeps the program whole. + let plan = self.m.dispatch_plan(limit, lds.filter(|_| multi).map(|_| &reads))?; ~~~~ --- The 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 is `xcl_bar` (the early-exit-safe barrier) are planned with `uniform = 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 an `s_barrier` in 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 polls `xcl_bar` in 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, decrements `alive` and 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.
bmjask commented 2026-12-02 08:57:47 +00:00 (Migrated from github.com)

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 3684

@@ -3671,6 +3680,12 @@ unsafe fn execute_indirect_snapshot(
                 if max == 0 || args == 0 {
                     return Ok(());
                 }
+                // (a compute pass cut into a chain runs its whole form: the group counts are the GPU's)
+                let whole = match super::real::dispatch_chain::whole_ready(tp.compute)? {

Two-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_pass built 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. With cs_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 through dispatch_chain::execute_indirect (as compute indirect does), or not chaining producers that are only drawn indirectly, would avoid it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4766988360 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#discussion_r4766988360). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T08:57:47Z. **Code review location:** `crates/xcl/src/hle/d3d12x/bind.rs`; line 3684 ~~~~diff @@ -3671,6 +3680,12 @@ unsafe fn execute_indirect_snapshot( if max == 0 || args == 0 { return Ok(()); } + // (a compute pass cut into a chain runs its whole form: the group counts are the GPU's) + let whole = match super::real::dispatch_chain::whole_ready(tp.compute)? { ~~~~ --- Two-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_pass` built 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. With `cs_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 through `dispatch_chain::execute_indirect` (as compute indirect does), or not chaining producers that are only drawn indirectly, would avoid it.
bmjask commented 2026-12-02 08:57:47 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:ivall/xcl:review:6147536653 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#pullrequestreview-6147536653). Originally posted by [bmjask](https://github.com/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._
Kalmarv commented 2026-12-02 13:52:17 +00:00 (Migrated from github.com)

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 main via merged #3655 (d71578f85).

Thanks @bmjask for the two inline correctness findings (split.rs:228 uniform = None on non-LDS multi-wave xcl_bar programs, and bind.rs:3684 indirect mesh whole-form stall) — tracking both as follow-up fixes on main.

<!-- greyfinch-sync:ivall/xcl:comment:7347595703 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3504#issuecomment-7347595703). Originally posted by [Kalmarv](https://github.com/Kalmarv) on 2026-12-02T13:52:17Z. --- Closing as superseded: all 11 commits from this PR landed on `main` via merged #3655 (`d71578f85`). Thanks @bmjask for the two inline correctness findings (`split.rs:228` `uniform = None` on non-LDS multi-wave `xcl_bar` programs, and `bind.rs:3684` indirect mesh whole-form stall) — tracking both as follow-up fixes on `main`.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3504
No description provided.