Repository navigation
Recompiler: split direct compute programs that use guest LDS - #2299
joeypercia wants to merge 8 commits into
Conversation
Keep control-flow cycles in one pipeline, pass edge-live values through per-dispatch scratch and compile the pieces on the PSO workers. Direct dispatch records the chain with UAV ordering. Indirect dispatch builds the whole form on demand. Assisted-by: OpenAI Codex (GPT-6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The synthetic split fixture declared u2 twice with different coherence flags. Bind its existing memory window and validate the whole fixture before checking the cut. Assisted-by: OpenAI Codex (GPT-6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adjacent lanes previously accessed ef008c0f's continuation data 1,612 bytes apart. Store the tag and each live dword in a separate lane-contiguous plane; transport both halves of i64 values through their own planes. Assisted-by: OpenAI Codex (GPT-6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adopt WebIdentity1's fixture from xcl-dev#2080. Lanes return early, skip ahead over a piece, or run different numbers of loop iterations. Check the whole and split outputs against the CPU model and guard words on a 2 x 3 x 2 dispatch grid for native wave32 and split wave64. Source: xcl-dev#2080 (comment) Assisted-by: OpenAI Codex (GPT-6) Co-authored-by: WebIdentity1 <212448219+WebIdentity1@users.noreply.github.com>
Compile and validate a partitionable CFG through the native-wave64 admission gate. On a wave64 adapter, run the whole pipeline and check its lane count and output. Identify the existing compare(64) case as two hardware waves. Assisted-by: OpenAI Codex (GPT-6)
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.
|
Independent focused test of exact PR head
This adds a dedicated RX 6800M run to the author's RTX 4070 Ti and RDNA2 iGPU evidence. The synthetic wave64 cases explicitly use the split representation; they do not test native-wave64 chains. I did not run the full workspace suite, title smoke, title-program output comparison, or GPU timing on this head. AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows test, checked the fixture paths and clean exact head, and drafted this report. No game data was used. |
5e60822 to
4de5261
Compare
|
Independent check of the updated head Tested
Not tested Retail smoke, GPU or compile timings, and the full workspace suite. AI use OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the logs and wrote this report. |
Stacked on #2097; only the top commit belongs here (
4de5261). Part of #2088 (campaign task C5, LDS part).The direct-DXIL compute splitter (#2080, #2097) keeps every program that uses guest LDS whole. Its mutable-global check refuses
xcl_lds, and its scan refuses LDS loads, stores and atomics, and guests_barrier. This lets those programs split.What is in it
crates/xcl/src/gpu/dxil/module/split.rs,Shader::split_compute/make_piece:transfer_shared. In the split form, the LDS includes the exchange words at its top. The LDS is its own(global, words, slot)region after the carried values, so it can move into Recompiler: give each split handoff value one scratch slot and load it where it's used #2126's fixed-slot layout if both land.xcl_xc/xcl_xsas separate translator globals are still told apart fromxcl_lds.xcl_ldscan cross a cut as its index, like the exchange slots.Module::dispatch_plan, which now takesuniform:docs/wave64-on-wave32.md: the sentence saying LDS programs stay whole now describes the above.split.rs:uniform: None) cuts where the group does not pass together, and the restricted plan never does.dispatch_chain_lds_cuts_before_a_guest_wave_returnscovers wave 0 returning before later guest barriers. Unrestricted plans put one of those barriers in a piece that wave 0 still has to pass, and the restricted plan keeps everything from the return on in the last piece. Its split form also matches the CPU reference on the GPU.dispatch_chain_lds_poll_loop_keeps_several_waves_whole, CPU only, polls with an atomic and with a plain load. The plain-load case fails without the load rule.Tested
RTX 4070 Ti 12 GB (NVIDIA 621.40, 32-lane waves) and the AMD Radeon iGPU of a Ryzen 7 7800X3D (RDNA2,
XCL_ADAPTER=Radeon). Windows 11 Pro 26200, Rust 1.100.0, DXC 1.8.2502.11, debug.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on4de5261:pso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translatoranddevice_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaa, also fail on the base8b2fa0e. Tests: two expectations that no longer match the code #2245 fixed them onmainafter this stack's base.fuzz_tests::fuzz_validate_and_gpu_1andrecomp::tests::gpu_image_get_resinfo_past_last_level. All four also fail on8b2fa0eon the Radeon.With the uniform rule switched off locally, the four tests with several waves fail on their plan assertions. They were not run on the GPU that way.
Census of the title's compute programs (
xcl shaders <pack> --direct --sample 0 --max-bytes 0 --windows 260,XCL_DIRECT_DXIL=1, with a local logging patch):atomicBinOp(add) whose result is used. UAV atomics are another C5 item.Cold
CreateComputePipelineStateon the 4070 Ti. Each run is a fresh process under a new exe name (the driver cache is per exe name; Developer Mode is off). Pieces build in parallel, on the root signatures the runtime uses. 3 runs each:CS_Primary_PrefilterAndIntegrateIrradianceSHCS_RaytraceShadows_Shared95cc13288a27a96e(CS_ScreenProbes_ActivateRays), the title's largest compute program, is not helped by this. 280,877 of its 291,811 instructions are in one strongly connected component (15,553 blocks), which a dispatch chain cannot cut. It also has a UAV atomic add. It stays whole.GPU time, the new fixtures, 8192 groups, median of 20 timestamped dispatches on the 4070 Ti:
The cost is the LDS copy: each cut writes and reads back the whole 32 KB
xcl_ldsblock of every group, about 1.3–1.4 ms per cut at 8192 groups. Direct DXIL: size a compute program's LDS block from its LDS_SIZE #2158 (open) sizesxcl_ldsfrom LDS_SIZE, and this copy follows the array's size. For the two programs above, that is an 8 KB and a 4 KB block.Regression run
scripts/smoke.ps1, the same retail title for 60 s, one after the other on the machine under Tested, release builds from clean trees.main1a0bbe3:this PR,
4de5261:PR vs
main: 1387 / 1468 frames (94 %), peak commit 15996 / 16696 MB (96 %). Device removals 0 and crashes 0 in both. An earlier pair on5e60822, before the load rule, gave 1491 / 1548 frames.Not tested
AI use