D3D12.X: no driver blobs on disk on AMD, whose blobs name a cache entry #2567
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2577"
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 madaraXor on 2026-11-25T23:44:17Z.
On AMD, the driver blob XCL keeps on disk is a 954-byte reference into the driver's own per-application shader cache, whatever the program. RX 6700 XT (RDNA2) here; RX 9070 XT (RDNA4) measured by DarkPanda69 in #2512.
CachedPSO, it removed the device instead of being refused (#2512).This PR keeps no driver blob on disk on AMD. Every other vendor is unchanged: NVIDIA's blobs hold code, and are under 4 KiB for small programs, so a size rule would not do. Fixes #2512.
What is in it
hle/d3d12x/real.rs,driver_cache:note_vendor(VendorId), called where the device is made, sets whether the driver's blobs are references (AMD,0x1002);enabled()then keeps none unlessXCL_PSO_DISK_CACHE=1, a literal1(0still turns them off everywhere; any other value is the default, which on other drivers keeps them as before);path,path_for,graphics_path) are the ones affected; explicit paths are not (tests,path_override).real::initandshaders.rs(Pipelines::new,xcl shaders --pipelines): callnote_vendor.README.md: the--pipelinesline says it saves no blobs on AMD.blobs_are_kept_on_disk_unless_they_are_references(vendors, and the switch's three settings);the_switch_is_read_as_0_1_or_the_default(unset,0,1, empty,false,off,2…).Tested
cargo test -p xcl --lib driver_cache: 6 passed.split_compute_program_prebuilds_and_caches_chain_piecesandstale_blob_cannot_bypass_the_offline_pipeline_cap(explicit paths, GPU): both pass on this AMD card.cargo test --workspace --no-fail-fast -- --test-threads=4on58bd3c9: 1420 passed, 5 failed, 46 ignored. The failures:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1,hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memoryand the e2e teststest_title_runs_and_game_folder_is_untouched,test_title_draws_with_a_root_signature_under_the_debug_layerandtest_title_runs_under_the_debug_layer_with_dred, which fail onmaine1d84b7on this machine too (its whole suite: 1416 passed, 7 failed, 46 ignored). SKIPPED: the six per-lane cases off16_programs_on_the_gpu/f32_programs_on_the_gpu(refused),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)xcl shaders --precompile --only cs --pipelines(details in #2512):Regression run
scripts/smoke.ps1, 60 s, release builds, the same title on the same day.main:
PR:
Not tested
stub_vendoris false.xcl run, rather thanxcl shaders, removes the device the same way. It is the same call with the same kind of blob.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T23:55:47Z.
Update for head
58bd3c9: rerun onmainb49be18, same cards, the same tests and the same local probe. On both the RX 9070 XT and the RTX 3060:driver_cache6 passed,pipeline_cap_tests3 passed,gpu_compute_e2e7 passed with 1 SKIPPED (no heap windows, the same onmain). WithXCL_PSO_DISK_CACHEunset, the probe gives the same results as below. The RX 9070 XT keeps no.pso, and the 2nd run reports "loaded from the driver cache 0" while the pipeline is still made fine. The RTX 3060 keeps its 5 118-byte.pso, and the 2nd run reports "loaded from the driver cache 1".RDNA4 and NVIDIA run (both listed as untested): the change does what it says on both cards, and the existing tests pass.
Head
97e1630applied onmain08db802, debug, Windows 11 Pro 26200, card chosen withXCL_ADAPTER, everything run onmainand with the PR:cargo test -p xcl --lib -- driver_cache-- pipeline_cap_tests(both explicit-path tests included)--test gpu_compute_e2eheap_window_out_of_memory_falls_back_to_the_switch_form, no heap windows, same onmain)The "none kept on disk" log line appears only on the RX 9070 XT.
The two offline-reuse tests in
gpu_compute_e2esetXCL_PSO_DISK_CACHEto0or1explicitly, so they don't reach the new default. To check the default end to end, I ran a local copy ofoffline_compute_pipeline_is_reused_by_a_second_process(not part of this PR) withXCL_PSO_DISK_CACHEunset. It runsxcl shaders --precompile --pipelinestwice and listscache/driver:XCL_PSO_DISK_CACHEunsetmain.pso; 2nd run "loaded from the driver cache 1".pso; 2nd run "loaded from the driver cache 1".pso; 2nd run "loaded from the driver cache 0", pipeline made fine.pso; 2nd run "loaded from the driver cache 1"So on RDNA4 the stub is gone and the pipeline still builds. NVIDIA keeps its real blob, as intended. Such a per-vendor check isn't in the PR's tests, which cover the vendor rule as a unit (
blobs_are_kept_on_disk_unless_they_are_references).Not tested: a title run on RDNA4, the crashed-
xcl runstale-stub case, Intel.AI use: Claude Code (Claude Opus 5.5) ran the tests and the probe on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T00:01:21Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by cindertheblue on 2026-11-26T00:58:18Z.
Update for head
58bd3c9: rerun on the same basee1d84b7, both GPUs, the same tests and the same local probe, plus the new switch reading. Everything behaves as the new head describes. On AMD,XCL_PSO_DISK_CACHE=falsenow gives the default (no blob), wheree1d84b7keeps the stub. Only1keeps it.cargo test -p xcl --lib -- driver_cache: 6 passed on both GPUs,the_switch_is_read_as_0_1_or_the_defaultincluded (base: 4).-- pipeline_cap_tests: 3 passed on both GPUs.--test gpu_compute_e2e -- --test-threads=1: 6 passed on both GPUs and both trees. One of the six,heap_window_out_of_memory_falls_back_to_the_switch_form, prints SKIPPED (no heap windows).cargo build --workspace; each was a clean detached worktree.The probe (
xcl shaders --precompile --pipelinestwice,cache/driverlisted after each run) gave the same result on the RX 7600 XT and the iGPU:XCL_PSO_DISK_CACHEe1d84b758bd3c9.pso; run 2 "loaded from the driver cache 1"cache/driver, "none kept on disk" logged; run 2 "loaded from the driver cache 0", made 1, refused 0false.pso; run 2 "loaded from the driver cache 1"cache/driver, "none kept on disk" logged; run 2 "loaded from the driver cache 0", made 1, refused 01.pso; run 2 "loaded from the driver cache 1".pso; run 2 "loaded from the driver cache 1"Earlier run, on head
97e1630:RDNA3 and an RDNA2 APU iGPU (both listed as untested): on both,
mainwrites the same 954-byte stub, and with this PR none is written and the pipeline still builds. The existing tests pass on both.Head
97e1630and its basee1d84b7, each a clean detached worktree with its own target dir, debug, Windows 11 Home 26200, Ryzen 5 9600X, Rust 1.99.1, card chosen withXCL_ADAPTER,XCL_PSO_DISK_CACHEunset:cargo test -p xcl --lib -- driver_cache-- pipeline_cap_tests--test gpu_compute_e2e -- --test-threads=1heap_window_out_of_memory_falls_back_to_the_switch_form) prints SKIPPED (no heap windows); the same on baseTo check the new default end to end, I ran a local copy of
offline_compute_pipeline_is_reused_by_a_second_process(not part of this PR, removed afterwards) withXCL_PSO_DISK_CACHEunset:xcl shaders --precompile --pipelinestwice, listingcache/driverafter each run. Both GPUs gave the same result:XCL_PSO_DISK_CACHEunsete1d84b7.pso; made 1, refused 0cache/driver; "none kept on disk" logged; made 1, refused 0cache/driver; "loaded from the driver cache 0", made 1, refused 0So the 954-byte size of the stub holds on RDNA3 and on the RDNA2 APU too, on two different driver branches.
xcl shaderswith an adapter name that matches nothing lists both cards, soXCL_ADAPTERdoes pick the card on this path.Not tested
scripts/smoke.ps1) on either GPU.mainor with the PR.xcl run, and Intel.AI use
upstream-sync referenced this pull request2026-11-26 05:05:05 +00:00
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T06:33:44Z.
Review: COMMENTED
The new AMD safeguard says stub blobs are kept only with
XCL_PSO_DISK_CACHE=1, butenv_setting()maps every present value except trimmed0toSome(true). An empty/whitespace value,false,off, or a typo therefore opts AMD back into loading disk stubs and suppresses the safeguard log. This truthiness existed on main, but it now leaves the stale-stub device-removal path reachable without the explicit=1opt-in described here. Could AMD require the literal trimmed1to override its default, while preserving legacy non-AMD behavior if needed, or document that every non-0value is an opt-in? The new test callsenabled_with()with already-parsed booleans and would not catch the string cases; an unset/0/1/empty/falseparser table would.Exact-head source review of
97e16303127d314013cfc9a063574cbad4cb5544; I did not run a GPU cache experiment or change driver settings. AI-assisted review with Codex.Imported from ivall/xcl. Originally posted by madaraXor on 2026-11-26T10:26:30Z.
Thanks, fixed (force-pushed).
XCL_PSO_DISK_CACHEis now read as0,1or the default (parse_setting).1, trimmed, keeps the references.0turns blobs off everywhere.false,off,2and any other value give the default: off on AMD, and on other drivers on as before, so their behaviour does not change.the_switch_is_read_as_0_1_or_the_default, a parser table and its effect with and without a stub driver.Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T00:20:29Z.
Tested: Clean
58bd3c9dbf05f17d5b323034f28b046f700ac336, Windows 11 build 26200, Ryzen 7 3800X, Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.cargo test -j 2 -p xcl --test gpu_compute_e2e --no-run; ranoffline_compute_pipeline_is_reused_by_a_second_process --exact --nocapture --test-threads=1on the resulting binary: 1 passed, 0 failed, 0 ignored, 0 skipped. Also ranxcl.exe shaders <synthetic shader directory> --precompile --pipelinesin two processes sharing a fresh XCL cache withXCL_PSO_DISK_CACHEunset. The cold process saved one 12,915-byte Intel driver blob. The warm process reported one driver-cache load. Both made one pipeline with zero refusals.Not tested: AMD or NVIDIA hardware, the original AMD device removal, full workspace suite, and retail smoke.
AI use: T3 Code / Codex (
gpt-6.2-sol) ran and reran the checks and wrote this report.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T08:24:44Z.
Triage (#1607) – head
58bd3c9This change is already on main:
3db4c3a("D3D12.X: default AMD driver-blob persistence off", adapted from this PR) records the vendor at device creation and in the offline precompile, turns disk blobs off by default on 0x1002, keepsXCL_PSO_DISK_CACHE=1as the override and=0as off everywhere, and updates the README line.Recommendation: close (superseded by main commit
3db4c3a).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:54:22Z.
Closing as superseded: this change is already on
main(3db4c3a).3db4c3a(adapted from #2577): driver_cache::note_vendor at real.rs init and shaders.rs precompile, blobs not kept on disk on AMD unless XCL_PSO_DISK_CACHE=1; README updatedTwo independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed