Shaders: --precompile driver compiles follow cores and free RAM (+44% RT pipelines on 16 GB RAM) #2994
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by RodrigoTorreao on 2026-11-27T09:41:05Z.
Part 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
Imported from ivall/xcl. Originally posted by ettehn on 2026-11-27T09:56:05Z.
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.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T10:24:41Z.
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).
Imported from ivall/xcl. Originally posted by mokkamokacaffe on 2026-11-27T14:18:56Z.
#2994 — bounded offline compute-pipeline A/B on RTX 4080 SUPER
Result: Both revisions compiled all 128 shaders and built all 128 GPU pipelines in every run. The timing comparison changed direction when the order was reversed. These runs do not establish a repeatable speedup or slowdown on this machine.
Tested
623d02e465a17497a757a4ce867f482b0a6c8f3band PR head82c9c69432b50217cafedec8ad530cac8b76ab2a. Both used clean worktrees andcargo build --release --locked -p xcl.2994and a 256 KiB maximum uncompressed record size.xcl shaders <private-sample> --precompile --pipelines --only cs --limit 128 --windows 1 --split 1.XCL_PIPELINE_THREADSandXCL_PIPELINE_RESERVE_MBwere unset so each revision used its defaults.All four processes exited
0. Each reported 0 already-cached shaders, 0 translation errors, 0 skipped records, 0 refused pipelines, and 0 pipelines loaded from XCL’s driver-blob cache.The PR took 3.67 s less than its paired parent in the forward order and 28.69 s more in the reverse order. The two PR runs were within 0.73 s of each other; the two parent runs differed by 31.63 s. System-wide page reads also fell substantially over the sequence. That counter includes activity outside XCL, so it cannot attribute the timing change to the patch or to paging by XCL.
Not tested
Low-memory behavior, title startup, time to first playable frame, or the original 16 GB machine’s ray-tracing workload. Available physical RAM stayed above 28 GiB throughout the sampled measurements. The title, shader records, paths, caches, and raw logs stayed local.
AI use
OpenAI Codex (GPT-6) prepared the bounded sample, ran the four benchmarks, and drafted this report.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-27T14:41:19Z.
Focused Wine/NVIDIA verification of exact head
82c9c69432b50217cafedec8ad530cac8b76ab2a:x86_64-pc-windows-msvc, release tests,DXVK_CONFIG='dxgi.hideNvidiaGpu = False'.2576c0b4adfae4a+(local console-vtable assertion relaxations; not stock-vkd3d certification).Compiling xcl v0.1.0 (.../xcl-pr2994/crates/xcl).cargo test --locked --target x86_64-pc-windows-msvc --release -p xcl --lib 'shaders::' -- --nocapture --test-threads=1: 11 passed, 0 failed, 0 ignored in 1.24 s. The physical NVIDIA adapter opened for the GPU-backed paths.driver_compile_estimate_grows_with_the_dxilpassed.pso_measurement_compiles_an_exact_synthetic_recordcould not disable the driver cache because Wine returnsE_NOTIMPLfor the Windows Developer Mode control;retail_pack_samplehad noXCL_SAMPLE_RPFconfigured. The other 9 tests exercised normally.This adds focused Wine/RTX 4060 correctness coverage on a 16 GiB host. I did not run the cold multi-record parent/head throughput benchmark, so this result does not independently establish reduced paging, loading stutter, or a speedup.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-27T15:25:28Z.
Matched offscreen follow-through on this Wine 11 / Linux 6.17 / i7-13620H / 16 GiB / RTX 4060 Laptop 8 GiB machine, NVIDIA 590.48.1. Exact production parent
623d02e465a17497a757a4ce867f482b0a6c8f3bvs head82c9c69432b50217cafedec8ad530cac8b76ab2a; separately freshly built release executables. Diagnostic-relaxed vkd3d2576c0b4adfae4a+, not stock compatibility certification.The same first 128 compute records, selected with
shaders --precompile --pipelines --only cs --limit 22285 --windows 1 --split 1. The limit counts all pack records: earlier smaller limits selected zero CS and are not benchmark results. Each measured leg used a new XCL DXIL cache and a new vkd3d cache directory, common executable filename, NVIDIA vendor unmasked, pipeline thread/reserve overrides unset, same 9 GiB/512 MiB scope and global guards. Driver-global/OS caches were not cleared. Order parent/head/head/parent.Every leg compiled 128, made 128 native PSOs, loaded 0 from the driver cache, refused 0, and exited 0. Head announces at most 14 driver compiles; shader compilation uses 15 threads. GPU peak 318 MiB throughout. The work-time ranges overlap: no robust local throughput improvement established. Head peak scope usage was lower in these two samples, but neither bounded corpus approached the scope cap. No loading frame-time/stutter or title-progress claim, and no evidence here justifying an added cgroup admission patch.
An earlier broad parent-only discovery pass reached the 9 GiB scope cap and timed out at 300 s after 225 native creations. It was not a matched completed benchmark and is not attributed to this PR. Do not extrapolate this 128-program result to that corpus.
Evidence under
.compat-runtime/logs/:verify-xcl2994-parent128-20261127T151722Z,verify-xcl2994-head128-20261127T151911Z,verify-xcl2994-head128reverse-20261127T152101Z,verify-xcl2994-parent128reverse-20261127T152232Z, each with command/console/resources/result. No game assets attached. Next useful owner measurement is actual loading frame-time/compile-admission correlation on a title-safe stack, rather than inferring stutter from offline throughput.Imported from ivall/xcl. Originally posted by KOLESNiii on 2026-11-27T16:35:50Z.
Cold A/B of
--precompile --only cs --pipelineson an 8 GB Turing card with 32 GB RAM and a 6-core CPU, at exact parent623d02e4and head82c9c694. Head: 300 pipelines in 8 minutes; parent: 225. One run per side.Tested
cargo build --release --locked -p xclin two clean worktrees, each with its own target directory.xcl shaders <retail game>\shaders.rpf --precompile --only cs --pipelines(all 26,503 records of the pack, no--limit). The run was stopped after 480 s.XCL_RT_GATE=0was set as in your description, but neither commit reads it.XCL_PIPELINE_THREADSandXCL_PIPELINE_RESERVE_MBwere unset.XCL_DXIL_CACHE(so DXIL, translations and driver blobs were all cold) and an exe name the NVIDIA driver had never seen. The global driver cache was not cleared. Order: parent, then head, 20 s apart, alone on the machine (run through our local exclusive queue). CPU is the machine-wide average over 1 s samples; available RAM is the minimum of those samples.623d02e482c9c694Not tested
AI use: Claude Code (Claude Opus 5.5) built both sides, wrote the measuring script, ran it on the hardware above and wrote this report.
Imported from ivall/xcl. Originally posted by RodrigoTorreao on 2026-11-28T00:04:07Z.
Closing:
mainnow covers this. Sinced8dae08d(#3043, offline DXIL is released after each pipeline build),mainalso sets the driver-compile count to min(cores, total RAM in GB / 2). On a 16 GB machine that is 8.I rebased this PR onto
2c717a04and keptmain's count, so only the free-RAM admission was left. Then I re-ran the cold A/B on the RX 6750 XT with 16 GB RAM, 8 min per phase:2c717a04XCL_RT_GATE=0): free RAM min / avgFree RAM never fell under 3.6 GB on either side, so the admission almost never acts. Before, it fell to 54 MB. The +44 % this PR measured on
623d02edoes not hold on today'smain.Thanks to @mokkamokacaffe, @pickles976 and @KOLESNiii for the reports.
AI-assisted (Claude Code with Claude Opus 5.5); run by me on the hardware above.
Pull request closed