Skip to content

D3D12.X: persist compute blobs when the RAM cache is full - #2740

Closed
ZekkJJ wants to merge 1 commit into
xcl-dev:mainfrom
ZekkJJ:codex/compute-driver-cache-ram-budget
Closed

ZekkJJ wants to merge 1 commit into
xcl-dev:mainfrom
ZekkJJ:codex/compute-driver-cache-ram-budget

Conversation

@ZekkJJ

@ZekkJJ ZekkJJ commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

A slow translated compute PSO can compile successfully after the 512 MiB compute blob RAM cache fills up. Preserve its driver blob for the disk cache even if it cannot be admitted to RAM. This extracts the standalone fix from the NVIDIA reference stack in #2706 and retains the original author of ee0183fd.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs gives the caller the driver blob for disk retention and independently checks the RAM budget. Regular translated compute and the two-pass compute path use the same policy.
  • A same-key insertion under the cache lock reuses the existing blob and charges its bytes once. The regression verifies bytes returned above the budget and a duplicate insertion.

Tested

  • Exact head 9ecae592ea3a1ba2b41db0167e06da435b271791 on NVIDIA GeForce RTX 4060 Laptop (616.56), Ryzen 7 8845HS, Windows 11 build 26200.9974, Rust 1.98.1 MSVC, DXC 1.8.2502.11.

  • cargo test --offline --locked -p xcl --lib compute_blob_tests -- --nocapture --test-threads=1 passed 3 with zero skips.

  • cargo test --offline --locked -p xcl --test gpu_compute_e2e -- --nocapture --test-threads=1 reported 7 passed and 1 runtime heap-window skip. The skipped case passed on this exact revision in a focused rerun with XCL_HEAP_WINDOWS=1.

  • The exact-head debug workspace build and complete RTX 4060 Laptop run reported 1436 passed, 0 failed, and 47 ignored. There were 26 runtime skip markers (21 no native wave64, 3 refused wave32 per-lane operations, 1 no heap windows, and 1 Windows Developer Mode unavailable).

  • The first 60-second smoke pair recorded 388 frames on the head against 499 on main, below the frame threshold. Both completed with zero crashes and device removals. The isolated 120-second pair below repeats the comparison.

Regression run

Clean release builds on the same RTX 4060 Laptop GPU and retail workload. XCL used a separate title state and DXIL cache for each run.

Main

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 4060 Laptop GPU
title: Retail workload A
seconds: 120
exit: 0x0
frames shown: 2406 (PresentX 2407)
presents per 2 s (last 3): 14 21 20
device removals: 0
crashes: 0
peak commit: 16637 MB

PR head

xcl-smoke v1
commit: 9ecae592ea3a1ba2b41db0167e06da435b271791
gpu: NVIDIA GeForce RTX 4060 Laptop GPU
title: Retail workload A
seconds: 120
exit: 0x0
frames shown: 1958 (PresentX 1959)
presents per 2 s (last 3): 35 36 36
device removals: 0
crashes: 0
peak commit: 16629 MB

Not tested

  • AMD and Intel hardware on this head. The retail smoke did not deliberately fill the process-wide compute blob budget. A local-store unit fixture covers that boundary.

AI use

Claude Code (Claude Fable 5.2) assisted the original commit. OpenAI Codex (gpt-6.2-sol) adapted it to current main, added the duplicate accounting check, ran validation, and prepared this submission.

@Decodere

Copy link
Copy Markdown
Contributor

Independent RTX 4060 (8 GB) / Windows 11 verification of PR #2740 at 9ecae592ea3a1ba2b41db0167e06da435b271791 (exact parent origin/main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain / caches: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)
  • Workload: Retail workload title: 29640639 via scripts/smoke.ps1 -Seconds 60 (XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)

Targeted RTX 4060 release unit tests (9ecae592)

  • cargo test --release -p xcl --lib a_blob_over_the_memory_budget_still_reaches_its_caller -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit 0).
  • cargo test --release -p xcl --lib hle::d3d12x::real::compute_blob_tests:: -- --test-threads=4: 3 passed, 0 failed, 0 ignored (0.00 s, 0 skipped, exit 0).
  • cargo test --release -p xcl --lib hle::d3d12x::real::driver_cache:: -- --test-threads=4: 4 passed, 0 failed, 0 ignored (0.00 s, 0 skipped, exit 0).
  • cargo test --release -p xcl --lib hle::d3d12x::real:: -- --test-threads=4: 61 passed, 0 failed, 0 ignored (0.85 s, 0 skipped, exit 0).

Observations

  • Returning the newly read driver blob from keep_compute_blob even when COMPUTE_BLOBS_MAX is reached passes a_blob_over_the_memory_budget_still_reaches_its_caller, all compute_blob_tests:: and driver_cache:: cases, and the full 61-test hle::d3d12x::real:: module in --release on this RTX 4060 host with 0 skips.
  • Quiet 60 s retail smoke ran cleanly (exit: 0x0, 1519 frames shown, 60 60 60 steady-state presents per 2 s, 0 device removals, 0 crashes, 13992 MB peak commit vs parent b49be183's 14018 MB / 1518 frames).

Paired 60 s RTX 4060 smoke (b49be183 vs 9ecae592)

Parent origin/main (b49be183):

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

PR #2740 head (9ecae592):

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

Limits of coverage

  • Full workspace test suite was not re-run on 9ecae592 (only targeted compute_blob_tests::, driver_cache::, and hle::d3d12x::real:: release tests plus paired quiet 60 s smoke).
  • The warm-cache 60 s retail smoke verifies no runtime regression on the normal path; filling COMPUTE_BLOBS_MAX during live cold compute PSO compilation was not triggered in this run (that overflow-to-caller path is exercised by a_blob_over_the_memory_budget_still_reaches_its_caller).
  • Single discrete NVIDIA 8 GB GPU (RTX 4060) on native Windows 11; no AMD, Intel, or Wine/Linux run on this host.

AI use

Ran the targeted release unit tests and paired quiet 60 s smoke runs with assistance from Google Antigravity (Gemini 4 Neon); all test counts and smoke blocks were taken directly from cargo test and scripts/smoke.ps1 outputs.

@sage-sage

Copy link
Copy Markdown
Contributor

Test report: passes on NVIDIA. Exact head 9ecae592 (its base is current main b49be18, so head = merged).

Tested

  • RTX 4080 SUPER (driver 621.40), Ryzen 5 7600X, Windows 11 26H2 build 26300.10075, rustc 1.100.0 MSVC, DXC 1.9.2602.17 (Windows SDK 10.0.26100), debug build
  • cargo test --workspace -- --test-threads=4: 1436 passed, 0 failed, 47 ignored; a_blob_over_the_memory_budget_still_reaches_its_caller passes
  • SKIPPED: 29 lines, the same as on main on this machine (wave64, debug layer, Developer Mode, heap windows)

Not tested

  • No game, so not a title filling the compute blob budget; AMD, Intel.

Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

@thehollowedone

Copy link
Copy Markdown
Contributor

Independent synthetic D3D12 cache-boundary check of PR head 9ecae592 against its parent b49be183 on Windows 11 build 26300, RTX 3080 Ti (621.35), rustc 1.99.1 MSVC, and DXC 1.8.2502.11.

I added the same uncommitted, test-only fixture to each checkout. It compiles an 86,012-byte synthetic compute DXIL program, sets the process-local compute-blob accounting to the 512 MiB limit without allocating 512 MiB, creates a real D3D12 PSO, and checks for a saved driver blob and a second PSO created from that disk blob. A 300 ms delay in the test's create callback crosses the disk-retention threshold; it is not a driver compile-time measurement.

cargo test --offline --locked -p xcl --lib full_compute_blob_budget_writes_and_reloads_driver_blob -- --nocapture --test-threads=1:

  • Parent: 0 passed, 1 failed, 0 ignored; the expected failure is driver blob written despite full RAM cache.
  • PR head: 1 passed, 0 failed, 0 ignored; 0 skips. The disk blob was saved and the second creation reported reused=true.

This exercises the real compute-PSO disk path at the simulated RAM boundary. It does not cover the two-pass path, a naturally full cache during a title run, or a change in frame rate. Synthetic shader only; no game files or diagnostics were used. AI use: Codex (GPT-6.2 Sol) wrote and ran the test fixture and drafted this report.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) verification of exact PR head 9ecae592ea3a1ba2b41db0167e06da435b271791 on Windows 11 Pro 26300 (AMD Radeon RX 9060 XT 16 GB, driver 32.0.31044.16, Ryzen 5 5600, Rust 1.100.0 MSVC, DXC 1.9.2602.17).

Tested

  • cargo build --workspace (debug): passed (0 errors).
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1434 passed, 2 failed, 47 ignored (8 SKIPPED: 6 per-lane DXIL forms refused by host adapter/driver, 1 heap_window_out_of_memory_falls_back_to_the_switch_form no heap windows, 1 pso_measurement_compiles_an_exact_synthetic_record Windows Developer Mode off).
    • The new test hle::d3d12x::real::compute_blob_tests::a_blob_over_the_memory_budget_still_reaches_its_caller passed.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 and fuzz_validate_and_gpu_3) are pre-existing on unmodified main on this RX 9060 XT / driver 32.0.31044.16.
  • cargo build --release -p xcl + 60 s retail-title smoke test (scripts/smoke.ps1, offline):
xcl-smoke v1
commit: 9ecae592ea3a1ba2b41db0167e06da435b271791
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1578 (PresentX 1578)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18776 MB

(Compare against main b49be183 on this machine: 1603 frames, 18576 MB peak, 0 device removals, 0 crashes.)

Not tested

  • NVIDIA / Intel GPUs, Linux / Wine.

AI use

  • Verification run and report prepared with Antigravity (Gemini 4 Neon); all build, test, and smoke results are from live runs on this machine.

@oni-swr

oni-swr commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Independent AMD RX 7800 XT / Windows 11 test report for PR #2740 at exact head 9ecae592ea3a1ba2b41db0167e06da435b271791 (parent main b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7; the head had not moved when tested). Unit/integration tests only; no title was run.

Tested

  • AMD Radeon RX 7800 XT (driver 32.0.31035.1003), Windows 11 Pro build 10.0.26200, rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11 (Windows SDK 10.0.26100), debug build, separate target dir.
  • Env: XCL_ADAPTER=7800, XCL_REQUIRE_GPU=1, -j 4 on every cargo command.
  • cargo test -j 4 -p xcl --lib compute_blob_tests -- --nocapture --test-threads=1: 3 passed, 0 failed, 0 ignored, 0 SKIPPED (includes a_blob_over_the_memory_budget_still_reaches_its_caller).
  • cargo test -j 4 -p xcl --lib hle::d3d12x -- --test-threads=4: 255 passed, 0 failed, 2 ignored.
  • cargo test -j 4 -p xcl --test gpu_compute_e2e -- --test-threads=1: 7 passed, 0 failed, 0 ignored; 1 SKIPPED (heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).
  • cargo test -j 4 -p xcl --lib -- --test-threads=4: 1309 passed, 1 failed, 27 ignored. The one failure is gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 (seed 722: res[30] = 0x1, CPU 0x7fffffff), the known AMD failure tracked in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115. It is in the DXIL fuzzer, which this PR does not touch, so I did not rerun it on b49be18. Every other test passed.
  • SKIPPED lines in the lib run: 6, all "per-lane form: refused" for f16 arithmetic, f16 packed and f32 conversions (wave32 and wave64, each, citing gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426). None are in the compute-blob/driver-cache tests, and there were no no-GPU or no-wave64 skips on this adapter.

Not tested

AI use: Claude Code (Claude Sonnet 5.5) ran the tests and wrote this report, coordinated by Claude Code (Claude Opus 5.5). All counts are from the runs described.

@SzczepanGrela

Copy link
Copy Markdown

RX 9070 / Wine cache-boundary verification, including GPU output and reuse in a fresh process.

Tested

  • Exact head 9ecae592ea3a1ba2b41db0167e06da435b271791 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.
  • Identical local #[cfg(test)] module appended to both revisions. All original source bytes were preserved and checked against their pinned inventories.
  • The fixture compiles owned synthetic HLSL (cs_6_6, -Od) to identical 25,520-byte DXIL on both sides, then calls real::compute_container. It sets only the process-local RAM accounting to 512 MiB with an empty map, without allocating 512 MiB. A 300 ms delay in the native-create callback crosses the existing 250 ms disk-retention threshold; this is not a driver-time measurement.
  • Explicit hardware selection, XCL_NETWORK=0, private XCL caches and enabled private VKD3D_SHADER_CACHE_PATH directories. Each repetition starts with empty XCL/native caches; the head's following fresh process retains that repetition's caches.

The same focused Windows libtest was invoked through GE-Proton Wine with --exact, --nocapture and --test-threads=1, in three paired repetitions:

Invocation Result Disk blob Calls carrying a cached blob GPU output
Main, cold, full RAM accounting Expected disk-save assertion failure, 3/3 0 B 0 31981793
Head, cold, full RAM accounting Pass, 3/3 112 B 0 31981793
Head, new process using the preceding disk blob Pass, 3/3 112 B 1 31981793

Every invocation made exactly one successful native PSO-create call, with no explicit cold retry, and dispatched the resulting PSO. GPU readback matched the CPU reference in all nine processes. All nine retained zero RAM-cache entries and accounting of 536,870,912 bytes. Main failed only at driver blob written despite full RAM accounting, after the successful GPU check. The head's relaunches returned reused=true; their saved blob hashes remained unchanged. No claim about compilation inside the driver follows from these counters.

Additional unchanged-code checks:

  • a_blob_is_found_only_for_the_same_program_root_signature_and_flags_and_is_forgotten: 1 passed on each revision.
  • Head's a_blob_over_the_memory_budget_still_reaches_its_caller: 1 passed.
  • Filter hle::d3d12x::real::driver_cache::tests::: 4 passed per revision at both --test-threads=1 and 4.
  • No ignored tests or runtime skip markers. All 16 final process summaries, executable hashes, cache files and source inventories were checked independently.

An initial fixture-sizing probe was excluded: its 14,000-byte DXIL was below the unchanged 16 KiB retention gate. The results above use the corrected, identical 25,520-byte fixture.

Not tested

Two-pass compute, console-shader translation, a naturally full cache during a title run, native Windows, full workspace suite, retail/smoke workloads, performance or FPS.

AI use

OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the diff, wrote the local fixture, ran and independently checked the paired tests, and drafted this report. Publication authorized by the account owner.

@throny

throny commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Two contributors checked independently and found that #2574 solves the same problem (for #1833) in a different way: #1607, group D127. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

Main (xcl-dev#2959 / 665f72f) moved disk persistence into `keep_driver_blob`
before RAM admission, so slow blobs already reach the disk cache past
COMPUTE_BLOBS_MAX / GRAPHICS_BLOBS_MAX. However, callers in graphics_pso
and finish_two_pass still looked up `graphics_blob` / `compute_blob` in
RAM afterward and skipped `warm_replay::accepted` whenever the RAM cache
was full.

Have `keep_driver_blob` return the captured `Arc<Vec<u8>>` directly (or
the existing RAM entry on `!reserve`) even when the RAM cap refuses it, and
pass that blob straight to `warm_replay::accepted`. Update
`a_blob_over_the_memory_budget_still_reaches_its_caller` for `DriverBlobs`
and `keep_driver_blob`.
@ZekkJJ
ZekkJJ force-pushed the codex/compute-driver-cache-ram-budget branch from 9ecae59 to 7b6f3f6 Compare November 28, 2026 03:52
@thehollowedone

Copy link
Copy Markdown
Contributor

Current-head check of #2740 7b6f3f62 against its main parent e429936c. RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, DXC 1.8.2502.11.

cargo test --offline --locked -j 4 -p xcl --lib compute_blob_tests -- --test-threads=1: 6 passed, 0 failed, 0 ignored. cargo test --offline --locked -j 4 -p xcl --test gpu_compute_e2e -- --test-threads=1: 7/0/0, with one no heap windows skip notice. The skipped case passed 1/0/0 in a focused rerun with XCL_HEAP_WINDOWS=1. The full cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4 finished 2,125 passed, 12 failed, 48 ignored across 40 targets, with 25 explicit SKIPPED notices. Those failures span DXIL split/compute, heap windows, mesh cache, test-title e2e and two-pass cache. I did not run the same full suite on this commit's parent, so I cannot attribute them to this PR. No paired retail smoke was run.

I found a repeat-key gap in the RAM-full return path. When a blob is saved to disk but not admitted to RAM, finish records its key as persisted with no resident Arc. The first keep_driver_blob call returns its bytes. A second creation with that key gets reserve == false and cache.get == None, so it returns no bytes to the new warm_replay::accepted call. For mesh recipes sharing a compute pass, that can leave a later recipe without its required compute-file receipt. A test-only fixture on the unchanged head wrote the first blob to disk, then reproduced the missing second result: 0 passed, 1 failed, 0 ignored. This is a preparation-efficiency gap; I did not measure a title slowdown.

Please distinguish a persisted disk-only key from an in-flight builder. For a warm-replay capture, the existing accepted check can validate the on-disk file against bytes read from the current successful PSO; avoid an extra blob read or disk I/O on ordinary runtime cache hits. A regression should cover two captures using one disk-only compute key and confirm both obtain complete mesh receipts, plus a concurrent in-flight writer. No source fix was committed here.

Failing test-only fixture
@@
+    #[test]
+    fn repeated_disk_only_blob_can_reach_each_warm_receipt() {
+        let cache = super::DriverBlobs::new();
+        let path = std::env::temp_dir().join(format!("xcl-repeat-{}.pso", std::process::id()));
+        let _ = std::fs::remove_file(&path);
+        let minimum = super::COMPUTE_BLOB_MIN_DXIL;
+        let took = std::time::Duration::from_secs(1);
+        super::keep_driver_blob(&cache, 4, 1u64, minimum, None, took, || Some(vec![1; 4]));
+        let first = super::keep_driver_blob(&cache, 4, 2u64, minimum, Some(&path), took, || Some(vec![2; 8]));
+        let persisted = path.exists();
+        let repeated = super::keep_driver_blob(&cache, 4, 2u64, minimum, Some(&path), took, || Some(vec![2; 8]));
+        let _ = std::fs::remove_file(&path);
+        assert!(persisted, "first disk-only blob should be written");
+        assert!(first.is_some(), "first receipt gets the blob");
+        assert!(repeated.is_some(), "a second receipt of the same disk-only blob should get bytes");
+    }

The #2574 overlap hint concerned disk persistence. That behavior is already present in this PR's current parent; this head adds the return to warm-replay after RAM admission fails. The description still lists the previous 9ecae592 test/smoke blocks, so it needs current-head results and a clean paired smoke before a merge assessment.

AI use: Codex (GPT-6.2 Sol) inspected the parent and overlapping patch, ran the tests, and wrote the failing fixture and report.

@thehollowedone

Copy link
Copy Markdown
Contributor

Follow-up to my current-head report on head 7b6f3f62. One correction: a normal sequential repeat can load the disk blob before creating the PSO. The missing receipt occurs when overlapping cold builders both miss that lookup, the first persists a blob without RAM admission, and the second finishes afterward. That second builder sees a persisted key with no resident blob.

I tested a local candidate that distinguishes a completed disk-only key from an active writer. It reads the current successful PSO's blob for a warm-replay capture only; ordinary duplicate calls retain the existing no-read behavior. warm_replay::accepted still verifies the returned bytes against the file and its before/after metadata. The candidate does not republish or charge the duplicate blob.

The new focused regression failed on the unchanged head (0 passed, 1 failed, 0 ignored) and passed with the candidate (1/0/0). On the candidate, cargo test --offline --locked -j 4 -p xcl --lib compute_blob_tests -- --test-threads=1 passed 7/0/0; cargo test --offline --locked -j 4 -p xcl --lib driver_cache -- --test-threads=1 passed 18/0/0. The regression also checks that an active writer and an ordinary repeat do not reread. git diff --check passed. No full-suite or paired smoke result is claimed for this uncommitted candidate.

Candidate diff and regression
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
index ec09ac02..fedf2ac5 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -6169,6 +6169,12 @@ impl<K: Copy + Eq + std::hash::Hash> DriverBlobs<K> {
         !persisted.contains_key(&key) && active.insert(key)
     }
 
+    fn persisted_only(&self, key: K) -> bool {
+        self.keeping.lock().unwrap().as_ref().is_some_and(|(active, persisted)| {
+            !active.contains(&key) && persisted.get(&key).is_some_and(|generation| generation.upgrade().is_none())
+        })
+    }
+
     /// Admit the exact disk generation accepted by the driver without copying it. Holding both
     /// locks excludes a builder reservation between the presence check and insertion.
     fn admit(&self, key: K, blob: std::sync::Arc<Vec<u8>>, limit: usize) -> bool {
@@ -6453,6 +6459,41 @@ mod compute_blob_tests {
 
         assert!(super::keep_driver_blob(&cache, 4, 3u64, super::COMPUTE_BLOB_MIN_DXIL, None, took, || Some(Vec::new())).is_none());
     }
+
+    #[test]
+    fn repeated_disk_only_blob_reaches_each_caller_without_republishing() {
+        let cache = super::DriverBlobs::new();
+        let took = std::time::Duration::from_secs(1);
+        let dir = std::env::temp_dir().join(format!("xcl-disk-only-{}", std::process::id()));
+        std::fs::create_dir_all(&dir).unwrap();
+        let path = dir.join("repeat.pso");
+        let _ = std::fs::remove_file(&path);
+        super::keep_driver_blob(&cache, 4, 1u64, super::COMPUTE_BLOB_MIN_DXIL, None, took,
+            || Some(vec![1; 4]));
+        let first = super::keep_driver_blob(&cache, 4, 2u64, super::COMPUTE_BLOB_MIN_DXIL, Some(&path), took,
+            || Some(vec![2; 8]));
+        assert!(path.exists());
+        assert_eq!(first.as_deref().map(Vec::as_slice), Some([2; 8].as_slice()));
+        assert!(super::keep_driver_blob(&cache, 4, 2u64, super::COMPUTE_BLOB_MIN_DXIL, Some(&path), took,
+            || panic!("ordinary duplicate must not reread the PSO")).is_none());
+        assert!(cache.reserve(3u64));
+        crate::shaders::warm_replay::capture_for_test(|| {
+            assert!(super::keep_driver_blob(&cache, 4, 3u64, super::COMPUTE_BLOB_MIN_DXIL, Some(&path), took,
+                || panic!("in-flight duplicate must not reread the PSO")).is_none());
+            true
+        });
+        cache.finish(3u64, None, 4, false);
+        let mut second = None;
+        crate::shaders::warm_replay::capture_for_test(|| {
+            second = super::keep_driver_blob(&cache, 4, 2u64, super::COMPUTE_BLOB_MIN_DXIL, Some(&path), took,
+                || Some(vec![2; 8]));
+            true
+        });
+        assert_eq!(second.as_deref().map(Vec::as_slice), Some([2; 8].as_slice()));
+        assert_eq!(cache.blobs.lock().unwrap().as_ref().unwrap().1, 4);
+        assert_eq!(std::fs::read(&path).unwrap(), [2; 8]);
+        std::fs::remove_dir_all(dir).unwrap();
+    }
 }
 
 /// Read `GetCachedBlob` from either an adopted or raw PC `ID3D12PipelineState`.
@@ -6491,7 +6532,13 @@ fn keep_driver_blob<K: Copy + Eq + std::hash::Hash>(
         return None;
     }
     if !cache.reserve(key) {
-        return cache.get(key);
+        if let Some(blob) = cache.get(key) { return Some(blob); }
+        // A second cold builder can finish after the first persisted a disk-only generation.
+        // Only a warm-replay capture needs its own successful PSO bytes for a verified receipt.
+        if disk.is_some() && crate::shaders::warm_replay::capturing() && cache.persisted_only(key) {
+            return read().filter(|bytes| !bytes.is_empty()).map(std::sync::Arc::new);
+        }
+        return None;
     }
     let keep_turn = disk.and_then(|path| driver_cache::KeepTurn::new(path, took));
     let Some(bytes) = read().filter(|bytes| !bytes.is_empty()) else {
diff --git a/crates/xcl/src/shaders/warm_replay.rs b/crates/xcl/src/shaders/warm_replay.rs
index fa6d7a22..461da005 100644
--- a/crates/xcl/src/shaders/warm_replay.rs
+++ b/crates/xcl/src/shaders/warm_replay.rs
@@ -61,6 +61,11 @@ pub(super) fn capture(f: impl FnOnce() -> bool) -> (bool, Vec<File>) {
     (success, files)
 }
 
+pub(crate) fn capturing() -> bool { CAPTURE.with(|slot| slot.borrow().is_some()) }
+
+#[cfg(test)]
+pub(crate) fn capture_for_test(f: impl FnOnce() -> bool) -> bool { capture(f).0 }
+
 /// Record only bytes accepted by the native driver that still occupy this cache file.
 pub(crate) fn accepted(path: Option<&Path>, bytes: &[u8]) {
     CAPTURE.with(|slot| {

AI use: Codex (GPT-6.2 Sol) traced the cache states, wrote and ran the candidate and tests, and checked this report.

@thehollowedone

Copy link
Copy Markdown
Contributor

One scope clarification for my candidate diff at #2740 head 7b6f3f62: its focused regression proves the second disk-only builder gets its blob bytes without charging RAM or rewriting the file. It does not prove that a complete two-pass mesh recipe is saved. The test's capture_for_test discards the captured files.

On this head, the mesh receipt index requires tp-ms- and tp-cs- filenames, while the native builder uses gfx-…pso and an unprefixed compute filename. #3101 separately addresses that pre-existing name mismatch. An end-to-end test of a deferable mesh recipe therefore needs both changes; #2740 can test the returned-byte invariant independently.

For that independent test, capture the second overlapping cold completion, pass its returned bytes to warm_replay::accepted, then save and reopen an ordinary gfx- recipe. Assert that matching bytes can defer and a same-length differing blob cannot, using distinct recipe hashes. This exercises receipt emission rather than only the return value. I have not run that added test; this is a source-level follow-up.

AI use: Codex (GPT-6.2 Sol) checked the current source and this note; Codex (GPT-6.2 Astra) independently traced the receipt and cache paths.

@thehollowedone

Copy link
Copy Markdown
Contributor

A disk-only rejected blob can leave a cache key marked as persisted after its file is gone. This also reproduces on current main 765b2c5b, so it is a follow-up cache issue, not a regression introduced by #2740 head 7b6f3f62.

With a zero-byte RAM budget, a successful save leaves a persisted key without a resident blob. On rejection, forget_if cannot remove that key because there is no resident entry; note(false, loaded) removes the exact disk file. The successful cold retry then cannot reserve the key, so it does not publish its replacement. Current main also deliberately creates disk-only entries during preparation. This is the reservation and invalidation path and the retry path.

I changed the existing synthetic retry test to call load → forget_if → note(false, loaded) instead of unconditional forget. That test failed on both unchanged #2740 head and unchanged main: 0 passed, 1 failed, 0 ignored on each; the final read returned None instead of fresh.

The candidate below is based on main 765b2c5b, not #2740's older head. It permits one eligible builder to repair a missing disk-only entry while retaining the ownership marker. The repair checks for an absent file and publishes the completed staging file without replacing a competing file. Its race regression installs a newer file after the absence check and confirms that the newer bytes survive. A long-path case and a failed-read-then-retry case also pass. On Windows 11 build 26300 with rustc 1.99.1 MSVC, cargo test --offline --locked -j 4 -p xcl --lib driver_cache::tests -- --test-threads=1 reported 21 passed, 0 failed, 0 ignored, 0 skips; git diff --check passed. This is a local candidate, not a tested change on the PR head. Full workspace, GPU, and paired title smoke were not run on it.

Candidate main-based diff and regressions
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
index 1c1c7318..177d00ec 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -6568,6 +6568,14 @@ pub(crate) mod driver_cache {
 
     /// `bytes` to `p`, under another name first: a run that is cut short leaves no half file.
     pub fn write(p: &Path, bytes: &[u8]) -> bool {
+        write_with_replacement(p, bytes, true)
+    }
+
+    fn write_if_absent(p: &Path, bytes: &[u8]) -> bool {
+        write_with_replacement(p, bytes, false)
+    }
+
+    fn write_with_replacement(p: &Path, bytes: &[u8], replace: bool) -> bool {
         use std::io::Write;
         if bytes.is_empty() {
             return false;
@@ -6583,7 +6591,22 @@ pub(crate) mod driver_cache {
         drop(file);
         let ok = written && {
             let _stall = crate::stall::span(crate::stall::StallKind::CacheIo);
-            std::fs::rename(&tmp, p).is_ok()
+            if replace {
+                std::fs::rename(&tmp, p).is_ok()
+            } else {
+                use std::os::windows::ffi::OsStrExt;
+                use windows_sys::Win32::Storage::FileSystem::{MoveFileExW, MOVEFILE_WRITE_THROUGH};
+                // Canonicalization supplies extended absolute paths for long user cache roots.
+                if let Ok(dir) = std::fs::canonicalize(tmp.parent().unwrap()) {
+                    let from = dir.join(tmp.file_name().unwrap());
+                    let to = dir.join(p.file_name().unwrap());
+                    let from: Vec<u16> = from.as_os_str().encode_wide().chain([0]).collect();
+                    let to: Vec<u16> = to.as_os_str().encode_wide().chain([0]).collect();
+                    unsafe { MoveFileExW(from.as_ptr(), to.as_ptr(), MOVEFILE_WRITE_THROUGH) != 0 }
+                } else {
+                    false
+                }
+            }
         };
         if !ok {
             let _stall = crate::stall::span(crate::stall::StallKind::CacheIo);
@@ -6615,7 +6638,15 @@ pub(crate) mod driver_cache {
         }
 
         pub(super) fn store(&self, blob: &[u8]) -> bool {
-            if write(&self.0, blob) {
+            self.store_with_replacement(blob, true)
+        }
+
+        pub(super) fn store_if_absent(&self, blob: &[u8]) -> bool {
+            self.store_with_replacement(blob, false)
+        }
+
+        fn store_with_replacement(&self, blob: &[u8], replace: bool) -> bool {
+            if if replace { write(&self.0, blob) } else { write_if_absent(&self.0, blob) } {
                 let n = STORED.fetch_add(1, Ordering::Relaxed) + 1;
                 if n.is_power_of_two() {
                     crate::xlog_info!("D3D12.X: {n} driver blobs kept on disk for the next run (this one: {} ms, {} KB)", self.1.as_millis(), blob.len() >> 10);
@@ -6754,7 +6785,57 @@ pub(crate) mod driver_cache {
             keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || None);
             keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || Some(b"old".to_vec()));
             assert_eq!(load_bytes(&path).as_deref(), Some(b"old".as_slice()));
-            cache.forget(9);
+            let loaded = load(&path).expect("disk-only blob");
+            let expected = loaded.shared();
+            cache.forget_if(9, &expected);
+            note(false, Some(loaded));
+            assert!(!path.try_exists().unwrap(), "rejected file removed");
+            keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || None);
+            keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || Some(b"fresh".to_vec()));
+            assert_eq!(load_bytes(&path).as_deref(), Some(b"fresh".as_slice()));
+        }
+
+        #[test]
+        fn a_disk_only_repair_does_not_replace_a_newer_file() {
+            use super::super::{keep_driver_blob, DriverBlobs, COMPUTE_BLOB_MIN_DXIL};
+            let dir = std::env::temp_dir().join(format!("xcl-driver-cache-repair-race-{}", std::process::id()));
+            let _ = std::fs::remove_dir_all(&dir);
+            std::fs::create_dir(&dir).unwrap();
+            let _directory = Directory(dir.clone());
+            let path = dir.join("repair.pso");
+            let cache = DriverBlobs::new();
+            keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || Some(b"old".to_vec()));
+            let loaded = load(&path).unwrap();
+            cache.forget_if(9, &loaded.shared());
+            note(false, Some(loaded));
+            assert!(!path.exists());
+
+            let result = keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || {
+                assert!(write(&path, b"newer"));
+                Some(b"loser".to_vec())
+            });
+            assert!(result.is_none(), "the losing generation must not be reported as saved");
+            assert_eq!(load_bytes(&path).as_deref(), Some(b"newer".as_slice()));
+            assert!(cache.get(9).is_none());
+            assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1, "no staging file remains");
+        }
+
+        #[test]
+        fn a_disk_only_repair_supports_a_long_cache_path() {
+            use super::super::{keep_driver_blob, DriverBlobs, COMPUTE_BLOB_MIN_DXIL};
+            let base = std::env::temp_dir().join(format!("xcl-driver-cache-long-repair-{}", std::process::id()));
+            let _ = std::fs::remove_dir_all(&base);
+            let _directory = Directory(base.clone());
+            let dir = base.join("a".repeat(120)).join("b".repeat(120));
+            std::fs::create_dir_all(&dir).unwrap();
+            let path = dir.join("repair.pso");
+            assert!(path.to_string_lossy().encode_utf16().count() > 260);
+            let cache = DriverBlobs::new();
+            keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || Some(b"old".to_vec()));
+            let loaded = load(&path).unwrap();
+            cache.forget_if(9, &loaded.shared());
+            note(false, Some(loaded));
+            assert!(!path.exists());
             keep_driver_blob(&cache, 0, 9u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || Some(b"fresh".to_vec()));
             assert_eq!(load_bytes(&path).as_deref(), Some(b"fresh".as_slice()));
         }
@@ -7020,6 +7101,18 @@ impl<K: Copy + Eq + std::hash::Hash> DriverBlobs<K> {
         !persisted.contains_key(&key) && active.insert(key)
     }
 
+    /// A rejected disk-only generation can leave a marker after its file is removed.
+    /// Keep that marker while one eligible builder attempts to replace the missing file.
+    fn reserve_disk_repair(&self, key: K) -> bool {
+        let blobs = self.blobs.lock().unwrap();
+        if blobs.as_ref().is_some_and(|(map, _)| map.contains_key(&key)) {
+            return false;
+        }
+        let mut guard = self.keeping.lock().unwrap();
+        let Some((active, persisted)) = guard.as_mut() else { return false };
+        persisted.get(&key).is_some_and(|generation| generation.upgrade().is_none()) && active.insert(key)
+    }
+
     /// Admit the exact disk generation accepted by the driver without copying it. Holding both
     /// locks excludes a builder reservation between the presence check and insertion.
     fn admit(&self, key: K, blob: std::sync::Arc<Vec<u8>>, limit: usize) -> bool {
@@ -7356,10 +7449,17 @@ fn keep_driver_blob_at<K: Copy + Eq + std::hash::Hash>(
     let min = if preparing { std::time::Duration::ZERO } else { min };
     let memory = !preparing && (dxil_len >= COMPUTE_BLOB_MIN_DXIL || driver_cache::keep_fixtures());
     let to_disk = disk.is_some() && driver_cache::worth_keeping(took, min);
-    if !(memory || to_disk) || !cache.reserve(key) {
+    if !(memory || to_disk) {
         return None;
     }
+    let fresh = cache.reserve(key);
+    let repair = !fresh && to_disk && cache.reserve_disk_repair(key);
+    if !fresh && !repair { return None; }
     let keep_turn = disk.filter(|_| to_disk).and_then(|path| driver_cache::KeepTurn::new(path, took, min));
+    if repair && (keep_turn.is_none() || !matches!(disk.unwrap().try_exists(), Ok(false))) {
+        cache.finish(key, None, limit, false);
+        return None;
+    }
     let Some(bytes) = read().filter(|bytes| !bytes.is_empty()) else {
         cache.finish(key, None, limit, false);
         return None;
@@ -7367,10 +7467,12 @@ fn keep_driver_blob_at<K: Copy + Eq + std::hash::Hash>(
     let blob = std::sync::Arc::new(bytes);
     // Publish to disk before exposing the blob through RAM: a concurrent consumer cannot reject
     // this generation while its staging file is being renamed into place.
-    let persisted = keep_turn.as_ref().is_some_and(|turn| turn.store(&blob));
+    let persisted = keep_turn.as_ref().is_some_and(|turn| {
+        if repair { turn.store_if_absent(&blob) } else { turn.store(&blob) }
+    });
     // (a blob for the disk only still releases the key, and marks it persisted when written)
-    cache.finish(key, memory.then(|| blob.clone()), limit, persisted);
-    Some(blob)
+    cache.finish(key, (memory && (!repair || persisted)).then(|| blob.clone()), limit, persisted);
+    (!repair || persisted).then_some(blob)
 }
 
 /// The driver's compiled form of translated graphics pipelines (`GetCachedBlob`),

AI use: Codex (GPT-6.2 Sol) wrote and ran the local candidate and regressions; Codex (GPT-6.2 Astra) reviewed the reservation and publication races.

@thehollowedone

Copy link
Copy Markdown
Contributor

Current-base update for #2740 head 7b6f3f62: its core RAM-full behavior is now on main through 9baaa6ff and the NVIDIA branch merge. Current main beeb81be returns the compiled blob to the caller even when RAM admission fails, writes an eligible blob to disk, and passes cargo test --offline --locked -j 4 -p xcl --lib a_slow_blob_is_saved_after_the_memory_cache_fills -- --test-threads=1 (1 passed, 0 failed, 0 ignored). This is a focused test, not a full-suite or title result.

The PR currently conflicts with main. I suggest comparing its remaining behavior with the merged implementation before rebasing; the RAM-full fix itself should not be added a second time. The overlapping cold-builder receipt and disk-only rejection/invalidation findings are distinct follow-ups, with local candidate diffs in those comments. Neither is resolved just by returning a blob from the first builder.

AI use: Codex (GPT-6.2 Sol) compared the current code and ran the focused test.

@thehollowedone

thehollowedone commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to the current-main repair candidate: its real.rs patch applies cleanly to main at beeb81be. I found one more publication race in that candidate. If a stale disk blob came from another process, this process has no persisted-key marker. After the exact stale file is removed, the retry takes the fresh branch; its replacing save can overwrite a newer file published by another writer during the capture.

A synthetic load stale → refuse and remove → publish newer during capture → save older interleaving failed against the earlier candidate: 0 passed, 1 failed; the file contained older. The additional change below uses the candidate's atomic no-replace store for both fresh and repair publication. The same regression then passed. On this current-main candidate, cargo test --offline --locked -j 4 -p xcl --lib driver_cache::tests -- --test-threads=1 passed 22/0/0, and cargo test --offline --locked -j 4 -p xcl --lib compute_blob_tests -- --test-threads=1 passed 6/0/0. git diff --check passed. These are focused synthetic tests; I did not run the full workspace suite or paired retail smoke on the uncommitted candidate.

If the fresh writer loses the file race, its compiled blob may still be used in memory. warm_replay::accepted compares the returned bytes with the file before recording a reuse receipt, so it cannot record the losing blob as that file's contents. The earlier repair diff plus this supplement are the complete local candidate for this retry path.

Supplemental diff and regression
@@ keep_driver_blob_at
-    let persisted = keep_turn.as_ref().is_some_and(|turn| {
-        if repair { turn.store_if_absent(&blob) } else { turn.store(&blob) }
-    });
+    let persisted = keep_turn.as_ref().is_some_and(|turn| turn.store_if_absent(&blob));

@@ driver_cache::tests
+        #[test]
+        fn a_fresh_builder_does_not_replace_a_newer_file() {
+            use super::super::{keep_driver_blob, DriverBlobs, COMPUTE_BLOB_MIN_DXIL};
+            let dir = std::env::temp_dir().join(format!("xcl-driver-cache-fresh-race-{}", std::process::id()));
+            let _ = std::fs::remove_dir_all(&dir);
+            std::fs::create_dir(&dir).unwrap();
+            let _directory = Directory(dir.clone());
+            let path = dir.join("fresh.pso");
+            assert!(write(&path, b"stale"));
+            let loaded = load(&path).expect("foreign cached blob");
+            note(false, Some(loaded));
+            assert!(!path.exists(), "refused generation removed");
+            let cache = DriverBlobs::new();
+            let got = keep_driver_blob(&cache, 0, 17u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP, || {
+                assert!(write(&path, b"newer"));
+                Some(b"older".to_vec())
+            });
+            assert_eq!(got.as_deref().map(Vec::as_slice), Some(b"older".as_slice()));
+            assert_eq!(load_bytes(&path).as_deref(), Some(b"newer".as_slice()));
+            assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 1);
+        }

AI use: Codex (GPT-6.2 Sol) wrote and ran the local regression and candidate; Codex (GPT-6.2 Astra) reviewed the cache invariant.

@thehollowedone

Copy link
Copy Markdown
Contributor

Rechecked the existing disk-only retry candidate and no-replace publication supplement on current main 9dfbe3ea.

Two test-only controls fail on unchanged main. The disk-only retry regression fails because the stale persisted-key marker blocks the retry before it can publish; it does not show that main overwrites newer bytes. The empty-file regression fails because load() treats a zero-byte cache file as a miss but leaves that file in place.

The refined candidate invalidates an empty cache entry through the exact open file handle, then keeps no-replace publication so a concurrent valid writer is preserved. On the candidate overlay: driver_cache::tests passed 23/23, and compute_blob_tests passed 6/6.

Baseline (disk-only retry, expected failure):
cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::real::driver_cache::tests::a_disk_only_repair_does_not_replace_a_newer_file -- --exact --nocapture --test-threads=1
0 passed, 1 failed; no replacement file was present because the stale marker blocked the retry.

Baseline (empty-file recovery, expected failure):
cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::real::driver_cache::tests::an_empty_driver_blob_is_invalidated_before_a_fresh_write -- --exact --nocapture --test-threads=1
0 passed, 1 failed; the empty cache file remained after load.

Candidate: cargo test --offline --locked -j 4 -p xcl --lib driver_cache::tests -- --test-threads=1
23 passed, 0 failed, 0 ignored.
Candidate: cargo test --offline --locked -j 4 -p xcl --lib compute_blob_tests -- --test-threads=1
6 passed, 0 failed, 0 ignored.

Windows 11 build 26300, Rust 1.99.1 MSVC; CPU-only, no GPU exercised. This is a local candidate based on current main, not a test of PR #2740's older conflicting head 7b6f3f62. The full workspace and paired title smoke were not run.

Additional empty-file recovery diff
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
@@ driver_cache::load
-        (!bytes.is_empty()).then(|| LoadedBlob { bytes: Arc::new(bytes), file: invalidatable.then_some(file) })
+        if bytes.is_empty() {
+            if invalidatable {
+                let empty = LoadedBlob { bytes: Arc::new(bytes), file: Some(file) };
+                let _ = empty.invalidate();
+            }
+            return None;
+        }
+        Some(LoadedBlob { bytes: Arc::new(bytes), file: invalidatable.then_some(file) })

@@ driver_cache::tests
+#[test]
+fn an_empty_driver_blob_is_invalidated_before_a_fresh_write() {
+    use super::super::{keep_driver_blob, DriverBlobs, COMPUTE_BLOB_MIN_DXIL};
+    let dir = std::env::temp_dir().join(format!("xcl-driver-cache-empty-repair-{}", std::process::id()));
+    let _ = std::fs::remove_dir_all(&dir);
+    std::fs::create_dir(&dir).unwrap();
+    let _directory = Directory(dir.clone());
+    let path = dir.join("empty.pso");
+    std::fs::write(&path, []).unwrap();
+    assert!(path.exists());
+    assert!(load(&path).is_none());
+    assert!(!path.exists(), "the exact empty cache generation is invalidated");
+    let cache = DriverBlobs::new();
+    let built = keep_driver_blob(&cache, 0, 18u64, COMPUTE_BLOB_MIN_DXIL, Some(&path), KEEP,
+        || Some(b"fresh".to_vec()));
+    assert_eq!(built.as_deref().map(Vec::as_slice), Some(b"fresh".as_slice()));
+    assert_eq!(load_bytes(&path).as_deref(), Some(b"fresh".as_slice()));
+}

AI use: Codex (GPT-6.2 Sol) revalidated the regressions and candidate; Codex (GPT-6.2 Astra) reviewed the file-handle and publication invariants.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 7b6f3f6

This change is already on main. real.rs:keep_driver_blob on main returns the captured blob and stores a slow build on disk even when the RAM cache cap refuses it (665f72f, "persist slow driver blobs past the RAM cap", adapted from #2574; the compute-only part first landed as 9baaa6f). The warm_replay::accepted call sites in translated_graphics_pso_once and finish_two_pass already use kept.or_else(|| graphics_blob/compute_blob(..)).
#2574 (same problem, compute and graphics) is covered by the same commit. This branch also conflicts with main.
Recommendation: close (superseded by main commit 665f72f).

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

@throny

throny commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Closing as superseded: this change is already on main (665f72f). keep_driver_blob now returns Option<Arc<Vec>> (captured blob even when the RAM cap refuses it) and the graphics/mesh/compute callers use it for warm_replay::accepted (665f72f, 9baaa6f); only difference: a duplicate same-key call returns None instead of cache.get(key)

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

@throny throny added the duplicate This issue or pull request already exists label Dec 1, 2026
@throny throny closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants