Shaders: the preparation trusts the driver blobs it checked before #2951
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!2951
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2951"
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?
@throny on GitHub · 2026-11-27 03:55 UTC · original
throny:prep-skip-verified→nvidia-dev· +203 −10 · 4 files · 1 commits · draftAt every launch the shader preparation created each used compute pipeline again from its stored driver blob, only to apply its check (the driver makes a pipeline from the blob and returns a blob of the same size), and then dropped the pipeline. That is not free: on an RTX 4080 (driver 621.40) creating a large pipeline from its blob was measured to take as long as compiling it, so the preparation took minutes at every launch, also right after a launch that had completed it. This PR remembers that a blob passed the check and does not create its pipeline again. Part of #2088 (plan and discussion there; the content digest is @ettehn's point).
What is in it
crates/xcl/src/hle/d3d12x/real.rs(driver_cache): a marker<blob>.okbeside a blob that passed the check or was just written: the driver's identity (the one the graphics blobs use), the blob's length and an FNV-64 digest of its bytes.verifiedcompares all three with the file as it is now;removedeletes a refused blob together with its marker.crates/xcl/src/shaders.rs(Pipelines::make_one): a record whose blob matches its marker is counted ("pipelines whose blob an earlier pass verified, not created again N") and returns before the worker slot and the driver call. Anything else goes the present way and is marked afterwards.XCL_PREPARE_VERIFY=1applies the check to every blob again.a_verified_blob_is_trusted_until_it_changes_or_is_refused(other driver, changed length, same-length overwrite, missing blob, refusal), GPU testa_second_pass_trusts_the_blobs_the_first_verified, andgpu_compute_e2e::offline_compute_pipeline_is_reused_by_a_second_processextended across processes (trusted; a blob overwritten with zeros of the same length is rebuilt and trusted again). Two existing e2e tests list only.psofiles and run their reuse assertions withXCL_PREPARE_VERIFY=1, unchanged otherwise.README.md: one bullet for the markers and the switch.The marker says what the preparation's check said before, no more: it does not prove the driver used the blob (the comment at the check already notes a driver may compile from the DXIL and still succeed). It changes when the check runs, not what it proves.
Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on 551bcb90 (this commit before a comment-only amend): 1825 passed, 8 failed, 48 ignored, 27 SKIPPED lines (mostly "no wave64", two "no heap windows"). The 8 failures are 6 tests that fail the same way on the clean baseecc0bb57on this machine, each rerun alone with and without the change: listed in #2572. None is in code this PR touches exceptgpu_compute_e2e, where the two failing tests fail at the same lines without it.cargo test -p xcl --lib driver_cache: 7 passed;--lib pipeline_cap_tests: 4 passed;--test gpu_compute_e2e: 5 passed, 2 failed (the two above).XCL_PREPARE_VERIFY=1(the present behaviour) 131 s (compute pipelines 120 s); the two launches after it, with the markers, 11 s and 11 s (compute pipelines 3 s). 4,203 markers were written.Regression run
On the base commit (
nvidia-dev, notmain: this PR is againstnvidia-dev) and on this PR's head, same title, 120 s:Not tested
XCL_PREPARE_VERIFY=1does.AI use
🤖 Generated with Claude Code
@andrewDoing on GitHub · 2026-11-27 04:02 UTC · original
On
40a14da3716bc28d0c34c86928de987a473192bb, the verified-blob marker and explicit pipeline-size cap behaved consistently across seven fresh Windows CLI processes on an RTX 5070. The test used one synthetic packed compute shader, 4,452 bytes of compiled DXIL, a 2,318-byte driver blob and one isolated cache. No code changes were needed..okmarker.All seven
xcl shaders --precompile --pipelinesruns exited successfully. This checks the interaction between same-length damage, the size cap and marker cleanup through the public CLI. It does not measure startup or first-dispatch latency in a retail title.AI use: OpenAI Codex with GPT-6.2 Astra prepared the synthetic checks and compared the CLI counters and cache files; Codex coordinated and prepared this report.
@andrewDoing on GitHub · 2026-11-27 04:03 UTC · original
I checked whether marker-bypass savings shifted into the first native consumer PSO creation, using head
40a14da3716bc28d0c34c86928de987a473192bbplus a test-only fixture on RTX 5070 / driver 616.92. Twelve synthetic compute shaders were seeded with driver blobs and markers. Each of 32 fresh processes began with a separate copy; the implicit OS/driver cache remained warm and its contents were not inspected. Eight counterbalanced runs were made per arm.All 384 consumer creates succeeded. One 115.253 ms trust/supplied preparation outlier is retained. The paired subtotal excludes fixture/setup overhead. Consumer blob I/O and root-signature setup were outside the timed native calls; PSOs remained alive. This checks a small synthetic corpus on one device and shows little transfer of the preparation difference to first native creation in this setup. It does not establish which blob path a title uses, cold-driver behavior, GTA VI startup, dispatch correctness or frame time.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the synthetic measurement and audited the artifacts; Codex coordinated and prepared this report.
@throny on GitHub · 2026-11-27 04:15 UTC · original
@andrewDoing thank you for both checks, in particular the second one: whether the saving just moves into the title's first creation was the open point in Not tested, and your 32 processes on driver 616.92 show little transfer for small programs. The size cap together with a same-length overwrite is a combination I had not run.
Status of the checks:
Build and test (Windows, no GPU)fails inhle::d3d12x::sparse::tests::a_gpu_write_into_a_gpu_view_lands_in_its_cpu_view, which this PR does not touch; the same check is red on the other open PRs againstnvidia-devI looked at (#2935, #2927, #2923), so it comes from the base.PR descriptionasks for a smoke block made on a commit ofmain; that run is in progress and I will add the block to the description.AI use: Claude Code (Claude Fable 5.2).
@LocranKing on GitHub · 2026-11-27 04:49 UTC · original
Independent back-to-back verification on RTX 3060 Ti (8 GB) + Ryzen 5 5500 (6C/12T) (
40a14da3merged withnvidia-devecc0bb57, Series S /lockhartprofile).Setup
621.40), DXC1.9.2602.17.XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_PSO_WAIT_MS=50 XCL_GFX_PSO_WAIT_MS=200 XCL_CS_PSO_WAIT_MS=50 XCL_PREPARE_GRAPHICS=0 XCL_DRED=1+XCL_PRESS_AT(18:A..74:A).Two consecutive 90 s runs on the same cache folder
lockhartsnapshot (1,572used shaders,3,206driver blobs, no.okmarkers yet)..okmarkers written by Run 1).90 s)first_2pass_mesh_tnvidia-dev(ecc0bb57, 2 runs)#2951Run 1 (creates.ok)43.3 swall)1 5 11)#2951Run 2 (trusts.ok)44 31 9)Not tested: driver update invalidation / tampered-blob fallback test on this machine, AMD/Intel adapters.
@luckyteagirl on GitHub · 2026-11-27 05:31 UTC · original · reviewed
On
40a14da3716bc28d0c34c86928de987a473192bb, the cold creation path marks a freshly exported blob verified as soon asdriver_cache::writesucceeds. That path cleareddesc.CachedPSOand built the pipeline from DXIL, so the newly written bytes have not passed the check described for this marker: importing them throughCreateComputePipelineState, then receiving a cached blob of the same size. On the next normal launchdriver_cache::verifiedreturns early and may never perform that check. Could the first pass round-trip the exported blob before marking it, or defer the marker untilfrom_cachesucceeds on a later pass? The new test currently expects a marker immediately after cold creation and would need to cover the intended cold → checked → trusted sequence. This is exact-head source review; I did not demonstrate a driver that rejects its own exported blob.AI use: OpenAI Codex (GPT-6.2 Sol) traced the cold and trusted paths and checked the discussion; OpenAI Codex (GPT-6.2 Astra) independently read the exact source and wrote this review.
@oni-swr on GitHub · 2026-11-27 06:16 UTC · original
amd-win check of
40a14da3(basenvidia-devecc0bb57), RX 7800 XT (RDNA3), driver 32.0.31035.1003, Windows 11 build 26200, Ryzen 7 5700X3D, 64 GB, release builds, DXC 1.8.2502.11.a_verified_blob_is_trusted_until_it_changes_or_is_refusedanda_second_pass_trusts_the_blobs_the_first_verified: 2 passed, 0 failed, 0 skipped.gpu_compute_e2e::offline_compute_pipeline_is_reused_by_a_second_process: 1 passed, 0 failed.xcl shaders <pack> --precompile --only cs --pipelines --used-only(331 used pipelines, 238 compute programs compiled),XCL_PSO_DISK_CACHE=1 XCL_PIPELINE_THREADS=4, run twice in a row per exe (first pass fills, second is the warm one):ecc0bb5740a14da3What this says for AMD: creating the pipelines from the stored blobs costs almost nothing here. The whole second pass of the base, translation included, takes 3.4 s for 238 pipelines (at most about 57 ms each on average with 4 threads), against 159 s for the first pass. So on this driver the marker saves about 0.1 s per launch and is neutral, in contrast to the 19.7 s per create reported on the RTX 4080. It also did no harm: 0 refused, 0 errors, identical pass 1 time.
Not tested: a title run, graphics pipelines, a driver or adapter change between passes, other AMD parts, NVIDIA. The AMD driver's own cache was warm from earlier runs (blobs here are names of entries in it), so this says nothing about a cold driver cache.
AI use: Claude Code (Claude Sonnet 5.5) ran the tests and runs and wrote this.
@thehollowedone on GitHub · 2026-11-27 08:46 UTC · original
Following the fresh-export review point, I tried the smallest local resolution on #2951 head
40a14da3: write a newly exported blob without marking it, then mark it only after the next pass successfully re-imports that blob through the PR's existingfrom_cachecheck. The sequence is cold export → checked import → later trusted skip. This uses the check the marker claims to record; it does not add a second driver creation to the cold pass.On Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Rust 1.99.1 MSVC, DXC 1.8.2502.11:
a_second_pass_trusts_the_blobs_the_first_verifiedtest on the unchanged production head failed as intended: 0 passed, 1 failed, 0 ignored, because the fresh export already had a marker. With the candidate fix, it passed 1/0/0.cargo test --offline --locked -j 4 -p xcl --lib pipeline_cap_tests -- --test-threads=1with the candidate: 4 passed, 0 failed, 0 ignored, no skips.cargo test --offline --locked -j 4 -p xcl --test gpu_compute_e2e offline_compute_pipeline_is_reused_by_a_second_process -- --nocapture --test-threads=1with the revised damaged-blob recovery expectation: 1 passed, 0 failed, 0 ignored, no skips. This runs the public CLI in fresh processes and uses synthetic shaders.Candidate diff for the author
The tradeoff is that the first later launch with a fresh blob must do the driver check; the next matching launch can skip it. The current second-launch timing claim should be remeasured if this is adopted. I did not run the full workspace suite or paired title smoke on this uncommitted candidate. AI use: Codex (GPT-6.2 Sol) traced the paths, wrote the local diff and ran these tests.
@JJAutoCompare on GitHub · 2026-11-27 12:17 UTC · original
Tested
Clean
40a14da3716bc28d0c34c86928de987a473192bbon Windows 11 build 26200.9974, Ryzen 7 3800X, Rust 1.100.0 MSVC, Intel Arc A770 driver 32.0.101.9175, DXC/DXIL 1.9.2602.17. Built withcargo test --offline --locked -j 2 -p xcl --lib --test gpu_compute_e2e --no-run --message-format=json-render-diagnostics. Ran eight freshxcl shaders <synthetic-input> --precompile --pipelinesprocesses with separate Arc cache roots per control.shaders::pipeline_cap_tests::stale_blob_cannot_bypass_the_offline_pipeline_cap --exact --nocapture --test-threads=1passed. The stale blob was removed, the offline cap was recorded, and dispatch read back 42.All eight CLI controls and the libtest passed. Zero failures, ignores, or runtime skips. The pinned identity probe identified Arc PCI 8086:56a0. Each Arc process used the shared mutex separately.
Not tested
A real adapter or driver change, Arc performance, retail smoke and full suite.
AI use
T3 Code / Codex (
gpt-6.2-sol) ran the original verification, independently reproduced the cases reported here, and wrote this report.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.