Repository navigation
Recompiler: split single-wave compute groups of any shape - #2353
zohaiblazuli wants to merge 5 commits into
Conversation
Single-wave 2D/3D native wave32 compute groups (y * z > 1, total <= 32) no longer allocate @xcl_wt or emit the wave-index atomic and barriers, since tid equals WaveGetLaneIndex(). Multi-wave 2D/3D groups also skip the trailing barrier unless sharing xcl_lds[8191]. Extend direct DXIL compute dispatch splitting to all full-wave native wave32 threadgroup shapes without guest LDS (total >= 32, total % 32 == 0): size per-group scratch by total threads, preserve @xcl_wt only as the wave-ID prefix for multi-wave 2D/3D groups while gating the wave64 exchange state machine on xcl_xs, select FlattenedThreadIdInGroup() for multi-wave 1D groups, and recompute Feature::WaveOps per piece so pieces without wave ops validate. Part of xcl-dev#1269, xcl-dev#2088. Assisted-by: Antigravity (Gemini 4 Neon)
|
Two contributors checked independently and found that #2349 solves the same problem (for #2088) in a different way: #1607, group D85. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Same pair of failures seen across #2229/#2231/#2234/#2235-#2247 — shared feature area, needs fixes before merge. — Devin |
|
Thanks, @throny. #2349 and this PR overlap: both drop the @DavidM1911: both failures also fail on this stack's base AI use: Claude Code (Claude Opus 5.5). |
Use the workgroup's flat logical thread ID for the continuation of each wave32 half. Keep each counter signal with its peer wait, and transfer the per-half arrival counters and double-buffered exchange slots at a group-wide rendezvous between pieces. Wave allocation starts afresh in each piece. Leave guest LDS and partial guest waves on the whole path. Exercise four wave64s with different exchange epochs across repeated cuts and compare every output word to the whole shader and a CPU oracle. Assisted-by: OpenAI Codex (GPT-6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adopt WebIdentity1's four-wave fixture. Two guest waves return at different points while the other waves keep exchanging. Compare the whole shader and the dispatch chain to the CPU oracle across a 3D grid. Source: xcl-dev#2097 (comment) Assisted-by: OpenAI Codex (GPT-6) Co-authored-by: WebIdentity1 <212448219+WebIdentity1@users.noreply.github.com>
The dispatch-chain splitter kept every program with guest LDS whole: its mutable-global check refused xcl_lds, and its scan refused LDS loads, stores and atomics and guest barriers. Now the LDS (with the split form's exchange words at its top) is copied to the per-group scratch at each piece exit and back at the next piece's start, like the exchange slots of several split waves. Geps into it can cross a cut as their index. In the split form the lane counter lives in the LDS too, so a piece meets once more before restoring over it. One console wave follows the guest's scalar control flow, so any cut keeps its guest barriers paired. A group of several waves can branch and return apart: a piece of such a program starts only at a component every thread enters exactly once (no earlier edge jumps past it, no earlier block returns), and a loop that reads the LDS (a load or an atomic), which could poll for another wave's write past a cut, keeps the program whole.
Large direct DXIL compute shaders with guest LDS stayed whole when a single native wave32 was laid out across multiple group dimensions, or when a full guest wave64 used two hardware wave32 halves. Admit native wave32 LDS groups by their 32-thread count. Pass the flat split lane ID for a 64-thread LDS group so each piece can replay lane allocation before restoring LDS. Exercise three wave32 shapes and an 8x4x2 split wave64 group, and reject a two-wave native LDS group. Earlier measurements on an RTX 3060 with cold caches compared whole pipeline builds with pieces built in parallel: 219287eb2f6021fe 217.2 s -> 9.2 s 7b468aa4210b1810 74.9 s -> 5.9 s df45a39c275d0db5 65.7 s -> 4.0 s Assisted-by: OpenAI Codex (GPT-6.2 Sol) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7e92361 to
a81f9d5
Compare
bmjask
left a comment
There was a problem hiding this comment.
No confirmed source-level correctness defect found, but this is not merge-ready. It substantially overlaps #2349; the author notes that it must be rebased onto #2349 plus #2299 and reduced to the LDS-specific portion. Please do that before review/merge, since the current +940/-43 diff obscures the boundary. Also, the strong synthetic GPU coverage is not a substitute for current real-title smoke/regression evidence for these LDS programs. After rebasing, please provide a fresh Windows GPU/smoke comparison, particularly because snapshotting full LDS around cuts can grow generated DXIL.
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
Stacked on #2349, #2097 and #2299; only the top commit belongs here (
a81f9d5). Part of #2088 (workstream 4, large-pipeline splitting).Found independently: the 8×4×1 single-wave gate was described in #2088 (comment, 15:54 UTC) before either PR opened. #2349 covers the part without guest LDS, and this PR is reduced to the guest-LDS part on top of it.
#2349 splits native wave32 groups of any shape, but only without guest LDS. #2299 splits programs with guest LDS, but only in a
[32, 1, 1]native wave32 group or a split-wave64 group whose translator gate admits it. So a program with guest LDS in a single 8×4×1 wave stays whole. In a census of the title's 30 largest compute programs (direct DXIL, default settings), 8 of the 13 that stay whole are exactly that: wave32 8×4×1 with guest LDS, 14.3 MB of plain DXIL, each a 66–217 s cold build on an RTX 3060. With this commit all 8 split, into 15–28 pieces each.What is in it
crates/xcl/src/gpu/dxil/kernel.rs: a native wave32 group with guest LDS is offered to the splitter by its thread count (32, one wave) instead of[32, 1, 1]. A 64-thread split-wave64 group with guest LDS gets its split lane id, so each piece replays the lane allocation before restoring the LDS. Recompiler: split direct compute programs that use guest LDS #2299's description lists that case as cut, but its translator gate still kept it whole.crates/xcl/src/gpu/dxil/module/split.rs:split_computerefuses a native group with guest LDS that is more than one wave and has no split lane id. Tests: Recompiler: split direct compute programs that use guest LDS #2299's LDS fixture takes a group shape and checks each thread's x/y/z, for wave32 8×4×1, 4×8×1 and 2×4×4 and split wave64 8×4×2. It also checks that single-wave native lane setup has no group barrier, and that an 8×8×1 wave32 group with LDS (two waves) is refused.README.md: two lines on group shapes with guest LDS.Tested
RTX 3060 12 GB (NVIDIA 617.42, 32-lane waves only), Intel Core i5-14600K, 32 GB, Windows 11 Pro 26300, Rust 1.94.0, DXC 1.8.2502.11. Tests in debug, smoke and timings in release.
cargo test --workspace --no-fail-fast -- --test-threads=4ona81f9d5: 1288 passed, 0 failed, 46 ignored.SKIPPED (25): 21 wave64 cases (no native wave64), 3 per-lane f16/f32 forms the per-lane lowering refuses, and no heap windows (1). The new LDS shape tests ran on the GPU without skips. Whole and split forms each match a CPU reference word for word over 3 groups, plus 16 guard words.
Census, translation only (
XCL_DIRECT_DXIL=1, default split target, 4 windows): the 8 records split ata81f9d5and stay whole at5e8246b(the commit below):219287eb2f6021fe28 pieces,f839072880d49fb427,c963276f38285bf427,52166c345576bded19,7b468aa4210b181016,715e7a408a537ff517,f9d73adcc1ad69ef16,df45a39c275d0db515.Cold
CreateComputePipelineStatewithxcl shaders <pack> --measure-psoand a local, not-included change that builds a chain's pieces in parallel. Implicit driver caches off, fresh process, no cached blob, 1 run each. These were measured on the earlier form of this change (7e92361, on Recompiler: split direct compute programs that use guest LDS #2299), which emits the same chains for these records:219287eb2f6021fe7b468aa4210b1810df45a39c275d0db5Regression run
scripts/smoke.ps1 -Game <title> -Seconds 100, both withXCL_DIRECT_DXIL=1, since the default HLSL path does not reach this code. 100 s because the title enters a texture-heavy phase near 60 s, and peak commit differs by ~4 GB between runs that end before it and runs that end after it.Not tested
kernel.rsandmodule/split.rsfor Recompiler: split wave64 compute groups of several waves across dispatches #2097's and Recompiler: split direct compute programs that use guest LDS #2299's commits. Those commits here are my resolution of them on top of Recompiler: split native wave32 compute groups beyond [32, 1, 1] #2349, not their authors'.AI use
🤖 Generated with Claude Code