D3D12.X: the driver's compile of a compute pipeline is kept on disk #634
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!634
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/634/head"
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?
@theaustinayers on GitHub · 2026-11-24 02:43 UTC · original
theaustinayers:driver-pso-cache→main· +127 −1 · 1 files · 1 commits · merged 2026-11-24 03:07 UTCRebased onto #636, which this now builds on. #636 keeps the driver's blob of a translated compute program in memory: its second build in one run is made from it. The first build of every run still goes through the driver's compiler. On an NVIDIA GPU that is seconds for each of a retail title's larger compute programs when its world loads (5 – 27 s each measured here, up to 0.5 MB of DXIL): the title dispatches without them meanwhile and is ended by its watchdog before all are built, so the next run starts the same compiles again. This writes those blobs to disk and reads them in the next run.
What is in it
crates/xcl/src/hle/d3d12x/real.rs,mod driver_cache: the file name (fnv64of the DXIL, its length and the flags, in<DXIL cache>\driver\), reading a kept blob, writing one under a temporary name first, dropping one the driver refused, and the log lines (powers of two).translated_compute_pso: when #636'scompute_blobhas none, the blob kept on disk is passed asCachedPSO; refused (another driver, adapter or root signature), the file is removed and the program compiled as before. After a build without a blob, whatkeep_compute_blobkept is also written to disk when the build took 250 ms or longer.XCL_PSO_DISK_CACHE=0turns it off.Tested
cargo build --workspace, thencargo test --workspace -- --test-threads=4: 692 passed, 0 failed, 41 ignored.gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.9182f27), two runs that went on into its world (with input, so not the smoke runs below). The first wrote blobs to disk, among them programs of 498724 B of DXIL built in 17000 ms, 363096 B in 5034 ms and 300756 B in 3162 ms. In the second, those three were made from the files in 8 ms, 5 ms and 6 ms. One program of 363096 B was compiled in 5402 ms in the second run (another program of that size, or other flags: not looked into). No blob was refused. Both runs still end in the title's world asmaindoes (its watchdog, ~100 s in); this PR does not change that by itself.Regression run
main:
```
xcl-smoke v1
commit:
dd2ae9a70agpu: NVIDIA GeForce RTX 5090
title: NYCMain
seconds: 60
exit: 0x0
frames shown: 1611 (PresentX 1611)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14482 MB
Not tested
note, not by a driver refusing one.AI use
xcl pipelines) #755@MesshM on GitHub · 2026-11-24 02:55 UTC · original
Test run of
aab678916f8b6a0c77825b4d84913dea89e23061on AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain18c105alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 691 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 651 passed, 0 failed, 21 ignoredSKIPPED;a_file_is_named_after_its_dxilanda_kept_blob_is_read_back_and_a_refused_one_is_droppedpass. No program here took 250 ms to build, so no blob was written and the disk path was not exercised.Review: A refused blob is deleted and the pipeline built as before, inside
BIG_COMPILES/wait_for_commitas now; the file is written under a temporary name and renamed, so a cut-short run leaves no half file. Two points: (1) the file is keyed by the DXIL alone.CachedPSOhas to match the whole description, root signature and flags included, so if one DXIL is ever built with two root signatures (or under two adapters withXCL_ADAPTER), each build makes the driver refuse the other's blob, deletes it and writes its own: a miss every time instead of a hit. #636 keys by DXIL hash, root signature and flags. (2) Overlap with #636, which edits the same lines oftranslated_compute_psofor the in-memory version of the same idea; they will conflict.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@alpz1000 on GitHub · 2026-11-24 03:00 UTC · original
Independent real-driver cache check on RTX 3060 12 GB, driver 610.88 (32.0.16.1088), i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc, SDK DXC 1.9.2602.17, debug.
Tested: unmodified
aab678916f8b6a0c77825b4d84913dea89e23061passed bothdriver_cacheunit tests. Then I temporarily lowered only the save threshold from 250 ms to 0 ms so the bundled shader (1 ms here) would use the save path. With a freshXCL_DXIL_CACHE, three separate processes rancargo test --locked -p xcl --test gpu_compute_e2e console_wave64_compute_through_the_pso_hook_dispatch_and_read_back -- --exact --nocapture:XCL_PSO_DISK_CACHE=0No skips. All three used the real RTX 3060 backend. The temporary threshold edit was reverted.
Not tested: default 250 ms save path on a long compile, real-driver rejection of a stale blob, full suite, or retail loading. This checks saving and reuse with a synthetic shader, with no speedup claim.
AI use: OpenAI Codex (GPT-6) ran the local checks and drafted this report.
@CryingLaughing on GitHub · 2026-11-24 03:05 UTC · original
Tested
9182f275c0464942cc51fca52dc2a475d931b918with a scratch-only extension ofgpu_compute_e2e.rs. NVIDIA GeForce RTX 4080, driver 621.01, Intel Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, DXC 1.8.2502.11, debug.XCL_ADAPTER=4080,XCL_REQUIRE_GPU=1,XCL_ASYNC_PSO=0,XCL_PSO_DISK_CACHE=1, allXCL_SAMPLE_*variables unset.cargo test -p xcl --test gpu_compute_e2e --locked -j 4 translated_compute_disk_cache_accepts_matching_and_rebuilds_rejected_blob -- --show-output --test-threads=1passed 1/1 with zero skips. The fixture used its own cache directory. The target shader was 5,164 bytes of DXIL, below the 16 KiB in-memory retention threshold, and its disk key used pipeline flags0x0.CreateComputePipelineStateaccepted the target program's 3,386-byte blob and refused the 1,450-byte blob from a different valid synthetic program on the same device with0x80070057(E_INVALIDARG). Both blobs came fromGetCachedBlob.aab678916f8b6a0c77825b4d84913dea89e23061also passed 1/1 with the same native rejection HRESULT and three matching readbacks, using that revision's disk key.Not tested
AI use
@thehollowedone on GitHub · 2026-11-24 03:20 UTC · original
Tested
On merge
63cdc25, a synthetic 155,996-byte translated compute shader crossed the stock 250 ms save threshold. The first process built it in 881 ms and left one 220,810-byte.psofile. A fresh process used that file, confirmed by XCL'skept on disklog, and built the PSO in 13 ms. A third process withXCL_PSO_DISK_CACHE=0built it in 15 ms without a disk hit. Both later runs left the file unchanged. The cache-off control was also fast, so this verifies reuse without isolating a speedup.All three dispatches matched 2,459,136 expected words each. A scratch extension to
gpu_compute_e2eenlarged the shader and readback. XCL runtime code was stock. Each process completedcargo test --offline --locked -p xcl --test gpu_compute_e2e console_wave64_compute_through_the_pso_hook_dispatch_and_read_back -- --exact --nocapture --test-threads=1with 1 pass, 0 failures, no runtime skips, and no D3D12 debug-layer errors. I used a fresh temporary DXIL cache for the first run and reused it for the controls, withXCL_ASYNC_PSO=0.RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug.
Not tested
Driver rejection, async builds, and retail behavior.
AI use
Codex with GPT-6.2 Sol adapted the scratch fixture, ran the tests, and drafted the report.
@MonkeyPython on GitHub · 2026-11-24 03:39 UTC · original
NVIDIA / wave32 retail data point: the on-disk driver-blob cache works across runs on an RTX 3080 Ti with GTA VI (Series 1.0.2.1).
Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, 32 GB, RTX 3080 Ti 12 GB (driver 621.01), main
91f9a5e(includes this PR), release,XCL_NETWORK=0+ firewall, scripted menu walk into loading (XCL_PRESS_AT).Suite at this commit: 692 passed / 0 failed / 41 ignored, 2 internal
SKIPPED(wave64 pair).Run pair (150 s cap each):
1 / 2 / 4 / 8 driver blobs kept on disk for the next run (this one: 1035–2989 ms, 224–282 KB); 13 blob files appear under%LOCALAPPDATA%\xcl\dxil\driver\.1 / 2 / 4 compute pipelines made from the driver's blob of an earlier run (kept on disk)— the second run reads what the first kept, on NVIDIA.Both runs still end in the pre-existing #232 null write (113 s / 102 s); the cache neither causes nor prevents it.
Not tested: AMD/Intel, cache invalidation on driver change, other titles.
AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the suite and the run pair and wrote this report from the logs; a human reviews it before posting. No code changes.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175github-bot referenced this pull request2026-11-26 11:14:32 +00:00