Shaders: add selective --replay-chain-whole validation, warming, and reuse test #2809
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2819"
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 Decodere on 2026-11-26T14:26:47Z.
Implements Steps 2–4 of #2741: selective offline validation and native
.chain.psowhole-form prewarming (xcl shaders <input> --replay-chain-whole <capture.jsonl> [--replay-cutoff <N>]), plus a fresh-process real-GPU E2E reuse proof across hookedExecuteIndirectand direct fallback (Dispatchwithout recording allocator). Regular--precompile,--pipelines,--used-only/--used,--records,xcl pso-precompile, chain pieces, and runtime fallback behavior are unchanged. Rebased cleanly ontomain(f9a0cb80f9decb41d6f6315f6cf4e06270ba2bda, preserving #1871's CLI options and usingmain's existingreal::driver_cache_stats()).Part of #2741
Part of #2088
Part of #2508
What is in it
crates/xcl/src/shaders/chain_whole_replay.rs(new):schema_version: 1UTF-8 JSONL parser accepting #2786's 12-fieldtranslation_optionsheader (validatingmem_windowsandsplit_wave64per demand record), ordered first-demand records, exactmin(cli_cutoff, header.sequence_cutoff)selection, and exact FNV-1a 64chain_root_sig_iddigest over ordered static samplers.source_record_hashseparate, resolving demanded compute records (FSSMandFSPX/ACCC) in a single pass over the shader input.recomp::pso::console_to_dxil_in, validates ABI version, header/CLI translation options, split-chain eligibility, final whole DXIL hash/length, ordered static samplers andchain_root_sig_id,effective_flags,node_mask == 0, and runtimedriver_cache::name_for(..., true)key; rejects disk-key collisions across distinct validated(chain_rs_id, node_mask, effective_flags, whole_dxil)targets asAmbiguousDiskKeyand collapses identical whole build targets sharing adisk_cache_nameto one first-demand entry so parallel workers never race on one.chain.psofile..chain.psoentries in first-demand order viadispatch_chain_root_signatureand recordedeffective_flags/node_maskunderXCL_PIPELINE_THREADSandXCL_PIPELINE_MAX_KB, reporting distinct native build/persistence outcomes (created_with_supplied_blob,created_fresh,rejected_and_cold_retried,persisted,blob_unavailable,write_failed,cache_disabled,capped,refused) and returning exit code1whenever any validation issue, cap, refusal, or unpersisted entry leaves replay incomplete.--replay-cutoffexit2), goldenchain_root_sig_iddigests, strict JSONL parser rejection, cutoff/dedup/multi-identity planning, validation and disk-key collision rejection, and incomplete-exit accounting when persistence is capped or disabled.crates/xcl/src/shaders.rs:mod chain_whole_replay;, adds--replay-chain-whole <path>and--replay-cutoff <u64>(rejecting orphan--replay-cutoffwith exit code2), tracks explicit--windows, allows single-file inputs for--replay-chain-whole, and dispatches tochain_whole_replay::run(...)without modifyingPipelines,precompile, or #1871'spso_precompile/--used/--recordshandling.crates/xcl/tests/gpu_compute_e2e.rs:selective_chain_whole_replay_reuses_blob_in_fresh_process: verifies disabled disk cache returns exit1and writes nothing, cold selective replay writes exactly 1.chain.psoblob for the demanded shader only (not an unselected sibling, split pieces, or.pso), warm replay hits the supplied blob, and 3 fresh Windows child processes prove exact reuse viareal::driver_cache_stats()(hits == 1, stale == 0) plus matching 32-lane GPU output on hookedExecuteIndirectand direct fallback (Dispatchwithallocator == 0) while the unselected sibling records(hits == 0, stale == 0).Tested
26200), NVIDIA GeForce RTX 4060 8 GB (Ada, 32-lane waves, driver32.0.16.2114), Intel Core i5-11400F (6C/12T), 32 GB RAM,rustc 1.100.0, DXC1.9.2609.5, debug + release, rebased HEAD9664e0b82880cbc19dc583fa842a5f801030d9fcoffmain(f9a0cb80f9decb41d6f6315f6cf4e06270ba2bda).cargo clippy --tests -p xcl -- -A clippy::approx_constant -A clippy::while_immutable_condition:exit 0,0new warnings or errors across all 3 modified/added files (shaders.rs,chain_whole_replay.rs,gpu_compute_e2e.rs; the-Aflags suppress only pre-existingrustc 1.100.0deny-by-default lints outside this diff).3xDebug and3xRelease targeted tests (RTX 4060,0skips on new GPU E2E test):cargo test --lib -p xcl chain_whole_replay -- --test-threads=4(Debug3x, Release3x):6 passed; 0 failed; 0 ignoredcargo test -p xcl --test gpu_compute_e2e selective_chain_whole_replay_reuses_blob_in_fresh_process -- --test-threads=1 --nocapture(Debug3x, Release3x):1 passed; 0 failed; 0 ignored(0skips; all 3 fresh child processes passed live on RTX 4060)cargo test --release -p xcl --test gpu_compute_e2e -- --test-threads=1:8 passed; 0 failed; 0 ignored(1expected runtime self-skip:heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows)cargo test --release --lib -p xcl shaders:: -- --test-threads=4:19 passed; 0 failed; 0 ignoredcargo build --release -p xcl:exit 0,0new warnings in touched files.Regression run
Quiet 60 s retail smoke runs (
scripts/smoke.ps1 -Seconds 60,XCL_PREPARE=0,XCL_NETWORK=0,title: 29640639, NVIDIA GeForce RTX 4060).main(f9a0cb80f9decb41d6f6315f6cf4e06270ba2bda, exact parent):PR (
9664e0b82880cbc19dc583fa842a5f801030d9fc):Not tested
XCL_HEAP_WINDOWS=1, and D3D12 debug layer (d3d12SDKLayers.dllnot installed on this host).AI use
--replay-chain-wholeparser/validator/prewarmer, unit tests, and fresh-process GPU E2E reuse test, rebased ontomain(f9a0cb80) preserving#1871and deduplicatingreal::driver_cache_stats(), ran all clippy,3xDebug/Release targeted tests, release build, and paired 60 s RTX 4060 smoke verifications, and updated this PR description.Imported from ivall/xcl. Originally posted by ettehn on 2026-11-26T14:32:19Z.
Independent Windows CLI and GPU check on
fd317b9c3124f01f305be9263d46017a14dedd2b. The only local change was two extra cases in the existing synthetic integration fixture. Both ran before the driver cache existed.--replay-cutoff 0exited 0 withselected 0,dropped_by_cutoff 1, andcomplete: true. It did not create a driver-cache directory.whole_dxil_hashto a different well-formed value exited 1 withwhole_dxil_mismatch,validated 0,created_fresh 0,persisted 0, andcomplete: false. The driver-cache directory still did not exist.Windows 11 build 26200, Ryzen 9 8945HX, RTX 5070 Ti Laptop 12 GB (621.24), Rust 1.97.1 MSVC debug, DXC 1.8.2502.11,
XCL_ADAPTER=NVIDIA XCL_REQUIRE_GPU=wave64.Integration 1 passed and unit tests 6 passed, no failures, ignored tests, or reported skips. The run used synthetic shaders. It did not cover a retail capture, heap-window mode, or the full workspace suite.
OpenAI Codex assisted with the two extra cases and verification.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T14:49:57Z.
Ran the selective chain-whole replay tests at
fd317b9: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 six parser/validator/collision unit tests pass, and the fresh-process GPU test also passes here: one
.chain.psoblob reused by three child processes with matching 32-lane GPU output on the RTX 5070 Ti.What this adds: the author tested an RTX 4060 8 GB (Ada). This is a Blackwell 16 GB host with the same DXC version; the thread has no report from another machine.
Not tested: a retail capture sidecar, a paired 60 s smoke run, the full workspace suite, AMD and Intel GPUs, wave64 hosts,
XCL_HEAP_WINDOWS=1, D3D12 debug layer, 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.
Imported from ivall/xcl. Originally posted by SzczepanGrela on 2026-11-26T15:21:34Z.
RX 9070 / Wine: offline replay and persistence checks pass; the fresh-runtime reuse fixture remains incomplete here.
Tested
fd317b9c3124f01f305be9263d46017a14dedd2bagainst mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.8293130ebe370b1+(local asserts-disabled build), DXC/DXIL 1.9.2602.17, Rust 1.97.1, releasex86_64-pc-windows-gnu.XCL_NETWORK=0, enabled private caches. Replay usesXCL_DIRECT_DXIL=1, split instruction limit 12,XCL_SPLIT_WAVE64=1,XCL_UMA_WINDOWS=4, and the upstream fixture's two synthetic compute records.Verified offline results
shaders::chain_whole_replay::: 6 passed / 0 failed / 0 ignored, both one and four test threads. Existingshaders::pipeline_cap_tests::: 3/0/0 on both main and head, at both thread counts; its GPU dispatch control reads 42.Separate CLI processes using the captured synthetic demand give:
whole_dxil_mismatch, validated 0, no native build/blobThe selected whole DXIL is 2692 bytes. Cold replay creates only
6bf9827cb92b8a85-a84-0.chain.pso, 112 bytes. Filename and SHA-256 match across cold/warm; corrupt-cache repair restores a valid 112-byte blob. Main rejects the new replay option with exit 2, as expected.Fresh-runtime limitation
selective_chain_whole_replay_reuses_blob_in_fresh_processreports 0 passed / 1 failed / 0 ignored in both the instrumented fixture and a separately built, unmodified exact-head fixture. In the logged run, disabled/cold/warm replay completes with the expected outcomes, then the firstindirectchild exits-1073741819(0xc0000005) before the cache-stat/readback checkpoint. Its actual device matches RX 9070 PCI1002:7550, LUID00000000:000003ef. The unmodified fixture also fails its firstindirectchild; it does not print that child's exit code.Separate baseline context: unchanged
console_wave64_compute_through_the_pso_hook_dispatch_and_read_backfails on both main and head withdispatch: Invalid parameter (0x80070057). The cause of the new child's termination is unestablished. Itsdirect_fallbackandunselected_siblingcases are not reached, so runtime reuse and GPU output for this fixture remain unverified.The instrumented tree changes only test observability: child output/counters/readbacks, device-LUID assertion, and preservation of caller-selected private artifacts. Original assertions and production sources remain unchanged. All source bytes were reconstructed and checked; the separate exact-head control has no overlays. Raw summaries, CLI counters, stored input/capture/blob bytes and executable hashes were independently verified. No runtime capability skips or ignored tests in these selections.
Build:
cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --test gpu_compute_e2e --no-run. Exact integration filter as above,--nocapture --test-threads=1. CLI:xcl.exe shaders <synthetic-input> --replay-chain-whole <capture.jsonl> --windows 4 --split 1, with--replay-cutoff 0for the cutoff case.Not tested
Successful runtime reuse/readback for the new fixture on this host, native Wave64 guest execution, heap-window mode, native static-sampler cases, retail captures or title workload,
scripts/smoke.ps1, full suite, native Windows, other GPUs, performance or FPS.AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the complete diff, added test observability, ran the tests and exact-head control, independently verified the bounded results, and drafted this report. Publication authorized by the account owner.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T20:24:21Z.
Independent Windows/Ampere check of #2819 head
fd317b9, based onmainb49be183. RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug build.cargo test --offline --locked -p xcl --lib shaders::chain_whole_replay:: -- --test-threads=1: 6 passed, 0 failed, 0 ignored.cargo test --offline --locked -p xcl --test gpu_compute_e2e selective_chain_whole_replay_reuses_blob_in_fresh_process -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored, 0 skipped. The stock fixture exercises cold/warm selective replay and three fresh GPU children with its output and cache assertions.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,441 passed, 1 failed, 47 ignored across 37 test targets, with 25 GPU SKIPPED notices. The sole failure wasconsole_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk(`cached_only console_mesh hit: "DXIL not compiled yet"). It also failed alone on the PR head and on its exact main base, 0 passed, 1 failed each, with the same error. I do not attribute that failure to this PR.Not tested: a sidecar emitted by #2786 and fed into this replay CLI, retail capture/replay or smoke, AMD/Intel GPUs, native wave64, or release. The GPU test constructs its synthetic sidecar itself, so this result does not establish the capture-to-replay handoff or a world-load speedup.
AI use: Codex (GPT-6.2 Sol) selected the independent check, inspected the fixture, ran and checked the tests, and drafted this report.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T20:32:49Z.
Synthetic capture-to-replay handoff check for #2786 head
3b6609fover #2819 headfd317b9, both based onmainb49be18. This was an uncommitted local overlay plus the test-only diff below, not a clean PR-head or retail run.I switched the existing
gpu_compute_e2eseed child from hand-written JSON to a hookedExecuteIndirectof its selected synthetic split shader with #2786 capture enabled and disk caching disabled. The child retained the 32-lane GPU output assertion and wrote one header plus onereason: indirectdemand. #2819's existing CLI then accepted that emitted file: disabled cache was incomplete, cold replay persisted exactly one selected.chain.pso, warm replay supplied the blob, and three fresh GPU children passed the selected indirect/direct-fallback and unselected-sibling cache/output assertions. This local test exercises the synthetic producer-to-consumer gap identified in #2741; it does not measure a retail load.On RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug:
cargo build --offline --locked --workspacepassed.cargo test --offline --locked -p xcl --lib hle::d3d12x::real::chain_whole_capture:: -- --test-threads=1: 9/0/0.cargo test --offline --locked -p xcl --lib shaders::chain_whole_replay:: -- --test-threads=1: 6/0/0.cargo test --offline --locked -p xcl --test gpu_compute_e2e selective_chain_whole_replay_reuses_blob_in_fresh_process -- --exact --test-threads=1 --nocapture: 1/0/0, no skip on the final fixture.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,453 passed, 1 failed, 47 ignored across 37 targets; 25 GPU SKIPPED notices. The sole failure was the mesh-cacheDXIL not compiled yettest, previously reproduced on the clean base.The diff is a candidate integration regression for after both PRs are present. The original hand-written
seed_capturebranch can be removed when adopting it. Not tested: actual retail capture, world-load timing, AMD/Intel, native wave64, release, or paired smoke. AI use: Codex (GPT-6.2 Sol) inspected the two revisions, wrote the local test, ran and checked the results, and drafted this report.Local test-only diff
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T20:43:10Z.
Correction to my exact-head #2819 report and #2786 + #2819 integration report. The mesh-cache failure in both runs depended on the default DXIL cache location in this sandbox. That location is outside the writable worktree; the pass-through mesh compile can succeed without persisting its DXIL, then its
cached_onlyrepeat reportsDXIL not compiled yet. The isolated test passed 1/0/0 after I setXCL_DXIL_CACHEto writable scratch. This is a test-environment correction, not evidence that the PR changed mesh caching.With
$env:XCL_DXIL_CACHEset to a new writable directory undertarget, I rerancargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4on Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC:fd317b9: 1,442 passed, 0 failed, 47 ignored, 25 GPU SKIPPED notices, 37 targets.3b6609f's diff and the local capture-to-replay test from my integration report: 1,454 passed, 0 failed, 47 ignored, 25 GPU SKIPPED notices, 37 targets. The actual capture-to-replay GPU fixture passed within that suite.These counts supersede the earlier one-failure counts. The combined result remains an uncommitted overlay, not a clean PR head; retail capture, world-load timing, paired smoke, AMD/Intel and native wave64 remain untested. AI use: Codex (GPT-6.2 Sol) traced the cache path, reran and checked the suites, and drafted this correction.
Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-27T03:37:01Z.
I tested the heap-window mode listed under “Not tested” on
fd317b9c3124f01f305be9263d46017a14dedd2b. The Windows RTX 5070 run passed the selective chain-whole replay integration test with one test-only change set and no runtime edits. DXC was 1.8.2502.11. The result was 1 passed, 0 failed, 0 ignored, with no capability skip.The original fixture clears
XCL_HEAP_WINDOWSfor its children. I enabled it for each child, generated the selected shader with4 | HEAP_WINDOWS(0x104), put the same encoded value andheap_windows=trueinto the synthetic capture, and asserted the effective runtime mode was0x104. The public CLI still received--windows 4 --split 1.With the disk cache disabled, replay reported incomplete and created no driver-cache directory. Cold replay with the cache enabled persisted exactly one
.chain.psofor the selected shader. Warm replay reused that blob with zero fresh creations. In independent runtime processes, the selected indirect and direct-fallback cases each observed one driver-cache hit and zero stale retries. An unselected sibling observed zero hits and zero stale retries. All three dispatches returned the expected values in all 32 checked lanes after the fence.This exercises selective replay of a synthetic schema-v1 capture on native D3D12. Retail capture generation, world-load timing and other adapters remain unmeasured.
AI use: OpenAI Codex with GPT-6.2 Astra adapted the fixture, ran the test and checked its assertions; Codex coordinated and prepared this report.
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T16:01:46Z.
Rebased cleanly onto
main(f9a0cb80/#1871) at9664e0b82880cbc19dc583fa842a5f801030d9fc(preserving#1871CLI options and dropping the now-redundantreal.rshunk in favor ofmain'sreal::driver_cache_stats()), updated the PR description, and re-verified on RTX 4060 (0new clippy warnings,3xDebug & Releasechain_whole_replay6/0/0+gpu_compute_e2e selective_chain_whole_replay_reuses_blob_in_fresh_process1/0/0+ full Releasegpu_compute_e2e8/0/0, paired 60 sXCL_PREPARE=0smoke1587vs1579frames,0device removals/crashes).AI disclosure: Google Antigravity (Gemini 4 Neon) resolved the
shaders.rsconflict, ran local verification, and updated the PR.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:00:50Z.
Triage (#1607) – head
9664e0b#2551 attacks the same cold
Chain::wholebuilds differently:--precompile --pipelinesbuilds every split program's whole form, while this PR replays only the whole forms recorded in #2786's first-demand capture. This PR reads #2786's JSONL format but is not stacked on it in git; it is only usable once #2786 (or an equivalent capture) lands.At +1891 lines (1368 in the new
chain_whole_replay.rs) it is far over the size rule; the description should say why it cannot be split (e.g. parser/planner, then prewarm, then the e2e test). It also conflicts with main.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by Decodere on 2026-12-02T07:56:53Z.
Closing this PR alongside its companion #2786:
mainby commitse9389076(used-indirect-split.txtprewarm) ande8a36664(pso::record_indirect_slicer+ asyncWholeBuild/xcl-pso-whole).CONTRIBUTING.md's ~800-line PR size limit without a rewrite against currentmain.Thank you @Foniass and @andrewDoing for the reviews and feedback.
AI use: Antigravity (Gemini 4 Neon) verified supersession against
main(1c8b5514) and drafted this closing note.Pull request closed