D3D12.X: no driver blobs on disk on AMD, whose blobs name a cache entry #2577
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!2577
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@madaraXor on GitHub · 2026-11-25 23:44 UTC · original
madaraXor:d3d12x-no-stub-driver-blobs→main· +75 −5 · 3 files · 1 commits · openOn 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
@DarkPanda69 on GitHub · 2026-11-25 23:55 UTC · original · edited 2026-11-26 10:35 UTC
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.
@DavidM1911 on GitHub · 2026-11-26 00:01 UTC · original
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
@cindertheblue on GitHub · 2026-11-26 00:58 UTC · original
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, no heap windows), 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
@luckyteagirl on GitHub · 2026-11-26 06:33 UTC · original · reviewed
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.97e1630312to58bd3c9dbf@madaraXor on GitHub · 2026-11-26 10:26 UTC · original
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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.