Skip to content

Shaders: discover offline pipeline recipes and prepare them before launch - #2829

Merged
Prime1997 merged 17 commits into
xcl-dev:mainfrom
bmjask:shaders/parallel-pso-preparation
Nov 28, 2026
Merged

Prime1997 merged 17 commits into
xcl-dev:mainfrom
bmjask:shaders/parallel-pso-preparation

Conversation

@bmjask

@bmjask bmjask commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Based directly on main after #1871. Related to #2088.

What and why

Known pipeline recipes can be prepared before guest entry. A verified driver artifact survives a diagnostics-only rebuild when the adapter, driver, translation settings and pipeline layout are unchanged. The offline command and the game window use the same staged corpus and validate native completion before reporting success.

What is in it

  • Discover shader sources and fixed-state variants from archive tables using a local layout profile. Stage one or more journals as a single deduplicated native workload.

  • Run xcl shaders <folder> --prepare-corpus --threads 8 for offline graphics, two-pass mesh and compute preparation. Select up to 32 workers.

  • Gate ordinary launch on preparation. The game window draws a progress-lit wireframe and reports progress and stalls. Cancellation and failed staged recipes prevent guest entry.

  • Reuse verified pack DXIL and compute, graphics and both mesh-pass blobs. Corrupt proofs and missing or replaced output files fall back to preparation.

  • Recover optional recorded history after a torn append. Unknown history tags and missing optional sources leave usable records available. A staged job still requires all sources and every frame. The history reader and its regression build on thehollowedone's review.

  • Restore XCL_PREPARE=0 for unstaged startup and XCL_PREPARE_GRAPHICS=0 for optional graphics history. A staged corpus retains its launch gate.

Tested

  • Main-based head b64e4862: workspace build passed; full XCL library suite reported 1,370 passed, 0 failed, 27 ignored; offline corpus suite reported 15 passed, 0 failed.

  • Revision dea6ae17 changes tested on Windows 11 build 26200, Core i9-12900K, GeForce RTX 4090 driver 610.88, rustc 1.100.0 MSVC, debug. python -B -m unittest discover -s scripts/pso_corpus -q reported 15 passed, 0 failed and 0 skipped. cargo test --locked -p xcl --lib shaders::warm -- --test-threads=1 reported 3 passed, 0 failed, 0 ignored and no skips. The targeted history_reader_keeps_verified_entries_after_an_incomplete_final_append test also passed (1 passed, 0 failed, 0 ignored and no skips).

  • On clean head e2b2eaf2, two separately linked Windows debug executables differing only in a progress diagnostic ran the standalone corpus command on the same adapter and cache. The second executable verified both known graphics recipes (classic and two-pass mesh) and the compute recipe from disk. All 3 completed with exit 0. A subsequent direct worker reported 2 verified recipes and 0 driver blob loads/writes. cargo test --locked -p xcl --lib warm_settings_ignore_worker_identity -- --test-threads=1: 1 passed, 0 failed, 0 ignored, no skips.

  • On e2b2eaf2, cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --nocapture: 1,837 passed, 8 failed, 48 ignored across 40 targets, 27 SKIPPED notices. Failures covered compute thread limits, a deferred sparse mapping, two texture-upload tests, the AS-slot mesh diagnostic, async compute registration, split compute and two-pass cleanup. All preparation receipt, history recovery and headless launch-gate tests passed. GPU skips do not count as hardware coverage.

  • Hosted Windows CI on this head exited in sparse tests with DXGI_ERROR_DEVICE_REMOVED after a 3 GiB GPU-view reservation. The software-adapter detection proposal Tests: sparse tests take CI's Basic Render Driver for a software device #2837 describes this symptom.

  • The following evidence is from earlier revisions of this PR:

  • Windows x64. python -B -m unittest discover -s scripts/pso_corpus -v passed 15 tests, with zero failures or skips.

  • Staged 84,228 graphics and mesh recipes plus 2,734 compute recipes from local journals. Readback verified the counts. Archive discovery requires a profile for the archive revision.

  • A local archive-layout profile produced 84,796 distinct source-derived recipes. Separate inputs provided static derivative mappings. The staged set includes byte-for-byte matches for all 82,612 recipes in a held-out capture. Other titles need suitable profiles.

  • On a GeForce RTX 4090, the public offline command prepared 24/24 archive-derived recipes (8 classic graphics, 8 two-pass mesh, 8 compute), wrote 32 native blobs, and exited successfully in 39.1 s with 2 workers and an initially empty application cache. A separate three-recipe test confirmed a second process could restore both mesh blobs.

  • The repository's test title prepared 768/768 generated compute recipes in its own window and returned 0. The old preparation-disable settings were set during this run. A headless failure test also passed. With 48 sources supplied both loose and staged, native submissions in the loose pass fell from 48 to zero, all 48 staged recipes were confirmed, and both title runs exited successfully. Separate mixed and fully covered packs verified worker routing.

  • cargo build --workspace --locked passed on Windows x64. On head 1eb656b4, cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-output reported 1,762 passed, 5 failed and 48 ignored across 40 targets. Sixteen reported-pass tests logged 26 skipped GPU subcases. All five failing tests also failed on the clean Shaders: replay compatible two-pass mesh pipelines at startup #2828 base: two texture upload tests, the AS-slot mesh diagnostic, async compute registration, and two-pass state cleanup. All head launcher end-to-end tests passed.

Regression run

The current head has no paired retail smoke results. Earlier review reports cannot supply a clean run of this rewritten main-based head.

Not tested

Current-head retail gameplay, paired regression smoke and AMD hardware. Complete native compilation of the largest staged corpus on this branch. Gameplay coverage beyond supplied recipes and matched history.

AI use

Codex, GPT-6, implemented and reviewed the changes and ran the checks.

@bmjask
bmjask marked this pull request as ready for review November 26, 2026 16:00
@Anon64

Anon64 commented Nov 26, 2026 •

Copy link
Copy Markdown

Regression run of aac27a6 on a newer retail title: the smoke run could not be made, because the title never started within it.

Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main b49be18 (this PR's base) and of this PR's exact head, scripts/smoke.ps1 -Game <title> for 60 s with XCL_NETWORK=0 and A pressed every 4 s from 20 s. XCL's DXIL cache on this machine is warm (18 GB, filled by runs and warm-ups of main and nvidia-dev today).

  • main: normal run, 1466 frames, no removal, no crash, peak commit 23,815 MB.
  • this PR: xcl run printed precompiling 26503 shaders into …\xcl\dxil (31 compile threads; 4 memory windows, split wave64 for a GPU with 32-lane waves) and was still precompiling when smoke.ps1 gave up with XCL printed no log path, so no xcl-smoke block exists for this head.

So with this PR, a launch on this title starts with a pass over every shader record of the pack, even with a warm cache. Unless that is meant to happen on every launch, it looks like the discovery picks up all records instead of the recipes earlier runs recorded, or the cache keys it looks up differ from the ones main writes. It also means scripts/smoke.ps1 cannot measure this PR on a large title; the 60 s window has no room for a launch-time pass.

Update: this head is 36,287 added lines in 98 files against b49be18, so it carries most of nvidia-dev with it. The same precompiling 26503 shaders pass at launch happened here on nvidia-dev af2cecc4 itself the first time its shader preparation ran (it later took about 2 minutes once a run had recorded what it used). So the pass is most likely nvidia-dev's preparation, not something this PR's own commits add, and the smoke run would need either XCL_PREPARE=0 or a first launch to completion before it. Splitting this PR's own commits from the nvidia-dev ones would make it measurable against main.

Update 2: with XCL_PREPARE=0 the head still started with the same precompiling 26503 shaders pass, and the smoke run failed the same way (main ran normally, 1466 frames). Reading the head: present::preparation::before_guest (from host.rs:83) returns early only when there is neither a staged corpus nor any run history, or when graphics are null, and no environment variable gates it, so XCL_PREPARE=0 from nvidia-dev no longer turns it off. On a machine that has run the title before, every launch begins with this pass. A switch to turn it off (or keeping XCL_PREPARE=0) would let scripts/smoke.ps1 and anyone comparing against main measure the rest of the PR.

Not tested: how long the pass takes to finish here; a second launch after it finishes; the suite on this head; AMD.

AI use: Claude Code (Claude Opus 5.5) ran these on this machine and wrote this report.

@KDenKC

KDenKC commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Source review of 1eb656b4, no run, plus a question about real data.

shaders.rs:2105-2107 now returns Err("… title graphics recipes lack matching shader sources") when any of the title's own recorded graphics recipes (local_missing) has no matching shader. On af2cecc4, with only the used-* files of one earlier run, the retail title logged:

Shader preparation: 3 of 145 graphics pipelines left out (their shaders are not in the title's shader files)

The preparation went on and the title started (RTX 5090, two runs). With this head, would those 3 now be found through the new embedded map, or would they count as local_missing and stop the launch on the second run? If it is the latter, logging them as before and preparing the rest would keep a relaunch from failing on recipes the pack cannot supply.

Not tested: this head in the title.

AI use: Gemini (Antigravity) flagged it in a review. Claude Code (Claude Opus 5.5) checked the source at 1eb656b4 and our logs and wrote this.

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Source review of 1eb656b4, no run. A relaunch can fail for good after a run that ended mid-write.

graphics_in_workers (shaders.rs:2065) now reads the title's history file, used-graphics-pipelines.bin, with the strict read_complete_payloads. On main this was gfx_records::read. The strict reader fails on a trailing partial entry ("damaged graphics job at byte N"). That file is appended to while the title runs, and both Writer::open (gfx_records.rs:559, "a cut-short tail is cut off") and the comment at gfx_records.rs:486 treat a partial tail as normal.

If a run ends mid-append, the ? stops the next launch before the title starts. Only Writer::open trims the tail, and it runs after the title starts. So every later launch fails the same way until the file is deleted. An entry from another build version stops it the same way ("Unrecognized graphics history entry", line 2069).

Reading the history file with gfx_records::read, and keeping the strict reader for worker job files, would avoid both.

AI-assisted (Claude Code, Claude Opus 5.5): traced in the source at this head.

@MatyEjsr

MatyEjsr commented Nov 26, 2026 •

Copy link
Copy Markdown

Independent Windows / RTX 3090 verification of exact PR #2829 head 1eb656b4b1af9daa9c71a612bd84995f2b8d9c3c (stacked on #2828 against nvidia-dev af2cecc4; currently MERGEABLE with origin/nvidia-dev at eae01502, 38 commits ahead).

System

  • Windows 11 Pro for Workstations (build 26200) x64, AMD Ryzen 7 7800X3D, NVIDIA GeForce RTX 3090 24 GB (driver 32.0.16.1742 / 617.42, Windows Developer Mode ON), 32 GB RAM (31.4 GiB usable)
  • Rust 1.100.0 (0ef1bc386 2026-11-09) MSVC, DXC 1.9.2602.17 (dxil 1.9.2602.17, Windows SDK 10.0.26100.0)

Tested

  • python -B -m unittest discover -s scripts/pso_corpus -v: 15 passed, 0 failed, 0 skipped (0.066 s).
  • cargo build --workspace --locked -j 8: passed (debug, 14.75 s); cargo build --release -p xcl --locked -j 8: passed (48.41 s).
  • cargo test --workspace --locked --no-fail-fast -j 8 -- --test-threads=8 --nocapture: 1,762 passed, 5 failed, 48 ignored across 40 top-level targets.
    • Serial reruns (--test-threads=1) reproduce all 5 failures deterministically (matching the 5 pre-existing failures on the Shaders: replay compatible two-pass mesh pipelines at startup #2828 / af2cecc4 base noted in the PR description):
      • hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels & gpu_parts_of_a_texture_go_up_and_the_rest_stays (texture_upload.rs:1002:17: attempt to multiply with overflow)
      • console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly (d3d12_mesh_stream.rs:96:5: ["MS: no NGG hardware variant"])
      • async_compute_pso_registers_real_pso_and_not_standin (gpu_compute_e2e.rs:535:5: TRANSLATED_COMPUTE cleanup)
      • two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (gpu_two_pass_cache_e2e.rs:649:5: left: 3, right: 0)
    • 29 SKIPPED subcases/tests (not counted as passing GPU coverage): 21 no wave64, 3 per-lane form: refused (unsupported) (wave32 f16 arithmetic/packed, f32 conversions), 2 no heap windows (XCL_HEAP_WINDOWS=1 opt-in), 3 no d3d12SDKLayers.dll / no D3D12 debug layer.

Retail smoke check (no xcl-smoke v1 block for PR head)

  • Run 1 (scripts/smoke.ps1 -Seconds 60 -Title c1cc91a4 -StartupTimeoutSeconds 120, clean data root, warm DXIL cache, XCL_PREPARE unset): killed at 180 s with XCL printed no log path while still precompiling (Shader preparation: 3601 of 26503 records processed after 177 s).
  • Run 2 (same data root, warm DXIL cache, XCL_PREPARE=0, XCL_PREPARE_GRAPHICS=0): also killed at 180 s with XCL printed no log path while still precompiling (Shader preparation: 8809 of 26503 records processed after 177 s).
  • Source check confirms crates/xcl/src/hle/d3d12x/present/preparation.rs:36-52 removed the XCL_PREPARE=0 early return and earlier_used_shaders() filter, and crates/xcl/src/shaders.rs:1798-1800 (prepare_title_inputs) removed XCL_PREPARE_GRAPHICS=0. On nvidia-dev (ea0698d4, 37 commits ahead of this PR's af2cecc4 base and 1 commit behind current origin/nvidia-dev eae01502), XCL_PREPARE=0 lets the title boot within the 60 s smoke window:
xcl-smoke v1
commit: ea0698d428f38f63fcc7638e50a86d186eb7e264
gpu: NVIDIA GeForce RTX 3090
title: c1cc91a4
seconds: 60
exit: 0x0
frames shown: 1599 (PresentX 1599)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15873 MB
  • Because pre-launch preparation did not complete within 180 s in Run 1, no graphics history file was written to test the local_missing != 0 relaunch error (shaders.rs:2105-2108) on retail data.

Not tested

  • AMD RDNA2/RDNA4 / native wave64, Intel GPUs, Linux/Wine, D3D12 debug layer, XCL_HEAP_WINDOWS=1 / XCL_DIRECT_DXIL=1, offline --prepare-corpus on a staged archive profile, exact af2cecc4 base smoke run, and gameplay past pre-launch shader preparation on 1eb656b4.

AI use

  • Antigravity (agy) with gemini-pro-orchestrator-argon (audited by gemini-pro-orchestrator-argon) checked out 1eb656b4, ran the tests and smoke attempts, verified the source lines, and wrote/audited this report.

@thehollowedone

Copy link
Copy Markdown
Contributor

Follow-up to the truncated-history review, tested on exact head 1eb656b4.

I reproduced the launch gate with the repository's synthetic test title and a title-scoped used-graphics-pipelines.bin containing a valid file header followed by two bytes of a frame header. On the unmodified head, xcl run stopped before guest entry with damaged graphics job at byte 12 (exit 2). With the candidate below, preparation passed that gate and entered the synthetic title. That title later aborted under my minimal null-renderer test configuration, so this check does not establish a successful full title run.

The smallest fix I found is a history-specific reader that accepts only an incomplete final frame header or payload and retains the verified prefix. A complete frame with a bad checksum or unsupported entry still fails. Completed worker job files retain their strict reader. Replacing the call with the older gfx_records::read would also ignore complete corrupt frames and read errors, so it is too permissive here. A future file-format version still fails closed; any migration policy is a separate decision.

The new regression was red on the unmodified reader (0 passed, 1 failed) and green with this change (1 passed, 0 failed, 0 ignored; no skips): cargo test --offline --locked -p xcl --lib history_reader_keeps_verified_entries_after_an_incomplete_final_append -- --test-threads=1 --nocapture. It covers a cut frame header, a cut payload, strict worker-job rejection, bad checksum, and unsupported complete entry. cargo build --offline --locked -p xcl --bin xcl passed on both revisions. The full cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 on the candidate reported 1,762 passed, 7 failed, 48 ignored, with 26 GPU subcase skip notices; the failures were in the shader-cache, texture-upload, mesh-stream, async-compute and two-pass-cache tests. I did not rerun that full suite on the unmodified head, so I cannot attribute those failures to or exclude this patch.

Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (driver 621.35), rustc 1.99.1 MSVC. Synthetic inputs only. Not tested: retail title, paired clean smoke, AMD or Intel. This is a candidate for the author, not a merge-readiness claim.

Candidate diff against 1eb656b
diff --git a/crates/xcl/src/hle/d3d12x/gfx_records.rs b/crates/xcl/src/hle/d3d12x/gfx_records.rs
index da67c087..00187d8e 100644
--- a/crates/xcl/src/hle/d3d12x/gfx_records.rs
+++ b/crates/xcl/src/hle/d3d12x/gfx_records.rs
@@ -482,9 +482,9 @@ pub(crate) fn read(path: &Path) -> Vec<Vec<u8>> {
     payloads(&file).map_or_else(Vec::new, |(list, _)| list.into_iter().map(<[u8]>::to_vec).collect())
 }
 
-/// A completed worker job must contain only whole, supported records. A history file
-/// may be open for appends, so its reader above accepts a trailing partial entry.
-pub(crate) fn visit_payloads(path: &Path, mut visit: impl FnMut(&[u8]) -> Result<(), String>) -> Result<(), String> {
+/// A completed worker job must contain only whole, supported records. A title history
+/// may end inside an append after the previous run stopped.
+fn visit_payloads_with_tail(path: &Path, allow_incomplete_tail: bool, mut visit: impl FnMut(&[u8]) -> Result<(), String>) -> Result<(), String> {
     use std::io::{BufReader, Read};
     let file = std::fs::File::open(path).map_err(|e| e.to_string())?;
     let size = file.metadata().map_err(|e| e.to_string())?.len();
@@ -498,10 +498,16 @@ pub(crate) fn visit_payloads(path: &Path, mut visit: impl FnMut(&[u8]) -> Result
     while offset < size {
         let damaged = || format!("damaged graphics job at byte {offset}");
         let mut frame = [0; 8];
-        if size - offset < 8 { return Err(damaged()); }
+        if size - offset < 8 {
+            if allow_incomplete_tail { break; }
+            return Err(damaged());
+        }
         reader.read_exact(&mut frame).map_err(|_| damaged())?;
         let len = u32::from_le_bytes(frame[..4].try_into().unwrap()) as usize;
-        if len as u64 > size - offset - 8 { return Err(damaged()); }
+        if len as u64 > size - offset - 8 {
+            if allow_incomplete_tail { break; }
+            return Err(damaged());
+        }
         payload.resize(len, 0);
         reader.read_exact(&mut payload).map_err(|_| damaged())?;
         if check(&payload) != u32::from_le_bytes(frame[4..].try_into().unwrap()) { return Err(damaged()); }
@@ -511,6 +517,10 @@ pub(crate) fn visit_payloads(path: &Path, mut visit: impl FnMut(&[u8]) -> Result
     Ok(())
 }
 
+pub(crate) fn visit_payloads(path: &Path, visit: impl FnMut(&[u8]) -> Result<(), String>) -> Result<(), String> {
+    visit_payloads_with_tail(path, false, visit)
+}
+
 pub(crate) fn shader_payload(payload: &[u8]) -> Option<(u64, &[u8])> {
     let (&tag, rest) = payload.split_first()?;
     if tag != SHADER { return None; }
@@ -518,9 +528,9 @@ pub(crate) fn shader_payload(payload: &[u8]) -> Option<(u64, &[u8])> {
     Some((r.u64()?, r.0))
 }
 
-fn read_complete<T>(path: &Path, mut take: impl FnMut(&[u8], Entry) -> T) -> Result<Vec<T>, String> {
+fn read_complete<T>(path: &Path, allow_incomplete_tail: bool, mut take: impl FnMut(&[u8], Entry) -> T) -> Result<Vec<T>, String> {
     let mut entries = Vec::new();
-    visit_payloads(path, |bytes| {
+    visit_payloads_with_tail(path, allow_incomplete_tail, |bytes| {
         let entry = decode(bytes).ok_or_else(|| format!("invalid graphics job entry {}", entries.len() + 1))?;
         entries.push(take(bytes, entry));
         Ok(())
@@ -528,12 +538,12 @@ fn read_complete<T>(path: &Path, mut take: impl FnMut(&[u8], Entry) -> T) -> Res
     Ok(entries)
 }
 
-pub(crate) fn read_complete_payloads(path: &Path) -> Result<Vec<Vec<u8>>, String> {
-    read_complete(path, |bytes, _| bytes.to_vec())
+pub(crate) fn read_history_payloads(path: &Path) -> Result<Vec<Vec<u8>>, String> {
+    read_complete(path, true, |bytes, _| bytes.to_vec())
 }
 
 pub(crate) fn read_job(path: &Path) -> Result<Vec<Entry>, String> {
-    read_complete(path, |_, entry| entry)
+    read_complete(path, false, |_, entry| entry)
 }
 
 /// What became of an entry handed to `Writer::add`.
@@ -886,6 +896,34 @@ mod tests {
         assert!(read_job(&path).is_err());
     }
 
+    #[test]
+    fn history_reader_keeps_verified_entries_after_an_incomplete_final_append() {
+        let dir = directory("history-tail");
+        let path = dir.0.join("history.bin");
+        let first = shader_entry(5, b"shader");
+        let mut writer = Writer::open(&path, u64::MAX).unwrap();
+        writer.add(&first).unwrap();
+        drop(writer);
+        let original = std::fs::read(&path).unwrap();
+        let mut writer = Writer::open(&path, u64::MAX).unwrap();
+        writer.add(&shader_entry(6, b"next")).unwrap();
+        drop(writer);
+        let complete = std::fs::read(&path).unwrap();
+        let second = &complete[original.len()..];
+        for tail in [&second[..3], &second[..second.len() - 2]] {
+            std::fs::write(&path, [original.as_slice(), tail].concat()).unwrap();
+            assert_eq!(read_history_payloads(&path).unwrap(), vec![first.clone()]);
+            assert!(read_job(&path).is_err(), "worker jobs still require whole frames");
+        }
+        let mut corrupt = original;
+        corrupt[HEADER + 8] ^= 1;
+        std::fs::write(&path, corrupt).unwrap();
+        assert!(read_history_payloads(&path).is_err(), "a complete but corrupt frame is not a torn append");
+        std::fs::write(&path, &complete).unwrap();
+        Writer::open(&path, u64::MAX).unwrap().add(&[0xff]).unwrap();
+        assert!(read_history_payloads(&path).is_err(), "an unsupported complete entry remains an error");
+    }
+
     #[test]
     fn legacy_pipeline_and_mesh_entries_share_version_one_history() {
         let dir = directory("mesh-version-one");
diff --git a/crates/xcl/src/shaders.rs b/crates/xcl/src/shaders.rs
index 6855d394..4d60aa64 100644
--- a/crates/xcl/src/shaders.rs
+++ b/crates/xcl/src/shaders.rs
@@ -2062,7 +2062,7 @@ fn in_workers(workers: usize, records: usize, progress: &LaunchPreparation, mut
 fn graphics_in_workers(inputs: &[Input], windows: u32, workers: usize, progress: &LaunchPreparation, staged_graphics: Option<&Path>) -> Result<(), String> {
     let t0 = std::time::Instant::now();
     let path = gfx_records::path();
-    let local = if path.try_exists().map_err(|e| e.to_string())? { gfx_records::read_complete_payloads(&path)? } else { Vec::new() };
+    let local = if path.try_exists().map_err(|e| e.to_string())? { gfx_records::read_history_payloads(&path)? } else { Vec::new() };
     let mut records = Vec::new();
     let mut embedded = std::collections::HashMap::new();
     for payload in local {

AI use: Codex (GPT-6.2 Sol) traced the path, wrote and ran the candidate and tests; GPT-6.2 Astra reviewed the reader design. I checked the review points and results.

@bmjask
bmjask force-pushed the shaders/parallel-pso-preparation branch from 1eb656b to dea6ae1 Compare November 26, 2026 22:48
@andrewDoing

Copy link
Copy Markdown
Contributor

I checked the missing-source behavior on head 1eb656b4 with synthetic, well-formed records and no game files. In a host-side graphics_in_workers test:

  • Empty history completed successfully.
  • Two valid recipes with neither shader source available stopped preparation with 2 of 2 title graphics recipes lack matching shader sources.
  • Supplying matching DXC-generated shader bytecode for one recipe changed the diagnostic to 1 of 2 title graphics recipes lack matching shader sources; preparation still stopped before workers launched.

The test passed 1/1 with zero reported skips. Normal title first-use capture was observed in source to write a recipe; staged or worker inputs can also include shader entries. This synthetic check does not determine whether the missing sources reported for GTA VI can be recovered from its actual inputs.

AI use: OpenAI Codex with GPT-6.2 Astra constructed and ran the synthetic test and inspected the source; Codex coordinated and prepared this report.

@andrewDoing

Copy link
Copy Markdown
Contributor

Retested the all-missing historical-source case from my earlier report on updated head e2b2eaf22e903624c3428b0f0a08c9cfa10e0963, with the same synthetic test-only overlay. Empty title history succeeded. With two well-formed recipes and no matching local shader sources, preparation now reported deferring 2 of 2, started zero workers, and returned success. The same all-missing input returned an error on the earlier head 1eb656b4.

The updated test passed 1/1 without a reported skip. Mixed-source worker execution and GTA VI title behavior were not tested in this retest.

AI use: OpenAI Codex with GPT-6.2 Astra inspected the updated source and ran the synthetic test; Codex coordinated and prepared this report.

@andrewDoing

Copy link
Copy Markdown
Contributor

Follow-up to my missing-source retest: on e2b2eaf22e903624c3428b0f0a08c9cfa10e0963, I tested mixed synthetic title history with two unresolved shader recipes and one complete two-pass mesh plus pixel shader recipe. The parent deferred 2/3 and launched one exact-head worker; it reported 1 pipeline made, 0 failed, and two blobs kept. The history file was byte-identical afterward.

The parent test contained a test-only override pointing at the real worker binary. This is a synthetic local integration, not a GTA VI title run or proof that its missing shader sources are recoverable.

AI use: OpenAI Codex with GPT-6.2 Astra built and ran the synthetic test; Codex coordinated and prepared this report.

@JJAutoCompare

Copy link
Copy Markdown

Tested: e2b2eaf22e903624c3428b0f0a08c9cfa10e0963 on Windows 11 build 26200, Ryzen 7 3800X, Rust 1.100.0 MSVC, debug, Python 3.12.10. python -B -m unittest discover -s scripts/pso_corpus -q: 15 passed. cargo test --offline --locked -j 2 -p xcl --lib --no-run followed by the selected warm settings, corpus, graphics record, and staged-worker filters: 22 passed, 0 failed, 0 ignored or skipped. Worker identity and Windows environment casing preserved warm settings identity, and a backend change did not. The inherited history test retained verified entries after an incomplete append. The staged-worker test refused missing or mismatched shader inputs before graphics pipeline creation.

Not tested: Actual prelaunch GPU cache reuse, retail titles, and the full workspace suite.

AI use: T3 Code / Codex (gpt-6.2-sol) ran and reran the checks and wrote this report.

@andrewDoing

Copy link
Copy Markdown
Contributor

Another synthetic prelaunch check on head e2b2eaf22e903624c3428b0f0a08c9cfa10e0963: two complete mesh recipes were prepared by the real worker in fresh processes. All five runs succeeded with zero failed recipes.

  • Cold ordered pair: 0/2 previously verified.
  • Same order in a new process: 2/2 verified, no driver blob loads.
  • Same pair reversed: 0/2 verified, three cached blobs loaded, no new blobs stored.
  • Repeated reversed, then returned to original order: 2/2 verified in each run.

The receipt identity includes the ordered recipe list, so reordered grouping triggers native revalidation even though driver blobs can still be reused. This is a synthetic test, not a GTA VI launch or measured performance regression.

AI use: OpenAI Codex with GPT-6.2 Astra built and ran the synthetic test; Codex coordinated and prepared this report.

@KDenKC

KDenKC commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

@bmjask, a question about the archive-layout profile. On nvidia-dev + #2794 (RTX 5090), the next cold-compile cost after whole-form compute is 135 graphics builds of 1 s or more, none of them in the first-use history (details: #2088 7211419072). Recipe discovery from the archive tables looks like the approach that covers them, so we'd like to test e2b2eaf in the retail title (1.0.2.1).

scripts/pso_corpus/ has the schema (archive-profile.md), pso_archive.py and stage.py, but not the profile itself. Is the profile for the retail title's archive revision something you can publish, or is there a recipe for building one from a local copy (which tables and offsets it reads)? With it, we'd run --prepare-corpus into a scratch folder, check whether the 135 slow builds come out as full stage-and-state matches, and post time to the first world frame with and without it.

AI use: Gemini (Antigravity) read the scripts and thread; Claude Code (Claude Opus 5.5) checked them and wrote this comment.

@thehollowedone

Copy link
Copy Markdown
Contributor

Focused review of #2829 head e2b2eaf2: a staged classic graphics recipe with a console geometry shader and depth bounds enabled can report successful native preparation with depth bounds off. The recipe keeps that flag, and prepare_graphics passes it to translated_graphics_pso_once. Its GS branch drops the flag at translated_gs_pso, which emits DEPTH_STENCIL for both cases. Because finish_two_pass hashes the resulting stream, the two cases can also share the same mesh-graphics cache identity. This is a preparation/correctness gap; I did not measure a title render.

I added a synthetic stream regression locally on the exact head. Before the correction, cargo test --offline --locked -j 4 -p xcl --lib gs_mesh_stream_preserves_depth_bounds_state -- --test-threads=1 failed 0 passed, 1 failed, 0 ignored: native subobject 11 (DEPTH_STENCIL) instead of 21 (DEPTH_STENCIL1). With the candidate diff below, cargo test --offline --locked -j 4 -p xcl --lib depth_bounds -- --test-threads=1 passed 3 passed, 0 failed, 0 ignored, zero skips. The new test also checks the two native cache keys differ. git diff --check passed.

Candidate fix and regression
diff --git a/crates/xcl/src/hle/d3d12x/real.rs b/crates/xcl/src/hle/d3d12x/real.rs
index 7d81274c..e2975e8c 100644
--- a/crates/xcl/src/hle/d3d12x/real.rs
+++ b/crates/xcl/src/hle/d3d12x/real.rs
@@ -5821,6 +5821,32 @@ mod graphics_blob_tests {
         assert_ne!(depth_bounds_key(key, true), key);
     }
 
+    #[test]
+    fn gs_mesh_stream_preserves_depth_bounds_state() {
+        let mut d = D3D12_GRAPHICS_PIPELINE_STATE_DESC::default();
+        d.DepthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_GREATER;
+        let mut keys = Vec::new();
+        for enabled in [false, true] {
+            let mut stream = StreamOut::default();
+            put_gs_depth_stencil(&mut stream, &d.DepthStencilState, enabled);
+            keys.push(unsafe { two_pass_stream_key(&stream.0, &[], 7, 0) }.unwrap());
+            let fields = stream_subobjects(&stream.0).unwrap();
+            let (ty, bytes) = fields.iter().find(|(ty, _)| {
+                *ty == D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL.0 as u32
+                    || *ty == D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1.0 as u32
+            }).unwrap();
+            if enabled {
+                assert_eq!(*ty, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1.0 as u32);
+                let state = unsafe { std::ptr::read_unaligned(bytes.as_ptr().cast::<D3D12_DEPTH_STENCIL_DESC1>()) };
+                assert!(state.DepthBoundsTestEnable.as_bool());
+                assert_eq!(state.DepthFunc, d.DepthStencilState.DepthFunc);
+            } else {
+                assert_eq!(*ty, D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL.0 as u32);
+            }
+        }
+        assert_ne!(keys[0], keys[1], "depth bounds must distinguish native graphics cache entries");
+    }
+
     #[test]
     fn graphics_blob_key_tracks_shaders_samplers_and_state() {
         unsafe {
@@ -6280,7 +6306,7 @@ unsafe fn translated_graphics_pso_once(this: *mut c_void, f: PsoFn, desc: *const
     }
     if let Some(gs) = shader_bytes(&d.GS).filter(|g| is_console(g)) {
         let _ = f;
-        return Some(translated_gs_pso(this, d, vs, gs, riid, ppv));
+        return Some(translated_gs_pso(this, d, vs, gs, depth_bounds, riid, ppv));
     }
     // a GPU that can run 32-lane waves may run a wave64 VS / PS in waves of 32 (the driver
     // picks; RDNA2 does for pixel shaders): the lanes 32..63 it reads come from `upper_lanes`
@@ -7909,9 +7935,17 @@ unsafe fn translated_mesh_stream_once(this: *mut c_void, desc: *const c_void, ri
     Some(hr)
 }
 
+fn put_gs_depth_stencil(out: &mut StreamOut, state: &D3D12_DEPTH_STENCIL_DESC, depth_bounds: bool) {
+    if depth_bounds {
+        out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1, &super::gfx_records::depth_stencil1(state, true));
+    } else {
+        out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL, state);
+    }
+}
+
 /// A graphics PSO with a console VS + GS: the GS pipeline in two passes, as a mesh pipeline
 /// with the description's state.
-unsafe fn translated_gs_pso(this: *mut c_void, d: &D3D12_GRAPHICS_PIPELINE_STATE_DESC, vs: &[u8], gs: &[u8], riid: *const GUID, ppv: *mut *mut c_void) -> HRESULT {
+unsafe fn translated_gs_pso(this: *mut c_void, d: &D3D12_GRAPHICS_PIPELINE_STATE_DESC, vs: &[u8], gs: &[u8], depth_bounds: bool, riid: *const GUID, ppv: *mut *mut c_void) -> HRESULT {
     let (tp, (ps, ps_samplers)) = match (
         crate::gpu::recomp::pso::console_geometry(vs, gs, shader_bytes(&d.PS), wave32_only(this)),
         two_pass_ps(shader_bytes(&d.PS), graphics_wave32(this)),
@@ -7969,7 +8003,7 @@ unsafe fn translated_gs_pso(this: *mut c_void, d: &D3D12_GRAPHICS_PIPELINE_STATE
     out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_BLEND, &blend);
     out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_MASK, &d.SampleMask);
     out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RASTERIZER, &d.RasterizerState);
-    out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL, &d.DepthStencilState);
+    put_gs_depth_stencil(&mut out, &d.DepthStencilState, depth_bounds);
     out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS, &rt);
     out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT, &dsv);
     out.put(D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC, &d.SampleDesc);

This needs a real GPU recipe/replay check on a depth-bounds-capable adapter and a clean-head paired smoke before merge. I did not run those or the full workspace suite on this uncommitted candidate. No proprietary inputs were used. AI use: Codex (GPT-6.2 Sol) wrote and ran the local regression and fix; Codex (GPT-6.2 Astra) independently traced the path.

@thehollowedone

thehollowedone commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to my depth-bounds finding: I checked the geometry-shader path with a native GPU worker replay and ran clean-commit smoke checks. The unmodified PR head is e2b2eaf; the proposed correction is a local, unpushed commit 92c26a56 on top of it.

On Windows 11 build 26300, RTX 3080 Ti (621.35), Ryzen 7 9800X3D, the new synthetic VS+GS worker test makes both native pipelines, one with depth bounds and one without. On the unchanged PR head it failed: both recipes produced the same mesh-pipeline cache entry. With the local correction it passed cold and warm replay: two distinct mesh entries, one shared compute entry, two pipelines made, zero failures. cargo test --offline --locked -j 4 -p xcl --lib depth_bounds -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored, 0 skips on the candidate.

The full cargo test --workspace --offline --locked --no-fail-fast -j 4 -- --test-threads=4 --show-output was also run on both revisions with isolated writable DXIL caches. Unchanged PR head: 1,841 passed, 9 failed, 48 ignored, 26 GPU skip notices. Local candidate: 1,843 passed, 9 failed, 48 ignored, 26 GPU skip notices. The same seven distinct test names account for the nine failures on both; the two added depth-bounds tests pass. Thus this check does not establish a green workspace suite for either revision.

The following xcl-smoke blocks came from scripts/smoke.ps1 on clean release builds of main, the exact PR head, and the local candidate. Each used the same anonymous title, adapter, 60-second duration, XCL_PREPARE=0, and a separate writable DXIL cache. These runs covered startup without menu input; they did not exercise world load or visually validate depth-bounds rendering. The candidate block cannot serve as this PR's required head block unless the change is adopted, pushed, and rerun on that new clean head.

Generated smoke blocks

main:

xcl-smoke v1
commit: 623d02e465a17497a757a4ce867f482b0a6c8f3b
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1259 (PresentX 1259)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14980 MB

PR head:

xcl-smoke v1
commit: e2b2eaf22e903624c3428b0f0a08c9cfa10e0963
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1543 (PresentX 1543)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16695 MB

Local candidate:

xcl-smoke v1
commit: 92c26a56d584ec53fadd20505047228af33fd800
gpu: NVIDIA GeForce RTX 3080 Ti
title: 9cc6a39e
seconds: 60
exit: 0x0
frames shown: 1570 (PresentX 1570)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 16820 MB

The bounded correction forwards depth_bounds into translated_gs_pso, emits DEPTH_STENCIL1 when enabled, and preserves the old DEPTH_STENCIL subobject otherwise. Its unit regression checks the subobject and distinct native cache keys; the worker regression checks the GPU compilation and cold/warm reuse. The earlier comment has the core candidate diff. I can share the new test diff if useful. AI use: Codex (GPT-6.2 Sol) integrated and ran the correction and checks; Codex (GPT-6.2 Astra) built and ran the synthetic GPU replay.

@KDenKC

KDenKC commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

@bmjask, an update to my profile question above: we found a route that doesn't need the archive profile, and it works with your offline corpus. #758's runtime journal writes each pipeline description when the title creates it, so a 180 s run records the descriptions of pipelines the title only uses minutes later. Staged with stage.py and prepared with --prepare-corpus, 135 of 135 slow graphics builds came from blobs in the title, against 0 of 135 without. Details: #2088 (comment)

Two things we hit on e2b2eaf2:

  • A staged corpus is only found under the game folder (present/preparation.rs ~44-46, root.join(".xcl/pso-corpus")). We keep the game folder read-only, so we ran --prepare-corpus offline into the run's cache instead. An override such as XCL_PSO_CORPUS=<dir> would make that path usable from a launch.
  • stage.py --title <folder> writes <folder>\.xcl\pso-corpus, so pointing it at a real title folder writes into it.

Your relaunch fix works here too: relaunch 1 logged deferring 3 of 145 recorded title graphics recipes until their shader sources are available, then built the other 142 and reached the title. That's the 3-of-145 case we reported.

The warm relaunch on the same cache (RTX 5090, same build, 147 recorded entries): preparation took 159 s in all (compute 136 s, 0 of 6 workers failed), the same 3 recipes were deferred, graphics 144 made with 143 driver blobs from disk, and 90 s in the title with no removal. The cold first launch's full-pack compute preparation took 6,092 s across resumed runs on this machine.

AI use: Claude Code (Claude Opus 5.5).

theaustinayers and others added 12 commits November 27, 2026 10:18
The driver builds about two pipelines at a time for one process, so the
preparation before a title (xcl-dev#2555) stood for minutes on each stretch of
large compute programs. The stages are still translated in the host;
the compute pipelines are built by worker processes of the same program,
each on its own slice of the records: the processors less two, 16 at
most, 3 GB of the commit left for each (XCL_PREPARE_WORKERS; 1: as
before). With a list of the pipelines an earlier run used, only those
are built before the title starts. A worker that fails is logged and the
title starts; a worker ends when the host does. A worker reports every
record while a title waits on it, and the host logs its progress every
5 s.

Measured on a retail title, RTX 5090, 32 threads: the first 92 % of the
steps in 85 s (one process: 84 % of one pass after several minutes).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… record

The two passes were added up (twice the records), and a worker's count
moved every 200 records, so the screen stood on one number for many
minutes. The workers' pass has its own heading and count, a worker
reports every record, and the line under the bar says a large pipeline
is compiling. Workers: the logical processors less four.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A run keeps the shaders of the pipelines it uses, each by its own key
(used-shaders.txt beside the DXIL cache). With that list the preparation
before a title translates only those records; the title translates
another when it first uses it. XCL_PREPARE_ALL=1: every record, as
without the list. XCL_PREPARE=0: no preparation, the title builds what
it uses as it goes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Records with the same program are in several workers' slices. Each
worker found no driver blob and built the pipeline: the driver's
compile of one took about twice as long in each of four workers that
built it at once, and a worker that had waited for its turn built what
another had written to the cache meanwhile.

A worker claims a pipeline with a file beside the blob it will write
(<blob>.claim) and removes it when the build ends; a worker that finds
the claim leaves the pipeline, and the cache is read again after the
wait. A claim left by a process that died is taken over after 30
minutes. The count of pipelines left to another process is printed
with the others.

Reported by a tester who logged what each worker compiled.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The shader preparation before a title starts builds the compute pipelines
earlier runs used, but no graphics pipeline: what is kept between runs is
not enough to make one again. used-pipelines.txt holds only the key of a
pipeline's shader set, and the driver cache holds blobs named after the
translated DXIL and the description's hash. A retail title then builds
~6 000 graphics pipelines in its first minutes, with thousands of
stand-ins that draw nothing meanwhile.

A lazy graphics pipeline's description is now written down at its first
use in a run (pso_async::on_first_use, told once, as used::note is):
every field of the description but its pointers, its input layout, and
the keys of its console shaders, ~200 bytes, under the key
used-pipelines.txt has. The entry is made when the pipeline is (no
shader copy is kept for it after its build) and written by a thread of
its own, each description once, to used-graphics-pipelines.bin beside
the DXIL cache (gfx_records: the format is in the module's comment). The
file is versioned (another version reads as none and is started again),
an entry cut short or damaged ends it, and it stops at XCL_GFX_RECORDS_MB
(64) with a line in the log. No shader code is kept: the preparation
finds the shaders in the title's shader files by key, as it does for
used-shaders.txt.

Mesh pipeline streams are not recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retail title's world lost the device with reason 0x887A0005 (no driver
error, DRED state 0, no list in flight) at 23 to 26 GB of video memory
and 46 to 49 GB of process memory, on a PC whose other programs held
71 GB of commit under a 147 GB limit. The sum looked like the limit;
nothing in the log could say.

- The memory line ends with "system commit N of M MB", and a removal
  reports it too. Measured with it: 30.8 GB were left at the removal, and
  the system's commit follows the process's own memory, not its video
  memory - the commit limit is not what removes the device (it is the
  driver's 512 MiB range for the code of pipelines in use,
  xcl-dev#2403).
- A warning when less than 8 GB of commit are left (once, then at each
  halving): there allocations start to fail for every program.

Tests: the rule of the warning; the commit is known and under its limit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
After the compute pass, the shader preparation now reads the graphics
pipeline records of earlier runs (used-graphics-pipelines.bin), finds
their console shaders in the title's shader files by key, and builds each
pipeline in worker processes, the way the title's background build makes
it (real::prepare_graphics calls translated_graphics_pso, as
build_graphics does): the translation, DXC and driver blob caches on disk
then hold exactly what the title asks for, and the title makes these
pipelines from the kept blob in milliseconds instead of compiling them
while it draws stand-ins.

Worker processes, as for the compute pipelines: the driver builds about
two pipelines at a time for one process, and a driver that ends a worker
ends no title. Nothing of the title's device is needed: a translated
pipeline gets XCL's root signature, and what else its build reads of the
process is the title's memory windows (given with --windows, no memory
reserved: uma::leave_out, pso::set_title_windows) and the adapter
(XCL_ADAPTER from the title's setting). Each worker gets a file of its
part with the shaders it needs (gfx_records' format) in the temporary
folder, removed after.

The title did not keep the blob of most graphics pipelines: none of under
16 KB of DXIL and none built in under 250 ms (XCL_PSO_DISK_CACHE_MIN_MS),
so most were compiled again in every run. A preparation worker keeps
every blob, on disk only. The blob's file name is made of the
description's state, the DXIL, the adapter and driver and the window
count, no address, so the title's lookup finds the worker's file.

The screen shows "Building graphics pipelines" with its own count, the
5 s line counts graphics pipelines, a failure is logged and skipped and
the title starts regardless. XCL_PREPARE=0 skips it with the rest,
XCL_PREPARE_GRAPHICS=0 skips this pass only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record supported console mesh streams with their fixed-function state and source shader keys. Replay through the existing graphics worker and two-pass translator to populate the runtime driver caches. Keep legacy graphics history compatible and leave unsupported streams to the existing runtime path.
Resolve shader and fixed-state selectors using a local layout profile. Publish a deduplicated native preparation job only after its recipes and shader references have been validated.
Share native replay between an offline CLI and the launch gate. Count successful recipes, propagate driver failures and cancellation, and scope recorded history to each title. Draw progress in the presentation window while workers prepare graphics, mesh and compute pipelines.
Avoid decoding the entire graphics job in both the launcher and worker. Validate the independent worker completion count and reject incompatible corpus configurations. Preserve cache reuse for inert mesh shader slots and cover the headless launch gate.
Match shader bytes and full graphics descriptors against the mandatory staged job. Keep distinct fixed-state variants and resolve their shader inputs from the staged corpus. A 48-recipe overlap fixture removed 48 redundant native submissions before the staged pass.
Limit record slicing to offline workers. An inherited slice from an earlier CLI run must not make the launch gate overlook an unstaged shader.
Use the intact prefix of optional history and defer records whose sources are still missing. Published worker jobs retain strict checks. Adapt the history reader regression contributed by thehollowedone.
Bind startup proofs to the driver, translation and pipeline ABI. Reuse only matching DXIL and validated native files, including both mesh passes. Restore the opt-outs for optional history and unstaged startup preparation while requiring published jobs to finish.
Exclude worker scheduling and observation settings from the preparation identity. Normalize Windows environment variable names, and report how many staged graphics recipes reused their existing native verification.
@bmjask
bmjask force-pushed the shaders/parallel-pso-preparation branch from e2b2eaf to b64e486 Compare November 27, 2026 15:36
@bmjask
bmjask changed the base branch from nvidia-dev to main November 27, 2026 15:36
@upipibi

upipibi commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Checked at b64e4862 by reading: graphics_in_workers (shaders.rs:2260) now uses read_history_payloads. That reader stops at a cut-short final entry and skips tags it doesn't recognize (7659b88d, gfx_records.rs), instead of failing. That covers both cases from my earlier note: a run that ended mid-append, and an entry from another build version. The new history_reader_keeps_verified_entries_after_an_incomplete_final_append test pins the first case. Nothing more from me on that point.

@cindertheblue

Copy link
Copy Markdown
Contributor

Smoke pair for Regression run, head b64e4862 and main 6089122a, the same title, 60 s each: no device removals or crashes, 94 % of main's frames (1,267 vs 1,353), 103 % of its peak commit (14,585 vs 14,188 MB). With both blocks pasted under Regression run, main's scripts/pr_check.py reports description ok for this head and the current description.

main 6089122a:

xcl-smoke v1
commit: 6089122a1c96dff16e93b6fdf04c8ed20cfb6102
gpu: AMD Radeon RX 7600 XT
title: e7eb0b27
seconds: 60
exit: 0x0
frames shown: 1353 (PresentX 1353)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14188 MB

This PR's head b64e4862:

xcl-smoke v1
commit: b64e48627fce09d2983a1cf420400f244738aebb
gpu: AMD Radeon RX 7600 XT
title: e7eb0b27
seconds: 60
exit: 0x0
frames shown: 1267 (PresentX 1268)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14585 MB

Tested

  • AMD Radeon RX 7600 XT 16 GB (RDNA3), driver 32.0.31041.1004, Ryzen 5 9600X, 15.1 GB RAM, Windows 11 Home 26200.9974, rustc 1.99.1, release builds (cargo build --release -p xcl) of both commits from clean worktrees.
  • Each run used its own tree's scripts\smoke.ps1 -Seconds 60 -StartupTimeoutSeconds 1800, with XCL_ADAPTER=7600 and XCL_PREPARE=0. main's log has Shader preparation left out (XCL_PREPARE=0); on this head preparation.rs:46 returns before preparing without logging that line, and the log has no preparation output.
  • Each run had an empty DXIL cache and data root of its own, and a renamed copy of its xcl.exe, so AMD's per-app driver cache was cold for both.

Not tested

  • The code this PR adds: with XCL_PREPARE=0 the offline recipes and the preparation before launch did not run. A run with preparation on this title takes many hours on this GPU.
  • Longer play, the test suite on this head.

AI use

  • Claude Code (Claude Opus 5.5) built both commits, ran the pair on this machine and wrote this comment from the two runs' output.

@Euryztheus

Copy link
Copy Markdown

RDNA3 validation — compute and graphics AOT persistence

Tested PR head b64e48627fce09d2983a1cf420400f244738aebb in an isolated checkout with local test-only additions.

Hardware / environment

  • RX 7900 XTX 24 GB (RDNA3)

  • Driver: 32.0.32029.2010

  • Ryzen 9 7950X3D, 64 GB DDR5

  • Windows 11 build 26200

  • Rust 1.100.0, DXC 1.7.2308.16

  • Four UMA windows, one worker

  • XCL_SPLIT_WAVE64 unset

Compute corpus

The actual --prepare-corpus path successfully prepared a synthetic console compute shader.

  • Cold preparation: 448 ms, one 954-byte native blob and receipt generated.

  • Fresh-process replay with receipt bypassed: 1 blob reused, 0 refused.

  • Returned blob was byte-identical.

  • Same-length corrupt control was rejected.

Graphics and two-pass mesh corpus

The real graphics corpus worker was exercised through a test-only entry point with the existing forced-retention hook.

Test Result Time
Cold preparation 3 native blobs stored 0.34 s
Fresh-process preparation 3 hits, 0 rejected 0.18 s
Restored-pipeline rendering Classic and mesh: 64/64 expected red pixels 0.42 s
Corrupt mesh-compute blob 2 hits, 1 rejected, 1 rebuilt 0.51 s
Restart after recovery 3 hits, correct rendering 0.41 s

The mesh negative control without its compute pass remained clear in all 64 pixels. All final targeted tests passed without skips.

Potential mesh receipt issue

A subsequent warm worker run skipped the classic recipe through its receipt but loaded both mesh blobs again.

warm_replay::Index::add expects mesh filenames beginning with tp-ms- and tp-cs-, whereas the generated files in this fixture use gfx- and compute-cache filenames.

Persistent blob reuse works, but mesh receipt-based deferral did not occur. Is this expected for this synthetic translation path, or is there a receipt identity mismatch?

Limitations

  • Synthetic workloads only; no retail workload or full workspace regression suite.

  • Graphics persistence required test-only forced retention because the fixtures fell below the production 250 ms and 16 KiB thresholds.

  • Production retention policies remain unchanged; real.rs is byte-for-byte identical to the PR head.

  • The staged pixel shader is generated PC DXIL; VS/MS are synthetic console shaders.

  • No driver-internal compiler counts were measured.

I have local test additions and reproduction logs available if useful. Happy to continue RDNA3 testing or assist with validating eventual amd-dev integration.

AI use: OpenCode with GPT-6.1 Terra implemented the test-only additions and executed the tests. ChatGPT (GPT-6.2) assisted with reviewing the reported results and drafting this comment.

@Prime1997
Prime1997 merged commit b64e486 into xcl-dev:main Nov 28, 2026
0 of 4 checks passed
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.