Repository navigation
Shaders: a Series S cache starts from the manifests both profiles shared - #3120
Raul-Paiva wants to merge 1 commit into
Conversation
12b7edb to
2ed71d6
Compare
|
Tested At Both processes exited 0. Total: 2 passed, 0 failed, 0 ignored, 0 skipped. The fixture seeded all three missing Series S manifests byte for byte from the shared files. An empty Series S graphics manifest reseeded with its original NUL and high bytes. Series X resolved the shared filenames. Later writes to either profile preserved all three files for the other profile. The stock shader-text test passed separately. Not tested Graphics record decoding, runtime profile selection or wiring, real shader caches, title launch, GPU, concurrency, performance, and the workspace suite. AI use T3 Code through Codex ( |
|
At I exercised the exact path selection, graphics writer and record reader on isolated Windows files, with one valid shared shader record. A missing or zero-byte Series S file each yielded one migrated record. A header-only file created by the writer yielded zero. A Series S file with its own valid record preserved that record without importing the shared one. Could the binary path recognize an exact current-format header with no payload as empty, while preserving populated profile files? The text-manifest paths can keep their existing test. This was CPU/disk verification with synthetic records; I did not measure title preparation time. AI use: OpenAI Codex extracted and ran the production helpers, checked the results and prepared this report. |
|
I tested a small fix for the zero-record graphics manifest reported above. A Series S file that consists of exactly the current graphics-record header now seeds from the shared file. The same check prevents copying a header-only shared file back on each lookup. Only a 12-byte graphics file gets opened for the additional check. The header comes from the production writer. On Windows, using the production manifest selector, writer and reader in a standalone Rust test, the previous head and candidate gave these results with one valid shared shader record:
Two additional candidate assertions passed: an empty shared header left a missing profile file absent, and a 12-byte profile file with different bytes stayed intact. This exercised serial disk migration with synthetic records. Concurrent writers, title startup, preparation time and the workspace suite remain untested. Patch and regression test, apply-checked against 2ed71d6--- a/crates/xcl/src/hle/d3d12x/pso_async.rs
+++ b/crates/xcl/src/hle/d3d12x/pso_async.rs
@@ -916,9 +916,15 @@
/// starts as a copy of a shared one that has entries; from then on each profile keeps its own.
fn seeded_used_path(dir: &std::path::Path, stem: &str, ext: &str, series_s: bool) -> std::path::PathBuf {
let path = dir.join(used_file_name(stem, ext, series_s));
- if series_s && std::fs::metadata(&path).map_or(true, |m| m.len() == 0) {
+ let populated = |p: &std::path::Path| {
+ std::fs::metadata(p).is_ok_and(|m| {
+ m.len() != 0 && !(stem == "used-graphics-pipelines" && ext == "bin"
+ && super::gfx_records::header_only(p, m.len()))
+ })
+ };
+ if series_s && !populated(&path) {
let shared = dir.join(used_file_name(stem, ext, false));
- if std::fs::metadata(&shared).is_ok_and(|m| m.len() > 0) && std::fs::copy(&shared, &path).is_ok() {
+ if populated(&shared) && std::fs::copy(&shared, &path).is_ok() {
crate::xlog_info!("D3D12.X: {} starts as a copy of {}, which both profiles shared before", path.display(), shared.display());
}
}
@@ -2463,6 +2469,40 @@
assert!(!profile_is_series_s_from(None, None));
}
+ #[test]
+ fn a_header_only_series_s_graphics_manifest_can_still_be_seeded() {
+ use super::super::gfx_records::{read, shader_entry, Added, Writer};
+ let dir = std::env::temp_dir().join(format!("xcl-gfx-seed-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let stem = "used-graphics-pipelines";
+ let local = dir.join(used_file_name(stem, "bin", true));
+ let shared = dir.join(used_file_name(stem, "bin", false));
+ let old = shader_entry(1, &[11, 22]);
+ let own = shader_entry(2, &[33]);
+ let seed = || seeded_used_path(&dir, stem, "bin", true);
+ let add = |p: &std::path::Path, cap, item: &[u8]| Writer::open(p, cap).unwrap().add(item).unwrap();
+
+ assert_eq!(add(&shared, 0, &old), Added::Full);
+ seed();
+ assert!(!local.exists());
+ assert_eq!(add(&shared, 1024, &old), Added::New);
+ assert_eq!(read(&seed()), vec![old.clone()]);
+ std::fs::write(&local, []).unwrap();
+ assert_eq!(read(&seed()), vec![old.clone()]);
+ std::fs::remove_file(&local).unwrap();
+ assert_eq!(add(&local, 0, &own), Added::Full);
+ assert_eq!(read(&seed()), vec![old]);
+ std::fs::remove_file(&local).unwrap();
+ assert_eq!(add(&local, 1024, &own), Added::New);
+ assert_eq!(read(&seed()), vec![own]);
+ std::fs::write(&local, [0xaa; 12]).unwrap();
+ seed();
+ assert_eq!(std::fs::read(&local).unwrap(), [0xaa; 12]);
+ std::fs::remove_file(local).unwrap();
+ std::fs::remove_file(shared).unwrap();
+ std::fs::remove_dir(dir).unwrap();
+ }
+
/// A Series S cache from before the profiles had files of their own: its `-lockhart` file
/// starts as a copy of the shared one when it is missing or empty, never when it has entries
/// of its own; Series X reads the shared file, and nothing is copied when that is empty.
--- a/crates/xcl/src/hle/d3d12x/gfx_records.rs
+++ b/crates/xcl/src/hle/d3d12x/gfx_records.rs
@@ -306,6 +306,18 @@
h[..8].copy_from_slice(MAGIC);
h[8..].copy_from_slice(&VERSION.to_le_bytes());
h
+}
+
+/// A writer may leave just the current header when its first record exceeds the cap.
+pub(super) fn header_only(path: &Path, len: u64) -> bool {
+ use std::io::Read;
+ if len != HEADER as u64 { return false; }
+ let mut bytes = [0; HEADER + 1];
+ std::fs::File::open(path).is_ok_and(|mut file| {
+ file.read_exact(&mut bytes[..HEADER]).is_ok()
+ && bytes[..HEADER] == header()
+ && matches!(file.read(&mut bytes[HEADER..]), Ok(0))
+ })
}
fn check(payload: &[u8]) -> u32 {AI assistance: OpenAI Codex (GPT-6) prepared and tested the candidate and drafted this follow-up. |
2ed71d6 to
0a7b3a0
Compare
|
Thanks @andrewDoing, confirmed: The fix and a regression test are folded into the PR's single commit; the PR is rebased onto The full suite against Written with Claude Code (Claude Opus 5.5). |
0a7b3a0 to
33866d5
Compare
33866d5 to
ad3c470
Compare
|
No open or merged PR makes the same change (a follow-up to #2860). No problems found in the diff. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Review (head ad3c470, diff read, not a merge-check;
Fine: this can't produce wrong pipelines. Translation doesn't depend on the profile (nothing under AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
ad3c470 to
e5fac00
Compare
Since xcl-dev#2860, Series S (`lockhart`) reads and writes its own used-shaders-lockhart.txt and used-pipelines-lockhart.txt instead of the shared files. A Series S cache from before xcl-dev#2860 only has the shared files, so after updating, shader preparation goes from the shaders earlier runs used (2,616 on a retail title) to every record (26,503, about 1.5 h on an i7-11800H). xcl-dev#2860's review noted this cold first launch; nothing handled it. A missing or empty Series S usage manifest now starts as a copy of a non-empty shared one last written before xcl-dev#2860 was merged (2026-11-28 00:36:19 UTC, `PROFILES_SPLIT_AT`): only such a file has Series S's entries. One written since may hold Series X's alone, and is not copied, so xcl-dev#2860's separation holds (`seeded_used_path`, `shared_before_split`). From then on each profile keeps its own. The readers (`earlier_used_shaders`, `earlier_used_keys`) and the run's writers go through `used_path`. `used_shaders_name` had no other caller and is removed. README mentions the copy. The graphics history (used-graphics-pipelines*.bin) is not seeded: the shared DXIL cache's file holds other titles' records, and gfx_records.rs is part of the native pipelines' identity (build.rs), so changing it would make every user prepare them again once. Review: andrewDoing (an empty or header-only Series S file); Foniass (seed only files from before the split, no graphics seeding from the shared cache, gfx_records.rs in the pipeline identity). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
e5fac00 to
3432ff9
Compare
|
Thanks for the review. Head is now 3432ff9 (rebased onto
On the per-call stat: it is a Tested on an RTX 3070 Laptop (driver 621.40): Claude Code (Claude Opus 5.5) helped with the fixes and this reply; I checked each point. |
|
Follow-up review (head 3432ff9, since ad3c470, diff read, not a merge-check):
New:
Fine: the cutoff matches #2860's merge time; the own file is checked and seeded before the run's writer opens it ( AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
Follow-up to #2860.
Since #2860, Series S (
lockhart) keeps its ownused-shaders-lockhart.txtandused-pipelines-lockhart.txt. A Series S cache from before #2860 only has the shared files, so after updating, shader preparation goes from the shaders earlier runs used (2,616 on a retail title) to every record (26,503, about 1.5 h on an i7-11800H). #2860's review noted Series S users get one unfiltered, cold first launch after updating; nothing handled it.A missing or empty Series S usage manifest now starts as a copy of a non-empty shared one last written before #2860 was merged (2026-11-28 00:36:19 UTC): only such a file has Series S's entries. One written since may hold Series X's alone and is not copied, so #2860's separation holds. From then on each profile keeps its own file. Series X is unchanged. The graphics history (
used-graphics-pipelines*.bin) is not seeded.Changed after Foniass's review of 12-01: the copy is limited to shared files from before the split, and the graphics-history seeding is gone (the shared DXIL cache's file holds other titles' records, and
gfx_records.rsis part of the native pipelines' identity, so changing it made every user prepare them again).gfx_records.rsis now as onmain.What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:used_path/seeded_used_path, used byearlier_used_shaders,earlier_used_keysand the run's writers;PROFILES_SPLIT_ATandshared_before_split(only a shared file last written before Shaders: separate Series S and Series X used manifests #2860 is copied);used_shaders_name(no other caller) removed; unit testsa_series_s_manifest_starts_from_the_shared_oneandonly_a_shared_manifest_from_before_the_split_is_series_s_too.README.md: one clause saying a missing or empty Series S usage manifest starts once as a copy of the shared one when that was last written before the split.Tested
mainb2b1f10 without conflicts;main's newer commits also changeREADME.md,pso_async.rs, which the rebase merged. The full-suite counts below were measured before those fixes and that rebase.mainb2b1f10), the lib tests ofhle::d3d12x::pso_asyncandhle::d3d12x::gfx_records, release, serial, with the 20 skips: 208 passed, 0 failed, 0 ignored, the new test among them.main53e85fb, this PR's base before that rebase (same commands, same machine).cargo test --release --workspace --no-fail-fast -- --test-threads=4: the lib test binary ends early onmaintoo (exit 0x80004005 aftersparse upload preparation still failed after bounded retries), so the lib was also run alone, serially (--test-threads=1), with--skipfor the 20 tests that end the binary onmain(6list_x, 12sparse, 1texture_upload, 1uma_driver; each passes alone).main: the same.main53e85fb: 2617 passed, 16 failed, 29 ignored, withvram::tests::d32s8_targets_take_their_own_size_of_video_memoryalso skipped because it ended the binary there (about 1 GB of depth targets; it fails or ends the binary late in the long run, and passes alone).main: 12title_textures,list_x::a_reset_while_the_last_submit_runs_records_on_another_pc_list,standin::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, andd32s8_targets_take_their_own_size_of_video_memoryabove. Two that failed onmainpassed here (alloc_pool::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_reads,vram::superseded_texture_waits_for_every_title_queue); both are intermittent in the long run.used_manifests_separate_series_s_from_series_x,a_series_s_manifest_starts_from_the_shared_oneanda_header_only_series_s_graphics_manifest_is_seeded(removed since, with the graphics seeding).main): the wave64 forms (no wave64), three f16/f32 per-lane forms refused by the recompiler, and the heap-window tests (no heap windows).Regression run
scripts/smoke.ps1 -Seconds 120 -Title 'retail title A', release builds of clean trees, one after the other on the machine in Tested, withXCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000. The title is left on its own, with no input; the shader cache was warmed by two runs ofmainbefore.main:This PR:
Not tested
AI use
🤖 Generated with Claude Code