Repository navigation
Conversation
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.
|
Regression run of Setup: RTX 3060 12 GB (NVIDIA 581.80), i9-14900KF, Windows 11 26200, release builds of main
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 Update: this head is 36,287 added lines in 98 files against Update 2: with 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. |
|
Source review of
The preparation went on and the title started (RTX 5090, two runs). With this head, would those 3 now be found through the new 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 |
|
Source review of
If a run ends mid-append, the Reading the history file with AI-assisted (Claude Code, Claude Opus 5.5): traced in the source at this head. |
|
Independent Windows / RTX 3090 verification of exact PR #2829 head System
Tested
Retail smoke check (no
Not tested
AI use
|
|
Follow-up to the truncated-history review, tested on exact head I reproduced the launch gate with the repository's synthetic test title and a title-scoped 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 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): 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 1eb656bdiff --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. |
Stacked on #2828 against
nvidia-dev. Related to #2088.What and why
Known pipeline recipes can be prepared before guest entry. The offline command and the game window use the same staged corpus and validate native completion before reporting success.
What is in it
xcl shaders <folder> --prepare-corpus --threads 8for offline graphics, two-pass mesh and compute preparation. Select up to 32 workers.Tested
python -B -m unittest discover -s scripts/pso_corpus -vpassed 15 tests, with zero failures or skips.cargo build --workspace --lockedpassed on Windows x64. On head1eb656b4,cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --show-outputreported 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
Paired title smoke runs are pending. This work has been exercised offline.
Not tested
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.