Skip to content

Shaders: add selective --replay-chain-whole validation, warming, and reuse test - #2819

Open
Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:feat-chain-whole-replay
Open

Decodere wants to merge 1 commit into
xcl-dev:mainfrom
Decodere:feat-chain-whole-replay

Conversation

@Decodere

Copy link
Copy Markdown
Contributor

Implements Steps 2–4 of #2741: selective offline validation and native .chain.pso whole-form prewarming (xcl shaders <input> --replay-chain-whole <capture.jsonl> [--replay-cutoff <N>]), plus a fresh-process real-GPU E2E reuse proof across hooked ExecuteIndirect and direct fallback (Dispatch without recording allocator). Regular --precompile, --pipelines, --used-only, chain pieces, and runtime fallback behavior are unchanged. Targets main independently and merges cleanly with #2786 in either order (disjoint hunks in crates/xcl/src/hle/d3d12x/real.rs).

Part of #2741
Part of #2088
Part of #2508

What is in it

  • crates/xcl/src/shaders/chain_whole_replay.rs (new):
    • Strict schema_version: 1 UTF-8 JSONL parser accepting D3D12.X: add opt-in first-demand capture sidecar for Chain::whole fallbacks #2786's 12-field translation_options header (validating mem_windows and split_wave64 per demand record), ordered first-demand records, exact min(cli_cutoff, header.sequence_cutoff) selection, and exact FNV-1a 64 chain_root_sig_id digest over ordered static samplers.
    • Deduplicates exact repeated final identities while keeping distinct final identities for the same source_record_hash separate, resolving demanded compute records (FSSM and FSPX/ACCC) in a single pass over the shader input.
    • Rebuilds each demanded record through recomp::pso::console_to_dxil_in, validates ABI version, header/CLI translation options, split-chain eligibility, final whole DXIL hash/length, ordered static samplers and chain_root_sig_id, effective_flags, node_mask == 0, and runtime driver_cache::name_for(..., true) key; rejects disk-key collisions across distinct validated (chain_rs_id, node_mask, effective_flags, whole_dxil) targets as AmbiguousDiskKey and collapses identical whole build targets sharing a disk_cache_name to one first-demand entry so parallel workers never race on one .chain.pso file.
    • Prewarms only validated, collision-free whole-form .chain.pso entries in first-demand order via dispatch_chain_root_signature and recorded effective_flags/node_mask under XCL_PIPELINE_THREADS and XCL_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 code 1 whenever any validation issue, cap, refusal, or unpersisted entry leaves replay incomplete.
    • Adds 6 deterministic unit tests covering CLI arg parsing (including orphan --replay-cutoff exit 2), golden chain_root_sig_id digests, 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:
    • Declares mod chain_whole_replay;, adds --replay-chain-whole <path> and --replay-cutoff <u64> (rejecting orphan --replay-cutoff with exit code 2), tracks explicit --windows, allows single-file inputs for --replay-chain-whole, and dispatches to chain_whole_replay::run(...) without modifying Pipelines or precompile.
  • crates/xcl/src/hle/d3d12x/real.rs:
    • Adds read-only driver_cache::stats() -> (u64, u64, u64) and #[doc(hidden)] pub fn driver_cache_stats() -> (u64, u64, u64) returning (hits, stale_rejections, stored).
  • crates/xcl/tests/gpu_compute_e2e.rs:
    • Adds selective_chain_whole_replay_reuses_blob_in_fresh_process: verifies disabled disk cache returns exit 1 and writes nothing, cold selective replay writes exactly 1 .chain.pso blob 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 (hits == 1, stale == 0) plus matching 32-lane GPU output on hooked ExecuteIndirect and direct fallback (Dispatch with allocator == 0) while the unselected sibling records (hits == 0, stale == 0).

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 4060 (8 GB, driver 621.14, 32-lane waves), Intel Core i5-11400F (6C/12T, 32 GB RAM), Windows 11, DXC 1.9.2609.5, rustc 1.100.0, debug + release
  • cargo clippy --all-targets -- -A clippy::approx_constant: 0 new warnings or errors across all 4 modified files (note: plain cargo clippy --all-targets exits 101 due to 3 pre-existing clippy::approx_constant errors in untouched lower_valu.rs, lower_wide.rs, and recomp/lower.rs)
  • XCL_WARP=1 cargo test -p xcl --lib -- shaders::chain_whole_replay:: --nocapture (debug WARP): 6 passed, 0 failed, 0 ignored
  • cargo test --release -p xcl --lib -- shaders:: --test-threads=4 --nocapture: 16 passed, 0 failed, 0 ignored
  • cargo test --release -p xcl --test gpu_compute_e2e -- --test-threads=1 --nocapture: 8 passed, 0 failed, 0 ignored (1 runtime skip: heap_window_out_of_memory_falls_back_to_the_switch_form without XCL_HEAP_WINDOWS=1; selective_chain_whole_replay_reuses_blob_in_fresh_process passed all 3 fresh child processes)
  • cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture: 1442 passed, 0 failed, 47 ignored across 37 workspace test targets (SKIPPED GPU tests/subcases: wave64-only GPU tests on 32-lane RTX 4060, 3 per-lane wave32 driver-refused subcases, heap_window_out_of_memory_falls_back_to_the_switch_form without XCL_HEAP_WINDOWS=1, pso_measurement_compiles_an_exact_synthetic_record without Windows Developer Mode, and 3 debug-layer tests without d3d12SDKLayers.dll)

Regression run

main:

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1571 (PresentX 1571)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13975 MB

PR:

xcl-smoke v1
commit: fd317b9c3124f01f305be9263d46017a14dedd2b
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1561 (PresentX 1561)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13983 MB

Not tested

  • Replaying a full multi-hundred-entry retail capture sidecar end-to-end against a retail shader archive (this PR validates the schema v1 contract, unit tests, and fresh-process GPU reuse on synthetic split-eligible compute shaders; retail capture-to-replay warm A/B measurement follows once D3D12.X: add opt-in first-demand capture sidecar for Chain::whole fallbacks #2786 and this PR are combined)
  • AMD / Intel GPUs, native wave64 GPUs, XCL_HEAP_WINDOWS=1, and D3D12 debug layer (d3d12SDKLayers.dll not installed on this host)

AI use

  • Google Antigravity (Gemini 4 Neon) — designed, implemented, and verified the selective --replay-chain-whole parser/validator/prewarmer, driver_cache::stats() reader, unit tests, and fresh-process GPU E2E reuse test

…reuse test

Follows up on xcl-dev#2741 Part 1 (first-demand capture sidecar) with Steps 2–4: offline validation, selective native `.chain.pso` whole-form prewarming, and fresh-process GPU reuse proof. Regular `--precompile`, `--pipelines`, `--used-only`, chain pieces, and runtime fallback behavior are unchanged.

- Add `crates/xcl/src/shaders/chain_whole_replay.rs` and CLI flags `--replay-chain-whole <path>` + optional `--replay-cutoff <u64>` in `crates/xcl/src/shaders.rs` (rejecting orphan `--replay-cutoff` with exit code 2).
- Parse the `schema_version: 1` UTF-8 JSONL capture sidecar (accepting xcl-dev#2786's 12-field `translation_options` header while validating `mem_windows`/`split_wave64` per demand record) in first-demand `seq` order, apply the effective cutoff (`min(cli_cutoff, header.sequence_cutoff)`), deduplicate exact repeated final identities while keeping distinct final identities for the same `source_record_hash` separate, and resolve demanded compute records (`FSSM` and `FSPX`/`ACCC`) in a single pass over the shader input.
- Rebuild each selected record through the runtime translation path (`recomp::pso::console_to_dxil_in`) and validate ABI version, header/CLI translation options, split-chain form, final whole DXIL hash/length, ordered static samplers and `chain_root_sig_id`, effective flags, `node_mask == 0`, and runtime `driver_cache::name_for(..., true)` key; reject ambiguous disk-key collisions across distinct validated `(chain_rs_id, node_mask, effective_flags, whole_dxil)` targets and collapse identical targets sharing one `disk_cache_name` so parallel workers never race on one `.chain.pso` path.
- Create only validated, collision-free whole-form `.chain.pso` pipelines in first-demand order using `dispatch_chain_root_signature` and recorded `effective_flags`/`node_mask` under `XCL_PIPELINE_THREADS` and `XCL_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 treating any validation issue, cap, refusal, or unpersisted entry as incomplete (exit code 1).
- Expose read-only `driver_cache::stats()` / `real::driver_cache_stats()` in `crates/xcl/src/hle/d3d12x/real.rs`.
- Add 6 unit tests in `shaders::chain_whole_replay::tests` plus fresh-process GPU E2E test `selective_chain_whole_replay_reuses_blob_in_fresh_process` in `crates/xcl/tests/gpu_compute_e2e.rs` (isolated from ambient translation/cache env vars and wave64-safe) verifying selective `.chain.pso` persistence, exact blob reuse without cold retry (`hits == 1, stale == 0`) on both real hooked `ExecuteIndirect` and direct fallback (`Dispatch` with `allocator == 0`), matching 32-lane GPU output, and zero cache hits for an unselected sibling.

Part of xcl-dev#2741
Part of xcl-dev#2088
Part of xcl-dev#2508
Assisted-by: Google Antigravity (Gemini 4 Neon)
@ettehn

ettehn commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

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 0 exited 0 with selected 0, dropped_by_cutoff 1, and complete: true. It did not create a driver-cache directory.
  • Changing only the capture’s whole_dxil_hash to a different well-formed value exited 1 with whole_dxil_mismatch, validated 0, created_fresh 0, persisted 0, and complete: false. The driver-cache directory still did not exist.
  • The original integration case then passed, including the single cold blob, warm replay, both selected runtime fallback paths, and the unselected sibling checks in three fresh GPU processes.

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.

cargo test --locked --offline -p xcl --test gpu_compute_e2e -j 2 -- selective_chain_whole_replay_reuses_blob_in_fresh_process --exact --test-threads=1 --nocapture
cargo test --locked --offline -p xcl --lib -j 2 -- shaders::chain_whole_replay:: --test-threads=1 --nocapture

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.

@Aniseto

Aniseto commented Nov 26, 2026

Copy link
Copy Markdown

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.

XCL_ADAPTER=nvidia cargo test -p xcl --lib shaders::chain_whole_replay:: -- --nocapture
6 passed; 0 failed; 0 ignored; 1336 filtered out      (exit 0)

XCL_ADAPTER=nvidia cargo test -p xcl --test gpu_compute_e2e selective_chain_whole_replay_reuses_blob_in_fresh_process -- --test-threads=1 --nocapture
1 passed; 0 failed; 0 ignored; 7 filtered out      (exit 0)

All six parser/validator/collision unit tests pass, and the fresh-process GPU test also passes here: one .chain.pso blob 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.

@SzczepanGrela

Copy link
Copy Markdown

RX 9070 / Wine: offline replay and persistence checks pass; the fresh-runtime reuse fixture remains incomplete here.

Tested

  • Head fd317b9c3124f01f305be9263d46017a14dedd2b against main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7.
  • 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, release x86_64-pc-windows-gnu.
  • Explicit RX 9070 selection, XCL_NETWORK=0, enabled private caches. Replay uses XCL_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. Existing shaders::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:

Case Result
Cutoff 0 exit 0, selected 0, dropped 1, complete true, no driver blob
Changed whole-DXIL hash exit 1, whole_dxil_mismatch, validated 0, no native build/blob
Disk cache disabled exit 1, cache_disabled 1, complete false
Cold exit 0, created_fresh 1, persisted 1, complete true
Warm exit 0, created_with_supplied_blob 1, fresh 0, complete true
Corrupt private blob exit 0, rejected_and_cold_retried 1, fresh 1, persisted 1
Cold 1 KiB cap exit 1, capped 1, no native build/blob
Warm 1 KiB cap exit 0, supplied blob accepted despite the cold-build cap
Private driver-directory write blocked exit 1, fresh 1, write_failed 1, complete false

The 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_process reports 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 first indirect child exits -1073741819 (0xc0000005) before the cache-stat/readback checkpoint. Its actual device matches RX 9070 PCI 1002:7550, LUID 00000000:000003ef. The unmodified fixture also fails its first indirect child; it does not print that child's exit code.

Separate baseline context: unchanged console_wave64_compute_through_the_pso_hook_dispatch_and_read_back fails on both main and head with dispatch: Invalid parameter (0x80070057). The cause of the new child's termination is unestablished. Its direct_fallback and unselected_sibling cases 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 0 for 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.

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent Windows/Ampere check of #2819 head fd317b9, based on main b49be183. 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 was console_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.

@thehollowedone

Copy link
Copy Markdown
Contributor

Synthetic capture-to-replay handoff check for #2786 head 3b6609f over #2819 head fd317b9, both based on main b49be18. 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_e2e seed child from hand-written JSON to a hooked ExecuteIndirect of 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 one reason: indirect demand. #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 --workspace passed.
  • 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-cache DXIL not compiled yet test, previously reproduced on the clean base.

The diff is a candidate integration regression for after both PRs are present. The original hand-written seed_capture branch 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
diff --git a/crates/xcl/tests/gpu_compute_e2e.rs b/crates/xcl/tests/gpu_compute_e2e.rs
index d6ac50a9..9c48cbf7 100644
--- a/crates/xcl/tests/gpu_compute_e2e.rs
+++ b/crates/xcl/tests/gpu_compute_e2e.rs
@@ -958,8 +958,8 @@ fn selective_chain_whole_replay_reuses_blob_in_fresh_process() {
         }
         let stats_after = real::driver_cache_stats();
         let (dhits, dstale) = (stats_after.0 - stats_before.0, stats_after.1 - stats_before.1);
-        if is_sibling {
-            assert_eq!((dhits, dstale), (0, 0), "unselected sibling must not hit prewarmed cache (case={case})");
+        if is_sibling || case == "capture_indirect" {
+            assert_eq!((dhits, dstale), (0, 0), "no prewarmed cache hit expected (case={case})");
         } else {
             assert_eq!(
                 (dhits, dstale),
@@ -988,6 +988,17 @@ fn selective_chain_whole_replay_reuses_blob_in_fresh_process() {
                 assert_eq!(got, expected, "case={case} lane={lane} mismatch");
             }
         }
+        if case == "capture_indirect" {
+            let out_path = PathBuf::from(std::env::var_os("XCL_TEST_CAPTURE_OUT").expect("capture out path"));
+            let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
+            loop {
+                if let Ok(lines) = fs::read_to_string(&out_path) {
+                    if lines.lines().count() == 2 { break; }
+                }
+                assert!(std::time::Instant::now() < deadline, "capture writer did not publish header and demand");
+                std::thread::sleep(std::time::Duration::from_millis(10));
+            }
+        }
         return;
     }
 
@@ -1020,6 +1031,8 @@ fn selective_chain_whole_replay_reuses_blob_in_fresh_process() {
             "XCL_PIPELINE_MAX_KB",
             "XCL_PIPELINE_THREADS",
             "XCL_SAFE_BARRIER",
+            "XCL_CAPTURE_CHAIN_WHOLE",
+            "XCL_CAPTURE_CHAIN_WHOLE_MAX",
         ] {
             cmd.env_remove(var);
         }
@@ -1030,16 +1043,25 @@ fn selective_chain_whole_replay_reuses_blob_in_fresh_process() {
             .env("XCL_SPLIT_WAVE64", "1");
     };
 
-    // 1. Generate a schema_version=1 capture sidecar demanding ONLY `selected.bin`.
+    // 1. Capture a real first-demand sidecar through the hooked indirect runtime path.
     let mut seed_cmd = Command::new(std::env::current_exe().unwrap());
     seed_cmd
         .args(["--exact", "selective_chain_whole_replay_reuses_blob_in_fresh_process", "--nocapture"])
-        .env("XCL_TEST_CHAIN_REPLAY_CASE", "seed_capture")
+        .env("XCL_TEST_CHAIN_REPLAY_CASE", "capture_indirect")
         .env("XCL_TEST_CAPTURE_OUT", &capture)
-        .env("XCL_PSO_DISK_CACHE", "1");
+        .env("XCL_ASYNC_PSO", "0")
+        .env("XCL_PSO_DISK_CACHE", "0");
     isolate(&mut seed_cmd);
+    seed_cmd.env("XCL_CAPTURE_CHAIN_WHOLE", &capture)
+        .env("XCL_CAPTURE_CHAIN_WHOLE_MAX", "64");
     let seed = seed_cmd.output().unwrap();
     assert!(seed.status.success(), "{}\n{}", String::from_utf8_lossy(&seed.stdout), String::from_utf8_lossy(&seed.stderr));
+    let captured = fs::read_to_string(&capture).unwrap();
+    let rows: Vec<serde_json::Value> = captured.lines().map(|line| serde_json::from_str(line).unwrap()).collect();
+    assert_eq!(rows.len(), 2, "expected one header and one first demand");
+    assert_eq!(rows[0]["kind"], "header");
+    assert_eq!(rows[1]["kind"], "demand");
+    assert_eq!(rows[1]["reason"], "indirect");
 
     // 2. Run selective offline replay into isolated cache: only selected.bin's whole `.chain.pso` is persisted.
     let run_replay = |disk_cache: &str| {

@thehollowedone

Copy link
Copy Markdown
Contributor

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_only repeat reports DXIL not compiled yet. The isolated test passed 1/0/0 after I set XCL_DXIL_CACHE to writable scratch. This is a test-environment correction, not evidence that the PR changed mesh caching.

With $env:XCL_DXIL_CACHE set to a new writable directory under target, I reran cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 on Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC:

  • Clean #2819 head fd317b9: 1,442 passed, 0 failed, 47 ignored, 25 GPU SKIPPED notices, 37 targets.
  • The same head with uncommitted #2786 head 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.

@andrewDoing

Copy link
Copy Markdown

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_WINDOWS for its children. I enabled it for each child, generated the selected shader with 4 | HEAP_WINDOWS (0x104), put the same encoded value and heap_windows=true into the synthetic capture, and asserted the effective runtime mode was 0x104. 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.pso for 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants