Recompiler: defer large per-lane compute shaders to compact direct DXIL #2796

Open
github-bot wants to merge 1 commit from github-bot/gh-2796 into amd-dev AGit
Owner

@⁠Saksukella on GitHub · 2026-11-26 13:42 UTC · original
Saksukella:fix/bound-3d-commit-memory → amd-dev · +38 −2 · 4 files · 1 commits · open

What is in it

  • Part 1 (7a8056fa, compact::large() block/instruction thresholds) was cherry-picked onto amd-dev in 53995420; this PR is rebased cleanly onto amd-dev (c32c91a3) with the remaining per-lane compact routing fix (960f4fc2):
  • crates/xcl/src/gpu/dxil/mod.rs, crates/xcl/src/gpu/recomp/lower_dxil.rs, crates/xcl/src/gpu/recomp/pso.rs:
    • Under XCL_PER_LANE=1, lower_dxil::compute_with() previously ran before gpu::dxil::kernel::translate_compute() and returned immediately on Ok(k), bypassing compact::large()/compact::plan() and split_compute(). As a result, branch-heavy unrolled compute shaders (for example, cs 56c0cd3b82a00c6e) still emitted 2,673,860 B monolithic DXIL (588,191 IR lines, 32,279 basic blocks, 36,143 PHIs) and triggered >36 GiB driver-compiler commit spikes under XCL_PER_LANE=1.
    • Defer large compute programs (compact::large(&cfg)) out of lower_dxil::compute_with() so they lower through compact/split direct DXIL (160,534 B, 31,585 IR lines, 975 blocks, 108 PHIs — 16.7x smaller), and fall back in pso.rs::direct_compute() to translate_compute_rodata() when per-lane DXIL exceeds 512 KiB and the compact/split alternative is smaller or split.
  • crates/xcl/src/gpu/dxil/compact_tests.rs:
    • Add CPU unit test per_lane_compute_defers_branch_heavy_program_to_compact_path confirming large branch-heavy compute programs defer from lower_dxil::compute_with.
  • Target branch: amd-dev.

Tested

  • Hardware: AMD Radeon RX 9070 XT (driver 32.0.32029.2010), 24-thread x86_64 CPU, 32 GB RAM, Windows; rustc 1.100.0 (0ef1bc386 2026-11-09); debug (tests) and release (xcl.exe).
  • cargo test -p xcl --lib gpu::dxil::compact -- --skip gpu_: 8 passed, 0 failed (1.52s), including per_lane_compute_defers_branch_heavy_program_to_compact_path.
  • Live 180s RX 9070 XT soak (XCL_DIRECT_DXIL=1, XCL_PER_LANE=1, XCL_RT_GATE=hold, no DXIL size cap):
    • cs 56c0cd3b82a00c6e lowered via compact form (direct DXIL compact form: 20965 blocks of 672 kinds), shrinking on-disk DXIL from 2,673,860 B to 160,534 B (16.7x smaller) with 0 driver refusals and no compile stall, dropping peak process commit from 63,298 MB to 34,190 MB (-29.1 GB / -46%, and 27.7–31.8 GB on amd-dev c32c91a3), with 0 device removals and 0 crashes.

Regression run

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: AMD Radeon RX 9070 XT
title: b8db18c2
seconds: 60
exit: 0x0
frames shown: 1624 (PresentX 1624)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19700 MB
xcl-smoke v1
commit: 960f4fc230fd610b2f64a448801edf9d2d4f7ca4
gpu: AMD Radeon RX 9070 XT
title: b8db18c2
seconds: 60
exit: 0x0
frames shown: 1655 (PresentX 1655)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15221 MB

Not tested

  • NVIDIA and Intel GPU adapters (tested on AMD Radeon RX 9070 XT only).

AI use

  • Antigravity (Google Gemini): assisted with profiling the XCL_PER_LANE=1 compact-bypass commit spike on branch-heavy compute shaders, implementing the lower_dxil::compute_with() / pso.rs::direct_compute() deferral and unit test, rebasing cleanly onto amd-dev c32c91a3, and running local tests and smoke verification. All diffs and measurements were verified locally on hardware.
**@⁠Saksukella** on GitHub · 2026-11-26 13:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796) `Saksukella:fix/bound-3d-commit-memory` → `amd-dev` · +38 −2 · 4 files · 1 commits · open **What is in it** - Part 1 (`7a8056fa`, `compact::large()` block/instruction thresholds) was cherry-picked onto `amd-dev` in `53995420`; this PR is rebased cleanly onto `amd-dev` (`c32c91a3`) with the remaining per-lane compact routing fix (`960f4fc2`): - `crates/xcl/src/gpu/dxil/mod.rs`, `crates/xcl/src/gpu/recomp/lower_dxil.rs`, `crates/xcl/src/gpu/recomp/pso.rs`: - Under `XCL_PER_LANE=1`, `lower_dxil::compute_with()` previously ran before `gpu::dxil::kernel::translate_compute()` and returned immediately on `Ok(k)`, bypassing `compact::large()`/`compact::plan()` and `split_compute()`. As a result, branch-heavy unrolled compute shaders (for example, `cs 56c0cd3b82a00c6e`) still emitted `2,673,860 B` monolithic DXIL (`588,191` IR lines, `32,279` basic blocks, `36,143` PHIs) and triggered `>36 GiB` driver-compiler commit spikes under `XCL_PER_LANE=1`. - Defer large compute programs (`compact::large(&cfg)`) out of `lower_dxil::compute_with()` so they lower through compact/split direct DXIL (`160,534 B`, `31,585` IR lines, `975` blocks, `108` PHIs — `16.7x` smaller), and fall back in `pso.rs::direct_compute()` to `translate_compute_rodata()` when per-lane DXIL exceeds `512 KiB` and the compact/split alternative is smaller or split. - `crates/xcl/src/gpu/dxil/compact_tests.rs`: - Add CPU unit test `per_lane_compute_defers_branch_heavy_program_to_compact_path` confirming large branch-heavy compute programs defer from `lower_dxil::compute_with`. - Target branch: `amd-dev`. **Tested** - Hardware: AMD Radeon RX 9070 XT (driver `32.0.32029.2010`), 24-thread x86_64 CPU, 32 GB RAM, Windows; `rustc 1.100.0 (0ef1bc386 2026-11-09)`; debug (tests) and release (`xcl.exe`). - `cargo test -p xcl --lib gpu::dxil::compact -- --skip gpu_`: 8 passed, 0 failed (`1.52s`), including `per_lane_compute_defers_branch_heavy_program_to_compact_path`. - Live 180s RX 9070 XT soak (`XCL_DIRECT_DXIL=1`, `XCL_PER_LANE=1`, `XCL_RT_GATE=hold`, no DXIL size cap): - `cs 56c0cd3b82a00c6e` lowered via compact form (`direct DXIL compact form: 20965 blocks of 672 kinds`), shrinking on-disk DXIL from `2,673,860 B` to `160,534 B` (`16.7x` smaller) with `0` driver refusals and no compile stall, dropping peak process commit from `63,298 MB` to `34,190 MB` (`-29.1 GB` / `-46%`, and `27.7–31.8 GB` on `amd-dev` `c32c91a3`), with `0` device removals and `0` crashes. **Regression run** ``` xcl-smoke v1 commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7 gpu: AMD Radeon RX 9070 XT title: b8db18c2 seconds: 60 exit: 0x0 frames shown: 1624 (PresentX 1624) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 19700 MB ``` ``` xcl-smoke v1 commit: 960f4fc230fd610b2f64a448801edf9d2d4f7ca4 gpu: AMD Radeon RX 9070 XT title: b8db18c2 seconds: 60 exit: 0x0 frames shown: 1655 (PresentX 1655) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15221 MB ``` **Not tested** - NVIDIA and Intel GPU adapters (tested on AMD Radeon RX 9070 XT only). **AI use** - Antigravity (Google Gemini): assisted with profiling the `XCL_PER_LANE=1` compact-bypass commit spike on branch-heavy compute shaders, implementing the `lower_dxil::compute_with()` / `pso.rs::direct_compute()` deferral and unit test, rebasing cleanly onto `amd-dev` `c32c91a3`, and running local tests and smoke verification. All diffs and measurements were verified locally on hardware.
compact::large() previously only checked reachable non-terminator instruction count
(>= 20_000), ignoring both terminating branches and basic-block count. Branch-heavy
unrolled compute shaders just below 20k non-terminator instructions (for example,
cs 56c0cd3b82a00c6e) skipped compact lowering and emitted >2.6 MiB monolithic DXIL
(~588k IR lines, ~32k blocks, ~36k PHIs), causing the driver compiler to commit >36 GiB
of virtual memory and stall compilation. In compact form the same shader shrinks to
~160 KiB (~975 blocks, 108 PHIs).

Lower the non-terminator threshold to 10_000 and add a reachable basic-block threshold
(>= 2_000) in compact::large(); compact::wanted() still gates adoption on >70%
deduplication and bounded table size.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:43:04 +00:00
Author
Owner

@⁠ettehn on GitHub · 2026-11-26 13:47 UTC · original

Independent Windows/NVIDIA check on 7a8056faf35e7c24d38e639ae893b89ff775a2c0. The only local change was a test probe using the existing synthetic repeated fixture. The default selection produced byte-identical output to the expected forced form in both cases.

Reachable blocks Non-terminators Default form Plain DXIL Compact DXIL
1,603 3,604 Plain 63,604 B 4,924 B
2,003 4,504 Compact 79,904 B 5,224 B

A single-block fixture independently confirmed the instruction gate: compact::large was false at 9,999 non-terminators and true at 10,000. Two existing small GPU tests confirmed plain/compact output parity and matching loop-budget behavior.

Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop GPU (12 GB, driver 621.24), Rust 1.97.1 MSVC debug, DXC 1.8.2502.11, XCL_ADAPTER=NVIDIA XCL_REQUIRE_GPU=wave64:

cargo test --locked --offline -p xcl --lib -j 2 -- compact_threshold_probe a_large_program_that_repeats_itself_takes_the_compact_form gpu_compact_form_runs_as_the_plain_form gpu_compact_form_spends_the_loop_budget_as_the_plain_form --test-threads=1 --nocapture

4 passed, 0 failed, 0 ignored, no reported skips. The threshold fixtures were translated only. This run did not measure NVIDIA driver compile commit, run the full workspace suite, or launch a retail title.

OpenAI Codex assisted with the probe and verification. The exact model identifier was unavailable in this session.

**@⁠ettehn** on GitHub · 2026-11-26 13:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7193840630) Independent Windows/NVIDIA check on `7a8056faf35e7c24d38e639ae893b89ff775a2c0`. The only local change was a test probe using the existing synthetic `repeated` fixture. The default selection produced byte-identical output to the expected forced form in both cases. | Reachable blocks | Non-terminators | Default form | Plain DXIL | Compact DXIL | | ---: | ---: | --- | ---: | ---: | | 1,603 | 3,604 | Plain | 63,604 B | 4,924 B | | 2,003 | 4,504 | Compact | 79,904 B | 5,224 B | A single-block fixture independently confirmed the instruction gate: `compact::large` was false at 9,999 non-terminators and true at 10,000. Two existing small GPU tests confirmed plain/compact output parity and matching loop-budget behavior. Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop GPU (12 GB, driver 621.24), Rust 1.97.1 MSVC debug, DXC 1.8.2502.11, `XCL_ADAPTER=NVIDIA XCL_REQUIRE_GPU=wave64`: ```text cargo test --locked --offline -p xcl --lib -j 2 -- compact_threshold_probe a_large_program_that_repeats_itself_takes_the_compact_form gpu_compact_form_runs_as_the_plain_form gpu_compact_form_spends_the_loop_budget_as_the_plain_form --test-threads=1 --nocapture ``` 4 passed, 0 failed, 0 ignored, no reported skips. The threshold fixtures were translated only. This run did not measure NVIDIA driver compile commit, run the full workspace suite, or launch a retail title. OpenAI Codex assisted with the probe and verification. The exact model identifier was unavailable in this session.
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-26 14:25 UTC · original · edited 2026-11-26 16:07 UTC

Update for head 960f4fc: still passes on both cards. On the newer amd-dev c32c91a, gpu::dxil::compact plus the new test gives 13 passed, 0 failed, 0 SKIPPED on the RTX 3060 and the RX 9070 XT, per_lane_compute_defers_branch_heavy_program_to_compact_path ok on both.

Update for head efb6e48: same result on both cards. On amd-dev b5c0275, gpu::dxil::compact gives 12 passed, 0 failed, 0 SKIPPED on the RTX 3060 and the RX 9070 XT (11 without the PR), and the new per_lane_compute_defers_branch_heavy_program_to_compact_path passes by name on both.


NVIDIA run for the Not tested line, with the RX 9070 XT from the same PC.

Tested: pass, head 7a8056f applied on its base amd-dev b5c0275, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked with XCL_ADAPTER.
cargo test -p xcl --lib -- gpu::dxil::compact --test-threads=4 --nocapture:

  • NVIDIA RTX 3060, driver 32.0.16.1088: 11 passed, 0 failed, 0 SKIPPED.
  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010: 11 passed, 0 failed, 0 SKIPPED.

amd-dev without the PR gives the same counts on both cards.

Not tested: a title run or the cs 56c0cd3b82a00c6e driver compile on NVIDIA; Intel.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-26 14:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7194802492) · edited 2026-11-26 16:07 UTC **Update for head `960f4fc`:** still passes on both cards. On the newer `amd-dev` `c32c91a`, `gpu::dxil::compact` plus the new test gives 13 passed, 0 failed, 0 SKIPPED on the RTX 3060 and the RX 9070 XT, `per_lane_compute_defers_branch_heavy_program_to_compact_path` ok on both. **Update for head `efb6e48`:** same result on both cards. On `amd-dev` `b5c0275`, `gpu::dxil::compact` gives 12 passed, 0 failed, 0 SKIPPED on the RTX 3060 and the RX 9070 XT (11 without the PR), and the new `per_lane_compute_defers_branch_heavy_program_to_compact_path` passes by name on both. --- NVIDIA run for the **Not tested** line, with the RX 9070 XT from the same PC. **Tested:** pass, head `7a8056f` applied on its base `amd-dev` `b5c0275`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked with `XCL_ADAPTER`. `cargo test -p xcl --lib -- gpu::dxil::compact --test-threads=4 --nocapture`: - NVIDIA RTX 3060, driver 32.0.16.1088: 11 passed, 0 failed, 0 SKIPPED. - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010: 11 passed, 0 failed, 0 SKIPPED. `amd-dev` without the PR gives the same counts on both cards. **Not tested:** a title run or the `cs 56c0cd3b82a00c6e` driver compile on NVIDIA; Intel. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠Saksukella on GitHub · 2026-11-26 14:32 UTC · original

Follow-up in \efb6e48e: during live \XCL_PER_LANE=1\ testing we found \lower_dxil::compute_with()\ in \pso.rs\ returned before \gpu::dxil::kernel::translate_compute(), bypassing \compact::large()\ and still emitting \2,673,860 B\ DXIL for \cs 56c0cd3b82a00c6e. Deferring \compact::large(&cfg)\ out of \lower_dxil::compute_with()\ (and falling back when per-lane DXIL exceeds \512 KiB\ and compact/split is smaller) now routes \cs 56c0cd3b82a00c6e\ through compact form at runtime (\160,534 B, \16.7x\ smaller), cutting 180s RX 9070 XT peak commit from \63,298 MB\ to \34,190 MB\ (-29.1 GB). Re-verified with \7/7\ CPU \compact\ tests and fresh 60s RX 9070 XT smoke (\1661\ frames, \60 61 60, \

**@⁠Saksukella** on GitHub · 2026-11-26 14:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7194970625) Follow-up in \efb6e48e\: during live \XCL_PER_LANE=1\ testing we found \lower_dxil::compute_with()\ in \pso.rs\ returned before \gpu::dxil::kernel::translate_compute()\, bypassing \compact::large()\ and still emitting \2,673,860 B\ DXIL for \cs 56c0cd3b82a00c6e\. Deferring \compact::large(&cfg)\ out of \lower_dxil::compute_with()\ (and falling back when per-lane DXIL exceeds \512 KiB\ and compact/split is smaller) now routes \cs 56c0cd3b82a00c6e\ through compact form at runtime (\160,534 B\, \16.7x\ smaller), cutting 180s RX 9070 XT peak commit from \63,298 MB\ to \34,190 MB\ (\-29.1 GB\). Re-verified with \7/7\ CPU \compact\ tests and fresh 60s RX 9070 XT smoke (\1661\ frames, \60 61 60\, \
Author
Owner

@⁠frozht on GitHub · 2026-11-26 14:59 UTC · original

Test report on a retail compute shader that crosses the new threshold but does not take the compact form. Linux/RADV, tested at head 7a8056fa (before efb6e48e), not on amd-dev.

Setup: RX 7900 XT 20 GB (gfx1100), Mesa 26.2.6 RADV, vkd3d-proton 30b0eb9b under Wine (wine-staging 11.22), Ryzen 9 5900X, 32 GB, Linux 7.3, release build (x86_64-pc-windows-gnu). Base: main b49be183 + #877, #684, #1993, #2127 (our Wine stack). 7a8056fa was cherry-picked on top (one conflict in compact.rs around automatic_plan, resolved by keeping main's automatic_plan), plus a local print of the compact decision inputs. Shader: retail title from #505, cs 84eee477d68b6fdf, built alone offline with xcl shaders <pack> --measure-pso and XCL_DIRECT_DXIL=1, under a 12 GB memory cap.

without #2796 with #2796 (7a8056fa)
reachable blocks / non-terminator insts 834 / 16,713 834 / 16,713
compact::large() false true (≥ 10,000 insts)
compact form adopted (wanted) – no (not repetitive enough)
direct DXIL whole 958,940 B 958,940 B, byte-identical
process peak memory (translate + RADV compile) 1.2 GB 1.5 GB (same DXIL; one run each)

So the lower threshold now asks wanted() about this shader, the dedup gate keeps it plain, and the output does not change. Nothing regresses for this shader. It also gets no benefit, but it does not need one: on the direct path RADV builds it in ~3.8 s.

For context, not about this PR: the same record through the default HLSL → DXC path (1,403,484 B DXIL) never finishes on RADV. ACO's register spiller grows past 12 GB within ~50 s, and a debug Mesa 26.2.6 build hits the spiller assert of https://gitlab.freedesktop.org/mesa/mesa/-/issues/15722. So the large-shader commit spikes the PR describes for AMD's Windows driver have a Linux counterpart on the HLSL path, which compact form does not reach.

Not tested: head efb6e48e and the XCL_PER_LANE path; the amd-dev base; Windows; the PR's unit tests (not run here); an in-game run with the PR.

AI use: Claude Code (Claude Opus 5.5) built the probe, ran the measurements and wrote this report. Numbers checked against the run logs before posting.

**@⁠frozht** on GitHub · 2026-11-26 14:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7195613301) Test report on a retail compute shader that crosses the new threshold but does not take the compact form. Linux/RADV, tested at head `7a8056fa` (before `efb6e48e`), not on `amd-dev`. **Setup:** RX 7900 XT 20 GB (gfx1100), Mesa 26.2.6 RADV, vkd3d-proton `30b0eb9b` under Wine (wine-staging 11.22), Ryzen 9 5900X, 32 GB, Linux 7.3, release build (`x86_64-pc-windows-gnu`). Base: `main` `b49be183` + #877, #684, #1993, #2127 (our Wine stack). `7a8056fa` was cherry-picked on top (one conflict in `compact.rs` around `automatic_plan`, resolved by keeping `main`'s `automatic_plan`), plus a local print of the `compact` decision inputs. Shader: retail title from #505, `cs 84eee477d68b6fdf`, built alone offline with `xcl shaders <pack> --measure-pso` and `XCL_DIRECT_DXIL=1`, under a 12 GB memory cap. | | without #2796 | with #2796 (`7a8056fa`) | |---|---|---| | reachable blocks / non-terminator insts | 834 / 16,713 | 834 / 16,713 | | `compact::large()` | false | **true** (≥ 10,000 insts) | | compact form adopted (`wanted`) | – | no (not repetitive enough) | | direct DXIL whole | 958,940 B | 958,940 B, byte-identical | | process peak memory (translate + RADV compile) | 1.2 GB | 1.5 GB (same DXIL; one run each) | So the lower threshold now asks `wanted()` about this shader, the dedup gate keeps it plain, and the output does not change. Nothing regresses for this shader. It also gets no benefit, but it does not need one: on the direct path RADV builds it in ~3.8 s. For context, not about this PR: the same record through the default HLSL → DXC path (1,403,484 B DXIL) never finishes on RADV. ACO's register spiller grows past 12 GB within ~50 s, and a debug Mesa 26.2.6 build hits the spiller assert of https://gitlab.freedesktop.org/mesa/mesa/-/issues/15722. So the large-shader commit spikes the PR describes for AMD's Windows driver have a Linux counterpart on the HLSL path, which compact form does not reach. **Not tested:** head `efb6e48e` and the `XCL_PER_LANE` path; the `amd-dev` base; Windows; the PR's unit tests (not run here); an in-game run with the PR. AI use: Claude Code (Claude Opus 5.5) built the probe, ran the measurements and wrote this report. Numbers checked against the run logs before posting.
github-bot changed title from DXIL: trigger compact form on branch-heavy shaders to prevent driver compile commit spikes to Recompiler: defer large per-lane compute shaders to compact direct DXIL 2026-11-26 15:52:50 +00:00
github-bot force-pushed github-bot/gh-2796 from efb6e48ef2 to 960f4fc230 2026-11-26 15:52:50 +00:00 Compare
Author
Owner

@⁠Saksukella on GitHub · 2026-11-26 15:52 UTC · original · edited 2026-11-26 16:33 UTC

Rebased cleanly onto amd-dev (c32c91a3, which already picked up Part 1 7a8056fa in 53995420) at 960f4fc2.

This PR now contains only the remaining XCL_PER_LANE=1 deferral to compact/split direct DXIL (lower_dxil::compute_with() + pso.rs::direct_compute() fallback to translate_compute_rodata()), verified with 8/8 CPU compact tests and a fresh 60s RX 9070 XT smoke (1,655 frames, 60 60 60, 0 crashes, 0 device removals, 15,221 MB peak commit).

**@⁠Saksukella** on GitHub · 2026-11-26 15:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7196868145) · edited 2026-11-26 16:33 UTC Rebased cleanly onto `amd-dev` (`c32c91a3`, which already picked up Part 1 `7a8056fa` in `53995420`) at `960f4fc2`. This PR now contains only the remaining `XCL_PER_LANE=1` deferral to compact/split direct DXIL (`lower_dxil::compute_with()` + `pso.rs::direct_compute()` fallback to `translate_compute_rodata()`), verified with 8/8 CPU `compact` tests and a fresh 60s RX 9070 XT smoke (`1,655` frames, `60 60 60`, `0` crashes, `0` device removals, `15,221 MB` peak commit).
Author
Owner

@⁠Aniseto on GitHub · 2026-11-26 16:27 UTC · original

Ran the compact-DXIL and per-lane routing tests at 960f4fc on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib gpu::dxil::compact_tests -- --test-threads=1
12 passed; 0 failed; 0 ignored; 0 measured; 1634 filtered out      (exit 0)

All 12 pass, including the new per_lane_compute_defers_branch_heavy_program_to_compact_path and five gpu_* tests that compile and run compact DXIL on the real adapter. This is the rebased head 960f4fc (targets amd-dev); the NVIDIA report from ettehn in the thread was on the earlier head 7a8056fa, and DarkPanda69 checked this head on other cards. This adds a desktop Blackwell part on driver 32.0.16.2124 with DXC 1.9.2609.5.

Not tested: the large branch-heavy program behind XCL_PER_LANE=1 from the description, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

**@⁠Aniseto** on GitHub · 2026-11-26 16:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7197668777) Ran the compact-DXIL and per-lane routing tests at `960f4fc` on an NVIDIA Blackwell desktop part: Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build. ``` XCL_ADAPTER=NVIDIA cargo test -p xcl --lib gpu::dxil::compact_tests -- --test-threads=1 12 passed; 0 failed; 0 ignored; 0 measured; 1634 filtered out (exit 0) ``` All 12 pass, including the new `per_lane_compute_defers_branch_heavy_program_to_compact_path` and five `gpu_*` tests that compile and run compact DXIL on the real adapter. This is the rebased head `960f4fc` (targets `amd-dev`); the NVIDIA report from ettehn in the thread was on the earlier head `7a8056fa`, and DarkPanda69 checked this head on other cards. This adds a desktop Blackwell part on driver 32.0.16.2124 with DXC 1.9.2609.5. Not tested: the large branch-heavy program behind `XCL_PER_LANE=1` from the description, the full workspace suite, a paired 60 s smoke run, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data. AI-assisted (OpenCode), model: **DeepSeek V4.1 Flash Free** - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Author
Owner

@⁠bielfreedom on GitHub · 2026-11-26 17:22 UTC · original

AMD Windows data for #2796: on an RX 9070 XT, the new thresholds change one retail compute program out of 2,689. That program builds about 1.6× slower in AMD's driver and with 4× the peak memory. On main it is split into 11 pieces; the compact form replaces them with one whole program.

First, the branch. It now carries 256 commits against main (77+ files) and does not merge cleanly. I measured only this PR's own threshold commit (7a8056f): the compact::large change, applied by hand onto main b49be18. The newer 960f4fc defers large per-lane compute programs to the compact form. As far as I can tell, the per-lane path is the 32-lane-GPU one, which this native wave64 card does not take; I did not build it.

Setup

  • GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010.
  • CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release.
  • Both builds carry a local timing patch in xcl shaders that writes every program's DXIL size and every CreateComputePipelineState time to a file.
  • Offline: xcl shaders <retail shaders.rpf> --precompile --only cs [--pipelines] with XCL_DIRECT_DXIL=1, XCL_PSO_DISK_CACHE=0, one driver thread, and a fresh translation cache and exe name per run, so every build is cold.

Which programs change, all 2,689 compute programs (translation only)

windows main this change programs changed
switch (default) 885,910,100 B 885,323,148 B 1: b6101d83892d44a5, 865,336 → 278,384 B
heap 728,930,968 B 728,461,444 B 1: the same program, 695,244 → 225,720 B

56c0cd3b82a00c6e, the example in the description, is already compact on main here, so it does not change.

Driver, b6101d83892d44a5 alone, switch windows, 2 interleaved rounds

build form pipelines driver time r1 / r2 peak memory
main split, 11 pieces 11 8.3 / 8.9 s 0.58 GB
this change compact, whole 1 13.1 / 14.0 s 2.48 GB

So on AMD this program was better off split. This looks like what #2810 describes for automatic compact lowering: the compact whole replaces a split plan that was available. One option is to leave the threshold alone for programs that already split.

Not tested: NVIDIA, GPU output, and a title run.

AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it.

**@⁠bielfreedom** on GitHub · 2026-11-26 17:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7198908929) **AMD Windows data for #2796: on an RX 9070 XT, the new thresholds change one retail compute program out of 2,689. That program builds about 1.6× slower in AMD's driver and with 4× the peak memory.** On `main` it is split into 11 pieces; the compact form replaces them with one whole program. **First, the branch.** It now carries 256 commits against `main` (77+ files) and does not merge cleanly. I measured only this PR's own threshold commit (`7a8056f`): the `compact::large` change, applied by hand onto `main` `b49be18`. The newer `960f4fc` defers large per-lane compute programs to the compact form. As far as I can tell, the per-lane path is the 32-lane-GPU one, which this native wave64 card does not take; I did not build it. **Setup** - GPU: RX 9070 XT 16 GB (RDNA4, native wave64), AMD driver 32.0.32029.2010. - CPU and memory: Ryzen 7 7700 (16 threads), 32 GB RAM, Windows 11, release. - Both builds carry a local timing patch in `xcl shaders` that writes every program's DXIL size and every `CreateComputePipelineState` time to a file. - Offline: `xcl shaders <retail shaders.rpf> --precompile --only cs [--pipelines]` with `XCL_DIRECT_DXIL=1`, `XCL_PSO_DISK_CACHE=0`, one driver thread, and a fresh translation cache and exe name per run, so every build is cold. **Which programs change, all 2,689 compute programs (translation only)** | windows | `main` | this change | programs changed | |---|---:|---:|---:| | switch (default) | 885,910,100 B | 885,323,148 B | 1: `b6101d83892d44a5`, 865,336 → 278,384 B | | heap | 728,930,968 B | 728,461,444 B | 1: the same program, 695,244 → 225,720 B | `56c0cd3b82a00c6e`, the example in the description, is already compact on `main` here, so it does not change. **Driver, `b6101d83892d44a5` alone, switch windows, 2 interleaved rounds** | build | form | pipelines | driver time r1 / r2 | peak memory | |---|---|---:|---:|---:| | `main` | split, 11 pieces | 11 | 8.3 / 8.9 s | 0.58 GB | | this change | compact, whole | 1 | 13.1 / 14.0 s | 2.48 GB | So on AMD this program was better off split. This looks like what #2810 describes for automatic compact lowering: the compact whole replaces a split plan that was available. One option is to leave the threshold alone for programs that already split. **Not tested:** NVIDIA, GPU output, and a title run. **AI use:** Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this report; I posted it.
Author
Owner

@⁠Saksukella on GitHub · 2026-11-26 17:33 UTC · original

Thanks for the thorough RX 9070 XT measurement! Two quick clarifications on the current PR head (960f4fc2):

  1. Base branch & diff: This PR targets amd-dev (not main) and is a single commit (960f4fc2, 2 files) cleanly on top of amd-dev (c32c91a3).
  2. Scope of 960f4fc2: The earlier compact::large threshold commit (7a8056f) is no longer in this PR — it was already picked into amd-dev as 53995420. What remains here is solely the XCL_PER_LANE=1 deferral (lower_dxil::compute_with() returning None for large branch-heavy programs so pso.rs::direct_compute() falls back to translate_compute_rodata()). When XCL_PER_LANE=1 is enabled (including on RX 9070 XT runs testing per-lane lowering), cs 56c0cd3b82a00c6e previously bypassed translate_compute_rodata() and emitted a 2.67 MB (32,279-block, 36,143-PHI) per-lane DXIL blob; with 960f4fc2 it takes the standard split/compact direct DXIL path (160 KB).

Your b6101d83892d44a5 finding (compact whole vs 11-piece split, matching #2810) is great data for the 53995420 threshold already on amd-dev, and is orthogonal to 960f4fc2 since 960f4fc2 defers directly to translate_compute_rodata()'s normal split/compact selection.

**@⁠Saksukella** on GitHub · 2026-11-26 17:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7199230659) Thanks for the thorough RX 9070 XT measurement! Two quick clarifications on the current PR head (`960f4fc2`): 1. **Base branch & diff:** This PR targets `amd-dev` (not `main`) and is a single commit (`960f4fc2`, 2 files) cleanly on top of `amd-dev` (`c32c91a3`). 2. **Scope of `960f4fc2`:** The earlier `compact::large` threshold commit (`7a8056f`) is no longer in this PR — it was already picked into `amd-dev` as `53995420`. What remains here is solely the `XCL_PER_LANE=1` deferral (`lower_dxil::compute_with()` returning `None` for large branch-heavy programs so `pso.rs::direct_compute()` falls back to `translate_compute_rodata()`). When `XCL_PER_LANE=1` is enabled (including on RX 9070 XT runs testing per-lane lowering), `cs 56c0cd3b82a00c6e` previously bypassed `translate_compute_rodata()` and emitted a 2.67 MB (`32,279`-block, `36,143`-PHI) per-lane DXIL blob; with `960f4fc2` it takes the standard split/compact direct DXIL path (`160 KB`). Your `b6101d83892d44a5` finding (compact whole vs 11-piece split, matching #2810) is great data for the `53995420` threshold already on `amd-dev`, and is orthogonal to `960f4fc2` since `960f4fc2` defers directly to `translate_compute_rodata()`'s normal split/compact selection.
Author
Owner

@⁠bielfreedom on GitHub · 2026-11-26 17:40 UTC · original

Correction to my comment above. This PR's base is amd-dev, not main, so my note on 256 commits was wrong: against amd-dev it is one commit. The threshold change I measured is already on amd-dev as 53995420. I reran everything on amd-dev c32c91a, on the same RX 9070 XT, the same way.

53995420 on amd-dev (A/B by reverting it)

  • DXIL: with amd-dev's defaults, 1,616 compute programs are translated (XCL_RT_GATE=hold holds back 1,073). Again only b6101d83892d44a5 changes: plain 611,608 B → compact 171,240 B with switch windows, and 461,036 → 142,872 B with heap windows.
  • Driver, that program alone, switch windows, XCL_RT_GATE=0, 2 interleaved rounds:
amd-dev form pipelines driver time r1 / r2 peak memory
53995420 reverted split, 11 pieces 11 6.6 / 6.3 s 0.57 / 0.58 GB
as is compact, whole 1 6.2 / 6.3 s 1.25 GB

So on amd-dev the compact whole builds about as fast as the 11 pieces. The 1.6× slowdown I reported is main's compact form only. The peak memory still roughly doubles, which matters little at 1.25 GB.

This PR's own commit (960f4fc) on amd-dev: no DXIL byte changes on this native wave64 card, over the 1,616 programs translated by default, as expected for the per-lane path.

AI use: Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this correction; I posted it.

**@⁠bielfreedom** on GitHub · 2026-11-26 17:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7199428156) Correction to my comment above. This PR's base is `amd-dev`, not `main`, so my note on 256 commits was wrong: against `amd-dev` it is one commit. The threshold change I measured is already on `amd-dev` as `53995420`. I reran everything on `amd-dev` `c32c91a`, on the same RX 9070 XT, the same way. **`53995420` on `amd-dev`** (A/B by reverting it) - **DXIL:** with `amd-dev`'s defaults, 1,616 compute programs are translated (`XCL_RT_GATE=hold` holds back 1,073). Again only `b6101d83892d44a5` changes: plain 611,608 B → compact 171,240 B with switch windows, and 461,036 → 142,872 B with heap windows. - **Driver, that program alone, switch windows, `XCL_RT_GATE=0`, 2 interleaved rounds:** | `amd-dev` | form | pipelines | driver time r1 / r2 | peak memory | |---|---|---:|---:|---:| | `53995420` reverted | split, 11 pieces | 11 | 6.6 / 6.3 s | 0.57 / 0.58 GB | | as is | compact, whole | 1 | 6.2 / 6.3 s | 1.25 GB | So on `amd-dev` the compact whole builds about as fast as the 11 pieces. The 1.6× slowdown I reported is `main`'s compact form only. The peak memory still roughly doubles, which matters little at 1.25 GB. **This PR's own commit (`960f4fc`) on `amd-dev`:** no DXIL byte changes on this native wave64 card, over the 1,616 programs translated by default, as expected for the per-lane path. **AI use:** Claude Code (Claude Opus 5.5) built the binaries, ran the measurements and wrote this correction; I posted it.
Author
Owner

@⁠relativespace2K on GitHub · 2026-11-26 17:52 UTC · original

Tested - retail title on native Windows AMD RDNA2, PR head 960f4fc230fd610b2f64a448801edf9d2d4f7ca4 on amd-dev c32c91a3

Tool: OpenCode with DeepSeek V4.1 Flash 1017

  • AMD Radeon RX 6800 XT (16338 MiB), driver 32.0.21045.29003; Ryzen 5 5600, 31.9 GB;
    Windows 11 IoT Enterprise LTSC 26100; release build; DXC 1.9.2602.17.
  • cargo test --release -p xcl --lib -- gpu::dxil::compact --skip gpu_:
    8 passed, 0 failed, 0 ignored, 0 skipped, 1638 filtered out, including
    per_lane_compute_defers_branch_heavy_program_to_compact_path.
  • Game: retail title 1.0.2.1, two 240 s runs, XCL_PER_LANE=1 XCL_DIRECT_DXIL=1 plus
    XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_FRAME_DUMP=1 XCL_RUN_SECONDS=240, no other XCL_* variables;
    warm shader/pipeline caches; baseline first, PR second.
run presents peak commit local VRAM last present draws skipped driver compiles
amd-dev c32c91a3 1,823 27,043 MB 9,161 MB 105.7 s 5,937 10 / 84 s
PR 960f4fc2 1,779 26,941 MB 9,153 MB 104.2 s 6,736 9 / 75 s

The deferral fires on this title: the PR logs 7 large/branch-heavy compute program: deferring to per-instruction/compact direct DXIL lines between 116 s and 218 s; the baseline logs none.
Both trees then log direct DXIL compact form: 20965 blocks of 672 kinds (baseline 129.9 s,
PR 129.5 s). That is the compact form the report gives for cs 56c0cd3b82a00c6e, so on this
part the baseline already reaches it; the line itself does not name the shader.

Peak commit and presents are unchanged, so the 36+ GiB per-lane spike does not reproduce here:
the largest driver compile is 0.44 MB DXIL on the baseline and 0.36 MB on the PR, against the
2.6 MB DXIL in the report. Under XCL_PER_LANE=1 both trees skip many draws and stop
presenting around 105 s; the title still stalls on its loading screen, so there is no world or
FPS comparison. No crash, 0 failed pipelines, 0 DXIL failures, 0 errors. The baseline's last
frame dump was black (0 non-dark samples) and the PR's was not; both come from the stalled
screen, so I do not treat that as a regression.

Not tested: the standard non-per-lane path (this change only runs under XCL_PER_LANE),
NVIDIA/RDNA4, world/FPS, full workspace, debug build.

AI use: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests, read the logs and wrote this comment; the figures and the deferral/compact lines were checked against the run logs.

**@⁠relativespace2K** on GitHub · 2026-11-26 17:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2796#issuecomment-7199797878) **Tested** - retail title on native Windows AMD RDNA2, PR head `960f4fc230fd610b2f64a448801edf9d2d4f7ca4` on `amd-dev` `c32c91a3` Tool: OpenCode with DeepSeek V4.1 Flash 1017 - AMD Radeon RX 6800 XT (16338 MiB), driver 32.0.21045.29003; Ryzen 5 5600, 31.9 GB; Windows 11 IoT Enterprise LTSC 26100; release build; DXC 1.9.2602.17. - `cargo test --release -p xcl --lib -- gpu::dxil::compact --skip gpu_`: **8 passed, 0 failed, 0 ignored, 0 skipped**, 1638 filtered out, including `per_lane_compute_defers_branch_heavy_program_to_compact_path`. - Game: retail title 1.0.2.1, two 240 s runs, `XCL_PER_LANE=1 XCL_DIRECT_DXIL=1` plus `XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_FRAME_DUMP=1 XCL_RUN_SECONDS=240`, no other XCL_* variables; warm shader/pipeline caches; baseline first, PR second. | run | presents | peak commit | local VRAM | last present | draws skipped | driver compiles | |---|---:|---:|---:|---:|---:|---:| | `amd-dev` `c32c91a3` | 1,823 | 27,043 MB | 9,161 MB | 105.7 s | 5,937 | 10 / 84 s | | PR `960f4fc2` | 1,779 | 26,941 MB | 9,153 MB | 104.2 s | 6,736 | 9 / 75 s | The deferral fires on this title: the PR logs 7 `large/branch-heavy compute program: deferring to per-instruction/compact direct DXIL` lines between 116 s and 218 s; the baseline logs none. Both trees then log `direct DXIL compact form: 20965 blocks of 672 kinds` (baseline 129.9 s, PR 129.5 s). That is the compact form the report gives for `cs 56c0cd3b82a00c6e`, so on this part the baseline already reaches it; the line itself does not name the shader. Peak commit and presents are unchanged, so the 36+ GiB per-lane spike does not reproduce here: the largest driver compile is 0.44 MB DXIL on the baseline and 0.36 MB on the PR, against the 2.6 MB DXIL in the report. Under `XCL_PER_LANE=1` both trees skip many draws and stop presenting around 105 s; the title still stalls on its loading screen, so there is no world or FPS comparison. No crash, 0 failed pipelines, 0 DXIL failures, 0 errors. The baseline's last frame dump was black (0 non-dark samples) and the PR's was not; both come from the stalled screen, so I do not treat that as a regression. **Not tested**: the standard non-per-lane path (this change only runs under `XCL_PER_LANE`), NVIDIA/RDNA4, world/FPS, full workspace, debug build. **AI use**: OpenCode with DeepSeek V4.1 Flash 1017 ran the tests, read the logs and wrote this comment; the figures and the deferral/compact lines were checked against the run logs.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2796/head:github-bot/gh-2796'
git switch 'github-bot/gh-2796'

Merge

Merge the changes and update on Forgejo.
git switch 'amd-dev'
git merge --no-ff 'github-bot/gh-2796'
git switch 'github-bot/gh-2796'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --ff-only 'github-bot/gh-2796'
git switch 'github-bot/gh-2796'
git rebase 'amd-dev'
git switch 'amd-dev'
git merge --no-ff 'github-bot/gh-2796'
git switch 'amd-dev'
git merge --squash 'github-bot/gh-2796'
git switch 'amd-dev'
git merge --ff-only 'github-bot/gh-2796'
git switch 'amd-dev'
git merge 'github-bot/gh-2796'
git push origin 'amd-dev'
This discussion has been locked. Commenting is limited to contributors.
No description provided.