Shaders: --precompile driver compiles follow cores and free RAM (+44% RT pipelines on 16 GB RAM) #2994
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!2994
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2994"
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?
@RodrigoTorreao on GitHub · 2026-11-27 09:41 UTC · original
RodrigoTorreao:pr/precompile-ram-budget→main· +102 −4 · 1 files · 1 commits · openPart of #2088. The offline pipeline pass (
xcl shaders --precompile --pipelines, and the same code inxcl run's shader preparation) ran four driver compiles at once on every machine, and nothing in it looked at physical RAM. On a 16 GB machine with ray-tracing compute programs of ~1 MB DXIL, that left a 20-thread CPU at ~44 % while free RAM fell to 54 MB and Windows read up to 21,700 pages a second. WithXCL_PIPELINE_THREADSunset, the number of compiles at once now follows the cores and the free physical RAM. With RAM to spare, timings matchmain. On the measured RX 6750 XT / 16 GB machine, 44 % more RT pipelines were built in the same time, and the RAM never ran out.What is in it
crates/xcl/src/shaders.rs, one commit:XCL_PIPELINE_THREADSunset, up to cores − 2 compiles run at once (at least 1, at most 32). One more starts only while free physical RAM keepsXCL_PIPELINE_RESERVE_MB(default 2048) plus its estimate plus the full estimate of the compiles already running. The estimate is 64 MiB + 1 KiB per DXIL byte: twelve ~300 KB compiles held ~5 GB together, and one ~1 MB RT program held ~3.5 GB with the whole process. A waiting compile looks again every 250 ms, because RAM also frees without a compile ending.XCL_PIPELINE_THREADS=Nkeeps today's behaviour: a fixed N, with no RAM check.driver_compile_estimate_grows_with_the_dxil.Tested
main623d02e(the measurements below were made on8b957be;shaders.rsis the same on both).cargo test --workspace --no-fail-fast -- --test-threads=4:82c9c69on623d02e): 1458 passed, 1 failed, 47 ignored;main623d02eon the same machine: 1457 passed, 1 failed, 47 ignored.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1. The extra pass is the new unit test.SKIPPEDon this adapter (both trees): thef16_programs_on_the_gpuandf32_programs_on_the_gpuper-lane forms, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).xcl shaders --precompile. Each side had its own emptyXCL_DXIL_CACHEand an exe name the AMD driver had never seen (its shader cache is per application). One run per side.main--limit 3000(translation + DXC)--only cs --pipelines,XCL_RT_GATE=0, 8 minutesThe 8-minute pass ran on the earlier version that also had the DXC gate. The driver-compile limit, which is what changes that pass, is the same.
main, the same change ran onamd-devf84a949: a full--precompileof the pack (26,503 records, 0 errors) and several title runs.Regression run
main623d02e:This PR,
82c9c69:Both runs:
XCL_PREPARE=0, a separate emptyXCL_DXIL_CACHEeach, no input. The PR shows 90 % ofmain's frames at the same peak commit. The menu runs at 30 fps on both; the difference is cold in-game compiles during the first seconds. This PR does not touch that path, so it is likely run-to-run noise.Not tested
Help wanted: numbers from 16 GB machines and other GPUs. With a fresh
XCL_DXIL_CACHEfolder per side, runxcl shaders <pack> --precompile --only cs --pipelineswithXCL_RT_GATE=0for a fixed time, onmainand on this branch. Post the pipelines made, CPU and the minimum free RAM.AI use
🤖 Generated with Claude Code
@ettehn on GitHub · 2026-11-27 09:56 UTC · original
Independent Windows/NVIDIA check of exact base
623d02e4and head82c9c694on RTX 5070 Ti Laptop (12 GB, driver 621.24), Ryzen 9 8945HX (32 logical threads), 32 GB RAM, Windows 11 build 26200, Rust 1.97.1 MSVC and DXC 1.8.2502.11.I ran
xcl shaders <synthetic compute corpus> --precompile --only cs --pipelines --windows 1 --split 1withXCL_DXC_THREADS=30 XCL_RT_GATE=0and a fresh XCL cache per process. The corpus contains 62 variants of the repository's guarded arithmetic fixture. NVIDIA's own cache was retained. CPU is the machine-wide average and available RAM was sampled every 100 ms.XCL_PIPELINE_RESERVE_MB=65536XCL_PIPELINE_THREADS=4All six runs exited 0, with 62 pipelines made, 0 refused, 0 translation errors, 0 skips and 0 XCL driver-cache loads. The 62 driver-cache filenames matched across all six. The head logged up to 30 driver slots in auto mode. The deliberately unattainable reserve exercised the combined translation/driver throttle and still completed the corpus. The baseline repeat matched the fastest head run, so the timings are inconclusive for a default-mode speedup. This covers synthetic offline compute. Large ray-tracing shaders and title startup were outside the test.
On the exact head,
cargo test --release --locked --offline -p xcl --lib driver_compile_estimate_grows_with_the_dxil -- --test-threads=1andcargo test --release --locked --offline -p xcl --test gpu_compute_e2e offline_compute_pipeline_is_reused_by_a_second_process -- --test-threads=1each passed 1/0/0 with no skip. The latter exercised building, reusing and repairing a synthetic compute PSO's driver blob across processes.AI use: OpenAI Codex (GPT-6) assisted with the benchmark and verification.
@Decodere on GitHub · 2026-11-27 10:24 UTC · original
Independent desktop NVIDIA verification of PR #2994 at head
82c9c69432b50217cafedec8ad530cac8b76ab2a(1commit; exact parent & merge-base:623d02e465a17497a757a4ce867f482b0a6c8f3bonmain).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
82c9c694)cargo test --release -p xcl --lib -- shaders::tests::driver_compile_estimate_grows_with_the_dxil --exact --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1357 filtered out× 3 (0.00s× 3,0skipped)cargo test --release -p xcl --lib -- shaders:: --test-threads=1 --nocapture(3 consecutive runs)11 passed; 0 failed; 0 ignored; 1347 filtered out× 3 (0.41s,0.40s,0.38s—9executed including on-GPU RTX 4060split_compute_program_prebuilds_and_caches_chain_pieces,stale_blob_cannot_bypass_the_offline_pipeline_cap, anddriver_compile_estimate_grows_with_the_dxil;2expected host/env skips:pso_measurement_compiles_an_exact_synthetic_record(SKIPPED: Developer Mode off / cannot disable driver cache) andretail_pack_sample(XCL_SAMPLE_RPFunset))cargo build --release -p xcl1m 35s, exit0,0new warnings inshaders.rs)Paired quiet 60 s retail smoke (
title: 29640639,XCL_PREPARE=0 XCL_NETWORK=0)Exact parent & merge-base (
623d02e465a17497a757a4ce867f482b0a6c8f3b,XCL_PREPARE=0 XCL_NETWORK=0, cached baseline on the same machine):PR #2994 (
82c9c69432b50217cafedec8ad530cac8b76ab2a,XCL_PREPARE=0 XCL_NETWORK=0):Limits of coverage
driver_compile_estimate_grows_with_the_dxil3/3) and theshaders::module suite (11/11× 3,9executed including on-GPU RTX 4060Pipelines::compilepaths inpipeline_cap_tests,2expected host/env skips).xcl shaders --precompile --pipelinesthroughput/paging benchmark on a 16 GB RAM host (this machine has 32 GB RAM and the PR's+44%RT pipeline / low-RAM paging numbers were not re-measured).XCL_PREPARE=0(XCL_NETWORK=0), bypassing startupprepare_for_launchshader precompilation, to confirm runtime non-regression.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
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.