Recompiler: XCL_WAVE64_SPIN=0 gives direct DXIL one-wave groups the group barrier #3625

Open
BBareth wants to merge 1 commit from upstream-pr/3625 into main
BBareth commented 2026-12-01 23:16:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-01T23:16:38Z.


On a GPU with 32-lane waves the two halves of a console wave64 exchange words. The HLSL path meets the halves of a one-wave group at a group barrier unless XCL_WAVE64_SPIN asks for the arrival counters; the direct DXIL translator has used the counters for compute and mesh groups since #1741 (a guess at the hang of #1727) and did not read the switch, although the switch is in the cache keys. This PR makes XCL_WAVE64_SPIN=0 give those groups the group barrier in the direct translator too, and keeps such a program whole: it is not cut into a dispatch chain (split_compute), as it is not with the counters. The default does not change.

Why: in a retail title on an RTX 5070 Ti one such compute program (a particle update, numthreads(64,1,1), 191 exchanges, 370 KB of DXIL) takes almost exactly 50 ms at every dispatch, about 57 dispatches a frame: one half polls its partner's counter to the limit of 1 << 20 and gives up. That is 2.8 s of a 4.2 s frame in the intro cutscene after the title screen. Part of #1833.

the particle program, this title, RTX 5070 Ti ms per call ms per frame
main (counters, limit 1 << 20) about 50 2822 / 2891
counters, limit 16,384 for this program only (local experiment) 0.9 94
group barrier for this program only (local experiment) 0.1 9.7
this PR with XCL_WAVE64_SPIN=0 (every one-wave compute and mesh group) 0.1 6.9 / 8.2

What the wait is not (each tested with a local build that changed this one program): the mask plan (all masks exchanged: no change), a half that left the program (an exit mark its partner sees: no change), the memory fences around the exchange (taken out: no change), short lane counts (both halves count whole waves of 32). At the timed-out wait the lower half has added (k + 1) * 32, its partner's counter is exactly one exchange short, and k is 32 or more. A read of the translated DXIL found the exchange number and the counters consistent on every path. So the counters do not work for this program on this driver, and I do not know why; the group barrier does.

What is in it

  • crates/xcl/src/gpu/dxil/kernel.rs:
    • one_wave_spin (the switch, as ComputePolicyKey::wave64_spin reads it) and its use where Lw::new picks Partner::Present or Partner::Spin for a group of 33 to 64 threads;
    • a test override that goes along into the translator's thread;
    • in finish_dispatch, a split program at the group barrier stays whole like one with the counters (review: with the switch it could otherwise be cut into a dispatch chain, a path no test runs at 64 threads);
    • groups of several console waves keep the counters.
  • crates/xcl/src/gpu/dxil/kernel.rs, test a_split_wave64_compute_program_at_the_group_barrier_stays_whole.
  • crates/xcl/src/gpu/dxil/core_tests.rs, a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier: also checks the switch's values, that a 64-thread group without the counters has group barriers at the exchange and no compare-exchange, and that a 128-thread group keeps the counters.
  • crates/xcl/src/gpu/dxil/mask_exchange.rs, gpu_split_wave64_compare_batch_preserves_both_words: runs its 64-thread compute program on the GPU through the group barrier too and expects the same memory.
  • docs/wave64-on-wave32.md: the paragraph on the default now says the direct translator uses the counters by default (=0 gives the group barrier, no chain) and the HLSL path the group barrier (=1 gives the counters).

Tested

  • RTX 5070 Ti, driver 32.0.16.2124; i7-12700K; Windows 11 Pro 26200; rustc 1.95.0; debug suite, release runs.
  • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4 on e3dabe10 (on main 078358a0): 3007 passed, 0 failed, 52 ignored.
  • SKIPPED on this adapter: 28: 22 no wave64; 2 no heap windows; 2 no d3d12SDKLayers.dll; 1 no D3D12 debug layer; 1 cannot disable the driver cache (no Developer Mode). Both tests this PR changes ran, the GPU one on wave32.
  • The retail title, on the previous head 334564ab (where these programs could still be chained), 360 s runs, the start prompt pressed at 70 s, XCL_TEXTURE_LEVEL_PAGES=1 XCL_GPU_TIMES=6,200, one compute program left out in every run (XCL_SKIP_CS, the compact-form removal of #3516), builds of this branch, interleaved, each setting after a warm-up run of its own:
presents in minute 5 GPU first to last stamp per frame device removals, crashes
switch unset, run 1 11 about 4.2 s 0, 0
XCL_WAVE64_SPIN=0, run 1 72 about 1.4 s 0, 0
switch unset, run 2 11 about 4.3 s 0, 0
XCL_WAVE64_SPIN=0, run 2 65 about 1.4 s 0, 0
  • Five runs with XCL_WAVE64_SPIN=0 in all on that head (two warm-ups, the two above, one with frame dumps): no device removal, no crash, no hang.
  • On e3dabe10, one 420 s run with XCL_WAVE64_SPIN=0 XCL_RESIDENCY_PRIORITY=1 XCL_GPU_TIMES=6,200 (no level pages, no program left out, so not comparable with the table): 3872 frames, 158 and 157 presents in minutes 5 and 6, no device removal, no crash, no hang. There was no run with the switch unset in this setting.
  • The picture with the switch on (every 10th frame of one run looked at): the night sky with its particles, a light with its lens flare, the credit texts and one credit card are drawn; most other frames of the cutscene are black, as on main. The run with the switch unset gave no frames to compare (every dump timed out), so this says the picture is not broken by the switch, not that it is better.

Regression run

xcl-smoke v1
commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 120
exit: 0x0
frames shown: 3046 (PresentX 3046)
presents per 2 s (last 3): 15 27 19
device removals: 0
crashes: 0
peak commit: 32465 MB
xcl-smoke v1
commit: e3dabe10a7c00055d837e90c3d421e35baf3205d
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 120
exit: 0x0
frames shown: 3039 (PresentX 3039)
presents per 2 s (last 3): 49 23 26
device removals: 0
crashes: 0
peak commit: 31136 MB

Both without the switch: the smoke runs check that the default is unchanged. Each follows a warm-up run of the same build; the start prompt is pressed once at 70 s. Both are the first counted run after the warm-up; neither lost the device.

Not tested

  • The hang of #1727 (group barriers in parallel test runs on an RTX 5070): five title runs without one is a small sample, and the lib tests were not run in parallel with the switch set. That is why this is a switch and not a new default.
  • The open world: the runs above end in the intro cutscene. Other titles, other NVIDIA generations, Intel.
  • AMD: wave64 is native there and nothing splits, so the switch does nothing.
  • The first runs with the switch set compile the programs it changes again (its cache identity is its own): 22 to 100 driver compiles without a stored blob after 200 s in those runs.
  • Whether the particle program's output is right in either form was not compared against a reference.

AI use

  • Claude Code, Claude Fable 5.2: found the wait with timing experiments in the shader, wrote the change, the tests and the first description, and ran the suite and the runs on 334564ab. Gemini 4 Neon (agy) read the translated DXIL for consistency; I did not re-verify that reading line by line.
  • Claude Code, Claude Opus 5.5: kept the program whole at the group barrier and fixed the doc paragraph after review, ran the suite and the runs on e3dabe10, and updated this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5596417115 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-01T23:16:38Z. --- On a GPU with 32-lane waves the two halves of a console wave64 exchange words. The HLSL path meets the halves of a one-wave group at a group barrier unless `XCL_WAVE64_SPIN` asks for the arrival counters; the direct DXIL translator has used the counters for compute and mesh groups since #1741 (a guess at the hang of #1727) and did not read the switch, although the switch is in the cache keys. This PR makes `XCL_WAVE64_SPIN=0` give those groups the group barrier in the direct translator too, and keeps such a program whole: it is not cut into a dispatch chain (`split_compute`), as it is not with the counters. The default does not change. Why: in a retail title on an RTX 5070 Ti one such compute program (a particle update, `numthreads(64,1,1)`, 191 exchanges, 370 KB of DXIL) takes almost exactly 50 ms at every dispatch, about 57 dispatches a frame: one half polls its partner's counter to the limit of `1 << 20` and gives up. That is 2.8 s of a 4.2 s frame in the intro cutscene after the title screen. Part of #1833. | the particle program, this title, RTX 5070 Ti | ms per call | ms per frame | |---|---|---| | main (counters, limit `1 << 20`) | about 50 | 2822 / 2891 | | counters, limit 16,384 for this program only (local experiment) | 0.9 | 94 | | group barrier for this program only (local experiment) | 0.1 | 9.7 | | this PR with `XCL_WAVE64_SPIN=0` (every one-wave compute and mesh group) | 0.1 | 6.9 / 8.2 | What the wait is not (each tested with a local build that changed this one program): the mask plan (all masks exchanged: no change), a half that left the program (an exit mark its partner sees: no change), the memory fences around the exchange (taken out: no change), short lane counts (both halves count whole waves of 32). At the timed-out wait the lower half has added `(k + 1) * 32`, its partner's counter is exactly one exchange short, and `k` is 32 or more. A read of the translated DXIL found the exchange number and the counters consistent on every path. So the counters do not work for this program on this driver, and I do not know why; the group barrier does. **What is in it** - `crates/xcl/src/gpu/dxil/kernel.rs`: - `one_wave_spin` (the switch, as `ComputePolicyKey::wave64_spin` reads it) and its use where `Lw::new` picks `Partner::Present` or `Partner::Spin` for a group of 33 to 64 threads; - a test override that goes along into the translator's thread; - in `finish_dispatch`, a split program at the group barrier stays whole like one with the counters (review: with the switch it could otherwise be cut into a dispatch chain, a path no test runs at 64 threads); - groups of several console waves keep the counters. - `crates/xcl/src/gpu/dxil/kernel.rs`, test `a_split_wave64_compute_program_at_the_group_barrier_stays_whole`. - `crates/xcl/src/gpu/dxil/core_tests.rs`, `a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier`: also checks the switch's values, that a 64-thread group without the counters has group barriers at the exchange and no compare-exchange, and that a 128-thread group keeps the counters. - `crates/xcl/src/gpu/dxil/mask_exchange.rs`, `gpu_split_wave64_compare_batch_preserves_both_words`: runs its 64-thread compute program on the GPU through the group barrier too and expects the same memory. - `docs/wave64-on-wave32.md`: the paragraph on the default now says the direct translator uses the counters by default (`=0` gives the group barrier, no chain) and the HLSL path the group barrier (`=1` gives the counters). **Tested** - RTX 5070 Ti, driver 32.0.16.2124; i7-12700K; Windows 11 Pro 26200; rustc 1.95.0; debug suite, release runs. - `cargo build --workspace`, then `cargo test --workspace --no-fail-fast -- --test-threads=4` on e3dabe10 (on main 078358a0): 3007 passed, 0 failed, 52 ignored. - `SKIPPED` on this adapter: 28: 22 `no wave64`; 2 `no heap windows`; 2 `no d3d12SDKLayers.dll`; 1 `no D3D12 debug layer`; 1 cannot disable the driver cache (no Developer Mode). Both tests this PR changes ran, the GPU one on wave32. - The retail title, on the previous head 334564ab (where these programs could still be chained), 360 s runs, the start prompt pressed at 70 s, `XCL_TEXTURE_LEVEL_PAGES=1 XCL_GPU_TIMES=6,200`, one compute program left out in every run (`XCL_SKIP_CS`, the compact-form removal of #3516), builds of this branch, interleaved, each setting after a warm-up run of its own: | | presents in minute 5 | GPU first to last stamp per frame | device removals, crashes | |---|---|---|---| | switch unset, run 1 | 11 | about 4.2 s | 0, 0 | | `XCL_WAVE64_SPIN=0`, run 1 | 72 | about 1.4 s | 0, 0 | | switch unset, run 2 | 11 | about 4.3 s | 0, 0 | | `XCL_WAVE64_SPIN=0`, run 2 | 65 | about 1.4 s | 0, 0 | - Five runs with `XCL_WAVE64_SPIN=0` in all on that head (two warm-ups, the two above, one with frame dumps): no device removal, no crash, no hang. - On e3dabe10, one 420 s run with `XCL_WAVE64_SPIN=0 XCL_RESIDENCY_PRIORITY=1 XCL_GPU_TIMES=6,200` (no level pages, no program left out, so not comparable with the table): 3872 frames, 158 and 157 presents in minutes 5 and 6, no device removal, no crash, no hang. There was no run with the switch unset in this setting. - The picture with the switch on (every 10th frame of one run looked at): the night sky with its particles, a light with its lens flare, the credit texts and one credit card are drawn; most other frames of the cutscene are black, as on main. The run with the switch unset gave no frames to compare (every dump timed out), so this says the picture is not broken by the switch, not that it is better. **Regression run** ``` xcl-smoke v1 commit: 078358a058f7ba5d16690dba8dc4e55d2c88ae0a gpu: NVIDIA GeForce RTX 5070 Ti title: 9cc6a39e seconds: 120 exit: 0x0 frames shown: 3046 (PresentX 3046) presents per 2 s (last 3): 15 27 19 device removals: 0 crashes: 0 peak commit: 32465 MB ``` ``` xcl-smoke v1 commit: e3dabe10a7c00055d837e90c3d421e35baf3205d gpu: NVIDIA GeForce RTX 5070 Ti title: 9cc6a39e seconds: 120 exit: 0x0 frames shown: 3039 (PresentX 3039) presents per 2 s (last 3): 49 23 26 device removals: 0 crashes: 0 peak commit: 31136 MB ``` Both without the switch: the smoke runs check that the default is unchanged. Each follows a warm-up run of the same build; the start prompt is pressed once at 70 s. Both are the first counted run after the warm-up; neither lost the device. **Not tested** - The hang of #1727 (group barriers in parallel test runs on an RTX 5070): five title runs without one is a small sample, and the lib tests were not run in parallel with the switch set. That is why this is a switch and not a new default. - The open world: the runs above end in the intro cutscene. Other titles, other NVIDIA generations, Intel. - AMD: wave64 is native there and nothing splits, so the switch does nothing. - The first runs with the switch set compile the programs it changes again (its cache identity is its own): 22 to 100 driver compiles without a stored blob after 200 s in those runs. - Whether the particle program's output is right in either form was not compared against a reference. **AI use** - Claude Code, Claude Fable 5.2: found the wait with timing experiments in the shader, wrote the change, the tests and the first description, and ran the suite and the runs on 334564ab. Gemini 4 Neon (agy) read the translated DXIL for consistency; I did not re-verify that reading line by line. - Claude Code, Claude Opus 5.5: kept the program whole at the group barrier and fixed the doc paragraph after review, ran the suite and the runs on e3dabe10, and updated this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-01 23:21:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T23:21:16Z.


Review (head 334564ab, diff read, not a merge-check):

  • The switch also brings back dispatch chains for these programs. In gpu/dxil/kernel.rs, only Partner::Spin keeps a split 64-thread program whole (~887). With XCL_WAVE64_SPIN=0 the program becomes Partner::Present (~852), so one without LDS over XCL_DIRECT_SPLIT_INSTRUCTIONS (12,500 by default) goes to split_compute (~897) and can be cut into several dispatches. Since 0f2fa3ee0 no test runs that chain path at 64 threads (module/split.rs ~971 now asserts the program stays whole), the PR's tests do not cover it, and the description does not mention this second effect.
  • The doc paragraph is still wrong about the HLSL default. docs/wave64-on-wave32.md ~75 still says "Both translators use this variant [the counters] by default for one console wave per group", but x64_spin_for (recomp/emit.rs ~6554) gives the HLSL path's one-wave groups the group barrier by default, as the description says; the rewritten sentence after it still reads as if both default to the counters.

Fine: opt-in with the default unchanged; one_wave_spin_wanted is only checked for compute and mesh groups of 33 to 64 threads; the test override reaches the translator thread; the switch is already in the compute and pipeline cache keys (ComputePolicyKey::wave64_spin, semantic_pipeline_setting, cache_allowed); multi-wave groups keep the counters, and the test checks it.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7329241427 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7329241427). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T23:21:16Z. --- Review (head 334564ab, diff read, not a merge-check): - **The switch also brings back dispatch chains for these programs.** In `gpu/dxil/kernel.rs`, only `Partner::Spin` keeps a split 64-thread program whole (~887). With `XCL_WAVE64_SPIN=0` the program becomes `Partner::Present` (~852), so one without LDS over `XCL_DIRECT_SPLIT_INSTRUCTIONS` (12,500 by default) goes to `split_compute` (~897) and can be cut into several dispatches. Since 0f2fa3ee0 no test runs that chain path at 64 threads (`module/split.rs` ~971 now asserts the program stays whole), the PR's tests do not cover it, and the description does not mention this second effect. - **The doc paragraph is still wrong about the HLSL default.** `docs/wave64-on-wave32.md` ~75 still says "Both translators use this variant [the counters] by default for one console wave per group", but `x64_spin_for` (`recomp/emit.rs` ~6554) gives the HLSL path's one-wave groups the group barrier by default, as the description says; the rewritten sentence after it still reads as if both default to the counters. Fine: opt-in with the default unchanged; `one_wave_spin_wanted` is only checked for compute and mesh groups of 33 to 64 threads; the test override reaches the translator thread; the switch is already in the compute and pipeline cache keys (`ComputePolicyKey::wave64_spin`, `semantic_pipeline_setting`, `cache_allowed`); multi-wave groups keep the counters, and the test checks it. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
i7Gamer commented 2026-12-02 01:24:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by i7Gamer on 2026-12-02T01:24:58Z.


Independent NVIDIA validation: RTX 5090, driver 616.56, Windows 11. The DXIL structure test and synthetic GPU readback test passed without skips on base 1c8b5514, PR head 334564ab, and integration ab09d222. The four-thread integration suite also passed: 2,909 passed, 0 failed, 51 ignored.

This covers the tested wave32 compute case. The larger dispatch-chain path, native wave64, mesh-stage execution, and retail titles were not tested. Would a separate synthetic compiler test for the larger dispatch chain be useful?

<!-- greyfinch-sync:ivall/xcl:comment:7331679927 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7331679927). Originally posted by [i7Gamer](https://github.com/i7Gamer) on 2026-12-02T01:24:58Z. --- Independent NVIDIA validation: RTX 5090, driver 616.56, Windows 11. The DXIL structure test and synthetic GPU readback test passed without skips on base `1c8b5514`, PR head `334564ab`, and integration `ab09d222`. The four-thread integration suite also passed: **2,909 passed, 0 failed, 51 ignored**. This covers the tested wave32 compute case. The larger dispatch-chain path, native wave64, mesh-stage execution, and retail titles were not tested. Would a separate synthetic compiler test for the larger dispatch chain be useful?
i7Gamer commented 2026-12-02 13:19:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by i7Gamer on 2026-12-02T13:19:54Z.


Follow-up on the larger dispatch-chain case: I ran a synthetic regression test on 334564ab with the test-only patch applied (RTX 5090, driver 616.56, Windows 11). It produced two dispatch pieces. The whole and chained GPU readbacks both matched the CPU reference, and the buffer guards passed. The test ran once and passed without skipping.

This covers the tested split-wave64 compute case on hardware wave32. It doesn’t cover native wave64, mesh execution, or retail titles. I can share the test patch here or open a separate test-only PR, whichever you prefer.

AI assistance: Codex drafted the test and ran the validation.

<!-- greyfinch-sync:ivall/xcl:comment:7346706740 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7346706740). Originally posted by [i7Gamer](https://github.com/i7Gamer) on 2026-12-02T13:19:54Z. --- Follow-up on the larger dispatch-chain case: I ran a synthetic regression test on 334564ab with the test-only patch applied (RTX 5090, driver 616.56, Windows 11). It produced two dispatch pieces. The whole and chained GPU readbacks both matched the CPU reference, and the buffer guards passed. The test ran once and passed without skipping. This covers the tested split-wave64 compute case on hardware wave32. It doesn’t cover native wave64, mesh execution, or retail titles. I can share the test patch here or open a separate test-only PR, whichever you prefer. AI assistance: Codex drafted the test and ran the validation.
bmjask commented 2026-12-02 16:21:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:21:28Z.

Review: COMMENTED


Review of 334564ab: 1 finding(s) (1 medium), most severe first.

  1. Medium crates/xcl/src/gpu/dxil/kernel.rs:887: see below.

On lines outside the diff:

  1. Medium crates/xcl/src/gpu/dxil/kernel.rs:887: Not certain about this one: with XCL_WAVE64_SPIN=0, split one-wave [64,1,1] compute programs without LDS are no longer kept whole. finish_dispatch sends them to split_compute(numthreads, split_tid, limit), whose barrier-exchange cut detection and per-piece lane re-assignment have had no production use since #1741 and no GPU test with Partner::Present. A title's numthreads(64,1,1) program over 12,500 instructions (likely including the PR's 370 KB particle program) is cut into a dispatch chain. If a cut breaks the exchange (store, barrier, load, barrier), or the arrival-order half assignment in a later piece, continuation values come out silently wrong. The PR's tests check one whole program (mask_exchange) and a disassembly, never a chained Present program. Keeping Present programs whole, as before, until the chained form has a GPU test would avoid the risk.

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:6154787969 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#pullrequestreview-6154787969). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T16:21:28Z. **Review:** COMMENTED --- Review of `334564ab`: 1 finding(s) (1 medium), most severe first. 1. **Medium** `crates/xcl/src/gpu/dxil/kernel.rs:887`: see below. **On lines outside the diff:** 1. **Medium** `crates/xcl/src/gpu/dxil/kernel.rs:887`: Not certain about this one: with XCL_WAVE64_SPIN=0, split one-wave `[64,1,1]` compute programs without LDS are no longer kept whole. `finish_dispatch` sends them to `split_compute(numthreads, split_tid, limit)`, whose barrier-exchange cut detection and per-piece lane re-assignment have had no production use since #1741 and no GPU test with Partner::Present. A title's `numthreads(64,1,1)` program over 12,500 instructions (likely including the PR's 370 KB particle program) is cut into a dispatch chain. If a cut breaks the exchange (store, barrier, load, barrier), or the arrival-order half assignment in a later piece, continuation values come out silently wrong. The PR's tests check one whole program (`mask_exchange`) and a disassembly, never a chained Present program. Keeping Present programs whole, as before, until the chained form has a GPU test would avoid the risk. --- _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._
bmjask commented 2026-12-02 16:21:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:21:31Z.


@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.

<!-- greyfinch-sync:ivall/xcl:comment:7351825000 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7351825000). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T16:21:31Z. --- @Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
BBareth commented 2026-12-03 01:46:26 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T01:46:26Z.


Updated to e3dabe10 (rebased on main 078358a0) after @Foniass's review of 334564ab:

  • Dispatch chains: right, Partner::Present let a split 64-thread program over the instruction limit go to split_compute. finish_dispatch now keeps a split program at the group barrier whole, as it does for one with the counters. So the switch changes only how the halves meet and brings back no chains. New test: a_split_wave64_compute_program_at_the_group_barrier_stays_whole. Native wave32 programs are not split and still chain as before; they use Partner::Present too.
  • Doc paragraph: rewritten. The direct translator defaults to the counters (=0 gives the group barrier and no chain); the HLSL path defaults to the group barrier (=1 gives the counters).

@i7Gamer, thanks for the 5090 runs and the chain test. With this change the switch no longer sends these programs into a chain, so the chain path stays as on main and this PR doesn't need that test. It would still make a good test-only PR for the chain path itself.

Suite on e3dabe10: 3007 passed, 0 failed, 52 ignored, 28 SKIPPED. Smoke blocks in the description are rerun on this head. One 420 s title run with the switch on this head: no hang, no device removal, no crash. The timing table in the description is still from the previous head.

AI use: Claude Code (Claude Opus 5.5) made the change, ran the suite and the runs, and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7364718132 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7364718132). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-03T01:46:26Z. --- Updated to e3dabe10 (rebased on main 078358a0) after @Foniass's review of 334564ab: - **Dispatch chains:** right, `Partner::Present` let a split 64-thread program over the instruction limit go to `split_compute`. `finish_dispatch` now keeps a split program at the group barrier whole, as it does for one with the counters. So the switch changes only how the halves meet and brings back no chains. New test: `a_split_wave64_compute_program_at_the_group_barrier_stays_whole`. Native wave32 programs are not split and still chain as before; they use `Partner::Present` too. - **Doc paragraph:** rewritten. The direct translator defaults to the counters (`=0` gives the group barrier and no chain); the HLSL path defaults to the group barrier (`=1` gives the counters). @i7Gamer, thanks for the 5090 runs and the chain test. With this change the switch no longer sends these programs into a chain, so the chain path stays as on `main` and this PR doesn't need that test. It would still make a good test-only PR for the chain path itself. Suite on e3dabe10: 3007 passed, 0 failed, 52 ignored, 28 SKIPPED. Smoke blocks in the description are rerun on this head. One 420 s title run with the switch on this head: no hang, no device removal, no crash. The timing table in the description is still from the previous head. AI use: Claude Code (Claude Opus 5.5) made the change, ran the suite and the runs, and wrote this.
Foniass commented 2026-12-03 01:48:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T01:48:48Z.


Follow-up review of e3dabe10, since 334564ab (code reading only, not a merge-check) · no new findings

In short: This push answers both points from my last review. With XCL_WAVE64_SPIN=0, a split one-wave compute program that meets its other half at the group barrier is now kept whole above the dispatch piece limit, as with the counters, so no dispatch chain of that untested form is made. A test checks it. The doc paragraph now gives each translator's default correctly. Nothing blocks it.

Checked and fine
  • Earlier finding fixed: the switch brought back dispatch chains. finish_dispatch (gpu/dxil/kernel.rs ~941) now skips split_compute when self.split && self.partner == Partner::Present.
  • That condition does not change the default path. For compute and mesh groups, Partner::Present is chosen only for 33-64 threads with one_wave_spin_wanted() false (~907), so only with the switch. Smaller groups get Missing and larger ones Spin, as before.
  • a_split_wave64_compute_program_at_the_group_barrier_stays_whole builds a program well past the piece limit under the switch, asserts Partner::Present, then checks it has no dispatch chain and validates.
  • Earlier finding fixed: docs/wave64-on-wave32.md ~75-78 now says the direct translator uses the counters by default for one-wave compute and mesh groups, XCL_WAVE64_SPIN=0 gives them the group barrier with no chain, and the HLSL path uses the group barrier by default (=1 gives it the counters).
  • The test override of IDIOMS_IN_TEST now reaches the translator thread, like the spin override.

Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7364762542 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7364762542). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-03T01:48:48Z. --- **Follow-up review** of `e3dabe10`, since `334564ab` (code reading only, not a merge-check) · no new findings **In short:** This push answers both points from my last review. With `XCL_WAVE64_SPIN=0`, a split one-wave compute program that meets its other half at the group barrier is now kept whole above the dispatch piece limit, as with the counters, so no dispatch chain of that untested form is made. A test checks it. The doc paragraph now gives each translator's default correctly. Nothing blocks it. <details><summary>Checked and fine</summary> - Earlier finding fixed: the switch brought back dispatch chains. `finish_dispatch` (`gpu/dxil/kernel.rs` ~941) now skips `split_compute` when `self.split && self.partner == Partner::Present`. - That condition does not change the default path. For compute and mesh groups, `Partner::Present` is chosen only for 33-64 threads with `one_wave_spin_wanted()` false (~907), so only with the switch. Smaller groups get `Missing` and larger ones `Spin`, as before. - `a_split_wave64_compute_program_at_the_group_barrier_stays_whole` builds a program well past the piece limit under the switch, asserts `Partner::Present`, then checks it has no dispatch chain and validates. - Earlier finding fixed: `docs/wave64-on-wave32.md` ~75-78 now says the direct translator uses the counters by default for one-wave compute and mesh groups, `XCL_WAVE64_SPIN=0` gives them the group barrier with no chain, and the HLSL path uses the group barrier by default (`=1` gives it the counters). - The test override of `IDIOMS_IN_TEST` now reaches the translator thread, like the spin override. </details> <sub>Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.</sub>
BBareth commented 2026-12-03 07:40:34 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T07:40:34Z.


Test report for this head (e3dabe10): the switch's effect in a retail title's gameplay.

Tree: main 395405e4 merged with #3094 (8a28d317), #3282 (ea91c5f4) and this PR (e3dabe10), release.

Hardware: RTX 5070 Ti, driver 32.0.16.2124; i7-12700K; Windows 11 Pro 26200.

Settings: the 16-window layout, without which this title's world stays black:

  • XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_VIEW_REACH_MB=36 XCL_MIRROR_FILL_MB=128 XCL_TWO_PASS_MB=4096
  • XCL_TEXTURE_LEVEL_PAGES=1 XCL_ALIAS_COPY=1 XCL_PAIR_PAGES=1

Runs: 1300 s each, A pressed once at 70 s, the same binary and warm shader caches; only XCL_WAVE64_SPIN differs. Each run spends its last ~17 minutes in the first gameplay scene.

run XCL_WAVE64_SPIN presents per minute, 360–1200 s (median, min–max) frames removals / crashes
1 0 85 (81–86) 4665 0 / 0
2 0 92 (86–94) 4800 0 / 0
3 default 59 (52–62) 4220 0 / 0
4 default 63 (59–66) 4401 0 / 0

With the switch, gameplay runs about 45 % faster.

Image: the lit HDR target, dumped with XCL_DUMP_TARGETS after 900 or 1000 s, looks the same with and without the switch. That includes a speckled patch over one window, which appears in runs with both settings. The three RGBA8 G-buffer targets have the same number of drawn texels within 1 %. The format-29 target varies between runs, from 134,066 to 186,423 of 230,400 sampled texels, and the lowest count is in one of the default runs. The other default run (185,767) is close to both runs with the switch, so the difference does not follow the switch.

Not checked: AMD; a wave64 adapter.

AI use: Claude Code, Claude Opus 5.5 ran the runs and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7371288263 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3625#issuecomment-7371288263). Originally posted by [BBareth](https://github.com/BBareth) on 2026-12-03T07:40:34Z. --- Test report for this head (e3dabe10): the switch's effect in a retail title's gameplay. **Tree**: main 395405e4 merged with #3094 (8a28d317), #3282 (ea91c5f4) and this PR (e3dabe10), release. **Hardware**: RTX 5070 Ti, driver 32.0.16.2124; i7-12700K; Windows 11 Pro 26200. **Settings**: the 16-window layout, without which this title's world stays black: - `XCL_HEAP_WINDOWS=1 XCL_UMA_WINDOWS=16 XCL_VIEW_REACH_MB=36 XCL_MIRROR_FILL_MB=128 XCL_TWO_PASS_MB=4096` - `XCL_TEXTURE_LEVEL_PAGES=1 XCL_ALIAS_COPY=1 XCL_PAIR_PAGES=1` **Runs**: 1300 s each, A pressed once at 70 s, the same binary and warm shader caches; only `XCL_WAVE64_SPIN` differs. Each run spends its last ~17 minutes in the first gameplay scene. | run | `XCL_WAVE64_SPIN` | presents per minute, 360–1200 s (median, min–max) | frames | removals / crashes | |---|---|---|---|---| | 1 | 0 | 85 (81–86) | 4665 | 0 / 0 | | 2 | 0 | 92 (86–94) | 4800 | 0 / 0 | | 3 | default | 59 (52–62) | 4220 | 0 / 0 | | 4 | default | 63 (59–66) | 4401 | 0 / 0 | With the switch, gameplay runs about 45 % faster. **Image**: the lit HDR target, dumped with `XCL_DUMP_TARGETS` after 900 or 1000 s, looks the same with and without the switch. That includes a speckled patch over one window, which appears in runs with both settings. The three RGBA8 G-buffer targets have the same number of drawn texels within 1 %. The format-29 target varies between runs, from 134,066 to 186,423 of 230,400 sampled texels, and the lowest count is in one of the default runs. The other default run (185,767) is close to both runs with the switch, so the difference does not follow the switch. **Not checked**: AMD; a wave64 adapter. AI use: Claude Code, Claude Opus 5.5 ran the runs and wrote this report.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3625:upstream-pr/3625'
git switch 'upstream-pr/3625'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3625'
git switch 'upstream-pr/3625'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3625'
git switch 'upstream-pr/3625'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3625'
git switch 'main'
git merge --squash 'upstream-pr/3625'
git switch 'main'
git merge --ff-only 'upstream-pr/3625'
git switch 'main'
git merge 'upstream-pr/3625'
git push origin 'main'
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!3625
No description provided.