Repository navigation
Direct DXIL: bound single-wave split exchanges - #1741
hajduzsolt wants to merge 1 commit into
Conversation
|
On an NVIDIA wave32 card the #1727 hang still happens with this PR, as often as on Tested
Not tested
AI use
|
|
Test report from split-wave64 hardware (the case listed under "Not tested"), plus a correction on the motivation. RTX 5070 12 GB (wave32 only), driver 621.24, Windows 11 26H2, rustc 1.100.0, DXC 1.9.2602.17, PR head 254f51a (base 85e3826). Correctness: #1727 hang: this does not fix it. I wrote #1727's barrier hypothesis and later bisected it to the sparse VRAM test, which
An equivalent local patch earlier gave 9/15 vs 9/15 on c160d86, so I would not read the 9 vs 2 as this PR making it worse; Review notes (from reading the code, not tested):
AI use: Claude Code (claude-opus-5-5) ran the tests and measurements and drafted this comment; I reviewed it. |
Brings xcl-dev#1747, xcl-dev#1791, xcl-dev#605, xcl-dev#1679, xcl-dev#1806, xcl-dev#1745, xcl-dev#1307, xcl-dev#1321 among others. Resolutions: - dxil/kernel.rs: upstream's Lw::new / Lw::finish; the safe s_barrier state and policy and xcl-dev#1741's single-wave bounded exchange move into Lw::new, with a safe_barrier flag (false for the per-lane lowering). - dxil/lower.rs: VAR_BAR_DEAD moves to VAR_BUDGET + 6 (+5 is VAR_F32_MODE). - TRANSLATOR_VERSION 9. - d3d12x/bind.rs: the bounded ExecuteIndirect call runs inside fresh_indirect_arguments. - d3d12x/list_x.rs: tracked_list_type, and transition (pub(super)) over the batched transitions. - recomp/mod.rs: compact backend and per-lane modules both kept; the oversized-structured-code fallback applies to translate after prepare. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
|
A test of this PR on split-wave64 NVIDIA hardware, the case under Not tested. Counts only. Setup:
Warm caches hide this PR. Result on a retail title:
A cost: the bounded exchange grows the largest compute program from 4.0 MB to 6.2 MB of DXIL. The NVIDIA driver took 92 s to build it once, and with 32 GB of RAM (47 GB commit limit) four runs and two precompile attempts ran out of memory while it was building. For the other runs I kept the group barrier locally for that one program. Not tested: the whole suite on this tree; AMD; the HLSL path; the title without the other PRs listed above. AI use: Claude Code (Claude Opus 5.5) applied the PR locally, ran the builds, tests and runs, read the logs and dumps, and wrote this comment. |
…ges by counters A wave64 program on 32-lane hardware runs as two hardware halves that exchange ballot words and lane values. Groups of more than one console wave do that through bounded group-shared counters; a group of exactly one (33 to 64 threads) met at a group barrier at every exchange. Those barriers hung NVIDIA GPUs when several such programs ran at once (xcl-dev#1727: device hung and driver event 153 in 11 of 25 parallel runs of the lib tests on an RTX 5070, none on the HLSL path, whose exchange spins by default). A retail title's world runs such programs on several queues at once and ended in a driver time-out with no shader exception. A compute or mesh group of one console wave now takes the counter exchange too (its slots and counters are made for it when the program has no LDS). Geometry programs, which set their partner by phase, and the tests' kernel form keep the barrier. The change is that of xcl-dev#1741 (hajduzsolt), which is open and written against an older main; applied here by hand. Not run on a GPU. The test checks the translated program: one group barrier (the start's) and the counters' atomics for 33, 64 and 128 threads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thank you for the detailed reports and the correction to the original motivation. The results do not establish this as a fix for #1727; the change should be evaluated as separate split-wave hardening. The direct-DXIL source-hash cache fix in #1947 has since merged upstream. I tested a local rebase with a single-wave barrier fallback, but have not pushed it: the updated tree introduced three failing dispatch-splitting tests, including invalid PHI nodes. Its workspace run had 1,193 passed, 5 failed and 26 ignored in the xcl unit suite. A separate run on upstream |
|
Thank you for the testing and review. I am closing this change: the bounded spin exchange uses group-shared counters and atomics, while the current dispatch splitter cannot safely carry that state across dispatch boundaries. Supporting it requires a broader splitter redesign. The barrier fallback passes the split-dispatch fixtures, but its synchronization behavior does not establish an equivalent fix for the originally proposed spin path. |
…ing them After the merge of upstream's dispatch chains, a single split wave64 of a compute group (64 threads, two hardware wave32 halves) meets its other half through group-shared counters its entry zeroes (Partner::Spin, xcl-dev#1741), and the exchange's running number (VAR_XK) counts from the program's start. A later piece of a chain is a new dispatch: its prefix zeroes the counters again, so its first exchange waits for a count they never reach, stalls for 2^20 polls and then reads 0 for the other half. split_compute refused every such program only by accident (the xcl_xc global, the atomics and the TGSM fences), and upstream's wave64 chain tests still expected a chain: on a GPU with wave32 they panic at chain.expect(...). - kernel.rs finish_dispatch: a program with a split thread id and the spin exchange is not given to split_compute at all; it is built whole as before (optimize + finish_optimized, the same output as try_finish), with a log line when it is above XCL_DIRECT_SPLIT_INSTRUCTIONS saying why. - split.rs tests: compare() and dispatch_chain_divergent_forward_edges_3d now build and check the program on the CPU before the wave32 skip. At 64 threads they assert that split_compute keeps the program whole and run only the whole program on the GPU; at 32 threads they still require a chain of at least 3 pieces and compare it with the whole one. On the merged tree the 64-thread case fails on the software adapter this way (chain None where the test expected a chain). compare()'s loop blocks register their edges with the translator's SSA (lw.block / lw.br / lw.cond_br): the spin exchange reads VAR_XK / VAR_XDEAD through it, and with raw blocks the 64-thread whole program failed validation (a PHI with no entries). - kernel.rs test a_split_wave64_compute_program_stays_whole: a 64-thread split program with exchanges before and after 40 cuttable blocks goes through finish_dispatch with a piece limit and comes out whole and valid. Tested (agentcargo wrapper, software adapter, release): test --release -p xcl --lib -- --test-threads=4 gpu::dxil:: 169 passed, 0 failed, 3 ignored. The CPU halves of the chain tests ran; their GPU halves printed SKIPPED (no wave32 GPU): dispatch_chain_wave32_live_loops, dispatch_chain_wave64_live_loops_and_exchange, dispatch_chain_oversized_loop_matches_whole, dispatch_chain_divergent_forward_edges_3d, dispatch_chain_payload_*. Not run: the 54 tests that open the hardware GPU themselves (the wrapper skips them); no GPU run of the whole 64-thread fixtures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runtime fix verified with unit tests and RX 9070 XT smoke run.
What is in it
Tested
cargo test -p xcl --lib split_single_wave_uses_bounded_exchange -- --test-threads=2passed.XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu_split_wave64 -- --test-threads=1 --nocapturepassed (5 passed, no reported skips).cargo test --workspace -- --test-threads=2passed; library tests: 827 passed, 22 ignored. Other test binaries also passed. Runtime GPU skips were not individually assessed in this run.Regression run
main:
PR:
Not tested
AI use