Direct DXIL (nvidia-dev): one-wave split compute groups spin at every exchange because of #1727, whose barrier cause was disproved #3114
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 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" (innvidia-devthrough aworld-mainmerge, not a PR; its message says "Not run on a GPU"). It applies #1741 by hand, for #1727. The comment is incrates/xcl/src/gpu/dxil/kernel.rs(thelw.partner = match tinLw::new).gpu_sparse_vram_descriptors_buffers_and_xmemrunning 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 innvidia-dev.nvidia-devmeets these groups at a group barrier by design (x64_spin_forinrecomp/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-dev54225f58+ #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_gatewithoutleave), 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.cargo test --release -p xcl --lib -- gpu --test-threads=4withXCL_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, threedispatch_chain_*"stays whole" checks) and a cache test the switch bypasses. All other GPU tests passed, includinggpu_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.)XCL_GPU_TIMES=16,420(16 frames from 420 s), same inputs:b78fa10b425b8e54(CS_DepthProcessingHBO, 160x90 groups, split in halves)nvidia-devtoday)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.