Skip to content

Shaders: verify native two-pass recipe receipts - #3101

Open
thehollowedone wants to merge 1 commit into
xcl-dev:mainfrom
thehollowedone:codex/warm-replay-two-pass-receipts
Open

thehollowedone wants to merge 1 commit into
xcl-dev:mainfrom
thehollowedone:codex/warm-replay-two-pass-receipts

Conversation

@thehollowedone

@thehollowedone thehollowedone commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2829. Warm-replay receipts should defer a pipeline only after the native driver accepted every required pass and the referenced cache files still match. This change records pass roles explicitly, discards receipts from failed heap-window attempts before switch-form retry, and makes old incomplete indexes revalidate.

What is in it

  • warm_replay.rs: require distinct mesh and compute receipts, verify pass roles, and reject old v2 indexes.
  • real.rs and shaders.rs: record accepted graphics, mesh, and compute blobs; discard failed-attempt receipts; classify legacy console VS+GS recipes as two-pass.
  • README.md: document the two-file requirement.

Tested

  • Windows 11 build 26300, NVIDIA GeForce RTX 3080 Ti / driver 621.35, Ryzen 7 9800X3D, rustc 1.99.1 MSVC, DXC 1.8.2502.11.
  • cargo build --offline --locked --workspace passed on head 01c2a85a.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 2,892 passed, 0 failed, 51 ignored across 43 targets; 24 explicit GPU skips (22 require wave64; 2 require heap-window opt-in).
  • cargo test --offline --locked -p xcl --lib warm_replay: 3 passed; legacy VS+GS classification: 1 passed; failed-attempt receipt cleanup: 1 passed.
  • two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs passed in the workspace suite.
  • git diff --check 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce..HEAD passed.

Regression run

Both clean commits were built separately and run for 60 seconds on the same adapter with the same title hash. scripts/smoke.ps1 sets XCL_PREPARE=0, so these results cover launch and presentation, not warm-replay preparation.

xcl-smoke v1
commit: 86e86fcb33f94fa5d0c809d9b50af7b84bf49cce
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1646 (PresentX 1646)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16113 MB
xcl-smoke v1
commit: 01c2a85a834169218466f27acf3477c365f1b0f2
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1645 (PresentX 1645)
presents per 2 s (last 3): 60 57 59
device removals: 0
crashes: 0
peak commit: 16684 MB

Not tested

The separate production-worker warm-cache sequence previously reported on head ff893a2e was not repeated on this rebased head. Startup-time benefit, a second prepared launch, AMD, Intel, and Wine were not tested.

AI use

Codex (GPT-6.2 Sol) rebased the existing change, built and tested it, ran both smoke checks, and updated this description. Codex (GPT-6.2 Astra) reviewed the rebased diff.

@thehollowedone

Copy link
Copy Markdown
Contributor Author

CI follow-up for head 6a04002: the Windows no-GPU job stops while compiling crates/xcl/benches/runtime.rs with E0451 (Config::input_profile is private). The same error occurs on untouched main at e429936c; this PR does not change that benchmark or Config.

I opened the separate two-line CI repair #3102. Its Windows CI and PR-description checks are green. Once that repair lands, I can rebase this warm-replay branch, rerun the clean-head smoke, and update this PR's evidence. Until then, #3101 remains draft.

AI use: Codex (GPT-6.2 Sol) traced both CI logs, made and tested the separate benchmark repair, and drafted this note.

@JJAutoCompare

Copy link
Copy Markdown

Tested

Exact 6a0400268d3b4962a9e884a0be05786d21962e71 on native Windows 11 x64 build 26200.9974, Ryzen 7 3800X, and Rust 1.100.1 MSVC debug. I reran the pinned libtest built from a Git archive with one private fixture inserted. All 393 original files matched their commit blobs when the fixture was excluded.

I ran <libtest.exe> <filter> --exact --nocapture --test-threads=1 separately for both filters.

  • shaders::warm_replay::tests::missing_mesh_file_invalidates_only_its_persisted_recipe used synthetic files with production cache filenames and receipt APIs. After saving and reopening, both mesh recipes sharing a compute file and the ordinary graphics recipe all qualified for deferral. After removing only the first mesh file and reopening against a fresh inventory, only its recipe lost deferral. The second mesh and ordinary graphics recipes still qualified.
  • The stock control shaders::warm_replay::tests::native_mesh_cache_names_make_complete_receipts passed.

2 passed, 0 failed, 0 ignored, 0 runtime skips. Both native processes exited 0, with 2,033 cases filtered out per invocation.

Not tested

Real driver cache, GPU or device creation, retail startup or smoke, the base revision, benchmarks, and the full workspace suite.

AI use

T3 Code through the Codex harness (gpt-6.2-sol) verified the source and executable, ran the tests and wrote this report.

@thehollowedone
thehollowedone force-pushed the codex/warm-replay-two-pass-receipts branch 2 times, most recently from 7fe3ccd to 5ca33f2 Compare November 28, 2026 15:01
@thehollowedone
thehollowedone marked this pull request as ready for review November 28, 2026 15:11
@thehollowedone
thehollowedone force-pushed the codex/warm-replay-two-pass-receipts branch 2 times, most recently from 928e497 to 1ddfbcd Compare November 28, 2026 20:15

@bmjask bmjask left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical-review result: I found no concrete receipt-validation defect. The pass-tagged receipt identity, failed-fallback removal, v3 index, and legacy VS+GS ordering are internally consistent.

The branch currently conflicts. Please rebase and rerun the required exact-head validation; cache/receipt changes are especially sensitive to silently retaining stale artifacts, so include a cold-cache round trip on the rebased head.

Reviewed at 1ddfbcd with Codex (GPT-5).

@thehollowedone
thehollowedone force-pushed the codex/warm-replay-two-pass-receipts branch from 1ddfbcd to daf03fe Compare November 28, 2026 22:41
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 28, 2026
@thehollowedone

thehollowedone commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Follow-up to the rebase and cold-cache request: I rebased this PR onto main at 7db2f391. The new head is daf03feb, and GitHub reports it mergeable.

On that head, the warm_replay tests passed 3/3. They include a synthetic cold-cache round trip: save two native-format pass files and their receipt index, reopen a fresh inventory, then verify that complete pairs defer and incomplete or wrong-role pairs do not. The switch-form retry test passed 1/1, and the native GPU two-pass cache test passed 1/1. I updated the PR description with the full workspace counts, the same failure reproduced on clean main, and both generated clean-commit 60-second smoke blocks. Windows no-GPU CI, the PR-description check and triage all passed on this head.

AI use: Codex (GPT-6.2 Sol) rebased and ran the checks; Codex (GPT-6.2 Astra) reviewed the receipt and retry invariants.

@andrewDoing

Copy link
Copy Markdown
Contributor

I connected the receipt checks to actual RTX 5070 driver blobs and pixel readbacks at daf03febbab3d2a5f58d66cab5c5685d210a7d52 (driver 616.92). Two synthetic NGG shaders differ by one color constant. They share the mesh graphics pass but have distinct compute passes.

Fresh process First shader Second shader
Empty XCL driver cache, before creation No receipt No receipt
After native creation and capture 2 accepted files, qualifies 2 accepted files, qualifies
Next two fresh processes, before creating either PSO Qualifies Qualifies
Fresh inventory after removing only the first shader's compute file Does not qualify Still qualifies

Both warm processes then created the live pipelines. The native draw/readbacks returned red 1.0 and 0.5 for the respective shaders, with alpha 1.0 and zero green/blue. The stock no-dispatch clear and legacy GS green controls also passed. One focused test passed with zero skips.

I extended the native two-pass fixture, wrapped synchronous pipeline creation with the production receipt capture/add/save APIs, and reopened the production index. The fixture used shader-container hashes as its two recipe identifiers and a fixed window count; it bypasses the preparation CLI's history key construction and scheduling. Cold refers to an empty XCL cache. When adapting the stock fixture, the phase variable must stay outside the XCL_ namespace (or be held constant) to avoid changing the settings key across child processes.

AI use: OpenAI Codex adapted the test-only fixture, ran the native controls and drafted this report.

@thehollowedone
thehollowedone force-pushed the codex/warm-replay-two-pass-receipts branch 3 times, most recently from 57da016 to efede78 Compare November 30, 2026 04:39
@thehollowedone

Copy link
Copy Markdown
Contributor Author

Rebased onto current main f3bb6649; the updated head is efede780. Since main now accepts native cache filenames, this revision records the producing pass explicitly, discards receipts from failed heap-window attempts, and revalidates old receipt indexes.

The full workspace run had 2,861 passed, 2 failed, and 51 ignored, with 24 explicit GPU skips. Both failures reproduced on clean main: the D16 result-register assertion and the mesh cache test’s “DXIL not compiled yet” result. The four new receipt/retry/classification tests passed.

The PR description now has generated paired 60-second smoke blocks for those exact commits. Both exited normally with no device removals or crashes; frames were 1,662 on main and 1,665 on the PR head. The smoke uses XCL_PREPARE=0, so it does not exercise warm-replay preparation.

AI use: Codex (GPT-6.2 Sol) rebased, resolved the overlap, built and tested this revision, ran the smokes, and drafted this report.

@thehollowedone
thehollowedone force-pushed the codex/warm-replay-two-pass-receipts branch from efede78 to ff893a2 Compare November 30, 2026 05:41
@thehollowedone

Copy link
Copy Markdown
Contributor Author

Rebased and rerun on current main d52ff48c, at PR head ff893a2e.

cargo build --offline --locked --workspace passed. The full workspace suite reported 2,878 passed, 2 failed, 51 ignored; both failing tests reproduced individually on clean main. There were 24 explicit GPU skip notices across 42 test targets.

The paired 60-second smoke on the RTX 3080 Ti showed 1,664 frames on main and 1,694 on this head, with 60 presents per two-second interval at the end of both runs, zero device removals or crashes, and peak commit of 15,724 MB / 15,284 MB. XCL_PREPARE=0, so this checks launch and presentation but does not exercise warm-replay preparation. The updated description has the exact smoke blocks and failure names. CI is running after the update.

AI use: Codex (GPT-6.2 Sol) rebased and ran the checks; Codex (GPT-6.2 Astra) reviewed the final diff.

@Gevroska

Copy link
Copy Markdown

I tested warm replay on ff893a2e on my RTX 3080 10 GB (driver 616.92). The smoke test on this head used XCL_PREPARE=0, so I ran two synthetic two-pass recipes through the production xcl shaders worker. They share a mesh pass and have separate compute passes.

Fresh worker process Result
Empty XCL cache Built both recipes and wrote one mesh file and two compute files.
Warm cache Deferred both recipes. All three files and the receipt index stayed byte-identical.
First recipe’s compute file removed Rebuilt only the missing compute pass, reused the shared mesh pass, and deferred the second recipe.
Warm cache after repair Deferred both recipes again.

All four processes exited successfully with zero worker failures or skips. On this head, removing one compute file invalidated only the recipe that needed it. This test covers cache recovery in the preparation worker. I didn’t measure game startup time.

I used Codex GPT-6.2 Sol to prepare the fixture, run the worker, and analyze the logs. The results were independently checked. Codex GPT-6.2 Astra drafted this comment.

I reviewed and approved this comment before posting.

@thehollowedone

Copy link
Copy Markdown
Contributor Author

Focused warm-replay tests on current head 284cda77, based directly on main 9dfbe3ea:

cargo test --offline --locked -p xcl --lib warm_replay -- --test-threads=1
3 passed, 0 failed, 0 ignored; 2,769 filtered out.

These tests cover complete native mesh receipts, legacy graphics-receipt revalidation, and requiring both unchanged driver files. Windows 11 build 26300; CPU-only run, no GPU test. The production worker's cold/warm/missing-file sequence was previously reported on head ff893a2e and was not repeated on this head.

AI use: Codex (GPT-6.2 Sol) ran the tests; Codex (GPT-6.2 Astra) reviewed the current diff.

The native cache writes gfx and compute-hash filenames, while the graphics receipt validator expected unused tp-ms/tp-cs names. Tag accepted files by pipeline pass, retain only receipts from a successful retry, and classify legacy console geometry shaders as two-pass. Version the graphics receipt index to invalidate old partial entries without deleting native blob caches.

The new filename regression fails on the parent and passes with this change. The workspace suite and paired smoke are verified separately on the final commit.

Assisted-by: Codex (GPT-6.2 Sol)
@thehollowedone
thehollowedone force-pushed the codex/warm-replay-two-pass-receipts branch from 284cda7 to 01c2a85 Compare November 30, 2026 22:33
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 01c2a85

Follows up #2829 and the name-based mesh receipts merged in #3495 (2308e9d). It replaces the file-name check with explicit pass roles, drops receipts from a failed heap-window attempt before the switch-form retry, and bumps the index to v3. No open PR changes warm_replay.rs the same way (#3506 only changes the Wine receipt import).
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: 493dbd3
head: 01c2a85
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2903 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+165/-36). On main, VS+GS records were classed as single-pass and receipts were checked by file name. The two-pass mesh file is also named gfx-..., so a mesh-pass file alone made a "complete" receipt and the compute pass was never verified; receipts from a failed heap-window attempt also stayed in the capture list. Pass roles are now recorded when the driver accepts a blob, and a misclassified recipe can only lose its receipt, never get a wrong one. Findings: (1) Cost. A two-pass receipt now needs a kept compute file (warm_replay.rs ~113, shaders.rs ~4002), and a compute build under 20 ms keeps none (COMPUTE_KEEP). So recipes with a fast compute pass never get a receipt and are rebuilt by the driver on every preparation run. Native mesh recipes already had this on main; console VS+GS recipes now join them. Right call, but not measured on a GS-heavy title. (2) Moving the index from v2 to v3 (~105) drops every existing receipt, valid single-pass ones included, so the next preparation runs everything once; the description could say so. The old v2 files stay on disk. (3) The new tests use the new Pass API, so they can't run on main, though their logic covers the false accept (key 6) and the discarded retry receipt; nothing tests the graphics_worker wiring end to end. Fine: legacy_two_pass (DS and HS empty, VS and GS console shaders) matches the real routing in translated_graphics_pso_once. checkpoint / discard_since are thread-local, cheap, and skipped when no capture runs. Verification itself is unchanged (size, creation and write time against the inventory), so no extra hashing at startup. smoke.ps1 sets XCL_PREPARE=0, so a smoke run doesn't reach receipt recording; no smoke run here.
performance: no smoke run (the default path doesn't reach this change); not measured. Preparation-only: a smoke run (XCL_PREPARE=0) doesn't record receipts.
verdict: safe to merge (the one-time re-preparation from the v2 -> v3 index and the cost for fast compute passes are worth a line in the description)
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

@github-actions github-actions Bot added needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU labels Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:docs-ci Documentation, scripts, workflows, repo governance area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) needs:amd-test Needs a test report or merge-check on an AMD GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants