Repository navigation
Conversation
Translates a title's compute programs from its shader package and has the driver compile their pipelines ahead of the run, writing the same driver blobs (same DXIL, root signature, flags) the runtime looks up. Pipelines an earlier run used go first, each group biggest first, on one driver compile a core (bounded by memory, --threads N). --records FILE / --used restrict it to given record hashes / pipeline keys; cached pipelines only load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent check of 27362a0 on an RTX 3080 Ti (621.35), Windows 11 build 26300, Rust 1.99.1 MSVC debug. I generated a two-record synthetic shader package and ran
AI-assisted. Codex (GPT-6 family, exact variant unavailable) generated the synthetic fixture, ran the checks, and drafted this report. Runtime cache check On the same revision and hardware, I also passed a synthetic compute shader through the runtime's public The scratch test AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote and ran the scratch test and drafted this update. Selection coverage check Following Kalmarv’s report, I tested a synthetic pack with three requested keys. Two keys referred to the same compute shader, and one key had no match. The current PR head built one pipeline and exited successfully without reporting the unmatched key. A local test build counted 2 of 3 keys matched for Same Windows 11 and RTX 3080 Ti setup. AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote the local change, ran the tests, and drafted this update. |
|
RTX 3090 full-suite check and a small Tested
The three 303-file source snapshots matched their SHA-256 manifests before and after native Windows runs. This PR head is still behind current Two-file patch (28 insertions, one deletion)diff --git a/crates/xcl/src/shaders.rs b/crates/xcl/src/shaders.rs
index 4c308f3..c95bea6 100644
--- a/crates/xcl/src/shaders.rs
+++ b/crates/xcl/src/shaders.rs
@@ -913,6 +913,13 @@ pub fn run(path: &Path, args: &[String]) -> i32 {
);
}
if args.iter().any(|a| a == "--precompile") {
+ let record_file = match required("--records") {
+ Ok(f) => f,
+ Err(e) => {
+ eprintln!("{e}");
+ return 2;
+ }
+ };
let only = args.iter().position(|a| a == "--only").and_then(|i| args.get(i + 1)).map(|s| s.to_ascii_lowercase());
let pipelines = args.iter().any(|a| a == "--pipelines");
if let Some(n) = opt("--threads") {
@@ -923,7 +930,7 @@ pub fn run(path: &Path, args: &[String]) -> i32 {
// `--records FILE` (record hashes or pipeline keys, a hexadecimal one a line) and / or
// `--used` (the pipelines an earlier run used): only those programs
let mut select: Option<std::collections::HashSet<u64>> = None;
- if let Some(f) = args.iter().position(|a| a == "--records").and_then(|i| args.get(i + 1)) {
+ if let Some(f) = record_file {
match std::fs::read_to_string(f) {
Ok(t) => select.get_or_insert_with(Default::default).extend(parse_used(&t)),
Err(e) => {
diff --git a/crates/xcl/tests/shaders_e2e.rs b/crates/xcl/tests/shaders_e2e.rs
index caac3a0..be77532 100644
--- a/crates/xcl/tests/shaders_e2e.rs
+++ b/crates/xcl/tests/shaders_e2e.rs
@@ -154,6 +154,26 @@ fn run_shaders(target: &Path, extra: &[&str]) -> Output {
.expect("spawn xcl shaders")
}
+#[test]
+fn pso_precompile_rejects_records_without_a_file() {
+ let dir = TempDir::new("pso-records-operand");
+ let pack = dir.path().join("shaders.rpf");
+ let mut bytes = b"9FPR".to_vec();
+ bytes.resize(0x40, 0);
+ std::fs::write(&pack, bytes).unwrap();
+
+ for tail in [&["--records"][..], &["--records", "--used"][..]] {
+ let out = Command::new(env!("CARGO_BIN_EXE_xcl"))
+ .arg("pso-precompile")
+ .arg(&pack)
+ .args(tail)
+ .output()
+ .expect("spawn xcl pso-precompile");
+ assert_eq!(out.status.code(), Some(2), "{out:?}");
+ assert!(String::from_utf8_lossy(&out.stderr).contains("--records needs a value"), "{out:?}");
+ }
+}
+
#[test]
fn shaders_single_file_reports_text_top_json_recomp_and_dxc_compile() {
let dir = TempDir::new("single");Not tested: retail smoke, whole-pack precompile time or memory, runtime cache reuse, and gameplay. This is a bounded CLI regression, not merge readiness. AI use: Codex desktop (GPT-6) wrote the test and local patch, ran the Windows checks and drafted this report; results are from retained raw logs. |
|
Tested on Proton Experimental with the HLSL backend. The title reused the offline blobs when paired with #1368. Both runs reached illustrated loading and showed black at 105 and 240 s. I applied the three-file diff from this PR at
One playback per configuration. This measures blob acceptance and the observed screen; full-pack preparation, linked adapters, and native Windows were outside this test. Investigation, log analysis and report assisted by OpenAI Codex (GPT-6.2 Astra). |
|
A test note from a run on an RTX 5070 Ti (NVIDIA), of our own precompile pass (the same approach, not this PR's code). It concerns which programs a In a 300 s title run after a pass over 1,957 compute programs, 60 compute programs the title created had no translation and no driver blob:
A suggestion: also take the DXBC containers of the title's DLLs (or of Tested: RTX 5070 Ti, Windows 11 26200, DXC 1.7.2308 (Windows Kits), AI use: Claude Code (Claude Opus 5.5) ran the pass and the title run on our machine and wrote this. |
|
The selective precompile worked across separate Proton processes on an RTX 5060 Laptop GPU (8 GiB), NVIDIA 615.78.08, Bazzite 44 and Proton Experimental 11.0-20261112. I used the record selector from this PR ported to main The seven selected compute pipelines took 120.4 s in the cold driver stage. The warm stage took 0.3 s, with seven cache hits and zero refusals. All seven blobs contained both inline SPIR-V and Vulkan cache data (18,011,104 bytes total). This exercised the underlying record selector on seven private inputs. Six were also found in the shader archive. A separate offline title run using the same app-cache mode and the saved blobs on a composite XCL build reached six of those records before the host froze. Their six logged driver calls completed in 1–120 ms. That title run ended with a manual power cycle during loading. Gameplay and the cause of the freeze remain unverified. Only the offline cold/warm timings above are a matched comparison. OpenAI Codex assisted with these tests and the report. |
…-dev#1871) Translates a title's compute programs from its shader package and has the driver compile their pipelines ahead of the run, writing the same driver blobs (same DXIL, root signature, flags) the runtime looks up. Pipelines an earlier run used go first, each group biggest first, on one driver compile a core (bounded by memory, --threads N). --records FILE / --used restrict it to given record hashes / pipeline keys; cached pipelines only load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ripts - docs/linux.md: documents native Linux MSVC cross-compilation via cargo-xwin (including the CFLAGS=-FIstring.h workaround for libudis86-sys under clang-cl), MinGW fallback, Proton/vkd3d-proton environment variables, tuning switches (XCL_PSO_WAIT_MS, XCL_PSO_FRAME_WAIT_MS, XCL_COHERENT_HEAPS/MB, XCL_DRED), offline compute PSO precompilation, and amdgpu troubleshooting. - scripts/linux/build-xwin.sh: portable cargo-xwin workspace build & optional --deploy script targeting x86_64-pc-windows-msvc. - scripts/linux/precompile-pso.sh: portable Proton/Wine wrapper for xcl.exe pso-precompile (xcl-dev#1871). Assisted-by: Antigravity (Gemini 4)
) Brings main to full parity with upstream/main (de36462): - xcl-dev#1969: official upstream merge of 64-bit icmp 32-bit lowering and MIMG heap guards - xcl-dev#1774: size-based commit headroom admission for big driver compiles and XCL_PIPELINE_MAX_KB cap for offline --pipelines precompile Conflicts resolved by keeping HEAD's already-merged xcl-dev#1969 emit.rs (with heap_index), combining xcl-dev#1996 + xcl-dev#1774 comments in real.rs, and combining xcl-dev#1871 + xcl-dev#1774 in shaders.rs. Assisted-by: Antigravity (Gemini 4)
|
Verification on RTX 3060 Ti (Windows 11): merge conflict with current |
PR #1871 compatibility verificationTested detached head Environment Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175, wave range 8–32, Tested
Failures and skips
Not tested Retail AI use T3 Code / Codex ( |
A retail title's world load creates hundreds of compute pipelines, several of them 0.3 – 1.6 MB of DXIL that take NVIDIA's compiler 15 – 170 s each. Compiled cold during the run, the title's binds wait for them or run without them, and its loading never finishes.
xcl pso-precompilebuilds them before the run. It translates the title's compute programs from its shader package and has the driver compile each pipeline the way the runtime does (same DXIL, XCL ABI root signature with the program's static samplers, flags). It writes the blob to thedriver_cachefile the runtime reads, so the run loads it instead of compiling.What is in it
xcl pso-precompile <game folder | shaders.rpf> [--threads N] [--records FILE] [--used]:shaders --precompile --pipelinesof the folder'sshaders.rpf.used-pipelines.txt) go first, and within each group the biggest go first, so the longest compiles don't start last.--threads,XCL_PIPELINE_THREADS, or one per core but at most one per 2 GB of RAM (was 4).--records FILE(record hashes as the runtime's "driver compile start … record H" lines name them, or pipeline keys) and--usedrestrict the pass to those programs. A whole retail pack is 26,503 records. The set the load needs is a few hundred.XCL_DIRECT_DXIL/XCL_HEAP_WINDOWSchange the translation keys, so the warm-up must run with the same values as the game.used-pipelines.txtparsing, shader package lookup, record / key selection.Numbers (RTX 4090, 24 driver compiles at once,
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1)--threadsis probably better and is not measured yet.Tested
cargo test --release -p xcl --lib pipeline_tests: 5 passed.Regression run
XCL_PRESS_AT=2:B,4:B,6:B,8:B,XCL_PRESS_A_AT=10,20,…,60main:
PR:
Not tested
cargo test --workspacesuite. Whole-pack warm-up time (26,503 records). AMD / Intel GPUs. The HLSL path's warm-up for the full load set (its translations are far slower).AI use
🤖 Generated with Claude Code