recomp: cap per-lane compute size so giant shaders use compact DXIL (#2203) #2341
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!2341
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2341"
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?
@zondy1i on GitHub · 2026-11-25 15:48 UTC · original
zondy1i:recomp/per-lane-size-cap→main· +44 −2 · 1 files · 1 commits · openWhat is in it
Follow-up to #2203 addressing @tiagonleal's
XCL_PER_LANE=1memory-spike report on giant compute programs (such as56c0cd3b82a00c6e):56c0cd3b82a00c6e(488,744 B guest code, 14,377 blocks) became accepted byrecomp::lower_dxil::compute_with. Because the per-lane form has no compact loop-switch lowering, it emitted 4,563,088 B of plain DXIL (9.5× larger than #1426's 478,764 B compact form), causing the NVIDIA driver compiler to spike +18 GiB RAM and OOM.crates/xcl/src/gpu/recomp/lower_dxil.rs:MAX_INSTS = 20_000(matchingdxil::compact::large's 20,000-instruction threshold): checked right after decode before spawning the 256 MB worker thread or constructing IR, so giant programs immediately fall back to #1426's compact form.MAX_DXIL_BYTES = 1 << 20(1 MiB): post-lowering safety cap incompute_with(all 39 normal per-lane compute shaders in the 2,000-program sample are<= 197 KB).lower_dxil.rsadvancesXCL_PER_LANE_SOURCE_IDautomatically so any cached multi-megabyte per-lane entries are invalidated on disk.compute_with_refuses_giant_programs_for_compact_fallbackcovering both caps.Impact:
56c0cd3b82a00c6ewith--direct --lanes --split 1: immediately refused ("program too large for the per-lane form") and translated via #1426 compact form (478 KB DXIL instead of 4.56 MB DXIL; total sweep time 0.7 s vs 3.2 s).--direct --lanes --split 1 --sample 2000 --max-bytes 0): all 39 / 205 normal per-lane compute shaders continue to translate (0 regressions); 4 giant compute programs (>= 20,000instructions) are routed to #1426's compact form.Tested
rustc 1.100.0, DXC /dxil.dll1.9.2602.17, debug & release builds.cargo test --workspace -- --test-threads=4on45dbd47: 1436 passed, 0 failed, 47 ignored across 37 test binaries (29 runtimeSKIPPEDnotices from adapter-gated tests); the newcompute_with_refuses_giant_programs_for_compact_fallbackpasses.--hash,--sample 2000) were done on the pre-rebase head92437bd; the rebase only merged this PR's test next to a new test inlower_dxil.rs(no code overlap).xcl shaders <pack> --direct --hash 56c0cd3b82a00c6e --lanes --split 1: refused by per-lane (program too large for the per-lane form), compact form 478 KB DXIL, 0 errors.xcl shaders <pack> --direct --lanes --split 1 --sample 2000 --max-bytes 0: 39/205 per-lane compute programs unchanged, 4 giant compute programs capped, 0 validator/panic errors.Regression run
Baseline (
main568e7db):PR (
45dbd47, run withXCL_PER_LANE=1):Not tested
XCL_PER_LANE=1(verified via single-hash56c0cd3b82a00c6erouting to compact form + 60-secondXCL_PER_LANE=1smoke run).AI use
56c0cd3b82a00c6eand the 2,000-program per-lane size distribution, implementingMAX_INSTS/MAX_DXIL_BYTESand the unit test inlower_dxil.rs, and running the test and smoke suites.@SlopTart on GitHub · 2026-11-25 16:22 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).No Linux/Wine report in the thread yet; adding one.
gpu_suite (--release --locked,--test-threads=2): 144 passed / 3 failed / 1 ignored, same three baseline failures as plainorigin/mainon this rig (rig's known baseline: fuzz seed 1003 of #2115,gpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_depth_buffer_created_for_unordered_access_is_placed).gpu::recomp::lower_dxil::tests::compute_with_refuses_giant_programs_for_compact_fallback(outside thegpu_suite filter): passes on this lane, targeted run.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@razormontana on GitHub · 2026-11-25 17:23 UTC · original
Independent RTX 3070 check of clean PR head
92437bd3ebc7df5504604247055acd93e57fc46f.Windows 11 Pro build 22631, Core i7-10700K, GeForce RTX 3070 (driver 617.42), Rust 1.100.0 MSVC, DXC/DXIL 1.9.2602.17, release build.
The workspace suite reported 1,273 passed, 0 failed, 46 ignored. Its pass count includes 26 runtime
SKIPPEDmarkers (21 native wave64, 3 unsupported per-lane forms, 1 heap-window capability, and 1 reserved cube with mip levels).compute_with_refuses_giant_programs_for_compact_fallbackpassed, including the 20,000-instruction cutoff and the 1 MiB DXIL size boundary. Coverage here was the synthetic workspace suite with external samples unset.Codex (GPT-6.2) ran the tests and drafted this report.
@tiagonleal on GitHub · 2026-11-25 18:21 UTC · original
Test report for #2341 on RTX 5070 Ti (Windows 11): the cap works at translation level and its test passes; I could not reproduce the memory spike on the base today, so the in-game effect is not shown
I reported the
XCL_PER_LANE=1memory jump on #2203; this checks the cap you added in answer.Tested
92437bd3ebc7df5504604247055acd93e57fc46f(clean worktree, no local changes; merge-base withmain082944135cd2b96288470a595861fa608eee08dc, the base compared below). PR open, head unchanged when I started.cargo test --release -p xcl --lib, test executable:compute_with_refuses_giant_programs_for_compact_fallback: 1 passed, 0 failed.gpu::recomp::lower_dxil: 21 passed, 0 failed, 0 ignored, 17 SKIPPED lines (no wave64, and an f16 case already refused in per-lane form).gpu::recomp: 371 passed, 0 failed, 19 ignored, 23 SKIPPED lines.xcl shaders <pack> --direct --hash 56c0cd3b82a00c6e --lanes --split 1): on the base the program is accepted in per-lane form, 4 563 088 B of DXIL against 478 764 B in the split form. On the PR head it is refused:program too large for the per-lane form(0 of 1 compute programs in per-lane form), so it falls to the compact form. Translation 0.26 s both ways.XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_COHERENT_HEAPS=0 XCL_COHERENT_MB=512 XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_GPU_PROFILE=1 XCL_PER_LANE=1, A pressed at 30 s, 300 s, fresh executable name, own copy of the compute cache per run, memory guard on and unchanged): PR head and base both ran the full 300 s at 30 fps in the menus, process commit peak 16.3 GB (PR) and 16.1 GB (base), no guard cut, no device removal. The 4.27 MB driver compile of56c0cd3b82a00c6edid not start in either run today, so this run does not show the spike on the base, and says nothing about the cap. (Two earlier runs withXCL_PSO_PRELOAD=0: 14.7 GB both, same.)xcl shaders <pack> --measure-pso 56c0cd3b82a00c6e, guarded, per-lane and heap windows on, 300 s budget each): PR head and base looked the same, working set 2.2-3.9 GB through the whole 300 s, still compiling at the budget in both, no spike in that window.--lanes --split 1(200 sampled records, 14 compute programs): per-lane form 3 of 14 on both the PR head and the base, same DXIL size per instruction, so the new caps change nothing in that sample.Not tested
5478c4a7.Run and written with Claude Code (Claude Fable 5.2 and Claude Sonnet 5.5).
@DavidM1911 on GitHub · 2026-11-25 18:25 UTC · original
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!
@emirduran707 on GitHub · 2026-11-25 18:34 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
92437bd3ebc7df5504604247055acd93e57fc46f(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1271 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.gpu::recomp::lower_dxil::tests::compute_with_refuses_giant_programs_for_compact_fallback.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@zondy1i on GitHub · 2026-11-26 02:52 UTC · original
Rebased onto current
main(b49be183); the only conflict was in the test module oflower_dxil.rs(both sides appended a test at the end, kept both). Re-ran the full workspace suite (1436 passed, 0 failed) and a 60 sXCL_PER_LANE=1smoke on the new head45dbd47; description updated with the new smoke block.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.