Recompiler: defer large per-lane compute shaders to compact direct DXIL #2796
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2796
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2796"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Saksukella on GitHub · 2026-11-26 13:42 UTC · original
Saksukella:fix/bound-3d-commit-memory→amd-dev· +38 −2 · 4 files · 1 commits · openWhat is in it
7a8056fa,compact::large()block/instruction thresholds) was cherry-picked ontoamd-devin53995420; this PR is rebased cleanly ontoamd-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:XCL_PER_LANE=1,lower_dxil::compute_with()previously ran beforegpu::dxil::kernel::translate_compute()and returned immediately onOk(k), bypassingcompact::large()/compact::plan()andsplit_compute(). As a result, branch-heavy unrolled compute shaders (for example,cs 56c0cd3b82a00c6e) still emitted2,673,860 Bmonolithic DXIL (588,191IR lines,32,279basic blocks,36,143PHIs) and triggered>36 GiBdriver-compiler commit spikes underXCL_PER_LANE=1.compact::large(&cfg)) out oflower_dxil::compute_with()so they lower through compact/split direct DXIL (160,534 B,31,585IR lines,975blocks,108PHIs —16.7xsmaller), and fall back inpso.rs::direct_compute()totranslate_compute_rodata()when per-lane DXIL exceeds512 KiBand the compact/split alternative is smaller or split.crates/xcl/src/gpu/dxil/compact_tests.rs:per_lane_compute_defers_branch_heavy_program_to_compact_pathconfirming large branch-heavy compute programs defer fromlower_dxil::compute_with.amd-dev.Tested
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), includingper_lane_compute_defers_branch_heavy_program_to_compact_path.XCL_DIRECT_DXIL=1,XCL_PER_LANE=1,XCL_RT_GATE=hold, no DXIL size cap):cs 56c0cd3b82a00c6elowered via compact form (direct DXIL compact form: 20965 blocks of 672 kinds), shrinking on-disk DXIL from2,673,860 Bto160,534 B(16.7xsmaller) with0driver refusals and no compile stall, dropping peak process commit from63,298 MBto34,190 MB(-29.1 GB/-46%, and27.7–31.8 GBonamd-devc32c91a3), with0device removals and0crashes.Regression run
Not tested
AI use
XCL_PER_LANE=1compact-bypass commit spike on branch-heavy compute shaders, implementing thelower_dxil::compute_with()/pso.rs::direct_compute()deferral and unit test, rebasing cleanly ontoamd-devc32c91a3, and running local tests and smoke verification. All diffs and measurements were verified locally on hardware.@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 syntheticrepeatedfixture. The default selection produced byte-identical output to the expected forced form in both cases.A single-block fixture independently confirmed the instruction gate:
compact::largewas 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: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.
@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 neweramd-devc32c91a,gpu::dxil::compactplus 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_pathok on both.Update for head
efb6e48: same result on both cards. Onamd-devb5c0275,gpu::dxil::compactgives 12 passed, 0 failed, 0 SKIPPED on the RTX 3060 and the RX 9070 XT (11 without the PR), and the newper_lane_compute_defers_branch_heavy_program_to_compact_pathpasses by name on both.NVIDIA run for the Not tested line, with the RX 9070 XT from the same PC.
Tested: pass, head
7a8056fapplied on its baseamd-devb5c0275, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked withXCL_ADAPTER.cargo test -p xcl --lib -- gpu::dxil::compact --test-threads=4 --nocapture:amd-devwithout the PR gives the same counts on both cards.Not tested: a title run or the
cs 56c0cd3b82a00c6edriver compile on NVIDIA; Intel.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@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, \@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(beforeefb6e48e), not onamd-dev.Setup: RX 7900 XT 20 GB (gfx1100), Mesa 26.2.6 RADV, vkd3d-proton
30b0eb9bunder Wine (wine-staging 11.22), Ryzen 9 5900X, 32 GB, Linux 7.3, release build (x86_64-pc-windows-gnu). Base:mainb49be183+ #877, #684, #1993, #2127 (our Wine stack).7a8056fawas cherry-picked on top (one conflict incompact.rsaroundautomatic_plan, resolved by keepingmain'sautomatic_plan), plus a local print of thecompactdecision inputs. Shader: retail title from #505,cs 84eee477d68b6fdf, built alone offline withxcl shaders <pack> --measure-psoandXCL_DIRECT_DXIL=1, under a 12 GB memory cap.7a8056fa)compact::large()wanted)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
efb6e48eand theXCL_PER_LANEpath; theamd-devbase; 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.
DXIL: trigger compact form on branch-heavy shaders to prevent driver compile commit spikesto Recompiler: defer large per-lane compute shaders to compact direct DXILefb6e48ef2to960f4fc230@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 17a8056fain53995420) at960f4fc2.This PR now contains only the remaining
XCL_PER_LANE=1deferral to compact/split direct DXIL (lower_dxil::compute_with()+pso.rs::direct_compute()fallback totranslate_compute_rodata()), verified with 8/8 CPUcompacttests and a fresh 60s RX 9070 XT smoke (1,655frames,60 60 60,0crashes,0device removals,15,221 MBpeak commit).@Aniseto on GitHub · 2026-11-26 16:27 UTC · original
Ran the compact-DXIL and per-lane routing tests at
960f4fcon 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.
All 12 pass, including the new
per_lane_compute_defers_branch_heavy_program_to_compact_pathand fivegpu_*tests that compile and run compact DXIL on the real adapter. This is the rebased head960f4fc(targetsamd-dev); the NVIDIA report from ettehn in the thread was on the earlier head7a8056fa, 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=1from 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.
@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
mainit 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): thecompact::largechange, applied by hand ontomainb49be18. The newer960f4fcdefers 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
xcl shadersthat writes every program's DXIL size and everyCreateComputePipelineStatetime to a file.xcl shaders <retail shaders.rpf> --precompile --only cs [--pipelines]withXCL_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)
mainb6101d83892d44a5, 865,336 → 278,384 B56c0cd3b82a00c6e, the example in the description, is already compact onmainhere, so it does not change.Driver,
b6101d83892d44a5alone, switch windows, 2 interleaved roundsmainSo 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.
@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):amd-dev(notmain) and is a single commit (960f4fc2, 2 files) cleanly on top ofamd-dev(c32c91a3).960f4fc2: The earliercompact::largethreshold commit (7a8056f) is no longer in this PR — it was already picked intoamd-devas53995420. What remains here is solely theXCL_PER_LANE=1deferral (lower_dxil::compute_with()returningNonefor large branch-heavy programs sopso.rs::direct_compute()falls back totranslate_compute_rodata()). WhenXCL_PER_LANE=1is enabled (including on RX 9070 XT runs testing per-lane lowering),cs 56c0cd3b82a00c6epreviously bypassedtranslate_compute_rodata()and emitted a 2.67 MB (32,279-block,36,143-PHI) per-lane DXIL blob; with960f4fc2it takes the standard split/compact direct DXIL path (160 KB).Your
b6101d83892d44a5finding (compact whole vs 11-piece split, matching #2810) is great data for the53995420threshold already onamd-dev, and is orthogonal to960f4fc2since960f4fc2defers directly totranslate_compute_rodata()'s normal split/compact selection.@bielfreedom on GitHub · 2026-11-26 17:40 UTC · original
Correction to my comment above. This PR's base is
amd-dev, notmain, so my note on 256 commits was wrong: againstamd-devit is one commit. The threshold change I measured is already onamd-devas53995420. I reran everything onamd-devc32c91a, on the same RX 9070 XT, the same way.53995420onamd-dev(A/B by reverting it)amd-dev's defaults, 1,616 compute programs are translated (XCL_RT_GATE=holdholds back 1,073). Again onlyb6101d83892d44a5changes: plain 611,608 B → compact 171,240 B with switch windows, and 461,036 → 142,872 B with heap windows.XCL_RT_GATE=0, 2 interleaved rounds:amd-dev53995420revertedSo on
amd-devthe compact whole builds about as fast as the 11 pieces. The 1.6× slowdown I reported ismain's compact form only. The peak memory still roughly doubles, which matters little at 1.25 GB.This PR's own commit (
960f4fc) onamd-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.
@relativespace2K on GitHub · 2026-11-26 17:52 UTC · original
Tested - retail title on native Windows AMD RDNA2, PR head
960f4fc230fd610b2f64a448801edf9d2d4f7ca4onamd-devc32c91a3Tool: OpenCode with DeepSeek V4.1 Flash 1017
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.XCL_PER_LANE=1 XCL_DIRECT_DXIL=1plusXCL_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.
amd-devc32c91a3960f4fc2The deferral fires on this title: the PR logs 7
large/branch-heavy compute program: deferring to per-instruction/compact direct DXILlines 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 thispart 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=1both trees skip many draws and stoppresenting 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.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.