Shaders: a copied dxcompiler.dll misses the whole DXIL cache (the toolchain key uses its modification time) #2814
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 hexgeon1 on 2026-11-26T15:03:16Z.
dxc::toolchain_identity()hashes the size and modification time ofdxcompiler.dllanddxil.dll(since #9). A copy of the same DLLs with a new modification time gets a different key. Every DXIL and translation cache entry written with the other copy is then missed, without any message. Copies made by Explorer,Copy-Item, robocopy or unzipping keep the time. Git Bashcpwithout-pdoes not, and neither do many scripts.What it cost here: two worktrees of
nvidia-devaf2cecc4shared oneXCL_DXIL_CACHE. The DLLs were byte-identical, but one copy was made withcp. In the other tree, the retail title's shader preparation ran as if nothing were cached: 3,758 records translated in its first 5 s. After matching the times withtouch -rand changing nothing else, it translated 19,147 in the first 5 s and finished the compute pipelines in 35 s. The translator sources of the two trees were identical (diff -rofsrc/gpu).Proposal: keep the key as cheap as now, but take it from the file instead of its file-system time. Read the first 4 KB of each DLL and hash the PE header's
TimeDateStamp,SizeOfImageandCheckSum, plus the file size. These fields are set at link time, so they change with every DXC build and stay the same when the file is copied. Three copies ofdxcompiler.dll1.9.2602.17 here have modification times 10:10:35 and 14:30:15. All three have the sameTimeDateStamp0x6998e047,SizeOfImage0xd9e000andCheckSum0xd9d0d9. There is no full-file hash, so the reason for #9's change still holds.@ivall, you chose size + mtime in #9. If this fits, I'll send it as a small PR to
dxc.rswith a test: a copy with a new modification time keeps the key, and a different header changes it. The cache key changes once with it, as it did in #9.Workaround until then: copy the DLLs with their times (
cp -p,Copy-Item), ortouch -r <reference> dxcompiler.dll dxil.dll.Tested: RTX 3090 24 GB (driver 617.14), Ryzen 7 5700X, Windows 10 22H2 (19045), release builds of
nvidia-devaf2cecc4. The DLL header fields were read with a short script.mainb49be183has the sametoolchain_identity, and I didn't run main for this.AI use: Claude Code (Claude Opus 5.5) found the cause, ran the comparisons and wrote this. I checked it before posting.
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-26T16:41:39Z.
Independent reproduction on exact main
8b957bec6f82495aec940944c6bf47faa02db590, RTX 4080 driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 x64 MSVC and SDK DXC/DXIL 1.8.2502.11, debug. Five freshxcl runprocesses used the same synthetic vertex shader, one private shared cache, and the same SDK copy and path. All five reached the native graphics PSO and exited 0, with zero preparation errors or skips.dxcompiler.dll's last-write time by one hour missed both. Repeating at the advanced time hit both. Restoring the original timestamp hit both original entries.c958ca51cd3512a7tocf47ee3c5e61442awhile the 3,268-byte shader stayed identical. The translated namespaces changed from9c8b36e2c3b1b82ftoccffb6c13136d971. The 2,584-byte records differed only in the eight-byte cache identity, with identical 2,544-byte DXIL payloads.The compiler and signing DLL SHA-256 and PE fields stayed constant. This confirms the cache split on current main with one synthetic input and provides no retail timing or proposed-fix measurement.