shaders: distinguish precompiled PSOs from saved driver blobs #2739
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!2739
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2739"
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?
@aijazmirzza on GitHub · 2026-11-26 09:30 UTC · original
aijazmirzza:fix/shader-cache-counters→main· +265 −10 · 1 files · 1 commits · openAdd separate counters to
Pipelinesfor successful fresh GPU creations (created), rejected XCL disk blobs (rejected), blobs successfully saved to disk (saved), unavailable blobs (blob_unavailable), failed disk writes (write_failed), disabled caching (cache_disabled), and a whole/chain breakdown (created_whole,created_chain), alongside the existingmade/reused/refusedcounters.createdincrements only on the successfulOkcold-creation path;rejectedfires when the driver refuses a loaded XCL blob (stale or wrong adapter) before the cold retry.The summary output reports these after the existing
made/reusedlines, which are preserved for scripts that parse them.Part of #2737
What is in it
created,rejected,saved,blob_unavailable,write_failed,cache_disabled,created_whole,created_chainfields onPipelines(crates/xcl/src/shaders.rs)createdincrements only on the successfulOkcold-creation path (not onErr/refused)rejectedincrements when an XCL disk blob was loaded but the driver refused it (stale or wrong adapter), including the over-cap stale-blob early-return pathcache_disableddistinguishes a successful creation with no cache path from a blob-extraction failurecreated_wholeandcreated_chainPipelines, deterministicwrite_failedwith an unwritable cache directory,cache_disabledwith no cache pathrejectedandcreated_chain/created_wholeassertions added to existing stale-blob and split-program testsmake()with nocache_dirnow gets no path instead of falling through todriver_cache::path_for; tests no longer write into the user's real PSO cacheTested
cargo test --workspace -- --test-threads=4: 1311 passed, 0 failed, 27 ignoredcargo test -p xcl pipeline_cap_tests -- --test-threads=1: 7 passed (including 4 new tests), 0 failedRegression run
main
this PR (
e58cd9e)104.9 % of main's frames, 100.8 % of its peak commit, no device removal, no crash. Runs by @KOLESNiii on NVIDIA GeForce RTX 2070 SUPER.
Not tested
--pipelinespass on a retail title (the new counters are exercised only in unit tests)Pipelinesin the same process, not a fresh process (#2737 asks for fresh-process verification)AI use
@luckyteagirl on GitHub · 2026-11-26 09:37 UTC · original · reviewed
On
5803bc4,createdis incremented immediately afterCreateComputePipelineStatein the cold path, before itsResultis checked. When native creation returnsErr, the later match also incrementsrefused, so one failed attempt is reported asmade 0, refused 1, fresh GPU creations 1. No pipeline was created; this conflicts with the new counter's label and #2737's request to count successful fresh creations.Could
createdincrement only on the successful coldOkpath, independently of whether a cached blob can be saved? A deterministic refused-create test should expectcreated == 0,refused == 1, and preservemade == created + reused. This is exact-head source review; I did not run a GPU test for this path.@luckyteagirl on GitHub · 2026-11-26 09:39 UTC · original · reviewed
On
5803bc4, a successful cold creation withXCL_PSO_DISK_CACHE=0has no cache path, so this branch never callsGetCachedBlob. It still incrementsblob_unavailable, and the new summary reports a driver blob as unavailable although extraction was never attempted. #2737 lists disabled caching and unavailable blob extraction as distinct causes, so this counter would obscure which one occurred in a supported mode.Could the no-path outcome be reported separately as disk caching disabled, or explicitly name this combined category
blob unavailable or caching disabled? A successful-create fixture with no cache path would pin down the expected summary. This is exact-head source review; I did not run the CLI with a GPU for this case.@aijazmirzza on GitHub · 2026-11-26 09:48 UTC · original
I don't have a game title available to run
scripts/smoke.ps1for the regression run blocks. The runtime changes are purely additive (new counter increments and a new summary line; existingmade/reusedoutput is unchanged), so existing behaviour should be unaffected.Could a maintainer or contributor with a game title run the smoke test on
mainand on this PR's head (5803bc4) and paste the twoxcl-smokeblocks here? Happy to rebase or adjust anything needed.@KOLESNiii on GitHub · 2026-11-26 10:10 UTC · original
Regression runs for this PR, as asked above. Both are clean release builds (
cargo build --release -p xcl) of the same retail game for 60 s. Base ismainatb49be18(this PR's merge base), head is5803bc4.Hardware: NVIDIA GeForce RTX 2070 SUPER, Windows 11 Home 10.0.26300.
main
this PR (5803bc4)
The PR run had 102 % of main's frames and 106 % of its peak commit, with no device removal and no crash.
xcl rundoes not reach the changed code (xcl shaders --precompile --pipelines), so this is a regression check only. Not tested: AMD, the--pipelinespass on a retail title.Test report written with Claude Code (Claude Opus 5.5) from runs on the hardware above.
@KOLESNiii on GitHub · 2026-11-26 10:11 UTC · original · reviewed
Points on
5803bc4that the reviews above don't already cover (I reviewed the source; none of this comes from a GPU run of these paths):A rejected disk blob counts as a plain cold creation. In
make_one, whendriver_cache::loadreturns a blob but the driver doesn't accept it (from_cacheisNone) and the program is under the cap, the code falls through to the cold create and incrementscreated. Nothing separates "a stale XCL blob was refused, then retried cold" from "no blob on disk", so the summary can't show whether the blobs on disk are actually being accepted. Arejectedcounter, incremented whencached.is_some() && from_cache.is_none(), would cover it.No whole/chain breakdown. #2737 asks for separate whole and chain counts when a run produces both.
make_onealready haschained, which picks the.chain.psoname, but every new counter is global.write_failedand the unavailable-blob branches have no test. Both new tests rely on the driver producing a blob.fresh_creation_tracks_created_and_saved_countersonly checkssaved > 0 || blob_unavailable > 0, so it would pass with either counter wrong. #2737 asks for a deterministic case, for example a cache path inside a missing or read-only directory so thatdriver_cache::writereturns false, which should expectwrite_failed == 1andsaved == 0.The relaunch test isn't a relaunch and can pass without checking anything.
persisted_blob_is_reused_on_relaunchcreates a secondPipelinesin the same process, so in-process driver state could hide a blob that doesn't reload on a real relaunch. #2737 asks for a fresh process. And whensaved == 0the test doesprintln!+return, which passes silently instead of reporting a skip throughrecomp::runner::skip_test.Nit: the commit subject and the PR title use
shaders:. The repo's prefix isShaders:(CONTRIBUTING.md, "Commits").Review written with Claude Code (Claude Opus 5.5). I checked each point against the diff.
@emirduran707 on GitHub · 2026-11-26 10:58 UTC · original
Independent AMD RDNA4 (native wave64) verification of exact PR head
7abc336668ecb5048d18760c2af14afa62616feeon Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC1.9.2602.17).Tested
cargo build --workspace(debug): passed (0errors).cargo test --workspace --no-fail-fast -- --test-threads=4:1436 passed, 2 failed, 47 ignored(8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1heap_window_out_of_memory_falls_back_to_the_switch_formno heap windows, 1pso_measurement_compiles_an_exact_synthetic_recordWindows Developer Mode off).shaders::pipeline_cap_tests::fresh_creation_tracks_created_and_saved_countersshaders::pipeline_cap_tests::persisted_blob_is_reused_on_relaunchshaders::pipeline_cap_tests::write_failed_when_cache_dir_is_unwritablegpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1andfuzz_validate_and_gpu_3) are pre-existing on unmodifiedmainon this RX 9060 XT / driver32.0.31044.16.cargo build --release -p xcl+ 60 s retail-title smoke test (scripts/smoke.ps1, offline):(Compare against
mainb49be183on this machine:1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@aijazmirzza on GitHub · 2026-11-26 11:00 UTC · original
Squashed into one commit (
2402a65) addressing all review feedback. Could you re-run the smoke test on this head so the regression block matches? Thank you for the earlier runs and the review.@KOLESNiii on GitHub · 2026-11-26 11:18 UTC · original
Regression runs for the updated head
2402a65. Both are clean release builds (cargo build --release -p xcl),scripts/smoke.ps1on the same retail game for 60 s. Base ismainatb49be18.Hardware: NVIDIA GeForce RTX 2070 SUPER, Windows 11 Home 10.0.26300.
main
this PR (
2402a65)96.9 % of main's frames, 95.4 % of its peak commit, no device removal, no crash.
Runs made and report written with Claude Code (Claude Opus 5.5).
@aijazmirzza on GitHub · 2026-11-26 11:19 UTC · original
Thank you for the AMD verification! Note that 7abc336 was squashed into
2402a65after the review fixes — the code is identical (same diff against main), only the commit history changed. The CI check expects the current head hash in the smoke block. Would you be able to re-run the smoke test on2402a65, or should I cherry-pick to produce a new commit that matches?@KOLESNiii on GitHub · 2026-11-26 11:23 UTC · original · reviewed
Review of
2402a65. One counting bug, and some tests that are weaker than they look.Bug
rejectedmisses stale blobs dropped on the over-cap path (crates/xcl/src/shaders.rs~L1720). Whencached.is_some() && from_cache.is_none() && over_cap, the blob is deleted and the function returns before therejectedincrement (~L1737) runs, so these are counted only ascapped. After a driver update that invalidates large programs' blobs, the summary prints "XCL disk blobs rejected 0", which hides exactly what the counter is for.stale_blob_cannot_bypass_the_offline_pipeline_capreaches this path but doesn't checkrejected. Suggest incrementingrejectedin that branch too, or right afterfrom_cacheis computed.Tests
write_failed_when_cache_dir_is_unwritableassertswrite_failed > 0 || blob_unavailable > 0, so it passes even if a failed write gets counted asblob_unavailable. For the "deterministicwrite_failed" test the description mentions, assertwrite_failed == 1andblob_unavailable == 0when the driver returns a non-empty blob, andskip_testotherwise.persisted_blob_is_reused_on_relaunchcan fail rather than skip:makecounts a hit only when the reloaded PSO'sGetCachedBlob()size equals the loaded size, and the test hard-assertsreused == 1. On a driver that accepts the blob but re-serializes it to a different size, this turns the GPU suite red. A skip in that case would match how the test already handles "no blob saved".Pipelinesin the same process on the same adapter, so it isn't a relaunch. The PR notes this under Not tested; the name could say what it checks (reuse through a secondPipelines), or the second half could run in a child process.rejected,cache_disabledandcreated_chainhave no assertions. For example:rejected == 1after a corrupt blob under the cap,cache_disabled == 1with no cache path,created_chaininsplit_compute_program_prebuilds_and_caches_chain_pieces. A test forrejectedwould have caught (1).Not from this PR (FYI)
Regression run
Smoke blocks for
2402a65andmainb49be18are in #2739 (96.9 % of main's frames, 95.4 % peak commit, no removal or crash).PR checksreads the description, so they need to be pasted under Regression run.Review done with Claude Code (Claude Opus 5.5); I checked each point against the code at
2402a65.@KOLESNiii on GitHub · 2026-11-26 11:25 UTC · original · requested changes
Requesting changes for the counting bug in #2739 (point 1): stale blobs dropped on the over-cap path return before
rejectedis incremented, so they never show in "XCL disk blobs rejected". Please fix it with a test that checksrejectedon that path; points 2, 3 and 5 there are worth tightening at the same time.Review done with Claude Code (Claude Opus 5.5).
2402a65bc8toe58cd9e794@aijazmirzza on GitHub · 2026-11-26 11:38 UTC · original
Addressed all points from the review of
2402a65ine58cd9e:rejectedcounter on the over-cap stale-blob path — addedself.rejected.fetch_add(1, …)before the early return, so a stale blob that would have bypassed the cap is counted as rejected. Thestale_blob_cannot_bypass_the_offline_pipeline_captest now assertsrejected == 1.created_whole/created_chainbreakdown —created_wholeandcreated_chainnow increment inside theOkbranch based on thechainedparameter. Thesplit_compute_program_prebuilds_and_caches_chain_piecestest assertscreated_chain == 2, created_whole == 0.write_failedtest tightened — now assertswrite_failed == 1specifically (not> 0), and skips viaskip_testif the driver returned no blob (blob_unavailable > 0).Relaunch test renamed and made robust — renamed to
persisted_blob_is_reused_through_a_second_pipelinesto reflect what it actually does. Usesskip_testwhensaved == 0and when the driver re-serializes the blob to a different size (reused == 0 && rejected > 0).cache_disabledtest — newcache_disabled_when_no_cache_pathtest: creates aPipelineswith nocache_dir, assertscache_disabled == 1,saved == 0,write_failed == 0. In test builds,cache_dir: Nonenow returnsNonefor the path (instead of falling through to the system default) so the counter is exercised deterministically.Stale file cleanup on a failed write noted as separate scope (per the review).
All 7
pipeline_cap_testspass on NVIDIA RTX 4060 (debug,--test-threads=1). The regression run blocks in the description reference 5803bc4; will need a fresh run one58cd9e.Commit prefix fixed to
Shaders:(capital S).@KOLESNiii on GitHub · 2026-11-26 11:45 UTC · original · approved these changes
Re-review of
e58cd9e. Everything from my review of2402a65is addressed; approving.crates/xcl/src/shaders.rs~L1767):rejectedis now counted before the early return, andstale_blob_cannot_bypass_the_offline_pipeline_capassertsrejected == 1. On the path under the cap,rejectedgoes up only whencached.is_some()and the blob gave no hit. So one stale blob counts as rejected exactly once on either path.created/ whole / chain: these count only on theOkarm of the cold create, so a refused create now givescreated 0, refused 1.made == created + reusedholds on every path that reaches the final match. The split-program test pinscreated_chain == 2,created_whole == 0.cache_disabledis separate fromblob_unavailable, and has a deterministic test.write_failedtest: the blocker file makesdriver_cache::writefail. The test assertswrite_failed == 1when the driver returned a blob and callsskip_testotherwise.Pipelinestest: renamed. It callsskip_testwhen nothing was saved and when the blob came back at a different size, so it no longer fails or passes silently.Two notes, neither blocking:
#[cfg(test)]change to path resolution means that in test builds,make()with nocache_dirnow gets no path, where it used to fall through todriver_cache::path_for. Tests therefore no longer write into the user's real PSO cache, which is better, but it is a behaviour change outside the counters. It is worth one line in the description..chain.psocheck at the end ofsplit_compute_program_prebuilds_and_caches_chain_piecesassertsrejected >= 1;== 1would be exact if piece 0 is always a hit there. Nit.The description still has no
xcl-smokeblocks for this head under Regression run, soPR checksfails. I'll runmainande58cd9eand post them.Review done with Claude Code (Claude Opus 5.5); I checked each point against the code at
e58cd9e. I did not run the GPU suite for this review.e58cd9e794tod653c21abd@KOLESNiii on GitHub · 2026-11-26 11:49 UTC · original
Regression runs for head
e58cd9e. Both are clean release builds (cargo build --release -p xcl),scripts/smoke.ps1on the same retail game for 60 s. Base ismainatb49be18(this PR's merge base).Hardware: NVIDIA GeForce RTX 2070 SUPER, Windows 11 Home 10.0.26300.
main
this PR (
e58cd9e)104.9 % of main's frames, 100.8 % of its peak commit, no device removal, no crash.
xcl rundoes not reach the changed code (xcl shaders --precompile --pipelines), so this is a regression check only.PR checksreads the description, so please paste both blocks under Regression run.Runs made and report written with Claude Code (Claude Opus 5.5).
d653c21abdtod613e31c73d613e31c73toe58cd9e794@ettehn on GitHub · 2026-11-26 12:18 UTC · original
Fresh-process CLI verification on exact head
e58cd9e7945f11191bd7537203ad1cd1ce6220a1(baseb49be183). Windows 11, RTX 5070 Ti Laptop 12 GB, Rust 1.97.1 MSVC, debug.cargo build --locked --offline -p xcl -j 2passed.Ran
xcl shaders <one synthetic compute record> --precompile --only cs --pipelines --windows 4 --split 1in six separate processes, with isolated XCL caches. All six exited 0 with zero refusals.XCL_PSO_DISK_CACHE=0The saved blob's SHA-256 stayed the same on relaunch. The over-cap case removed the rejected blob; the uncapped case replaced it. Blob unavailable was zero in all cases. NVIDIA's implicit cache was not controlled. No retail title, split-chain case, AMD, or full-suite run in this check.
AI-assisted verification (OpenAI Codex).
@SzczepanGrela on GitHub · 2026-11-26 13:08 UTC · original
Additional RX 9070 / Wine verification on exact head
e58cd9e7945f11191bd7537203ad1cd1ce6220a1, against mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7. Both source trees were unmodified, with full source inventories checked before and after testing.Environment
RX 9070 16 GB (RADV GFX1201), Ryzen 7 7700, CachyOS kernel 7.3.0-5-cachyos, Mesa 26.3.1-arch3.5, GE-Proton11-12 Wine 11.0 Staging, vkd3d-proton
8293130ebe370b1+(local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, releasex86_64-pc-windows-gnu.Fresh-process CLI results
Seven separate processes per revision, using a directory containing one synthetic compute record adapted from the existing test builders. No title data. The resulting DXIL was 3,640 bytes; the cold saved PSO blob was 112 bytes.
Cap off (
XCL_PIPELINE_MAX_KB=0) except the explicitly capped case. Head counters:driverdirectoryXCL_PSO_DISK_CACHE=0All 14 CLI processes exited 0, with zero translation errors and zero pipeline refusals.
blob unavailablewas zero in every head case. The saved blob's SHA-256 stayed unchanged in both relaunch cases. The uncapped invalid blob was replaced; the capped invalid blob was removed without an uncached creation. Every fresh creation was counted as one whole PSO and zero chain PSOs. These hits are the PR's accepted-blob counter, not a timing measurement of the driver's internal cache.Main produced the same legacy made/refused/reused counts and matching cache-file outcomes for each case; it has no new detailed counters.
Unit checks
Windows libtest binaries through the same Wine prefix, filter
shaders::pipeline_cap_tests::,--nocapture, separately with--test-threads=1and4,XCL_REQUIRE_GPU=wave64, and a fresh private enabled native cache per invocation:Not tested
Retail/smoke workloads, native Windows, full workspace suite, graphics PSOs, fresh-process split-chain reuse, performance or FPS. The fresh-process CLI fixture exercises whole compute PSOs only.
AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, ran and verified the paired synthetic tests and cache controls, and drafted this report. Publication authorized by the account owner.
@Aniseto on GitHub · 2026-11-26 13:13 UTC · original
Ran the pipeline counter tests at
e58cd9e:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
All seven pass, including the four new counter tests and the stale-blob test, which logs
adapter=NVIDIA GeForce RTX 5070 Ti ... rejected=1. These are unit tests with a real D3D12 device for the cap case, not a title run.What this adds: the author tested an RTX 4060 Laptop and the smoke runs were done on an RTX 2070 SUPER. This is a Blackwell host with a different driver, and the thread has no report from another machine.
Not tested: the full workspace suite, the
--pipelinespass on a retail title, a fresh-process relaunch, AMD and Intel GPUs, Wine, release profile, title data.AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.