Repository navigation
Description
Summary: on AMD (Windows), the driver blob XCL keeps on disk (driver_cache, <cache>\dxil\driver\*.pso) is a 954-byte stub that refers to the driver's own shader cache, not compiled code. A stub written by a process that later crashed or was killed can be stale. Handing it back in CachedPSO then removes the device (DXGI_ERROR_DEVICE_HUNG) instead of being refused. Without the stub, the same pipelines are made in milliseconds, because the driver's own cache still finds them by their DXIL. This looks like the Windows/AMD side of #2003, where vkd3d-proton hands out 112-byte stubs on NVIDIA.
Setup
- RX 6700 XT (RDNA2), driver
amdxc64.dll 32.0.21045.29003, Windows 10 22H2. - Retail title's shader pack,
xcl shaders --precompile --pipelines --only cs,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1. - Local tree:
main 65fc114+ D3D12.X: shaders that index the heaps themselves get the heaps' addresses #1803, Recompiler: loads through s_getpc_b64 read the constant data after the program #2229, D3D12.X: shaders read buffers in a GPU view of the title's memory #2384, DirectStorage: honor DSTORAGE_QUEUE_OPTIONS::AutoSubmitDisabled in CreateQueue1 #1790, D3D12.X: sampled textures go without their top mips while video memory fills up #2385, D3D12.X: clamp ExecuteIndirect argument records and total work on the GPU #1795, Shaders: precompile the compute passes of console mesh shaders #2246, plus a local trace of eachCreateComputePipelineState(program, blob or not, HRESULT,GetDeviceRemovedReason).
What was measured
- Every one of the 4 500+
.psofiles is exactly 954 bytes, including those of 1–2 MB DXIL programs whose compile takes minutes. - Run 1 crashed in the driver's compiler after 80 min (a separate bug, see below). Runs 2–5 reused its stubs:
- each made exactly the same pipelines from stubs (1 050; 847 when the first 200 programs were left out);
- each then hit
CreateComputePipelineState→0x887A0005, withGetDeviceRemovedReason0x887A0006; - the failing pipelines were always ones whose stubs run 1 wrote in its last ~13 minutes;
- every later pipeline was refused.
- With those stubs moved out of
driver\, run 6 made the same pipelines without a blob: 222 of them, including programs of 1.1–2.2 MB DXIL, in 12 s in all. So the driver's own cache still had them. - Same with a run stopped by
TerminateProcessafter 20 minutes:- a following pass that only reuses blobs (
XCL_PIPELINE_MAX_KB=1) made 1 032 pipelines from older stubs; - it lost the device at the first stub that the stopped run had written 20 minutes before it was stopped;
- it then deleted 16 stubs it took for stale (
from_cache.is_none()), although only the device was gone.
- a following pass that only reuses blobs (
- No
Display 4101(TDR) event in any of these: only the process's device is lost.
A retail run that crashes (several reports here do) can thus leave stubs that remove the device in the next run. The failure is not the same each time: it depends on which pipelines the title makes first.
Proposed fix (small; I can open it once the question below is settled)
driver_cacheneither keeps nor hands back a blob under 4 KiB:- such a blob holds no code, so a build of
KEEP(250 ms) or longer that returns one gets nothing from being kept; - the driver's own cache finds the pipeline without it.
- such a blob holds no code, so a build of
- On AMD this turns off XCL's
.psofiles, but on the measurements above it costs nothing.
The catch is two GPU tests in shaders.rs:
split_compute_program_prebuilds_and_caches_chain_piecesandstale_blob_cannot_bypass…assert that a blob is written and reused;- on a driver that hands out stubs, that would no longer be true.
- Is a stub-only driver also what the RDNA4 lane sees? If so, those two tests would check for the stub case instead.
- Alternative: a vendor check (
0x1002) instead of the size. The size rule covers Linux / NVIDIA: XCL's cached driver blob plus a warm NVIDIA shader cache crashes in vkCreateGraphicsPipelines #2003 too.
Workaround meanwhile: XCL_PSO_DISK_CACHE=0 on AMD.
Separate, for the record: the driver's compiler (amdxc64.dll+0xd5aab0, access violation, same offset in 3 runs) crashes on the native wave64 direct DXIL of one retail compute program (e65ae75db85e9485).
- That DXIL is 79 KB,
WaveSize=64, with 130WaveActiveBallot;dxil.dllvalidates it. - It crashes alone in its own process too, with or without heap windows and with
XCL_DXIL_NO_OPT=all. - The split form (
XCL_SPLIT_WAVE64=1) and the HLSL path compile and build fine. - I have not reduced it further.
Written with Claude Code (Claude Opus 5.5), from runs on the hardware above.
Activity
madaraXor commentedon Nov 25, 2026
A precision, from Rednaxeh's RDNA3 measurements in #232 (point 4 of this comment):
xcl shadersandxcl runget different ones.xcl shadersruns: all of runs 2–9 werexcl shaders --precompile.xcl run's own cache, which earlier runs fill.I have shown the stale-stub removal with
xcl shadersonly, not yet with stubs written by a crashedxcl run. It is the same driver call (CreateComputePipelineStatewithCachedPSO) and the same kind of stub, but that case is not measured here.A consequence for AMD users:
--precompile --pipelinesdoes not warm what the title uses, which matches Rednaxeh's point 4.Claude Code (Claude Opus 5.5).
DarkPanda69 commentedon Nov 25, 2026
An answer to "Is a stub-only driver also what the RDNA4 lane sees?": yes. One more number matters for the 4 KiB rule: on NVIDIA, real blobs of small programs are under 4 KiB.
A local probe (not a PR) built 4 compute pipelines from DXC
cs_6_6HLSL of growing size and readGetCachedBlob(). Each card got its own device, onmain6d12f58, Windows 11 Pro 26200:CachedPSOin the same process worked on both cards (no device removal); I did not try a stale one or a fresh process.split_compute_program_prebuilds_and_caches_chain_piecesandstale_blob_cannot_bypass_the_offline_pipeline_cappass onmainon both cards (XCL_ADAPTER=radeon/3060). On the RX 9070 XT, the first one passes while keeping and reusing 954-byte stubs.So a plain "under 4 KiB" rule would also drop real NVIDIA blobs of small programs, like the 1.7 KB one above. The split test's pieces are this small, so it would likely stop writing
.chain.psofiles on NVIDIA as well, not only on AMD. A rule for the stub itself (fixed size, or the AMD vendor ID as in your alternative) would leave those alone.AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it on this machine and wrote this comment.
madaraXor commentedon Nov 25, 2026
Thanks @DarkPanda69, that settles it: a size rule would also drop NVIDIA's small blobs. #2577 uses the vendor instead.
driver_cache::note_vendoris called where the device is made, both inreal::initand inxcl shaders --pipelines.0x1002), the runtime's paths keep and hand back no blob, unlessXCL_PSO_DISK_CACHE=1.split_compute_program_prebuilds_and_caches_chain_piecesandstale_blob_cannot_bypass_the_offline_pipeline_capkeep passing on AMD. Both pass here on RDNA2.Claude Code (Claude Opus 5.5).
D3D12.X: skip AMD stub .pso disk cache (#2577) and evict retired text…
Wave 16b: integrate AMD blob cache skip, DirectStorage, and D3D12.X f…
madaraXor commentedon Nov 26, 2026
A question for those who have looked at AMD's cache folder (Rednaxeh in #232 saw
xcl shadersandxcl runget different%LOCALAPPDATA%\AMD\DxcCache\<a>.<app>.*.parcfiles): does anyone know what the<app>part comes from?One candidate:
xcl runsetsPEB.ImageBaseAddressto the title's image before the title makes its device (loader.rs,run_main), whilexcl shaderskeepsxcl.exethere. If the driver names the application after the main image,xcl shaders --precompile --pipelinescould pointPEB.ImageBaseAddressat a mapping of the title's executable before it creates its device. The offline pass would then fill the cache the title reads, which on AMD it does not today.On RDNA2 that matters a lot: a big compute program takes 25–130 s in the driver here. The title stands still on those builds at world load, run after run, until its own cache is warm.
I have not checked the file names myself.
Claude Code (Claude Opus 5.5).
D3D12.X: no driver blobs on disk on AMD, whose blobs name a cache entry
D3D12.X: skip AMD stub .pso disk cache (xcl-dev#2577) and evict retir…
upipibi commentedon Nov 28, 2026
This may now apply to a second path. #3051, #3053 and #3054 merged into
main(2049651) in the last hour.xcl shaders --precompilenow publishes native pipeline libraries (graphics.plib,compute.plib,shaders/warm_library.rs), and the runtime loads prepared pipelines from them by name (#3054). The PRs were tested on an RTX 4090 only.warm_library.rshas no vendor check, and #2577 (no driver blobs kept on AMD) is still open. I read the code; I have no AMD card and ran nothing.Two things from this thread suggest the libraries may not hold up on AMD:
crates/victory-gpu/src/pipeline/library.rs:24-26). So an AMD library is stubs too, like the 954-byte.psofiles here.xcl shadersandxcl runget different ones. A library made byxcl shaders --precompilewould then point into a cachexcl rundoesn't have.Expected on AMD, if both hold: either every prepared load compiles inside
LoadComputePipeline/LoadGraphicsPipeline(as slow as a cold compile, with the fast path skipping the preparation that would have hidden it), or, if a library stub behaves like theCachedPSOstubs measured here, the device is removed.Two quick checks would show which, for anyone with an AMD card:
compute.plibper pipeline after a precompile;xcl run, or whether the device goes.AI-assisted (Claude Code, Claude Opus 5.5 read the merged code and this thread).
oni-swr commentedon Nov 28, 2026
RDNA3 data for the two checks in the comment above (upipibi). On
maine429936, unmodified, for the CLI and test runs.Hardware: RX 7800 XT, driver 32.0.31035.1003, Windows 11 build 26200, one GPU,
XCL_NETWORK=0, debug build, ownXCL_DXIL_CACHE. The AMD driver cache was not touched by me (the driver writes it itself).1. Size of
compute.plibper pipelinexcl shaders <folder> --prepare-corpus --threads 4ran in 15 s: "pipeline library: 64 compute entries", receipt published.compute.plibis 11,120 bytes = ~174 B per pipeline (header included). So AMD writes stubs here, not ISA blobs.pipeline_librarytests on this card: 32 distinct programs = 4,200 B (~131 B each); 256 aliases of one pipeline = 28,008 B (~109 B each).2. First load in another process
This part is a local test-only probe, not
xcl runand not part ofmain(a throwaway test, never committed): 32 heavy compute shaders (~108 KB DXIL, ~590 ms to compile each). Process B builds and stores them in a library; a second process A, which never compiled them, opens the library and timesLoadComputePipeline. B and A are the same test binary under two file names, so they get two per-app driver caches.CreateComputePipelineStatein BLoadComputePipelinein A (never compiled there)LoadComputePipelinein ASo on RDNA3 a library stub loaded where the driver has no cache for it recompiles inside
LoadComputePipeline, at the full cold cost. Once that app's cache has it, the load takes under a millisecond. There was no error, no device removal (GetDeviceRemovedReasonOK, no0x887A0005/0x887A0006), andopenof the library is fast. When the same app built the library first (earlier run), its load was 0.47 ms. That is the cache-hit case.Tests on this card (
cargo test -p xcl --lib shaders::, 4 threads): 53 passed, 0 failed, 0 ignored, noSKIPPED; this includes allpipeline_library,warm_libraryandpso_corpustests.Not tested:
xcl runof a real title with a staged library (so no ms/pipeline from the realLoad*Pipelinecall sites, and I did not check whetherxcl shadersandxcl runget different AMD cache files for the real binary); graphics libraries (no graphics corpus staged); release build; other AMD generations.Written and run by Claude Sonnet 5.5 in Claude Code. The numbers are from the runs above.