Recompiler: XCL_DIRECT_COMPACT_MIN=<n> takes big compute programs compact #3479
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3479"
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?
Imported from ivall/xcl. Originally posted by Foniass on 2026-11-30T00:00:26Z.
Port of raylitebull's amd-dev commit
41dc012e. The direct translator picks the compact form only for size: from 10,000 instructions or 2,000 blocks, and only when most of the program repeats. On a big program below that, the driver's register allocation of the plain form can be the program's cost. amd-dev's case is the retail title's shadow-mask program (d9fac2f1d8f646fd, ~6,000 instructions, 20–139 ms a frame in the open world):XCL_DIRECT_COMPACT_MIN=<n>: a compute program of at least n reachable instructions takes the compact form whenever its table fits (compact::sized_plan), however little of it repeats. Otherwise the automatic choice applies as before. Unset by default, so nothing changes unless it is set. The caches key the value.amd-dev's measurement (RX 9070 XT, the program patched past its early exits, ms per dispatch): plain 95.6, compact 24.7.
What is in it
crates/xcl/src/gpu/dxil/compact.rs:compact_min,sized_plancrates/xcl/src/gpu/dxil/kernel.rs: the switch in the plan choice for compute programs, the test plumbingcrates/xcl/src/gpu/recomp/pso.rs: the value in both direct cache identities, testa_compact_size_is_another_direct_outputcrates/xcl/src/gpu/dxil/compact_tests.rs: the commit's tests of the size choice and a GPU run against the plain formXCL_DIRECT_COMPACT_MINparts are taken.Tested
cargo test -p xcl --lib -- gpu::dxil::compact_tests shader_cache_tests(5070 Ti): 47 passed, 0 failedgpu::dxil::compact_testson the iGPU: 15 passed, 1 failed. The failure is main's literal-table bug on AMD, fixed by #3473. The new tests pass there.cargo test --workspace --no-fail-fast -- --test-threads=4onf9935af1, rebased on main86e86fcb(5070 Ti): 2892 passed, 0 failed, 51 ignored. SKIPPED: 28 notices, almost allno wave64(the others: no D3D12 debug layer, heap windows off, driver cache needs Developer Mode). The narrower runs listed here are from before the rebase.Regression run
main:
this PR:
Not tested
AI use
41dc012e.🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-12-01T23:07:26Z.
merge-check
base:
1c8b551475head:
f9935af164merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2911 passed, 1 failed, 51 ignored (base: 2909 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing:
hle::xaudio2::tests::xma2_source_voice_decodes_and_manages_lifetime. Not this PR: it is the shared-counter race #3551 fixes, and it passed alone 3 of 3 on this merge.review: read the whole diff (4 files, +151 -3). No correctness problem found.
XCL_DIRECT_COMPACT_MIN=<n>(unset or 0: off) makes a compute program of at least n reachable instructions takesized_plan, the compact form when its table fits, before the automatic choice. Graphics and the default path are unchanged.a_compact_size_is_another_direct_output), and the warm-settings key takes anyXCL_variable not on its exclusion list.gpu::dxil::compact_tests::plusa_compact_size_is_another_direct_output(17 tests): 3 of 3 runs passed. They includegpu_compute_compact_form_from_the_size_runs_as_the_plain_formon this wave32 GPU (not skipped).gpu::dxil::(310 tests) withXCL_DIRECT_COMPACT_MIN=100and with=5000: 310 passed, 0 failed each.sized_planignoring the size (if false && insts(cfg) < min) failsa_compute_program_from_the_compact_size_takes_the_compact_form. Good. (The GPU parity test still passes then, as it should: the compact form is still right.)performance: none by default (unset). When set, compute programs from that size take the compact form: the author's amd-dev numbers, not measured here.
verdict: safe to merge
hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T14:13:01Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.