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

Open
brandostrong wants to merge 2 commits from upstream-pr/2210 into main
brandostrong commented 2026-11-25 09:53:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by brandostrong on 2026-11-25T09:53:37Z.


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 #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

  • AMD (the RDNA3 unsupported → 0x887A0005 and the RDNA4 ParseAddress failures reported on #1901 are about the outlined switch-form window accessors — #1867's reporter shows the same program builds with XCL_HEAP_WINDOWS=1, where the accessors stay inline and the DXIL is the base's, and the RX 7800 XT report on #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.)
  • In-world milestone timing: the run above stops presenting before the in-world HUD, so it does not say what the switch does to frame pacing in the world.
  • Heap windows, and any threshold other than "all or none".
  • Native wave64 GPUs, where the split-wave64 exchange helpers are not emitted at all and this switch is a no-op.

AI use

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

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5489010509 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2210). Originally posted by [brandostrong](https://github.com/brandostrong) on 2026-11-25T09:53:37Z. --- > 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 #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** - AMD (the RDNA3 `unsupported` → `0x887A0005` and the RDNA4 `ParseAddress` failures reported on #1901 are about the outlined switch-form window accessors — #1867's reporter shows the same program builds with `XCL_HEAP_WINDOWS=1`, where the accessors stay inline and the DXIL is the base's, and the RX 7800 XT report on #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.) - In-world milestone timing: the run above stops presenting before the in-world HUD, so it does not say what the switch does to frame pacing in the world. - Heap windows, and any threshold other than "all or none". - Native wave64 GPUs, where the split-wave64 exchange helpers are not emitted at all and this switch is a no-op. **AI use** - Claude Code (Claude Opus 5.5): wrote the change, ran the measurements and wrote this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DavidM1911 commented 2026-11-25 16:12:23 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T16:07:10Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7167609582 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2210#issuecomment-7167609582). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T16:07:10Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
github-actions[bot] commented 2026-11-29 20:43:17 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:43:17Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7262304780 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2210#issuecomment-7262304780). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T20:43:17Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 07:35:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:35:28Z.


Triage (#1607) – head c0d3729

This PR is stacked on #1901 and carries #1901's commit (afbc413, an earlier revision than #1901's current head 5064119). Its own commit adds only outline_exchange() (XCL_OUTLINE_EXCHANGE=0) in recomp/emit.rs, which keeps the split-wave64 rendezvous helpers inline. Nothing changes by default. This is not a duplicate of #1901.
No problems found in the top commit. It will need a rebase onto #1901's current head, and the PR description check is failing.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7304243677 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2210#issuecomment-7304243677). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:35:28Z. --- **Triage (#1607)** – head c0d3729 This PR is stacked on #1901 and carries #1901's commit (`afbc413`, an earlier revision than #1901's current head `5064119`). Its own commit adds only `outline_exchange()` (`XCL_OUTLINE_EXCHANGE=0`) in `recomp/emit.rs`, which keeps the split-wave64 rendezvous helpers inline. Nothing changes by default. This is not a duplicate of #1901. No problems found in the top commit. It will need a rebase onto #1901's current head, and the `PR description` check is failing. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2210:upstream-pr/2210'
git switch 'upstream-pr/2210'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2210'
git switch 'upstream-pr/2210'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2210'
git switch 'upstream-pr/2210'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2210'
git switch 'main'
git merge --squash 'upstream-pr/2210'
git switch 'main'
git merge --ff-only 'upstream-pr/2210'
git switch 'main'
git merge 'upstream-pr/2210'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2200
No description provided.