Repository navigation
Recompiler: XCL_OUTLINE_EXCHANGE=0 keeps the split-wave64 rendezvous inline - #2210
Draft
brandostrong wants to merge 2 commits into
Draft
brandostrong wants to merge 2 commits into
brandostrong wants to merge 2 commits into
Conversation
…ining them DXC inlines every helper before it optimises, so a large compute program gets a copy of the memory-window switch, the split-wave64 exchange and the typed-format conversions at every use, and the driver compiles all of them. From 1 024 instructions (256 for the format helpers) these stay [noinline] with scalar parameters, which SM 6.6 DXIL keeps as calls. Heap windows keep their single access. The EXEC bit test stays inline: as a call it made the driver slower. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inline xcl-dev#1901 decides one thing for three groups of helpers: from 1 024 instructions the memory-window accessors, the split-wave64 exchange helpers and the typed-format conversions all become `[noinline]`. The reports on that PR show the groups do not behave alike. The build win comes from the accessors and the format conversions; the dispatch-time cost is in the rendezvous helpers — 1.7 – 2.7× on an RTX 3090 (@CharlyRien), reproduced here at 1.73× on an RTX 4090 for a 32 768-iteration loop that reads a lane every iteration (42.9 ms outlined, 24.9 ms inline, 24.5 ms on `main`), and 1.02× for the same loop when it only reads a mask. Keeping the exchange inline gives the run time back. For four compute programs of a retail title that have no lane-exchange site it changes nothing the driver sees: the DXIL is byte-identical between the two settings (917 068 / 1 131 876 / 270 684 / 196 096 B, same instruction, phi and `dx.op` counts), so the switch only touches programs that actually read lanes. On the one program of that title's ten largest that does (1 030 ballot + 109 lane-read sites) it is a trade, not a free win: inline 2 075 296 B at 68.3 s cold against outlined 1 706 500 B at 55.4 – 60.1 s and `main`'s 1 933 172 B at 63.4 s, so there it buys the dispatch time and pays in the build. The variant is @CharlyRien's ("keeping the exchange inline and outlining only the accessors and the format helpers … would keep most of the build gain; I have not measured those variants"); this puts it behind a switch so it can be measured without editing the emitter. Default behaviour is unchanged: `cargo test --release --offline --workspace -- --test-threads=4` gives 1155 passed, 0 failed, 46 ignored on both this branch and xcl-dev#1901 alone, with the same 24 `SKIPPED` lines. Not measured: AMD (the RDNA3 / RDNA4 failures on xcl-dev#1901 are in the outlined switch-form accessors, which this switch does not touch), native wave64 GPUs (no split form, so the switch is a no-op), and the title's own programs' exchange counts per iteration. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes and why. #1901 decides one thing for three groups of helpers: from 1 024 instructions the memory-window accessors, the split-wave64 rendezvous and the typed-format conversions all become
[noinline]. The reports on that PR show the three groups do not behave alike — the build win comes from the accessors and the format conversions, while the dispatch-time cost (@CharlyRien's 1.7 – 2.7× on Ampere, reproduced here at 1.73× on an RTX 4090) is entirely in the rendezvous helpers, and their "keeping the exchange inline and outlining only the accessors and the format helpers … would keep most of the build gain; I have not measured those variants" is exactly this. This splits the decision in two and puts the exchange group behindXCL_OUTLINE_EXCHANGE=0, which keeps it inline, so the variant can be measured without editing the emitter. Nothing changes by default.What is in it
crates/xcl/src/gpu/recomp/emit.rs:outline_exchange()(XCL_OUTLINE_EXCHANGE=0→ keep inline), andEm::finishpassesoutline && outline_exchange()tox64_preludeinstead ofoutline. The accessor and format thresholds are untouched.Why this is the shape to keep. A retail title's ten largest compute programs that have no driver blob, measured on this rig: eight of the ten have no lane-exchange sites at all (0
xcl_x_ballot,xcl_x_meet,xcl_x_rla_*) and 318 – 467 window-accessor sites, so for them the accessor and format outlining is the whole win and the exchange group is not in the program. The two that do have exchanges (1 030 and 982 ballot sites, both of one shadow-cascade family) are exactly the programs that would pay the dispatch cost. So the two decisions need to be separable, and one build with the switch measures both. Measured both ways the split is real in both directions: for the eight the DXIL is byte-identical between the settings, and for the two that read lanes the inline form costs 21 % of DXIL and 8 % of driver time overmainwhile giving back the 1.73× dispatch cost. The default stays what #1901 chose; the switch is what makes the other side measurable and what a title that reads lanes per iteration can be run with.Tested
cargo build --release --offline --workspacethencargo test --release --offline --workspace -- --test-threads=4on this branch: 1155 passed, 0 failed, 46 ignored, exit 0, 24SKIPPEDlines (no wave64,no heap windows, the direct path's refused f16 / f32 forms) — the same counts and the same skip set asafbc413alone on this adapter, which is what "nothing changes by default" should produce.scripts/smoke.ps1 -Seconds 180run of a retail title withXCL_OUTLINE_EXCHANGE=0on this branch, on a wiped per-tree cache: 1719 frames shown, 0 device removals, 0 crashes, peak commit 30 327 MB, worst single compute compile 11 017 ms.mainand Recompiler: large compute programs call shared helpers instead of inlining them #1901 under the same procedure give 1539 / 29 491 MB / 8 072 ms and 1488 / 30 008 MB / 8 993 ms; all three stop presenting between 90 and 102 s, so the frame counts compare the same screen and this is one run per tree, not a pacing result.XCL_OUTLINE_EXCHANGE=0vs1on the same build, GPU time of a 32 768-iteration exchange loop (2^18 threads, median of 9, RTX 4090): the split-wave64 form that reads a lane every iteration goes 42.909 ms → 24.894 ms, i.e. 1.015×main's 24.522 ms instead of 1.75×; the mask-only split form 8.480 → 7.632 ms (main7.954); the two wave32 forms 7.058 → 7.235 and 7.781 → 7.940 ms (main7.323 / 8.188).dx.opcounts), so for programs without exchanges the switch changes nothing the driver sees. ColdCreateComputePipelineStateof those four, exchange inline: 20.668 / 36.926 / 5.391 / 3.178 s, against 28.608 / 26.553 / 3.066 / 3.474 s for the identical bytes in the other leg — that spread is this machine's run-to-run variance, not a difference between the settings.maincompiles the same four in 75.525 / 132.446 / 8.020 / 4.932 s.73fb752d7f62c3a5, 1 030 ballot + 109 lane-read sites), cold driver each leg:=11 706 500 B / 219 360 instructions / 6 787 phis / 12 198dx.opcalls at 55.401 s and 60.075 s (identical bytes, two legs),=02 075 296 B / 260 182 / 12 066 / 18 951 at 68.295 s, and568e7db1 933 172 B / 236 547 / 16 902 / 30 602 at 63.400 s. On that class the switch is a trade, not a free win: 21 % more DXIL and 14 – 24 % more driver time than the outlined form, 7 % more DXIL and 8 % more driver time thanmain, and 2.5× its DXC time (138.8 s against 55.8 s). It buys the dispatch time there and pays for it in the build.SKIPPEDGPU tests on this adapter: theno wave64set and the direct path's refused f16 / f32-conversion forms, same asmain.Not tested
unsupported→0x887A0005and the RDNA4ParseAddressfailures reported on Recompiler: large compute programs call shared helpers instead of inlining them #1901 are about the outlined switch-form window accessors — Recompiler: large compute programs share repeated code with DXC and the driver #1867's reporter shows the same program builds withXCL_HEAP_WINDOWS=1, where the accessors stay inline and the DXIL is the base's, and the RX 7800 XT report on Recompiler: large compute programs call shared helpers instead of inlining them #1901 finds the suspension follows any remaining[noinline]internal function. This switch only removes the outlined exchange helpers, so it neither fixes nor reproduces those, and I did not test AMD.)AI use
🤖 Generated with Claude Code