Direct DXIL (nvidia-dev): one-wave split compute groups spin at every exchange because of #1727, whose barrier cause was disproved #3114

Open
opened 2026-11-28 09:12:16 +00:00 by afpruivo · 0 comments
afpruivo commented 2026-11-28 09:12:16 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by afpruivo on 2026-11-28T09:12:16Z.


On nvidia-dev, the direct translator meets the two halves of a one-wave split compute group (33–64 threads) through the counter exchange instead of a group barrier, and that costs one retail program 2.6x its GPU time (8.4 → 3.3 ms a frame on an RTX 3090). The reason given for the counters is #1727's GPU hangs, but #1727 was later bisected to the sparse VRAM test (#614), and in 16 parallel test runs here barrier meets did not hang.

Where it comes from

  • 1be95b1b "Direct DXIL: one split console wave of a compute or mesh group exchanges by counters" (in nvidia-dev through a world-main merge, not a PR; its message says "Not run on a GPU"). It applies #1741 by hand, for #1727. The comment is in crates/xcl/src/gpu/dxil/kernel.rs (the lw.partner = match t in Lw::new).
  • On #1727, IgorAntunes66 bisected the hangs to gpu_sparse_vram_descriptors_buffers_and_xmem running beside the other GPU tests: a local patch with the counter exchange for one-wave groups hung exactly as often (9/15 vs 9/15), and #614 removed the hangs. @upipibi (RTX 3070) and @PHeitor1 (RTX 5060 Ti) confirmed 0 hangs with #614, which is in nvidia-dev.
  • The HLSL path on nvidia-dev meets these groups at a group barrier by design (x64_spin_for in recomp/emit.rs: "the barrier costs a fraction of the counters", #1244).

Measured (RTX 3090 24 GB, NVIDIA 621.40, i5-13600K, Windows 11 26300, release; tree nvidia-dev 54225f58 + #609 + #2551 + local profiling hooks)

A local switch gives a compute group of one console wave Partner::Present (group barrier) again. It also keeps such a group's lanes past a thread limit in, with their EXEC bits clear (compute_gate without leave), so neither half can leave before an exchange. The per-lane bridge form (recomp::lower_dxil) keeps the counters, since one half can be in a block alone there. Mesh programs are not changed.

  1. Hangs: cargo test --release -p xcl --lib -- gpu --test-threads=4 with XCL_DIRECT_DXIL=1, the two arms interleaved, 16 runs each: 0 hangs or device removals in either arm. With barriers, the same 7 tests fail in every run, all of them assertions of the counter form (a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier, split_lds_reads_meet_after_writes, a_split_wave64_compute_program_stays_whole, three dispatch_chain_* "stays whole" checks) and a cache test the switch bypasses. All other GPU tests passed, including gpu_compute_thread_limits_leave_the_lanes_past_them_out. (A separate abort, "coherent window could not be restored … error 487", hit both arms in some runs of a first batch; it is not related to this.)
  2. Retail title, 700 s each, no crash or device removal, XCL_GPU_TIMES=16,420 (16 frames from 420 s), same inputs:
b78fa10b425b8e54 (CS_DepthProcessingHBO, 160x90 groups, split in halves) all programs split-halves programs frame (wall)
counters (nvidia-dev today) 8.4 ms 159.1 ms 51.7 ms 144.7 ms
group barrier 3.3 ms 155.9 ms 45.6 ms 147.3 ms
HLSL form (for reference) 3.2 ms 145.9 ms

The program's direct DXIL with counters has 137 spin exchanges (an atomic add, a wait loop of atomics and two fences each); with the barrier it has 269 group barriers, and its DXIL shrinks from 126 KB to 89 KB. The frame time does not move: on this tree other work bounds the frame, so this is GPU time freed, not frames gained yet. The remaining ~46 ms in split programs are mostly groups of several console waves, which need the counters (C22 on #3011 is about those).

Suggestion: give one-wave split compute groups the group barrier again on the direct path, as the HLSL path has, with the early-leave guard above and the counter-form tests changed to match. I have not opened a PR; I can, if this direction is wanted. The direct exchange also meets twice per exchange where the HLSL one meets once (double-buffered slots), which could halve the barriers again.

Not tested: Blackwell (#1727's hangs were on RTX 5070 / 5060 Ti) and other NVIDIA cards; AMD with the split form forced; output equality in play (the picture is black on this tree); mesh programs; the retail driver time-out 1be95b1b's message also mentions (I saw none in this run).

AI use: Claude Code (Claude Opus 5.5) wrote the local switch, ran the tests and the runs, and drafted this issue; I checked the numbers against the logs.

<!-- greyfinch-sync:ivall/xcl:issue:6662445805 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3114). Originally posted by [afpruivo](https://github.com/afpruivo) on 2026-11-28T09:12:16Z. --- **On `nvidia-dev`, the direct translator meets the two halves of a one-wave split compute group (33–64 threads) through the counter exchange instead of a group barrier, and that costs one retail program 2.6x its GPU time (8.4 → 3.3 ms a frame on an RTX 3090). The reason given for the counters is #1727's GPU hangs, but #1727 was later bisected to the sparse VRAM test (#614), and in 16 parallel test runs here barrier meets did not hang.** **Where it comes from** - `1be95b1b` "Direct DXIL: one split console wave of a compute or mesh group exchanges by counters" (in `nvidia-dev` through a `world-main` merge, not a PR; its message says "Not run on a GPU"). It applies #1741 by hand, for #1727. The comment is in `crates/xcl/src/gpu/dxil/kernel.rs` (the `lw.partner = match t` in `Lw::new`). - On #1727, IgorAntunes66 bisected the hangs to `gpu_sparse_vram_descriptors_buffers_and_xmem` running beside the other GPU tests: a local patch with the counter exchange for one-wave groups hung exactly as often (9/15 vs 9/15), and #614 removed the hangs. @upipibi (RTX 3070) and @PHeitor1 (RTX 5060 Ti) confirmed 0 hangs with #614, which is in `nvidia-dev`. - The HLSL path on `nvidia-dev` meets these groups at a group barrier by design (`x64_spin_for` in `recomp/emit.rs`: "the barrier costs a fraction of the counters", #1244). **Measured** (RTX 3090 24 GB, NVIDIA 621.40, i5-13600K, Windows 11 26300, release; tree `nvidia-dev` `54225f58` + #609 + #2551 + local profiling hooks) A local switch gives a compute group of one console wave `Partner::Present` (group barrier) again. It also keeps such a group's lanes past a thread limit in, with their EXEC bits clear (`compute_gate` without `leave`), so neither half can leave before an exchange. The per-lane bridge form (`recomp::lower_dxil`) keeps the counters, since one half can be in a block alone there. Mesh programs are not changed. 1. **Hangs:** `cargo test --release -p xcl --lib -- gpu --test-threads=4` with `XCL_DIRECT_DXIL=1`, the two arms interleaved, 16 runs each: **0 hangs or device removals in either arm.** With barriers, the same 7 tests fail in every run, all of them assertions of the counter form (`a_single_split_wave_of_a_compute_group_exchanges_without_a_group_barrier`, `split_lds_reads_meet_after_writes`, `a_split_wave64_compute_program_stays_whole`, three `dispatch_chain_*` "stays whole" checks) and a cache test the switch bypasses. All other GPU tests passed, including `gpu_compute_thread_limits_leave_the_lanes_past_them_out`. (A separate abort, "coherent window could not be restored … error 487", hit both arms in some runs of a first batch; it is not related to this.) 2. **Retail title, 700 s each, no crash or device removal**, `XCL_GPU_TIMES=16,420` (16 frames from 420 s), same inputs: | | `b78fa10b425b8e54` (CS_DepthProcessingHBO, 160x90 groups, split in halves) | all programs | split-halves programs | frame (wall) | |---|---|---|---|---| | counters (`nvidia-dev` today) | 8.4 ms | 159.1 ms | 51.7 ms | 144.7 ms | | group barrier | 3.3 ms | 155.9 ms | 45.6 ms | 147.3 ms | | HLSL form (for reference) | 3.2 ms | | | 145.9 ms | The program's direct DXIL with counters has 137 spin exchanges (an atomic add, a wait loop of atomics and two fences each); with the barrier it has 269 group barriers, and its DXIL shrinks from 126 KB to 89 KB. The frame time does not move: on this tree other work bounds the frame, so this is GPU time freed, not frames gained yet. The remaining ~46 ms in split programs are mostly groups of several console waves, which need the counters (C22 on #3011 is about those). **Suggestion:** give one-wave split compute groups the group barrier again on the direct path, as the HLSL path has, with the early-leave guard above and the counter-form tests changed to match. I have not opened a PR; I can, if this direction is wanted. The direct exchange also meets twice per exchange where the HLSL one meets once (double-buffered slots), which could halve the barriers again. **Not tested:** Blackwell (#1727's hangs were on RTX 5070 / 5060 Ti) and other NVIDIA cards; AMD with the split form forced; output equality in play (the picture is black on this tree); mesh programs; the retail driver time-out `1be95b1b`'s message also mentions (I saw none in this run). AI use: Claude Code (Claude Opus 5.5) wrote the local switch, ran the tests and the runs, and drafted this issue; I checked the numbers against the logs.
Sign in to join this conversation.
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#3114
No description provided.