Repository navigation
Recompiler: give each split handoff value one scratch slot and load it where it's used - #2126
Conversation
|
Thanks for distinguishing the dispatch and scratch effects. PortBridge checked a conservative last-consumer reuse rule against nine synthetic lifetime arrangements at the dimensions in this PR. At the ef008c0f dimensions, the model requested 11.14 MiB for 64 groups with fixed slots, and 3.15, 6.29, or 11.14 MiB with reuse depending on the lifetimes. The modeled read/write counts stayed the same and all 50,865 value checks per arm and order passed. Reusing a slot in the same dispatch as the last read failed the write-first control. The existing overlapping-edge fixture is a good check for keeping those slots separate. For actual plans, per-program totals in dwords per group with fixed slots versus reuse strictly after the last consuming piece would decide whether a prototype is worthwhile. Aggregates are enough without sharing shader inputs. The CPU model leaves GPU speed to a separate measurement. PortBridge #54 is open for optional independent runs of the two pinned tests on Radeon and Intel Arc. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
AMD RDNA4 data for #2126: on top of #2080, the split builds 1.76× faster in wall time and do 2.36× less driver work. That makes the split 14.4× faster than the whole programs on the RX 9070 XT. The 17 programs and the method are the same as in my #2080 report. Every whole and piece build succeeded. Setup
Method
Totals (mean of 2 rounds)
Per program (split wall, mean of 2 rounds)
Read / inference
Tests on this card
Not tested
AI use: Claude Code (Claude Opus 5.5) ran the measurement and drafted this. Counts and timings only, no game data. |
|
@bielfreedom, thank you. On RDNA4 the summed driver work of the pieces drops 2.36×, more than on NVIDIA (1.8–2.0× on the three programs in the description), so machines with few free PSO workers gain too. I've added your numbers and the 27/0/1 test run to #2126's description. AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Following up with a replay on the actual XCL planner and emitter at 3283da4. PortBridge's replay and raw results include the pinned inputs and a clean reproduction guide. Strict reuse after the last consuming piece reduced the published native Wave32 loop fixture from 288 to 256 DWORDs per group (11.1%), reaching its peak live-word bound. Static payload accesses stayed at 12 reads and 8 writes. The two original payload fixtures kept 128 and 160 DWORDs per group and emitted byte-identical DXIL. All 28 emitted pieces passed DXV. The CPU replay matched 832 scratch words per layout and access order. Deliberately aliasing the overlapping control produced 32 mismatches. That is a capacity result for the synthetic plans. GPU timing and stride on the three measured programs remain open. The replay compares the fixed stride, the peak live-word bound and the assigned stride without requiring shader inputs to be shared. Thanks for adding the independent Radeon results. Both pinned tests are covered there, so PortBridge #54 now asks for the remaining Intel Arc run. |
|
Tested At cargo test --locked -p xcl --lib --no-run --message-format=json-render-diagnostics
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test {
& 'L:/XclTooling/pr1947-1831ec4-t3-97236edf/target/debug/build/xcl/97fdf2b9ff8e1482/out/xcl-97fdf2b9ff8e1482.exe' `
'gpu::dxil::module::split::tests::dispatch_chain_payload_skips_middle_piece' --exact --test-threads=1 --nocapture
}1 passed, 0 failed, 0 ignored, 0 GPU skips, 1,129 filtered out, 0.50 s. The executable SHA-256 matched before and after mutex acquisition. The stock wave32 fixture issued one whole-shader dispatch and three direct-DXIL chain dispatches, each with a Not tested Reused-edge-slot stress, overflow, negative inputs, other fixtures or adapters, performance, full suite, and retail smoke. AI use T3 Code / Codex ( |
|
Native Windows verification of 3283da4 from a clean checkout. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. Tested
Not tested AI use |
|
Kalmarv, PortBridge found one capacity case that the first-fit order in our earlier scratch census misses. On a new four-piece Wave32 fixture using your pinned #2126 planner and DXIL emitter, fixed slots and the earlier first-fit order both used 192 DWORDs per group. Placing longer-lived values first among values defined in the same piece reached the exact 160-DWORD bound (−16.7%) with the same strict last-consumer rule. The two-word transport value fits without adding slots. The static count stayed at 7 reads and 5 writes. CPU replay matched 224 words per checked order, and DXV validated all 12 emitted pieces. For the three #2126 plans, a useful aggregate is whether the first-fit stride exceeds the peak live-word bound. Where it does, the two orders can be compared without sharing the shaders. The Intel Arc A770 report covers the skip-middle-piece case. Reused-edge-slot on Intel and GPU timing remain open. The independent RTX 3080 Ti run covered both existing cases at the same revision. PortBridge reproducer · Earlier replay Synthetic CPU and DXV checks developed in PortBridge with Codex using GPT-6. |
|
Kalmarv, PortBridge turned the strict lifetime rule and the same-piece ordering from the preceding checks into a one-file patch and runnable evidence on With the real planner and emitter, the Wave32 loop used 288 → 256 DWORDs/group and the four-piece fragmentation case used 192 → 160. The upstream skip-middle and overlap controls kept their original DXIL bytes. Microsoft DXV accepted all 58 generated variants. Replay matched 1,056 words per access order, and the allocator matched an independent reference for 6,585 lifetimes across 128 seeded cases. The patch is available as an optional add-on if it fits your stack. Its GPU runs and timings on the three upstream programs remain open. The existing Arc A770 skip-middle run covers the original revision. PortBridge ran the checks with Codex. |
|
@akimfomin, thanks. #2126 stays as it is for review, since its runs and reports are all on Your patch covers both rules: reuse only after the last carrying destination, and the same-piece ordering. The original offsets stay whenever packing saves nothing. That makes it a good base. PortBridge is MIT, so it can come over with a provenance note and a What it still needs before it's worth a PR is the scratch per group and GPU time on ef008c0f, c3ae6819 and fb1c6d2d. Those are where #2126 grew scratch 3.5–5.4×. Nobody has started that follow-up yet. AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
#2126 and #2107 compound on AMD RDNA4. On the 13 programs that only #2107 splits on the RX 9070 XT, the split wall drops from 87.3 s to 34.3 s with this PR on top. That is 24× faster than whole. It includes Setup
Method
Read: with both PRs, every one of these 13 programs builds in 2–3.3 s on a 16-thread CPU. On AMD Windows, the HLSL path takes 1–2 minutes per program, or never finishes for Not tested: GPU output of the merged form beyond the chain tests, a title run, RDNA2 and RDNA3. AI use: Claude Code (Claude Opus 5.5) ran this and drafted it. Account owner away; counts and timings only, no game data. |
|
Thanks, Kalmarv. Agreed on using the reviewed The probe reproduced 288 → 256 and 192 → 160 DWORDs/group on two public synthetic fixtures. Scratch and GPU time for the three RTX workloads still need measurement with your inputs. Pinned kit and exact protocol Codex helped prepare and verify the kit. |
|
Kalmarv, PortBridge linked a new independent report from thehollowedone to the exact compact-slot candidate on This adds synthetic hardware correctness coverage. Scratch per group and GPU time for AI use: Codex (GPT-6, exact variant unavailable) verified the public report and patch digest and drafted this update. |
3b6f7d3 to
c9e3945
Compare
|
Regression run of Against the limits in CONTRIBUTING.md: 104 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
c9e3945 to
303455a
Compare
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)
303455a to
f6fa8a9
Compare
|
Independent check on One CPU-only comparison on the same local compute record with Compact-slot follow-up: The PortBridge candidate from On the RTX 5070 Ti Laptop, AI use: OpenAI Codex (GPT-6.2 Sol) assisted with verification. Originally posted by @ettehn in #2126 (comment) |
|
Tested Independent verification on clean
Commands: I ran the same targeted filter on the 9800X3D's Radeon RDNA2 iGPU (driver The two NVIDIA workspace failures match those documented against Not tested: I did not independently rerun that base, run an AMD workspace suite, or test retail performance, driver compile times, or smoke on this head. AI use Ran via Samaritan:
|
|
Merged as Tested on the merged tree: AMD RDNA4, Windows, DXC 1.8.2502.11, debug. In a title (these heads on Conflicts with #1592 ( AI use: Claude Code (Claude Opus 5.5) merged it, ran the tests and wrote this on the maintainer's behalf. |
Stack PortBridge's compact allocator on Kalmarv's merged xcl-dev#2126 baseline. Preserve the earlier scratch layout whenever packing saves no space and retain same-stage ordering. AI use: OpenAI Codex (GPT-6 family; exact serving variant was not exposed) assisted with rebasing, code review, synthetic regression checks and preparation of this fork branch for human review.
Part of #1269. Stacked on #2080: only the last two commits are new here,
ad03e65(the change) andf6fa8a9(its tests). They were522b1b5and3283da4before the rebase ontomain9633138.The split in #2080 hands every value live across a cut to the next piece through scratch, and the next piece loads all of them at its entry. A value used several pieces later is stored and loaded again at every cut it crosses, and inside each piece it stays live from the entry to its first use. In one 18,415-instruction ef008c0f piece, 38 % of the values the driver has to keep live across blocks were such handoff values, most of them first used 8 or more blocks after the entry. The NVIDIA driver's build time grows with values live across blocks, so those long ranges cost build time as well as GPU time. Synthetic modules built cold show this: with many live values and memory operations, cost per instruction goes from 24 µs to 65 µs.
With this change the title's three largest direct compute programs build about 1.7–2.1× faster again than with #2080 alone (12–18× faster than whole). On the late shading path the split's GPU time drops from 1.59× the whole program's to 1.23×.
@akimfomin's fixed slot for first-piece values on #2080 (comment) is the narrow case of this; here every carried value gets one.
What is in it
crates/xcl/src/gpu/dxil/module/split.rs:crates/xcl/src/gpu/dxil/module/opt.rs: a one-line change for the sinking.Tested
Ryzen 9 9950X, RTX 5070 Ti (NVIDIA 610.74), Windows 11 build 26200, release, DXC 1.9.2609.
Cold pipeline build of the whole chain, the title's programs as the title emits them, fresh process each, implicit caches off, pieces on 16 threads:
main)The ef008c0f chain's DXIL is 32 % smaller (1,559,560 → 1,066,052 B).
Output on the GPU, ef008c0f, two seeded inputs (an early-exit path and the late shading path): the whole program, Recompiler: split large direct compute pipelines at CFG edges #2080's split and this PR's split each write 2,048 words, 0 different, and all match the expected 2,048 texels.
GPU time, the same two inputs, the three forms taking turns after a 3 s warm-up, 4 rounds of 20, medians. The card settles at its P3 clocks under this load (memory at 7,001 MHz), so these are steady-state at P3, not full clocks; spread within ±1.5 %:
AMD RDNA4, measured by @bielfreedom (comment), RX 9070 XT, Ryzen 7 7700, on
3283da4against Recompiler: split large direct compute pipelines at CFG edges #2080's split ataf2bd61, 17 split programs, mean of 2 interleaved rounds: split wall on 16 threads 125.8 → 71.3 s (1.76×), sum of piece builds 961.8 → 408.0 s (2.36×), so 14.0× faster than the whole programs (997 s) against 8.2× with Recompiler: split large direct compute pipelines at CFG edges #2080. Every program of 9 or more pieces builds 1.2–3.0× faster; the three 2-piece programs are unchanged within noise. Peak private bytes did not change. On that carddispatch_chainandsplittests: 27 passed, 0 failed, 1 ignored (the opt-in benchmark), no skips, including both new tests.With Recompiler: give a compute loop above the split target its own dispatch piece #2107 and Recompiler: give each split handoff value one scratch slot and load it where it's used #2126 together, on AMD RDNA4, measured by @bielfreedom (comment), RX 9070 XT,
3283da4withd4b8717merged on top (clean merge): the 13 programs only Recompiler: give a compute loop above the split target its own dispatch piece #2107 splits build in 34.3 s split against 87.3 s with Recompiler: give a compute loop above the split target its own dispatch piece #2107 alone and 837.1 s whole (24.4×), each in 2.1–3.3 s. That includes 84eee477d68b6fdf, which never finishes building on the HLSL path there, in 2.6 s. Summed piece builds 693.6 → 281.9 s. On the merged tree thedispatch_chainandsplit::teststests pass, 8 of 8, with no skips.cargo test --release --offline --workspace -- --test-threads=4on5cd2c38, the same crates tree before Recompiler: split large direct compute pipelines at CFG edges #2080's README-only rebase ontomainf5c5bdf: 1160 passed, 0 failed, 46 ignored. Both new GPU tests ran. On3283da4the sixdispatch_chaintests pass again.Checked by @ettehn (comment) on
f6fa8a9, RTX 5070 Ti Laptop, DXC 1.8.2502: both payload readback tests pass, with no skips. On a local compute record that splits into 12 valid pieces on both6c34370(Recompiler: split large direct compute pipelines at CFG edges #2080) and this head, the pieces' DXIL drops from 1,927,980 to 1,257,712 bytes (−34.8 %) and scratch rises from 11,040 to 47,712 dwords per group (4.3×), in line with the scratch cost under Not tested.Checked by @itsSio (comment) on
f6fa8a9, debug, NVIDIA 610.88: on an RTX 5080 and an RTX 2080 SUPER, thedispatch_chaintests give 7 passed, 0 failed, with only the native-wave64 GPU part skipped, and the workspace suite gives 1,248 passed, 2 failed (main's two above), 46 ignored. On a Radeon RDNA2 iGPU thedispatch_chaintests give 7 passed with no skips, both payload tests included.AMD Radeon RX 9070, regression pair by @Toons29 (comment), Ryzen 7 7800X3D, on
c9e3945(this branch before the latest rebase), 60 s of a title on the default route:main568e7db1566 frames and this PR 1629, peak commit 14592 / 14593 MB, no crash or device removal in either.cargo test --workspace -- --test-threads=4(debug) onf6fa8a9, rebased ontomain9633138: 1248 passed, 2 failed, 46 ignored. The two failures,device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaaandpso::shader_cache_tests::rerouted_disk_entries_follow_the_direct_translator, fail onmain9633138too; Tests: two expectations that no longer match the code #2245 fixed both onmainsince. 25 SKIPPED notices: no native wave64 on this card, three per-lane FP16 forms the per-lane lowering refuses, and no heap windows.Regression run
The branch was rebased onto
main9633138with #2080's current head6c34370. The only change: its two GPU tests' middle blocks, which #2194 would merge with their neighbours, are now conditional, with a phi where the payload arrives.scripts/smoke.ps1 -Seconds 120, the same retail title, one after the other on the machine under Tested, release builds from clean trees.main9633138(this PR's base):this PR,
f6fa8a9:PR vs
main: 1329 / 1323 frames (100 %), peak commit 30533 / 29175 MB (105 %); device removals 0 and crashes 0 on the PR run, 0 and 0 onmain.Both runs use
XCL_DIRECT_DXIL=1and start with the same private XCL pipeline cache, holding only the pipeline list; the driver's own cache was left alone. The PR run loggedcompute split: 34 programs split, 188 pieces built, 134 chained dispatches issuedat 120 s (0 by 60 s, all 134 by 70 s), and nopiece ... refusedwarning. Before the rebase,3283da4logged 29 programs, 162 pieces, 83 chains in the same setup; how far the title gets before it stops varies between runs. Both runs present no frames in their last 6 s, for a reason this change doesn't touch.Not tested
303455a, on the samemain, before Recompiler: split large direct compute pipelines at CFG edges #2080's typed-UAV and worker fixes) crashed with an access violation in CPU texture detiling (gpu::tiling::Chain::detile_level, called fromtitle_textures::title_bytes), at 30.6 s and 59.5 s. Neither had issued a chained dispatch yet. The run on this head above was clean. The cause wasn't found, and whether this branch makes it more likely isn't known.AI use
OpenAI Codex (GPT-6.2) wrote the change, the tests and the audits. Claude Code (Claude Opus 5.5) helpers ran the driver timings and GPU checks, and Claude Code wrote this description and opened the PR.
🤖 Generated with Claude Code