Skip to content

Recompiler: XCL_OUTLINE_EXCHANGE=0 keeps the split-wave64 rendezvous inline - #2210

Draft
brandostrong wants to merge 2 commits into
xcl-dev:mainfrom
brandostrong:narrow-exchange
Draft

brandostrong wants to merge 2 commits into
xcl-dev:mainfrom
brandostrong:narrow-exchange

Conversation

@brandostrong

Copy link
Copy Markdown
Contributor

Stacked on #1901; only the top commit belongs here.

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 behind XCL_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), and Em::finish passes outline && outline_exchange() to x64_prelude instead of outline. 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 over main while 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

  • hardware: RTX 4090 24 GB (32-lane waves, so split wave64), driver 32.0.16.1664, i9-13900K, 64 GB, Windows 11 Pro 26200, rustc 1.100.0, DXC 1.9.2602.17 (SDK 10.0.26100.0), release, Developer Mode on.
  • commands and counts: cargo build --release --offline --workspace then cargo test --release --offline --workspace -- --test-threads=4 on this branch: 1155 passed, 0 failed, 46 ignored, exit 0, 24 SKIPPED lines (no wave64, no heap windows, the direct path's refused f16 / f32 forms) — the same counts and the same skip set as afbc413 alone on this adapter, which is what "nothing changes by default" should produce.
  • one scripts/smoke.ps1 -Seconds 180 run of a retail title with XCL_OUTLINE_EXCHANGE=0 on 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. main and 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.
  • with XCL_OUTLINE_EXCHANGE=0 vs 1 on 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 (main 7.954); the two wave32 forms 7.058 → 7.235 and 7.781 → 7.940 ms (main 7.323 / 8.188).
  • the same two legs on four compute programs of a retail title that have no lane-exchange site: 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 for programs without exchanges the switch changes nothing the driver sees. Cold CreateComputePipelineState of 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. main compiles the same four in 75.525 / 132.446 / 8.020 / 4.932 s.
  • the same two legs on the one program of those ten that does read lanes (73fb752d7f62c3a5, 1 030 ballot + 109 lane-read sites), cold driver each leg: =1 1 706 500 B / 219 360 instructions / 6 787 phis / 12 198 dx.op calls at 55.401 s and 60.075 s (identical bytes, two legs), =0 2 075 296 B / 260 182 / 12 066 / 18 951 at 68.295 s, and 568e7db 1 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 than main, 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.
  • SKIPPED GPU tests on this adapter: the no wave64 set and the direct path's refused f16 / f32-conversion forms, same as main.

Not tested

AI use

  • Claude Code (Claude Opus 5.5): wrote the change, ran the measurements and wrote this description.

🤖 Generated with Claude Code

SamG-Coder and others added 2 commits November 25, 2026 00:07
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants