Skip to content

Shaders: xcl pipelines compiles a run's queued pipelines outside the title - #759

Draft
oishigeso wants to merge 15 commits into
xcl-dev:mainfrom
oishigeso:pipelines-3-tool
Draft

oishigeso wants to merge 15 commits into
xcl-dev:mainfrom
oishigeso:pipelines-3-tool

Conversation

@oishigeso

@oishigeso oishigeso commented Nov 24, 2026 •

Copy link
Copy Markdown

Part 3 of 3 for #755. Stacked on #758; its own commits are the eight after #758's head.

xcl pipelines <game | data folder | pipelines.bin> [--watch] reads the journal from part 2 and
makes each pipeline on its own D3D12 device, the way the title would: prep_graphics for VS /
PS, and for compute the same path with XCL's ABI root signature. It uses the GPU the title's
xcl.toml names. Afterwards the DXIL cache, the driver's cache and driver_cache (#634) hold
what the title asks for. Run it before the next run, or next to the running title with
--watch, which follows the journal and takes the used pipelines first.

Translation and DXC run on half the cores at below-normal priority; the driver's compiles run a
few at a time (XCL_PIPELINE_THREADS). Progress is kept in pipelines.done for this binary,
and failures are retried by the next run. It must be the same xcl.exe as the title's. GS / HS /
DS and mesh pipelines are left to the title.

Unlike #690, which builds the pipelines an earlier run used, inside the title, this one covers
every queued pipeline, and none of the work happens in the title's process.

Two small changes it needs:

  • pso::set_mem_windows: the run's memory windows come from the journal, because
    prep_graphics translates through console_to_dxil_for like the title does.
  • shader::readable no longer creates the UMA (uma::existing). Without this, the tool reserved
    12 GiB of windows and a 512 MB coherent window just for a pointer check.

704 lines: the command (pipelines.rs) is 581 of them, with its tests, and it does nothing on its
own if split.

What is in it

  • the command (crates/xcl/src/pipelines.rs, crates/xcl/src/main.rs, crates/xcl/src/lib.rs,
    README), with its tests; a console control handler removes .trying on Ctrl+C, so what was
    cut short is made again by the next run (a crash still leaves it to the title)
  • warm (crates/xcl/src/hle/d3d12x/real.rs): one journal entry made on a plain device, with
    the switch-form fallback of Recompiler: memory windows from the descriptor heap (no per-access switch) #680
  • pso::set_mem_windows (crates/xcl/src/gpu/recomp/pso.rs), uma::existing
    (crates/xcl/src/gpu/uma.rs, used by crates/xcl/src/gpu/shader.rs),
    launcher::resolve_location made pub(crate) (crates/xcl/src/launcher.rs)

Tested

  • AMD Radeon RX 6700 XT (driver 32.0.21030.2001), Ryzen 5 3600, Windows 10 Pro 19045, rustc 1.100.0, release
  • Rebased onto main 9e3831e: cargo test -p xcl --lib -- pipeline heap_window --test-threads=1: 14 passed, 0 failed (with Recompiler: memory windows from the descriptor heap (no per-access switch) #680's heap-window tests). d9cea04: the tool replays a run's heap-window flag and, like the title, makes a pipeline the driver refuses with heap windows again in the switch form (with_switch_fallback)
  • bbf56a8 (Ctrl+C) and a merge of main c160d86 (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426; the xcl shaders --direct help and this command's both kept in main.rs): the same 14 tests pass
  • dd66d20, D3D12.X: a journal of the pipelines a title queues (<data>\cache\pipelines.bin) #758's c02d059 merged in: cargo test -p xcl --lib -- pipeline heap_window pso_journal --test-threads=1: 16 passed, 0 failed; the run below is on this head
  • Heap windows end to end: a 60 s run with XCL_HEAP_WINDOWS=1 (exit 0x0, 437 frames), then xcl pipelines --limit 100 without it on that journal: 4 memory windows (from the descriptor heap), made 100, failed 0; the run's earlier switch-form frames were left out
  • cargo test --workspace -- --test-threads=4: 659 passed, 3 failed, 21 ignored; the 3 failures (title_textures::placed_title_textures_share_vram_and_preserve_pixels, title_textures::transitions_apply_when_their_list_is_submitted, vram::d32s8_targets_take_their_own_size_of_video_memory) fail on main (f4ce27c) the same way in a full run (657 passed, 3 failed there) and pass alone; no GPU test SKIPPED
  • proof that the title finds what the tool made: two 60 s runs, each with its own empty DXIL
    cache (XCL_DXIL_CACHE). Run A: empty cache – the title compiled 4 programs itself (hits 0,
    misses 4). Then xcl pipelines for 8 min into a second empty cache (50 895 of the journal's
    57 798 pipelines, 17/s at first and ~870/s at the end, as later pipelines share already
    compiled shaders). Run B on that cache alone: hits 4, misses 0, 0 compilations in the title
    (report.json → d3d12.dxil_cache). Both runs on the same build, exit 0x0, no crash

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 373 (PresentX 374)
presents per 2 s (last 3): 0 28 60
device removals: 0
crashes: 0
peak commit: 19259 MB

PR (this PR's head commit; the title is run through a folder named RetailTitle):

xcl-smoke v1
commit: dd66d20995e225a0e5b3853e3578f5bd03e3c2c4
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 585 (PresentX 585)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 18412 MB

Not tested

  • --watch next to a running title
  • a whole journal: 57 807 pipelines take ~3 h at ~5.6/s on half of a Ryzen 5 3600 (the used ones
    come first)
  • NVIDIA (where driver_cache matters most), Intel, RDNA4
  • XCL_DIRECT_DXIL (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426): the tool translates through console_to_dxil_for as the title does,
    so it follows the variable, but the journal does not record it: the tool has to run with the
    title's setting, or it fills the cache of the other backend

AI use

  • Claude Code (Claude Opus 5.5) wrote the code, the tests and this description, and ran the tests and runs above on my PC at my direction. An independent Claude Opus 5.5 review of the diff found 2 bugs and 6 risks; all were fixed before this was opened.

@crosettiremi

Copy link
Copy Markdown

Native AMD follow-up on exact clean head 6dd5c1d: offline compilation eliminated all eight in-title DXIL compilations in a paired 60-second menu capture.

RX 7900 XT (20 GiB), Windows 11 build 26100, SDK DXC 1.9.2602.17. Same release executable, fresh copies of the same Series S-profile save/config, networking off and no input in either timed run. The driver-managed Windows cache was shared.

60-second run DXIL hits Misses In-title compilations Presents Device removals
Empty application cache 0 8 8 1,063 0
Cache populated only by the offline sample 8 0 0 1,103 0

The cold run recorded 55,064 graphics and 2,734 compute entries, 5,651 shader records and four used markers. I copied six original pipeline records and their dependencies into a separate sample journal, including all four marked used (three graphics and one compute), plus two more compute pipelines. The same executable ran xcl pipelines on the sample with one worker and one driver compile at a time. First pass: made 6, failed 0, skipped 0. Resume: 6 done before, made 0. A fresh progress file with the same cache: made 6, failed 0. The selection retained the original frame bytes. Both menu runs exited 0 and ended at 60 presents per two-second interval.

The workspace reported 703 passed, 0 failed, 41 ignored. One counted pass printed a runtime skip for the missing xgameruntime.dll debug-layer fixture. This covers journal capture, resume and DXIL reuse at the menu. The six-entry sample did not establish driver-blob reuse or world-loading stability. Codex (GPT-6) ran the tests and prepared this report.

@anes66

anes66 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up patch index (full measurements and limitations remain below):

Change Patch
Validate an existing compute blob before marking it done 1e7047b
Help without a target ffc40b3
Reject invalid option values f5a2e21
Validate the journal header before GPU/progress setup 3a1be15
#1420 integration and nonempty-sampler cache reuse regression 83ac24b

Native NVIDIA follow-up on 6dd5c1d7c36652cfecef6ad517828b443c140715: the clean workspace passed, and a synthetic CLI regression exposed a Windows progress-file reset problem.

The test builds one compute journal from the existing synthetic console CS fixture, runs xcl pipelines with an isolated empty DXIL cache, then resumes it. Those steps succeed: made 1, then made 0 with 1 done before. After changing one bit of the saved binary key to simulate executable replacement, the third run makes the pipeline again but leaves a 32-byte pipelines.done containing the old record followed by the new key/hash. It should replace the original 16-byte record. The test fails on that final assertion before the fix.

Patch: d2a3e01, directly on this PR's head. The file now opens for writing, truncates and rewinds a fresh record, or seeks to the end of valid progress. Initialization errors return 2 instead of being ignored. The new test checks cold compilation, unchanged resume, and exact progress replacement after key invalidation. With the fix, all three CLI passes succeed and the file returns to the original 16 bytes. No change to shader translation or pipeline descriptors.

Tested on Windows 10 Pro 19045, RTX 3060 12 GB, driver 32.0.16.2114, Rust/MSVC 1.100.0, SDK DXC 1.9.2602.17 and Agility 1.620.2:

cargo build --locked --workspace -j 4
cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output

Build passed. Clean PR head: 703 passed / 0 failed / 41 ignored. Patched tree: 704 passed / 0 failed / 41 ignored. Both runs printed two no wave64 skips: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware. Sample-gated tests had no XCL_SAMPLE_* inputs, so their counted passes do not establish title coverage.

Not tested: retail title smoke, graphics journal replay, --watch alongside a running title, or driver-blob reuse. The tiny compute pipeline may compile below the 250 ms persistence threshold; this is a CLI/progress regression test, not evidence of driver-cache reuse. Runtime code changed, so the patch still needs the project's main/head title smoke before merge.

AI use: Codex (GPT-6; exact variant unavailable) investigated, wrote the patch and synthetic test, ran validation, and prepared this report.

Follow-up: 26d7532 extends the same synthetic test with a complete journal frame containing an incomplete compute payload. Two subsequent CLI processes each report made 0 / failed 1, retry that record, and preserve the exact successful progress bytes. This covers unreadable journal entries staying retryable; it does not simulate a driver compile failure. Test-only follow-up, no additional runtime changes. The full workspace was rerun with the command above: 704 passed / 0 failed / 41 ignored, exit 0, with the same two native-wave64 skips. Tool, model, hardware and coverage limits remain as reported above.

Native NVIDIA follow-up on 34073938054ee91c360fc45a3ee20053ce8eda5d

Thanks for fixing the progress reset and crediting the report. I tested the current head and ported only the synthetic CLI test, with no runtime changes. All inputs are generated from the existing console_cs / program fixture.

Tested: Windows 10 Pro 19045, RTX 3060 12 GB / driver 32.0.16.2114, Ryzen 7 9800X3D, Rust 1.100.0 MSVC, DXC 1.9.2602.17, Agility 1.620.2, debug.

cargo build --locked --workspace -j 4
cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output
cargo test --locked -p xcl --test gpu_compute_e2e pipeline_journal_cli_compiles_and_resumes -- --exact --show-output

The clean-head build passed. Workspace results were inconsistent, so this is not a consistently green suite report:

Tree / run Passed Failed Ignored
Clean head, first run, 4 test threads 707 0 41
Optional test patch, 4 threads, twice 705 3 41
Optional test patch, 1 thread 703 5 41
Clean head again, patch removed, 4 threads 703 4 41

Each run printed the same two native-wave64 skips: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware. Samples were unset; sample-gated counted passes are not title coverage.

The two patched parallel runs failed in placed_title_textures_share_vram_and_preserve_pixels (placement readback mismatch), then transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory (poisoned locks). All three passed separately with cargo test --locked -p xcl --lib <full-name> -- --exact --show-output. The serial run also failed ensure_mapped_with_query_holes_skips_uncommitted_pages_on_readback and gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes. The clean rerun hit the original three plus cpu_writes::tests::writes_land_after_the_queue. These failures were in the unchanged library test binary, before the added integration test ran. The cause of the texture/sparse failures has not been established here.

CLI regression: 1 passed / 0 failed in the focused run, and it passed in all three patched workspace runs. It checks:

  • cold compute compilation, resume, stale-key replacement, and trimming a torn progress record;
  • a Windows sharing violation on pipelines.done returns 2 without altering saved progress or creating .trying;
  • two runs retry an unreadable compute payload and retain the exact successful progress bytes;
  • a clean exit removes .trying.

Not tested: real-title smoke, graphics replay, --watch, a real driver update, driver/DXC crash recovery, Wine/Proton, AMD/Intel, or driver-blob reuse. The sharing check holds the file from the test process; it is not two concurrent CLI warmers. #1335 already covers a separate crash/interrupt follow-up; this patch does not change that logic.

Optional test-only patch against this exact head (git apply --check passed):

Synthetic CLI regression patch (90 added lines)
diff --git a/crates/xcl/tests/gpu_compute_e2e.rs b/crates/xcl/tests/gpu_compute_e2e.rs
index 587c489..9363cdc 100644
--- a/crates/xcl/tests/gpu_compute_e2e.rs
+++ b/crates/xcl/tests/gpu_compute_e2e.rs
@@ -81,6 +81,96 @@ fn console_cs(code: &[u8], rsrc2: u32, threads: [u32; 3]) -> Vec<u8> {
 
 const V: u64 = 256; // VALU source code of v0
 
+#[test]
+fn pipeline_journal_cli_compiles_and_resumes() {
+    let _serial = SERIAL.lock().unwrap_or_else(|e| e.into_inner());
+    if xcl::gpu::recomp::dxc::location().is_err() {
+        runner::skip_test("no DXC");
+        return;
+    }
+    if runner::wave64_programs_supported() != Ok(true) {
+        runner::skip_test("no wave64");
+        return;
+    }
+    let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos();
+    let dir = std::env::temp_dir().join(format!("xcl_pipeline_cli_{}_{stamp}", std::process::id()));
+    std::fs::create_dir_all(&dir).unwrap();
+    let journal = dir.join("pipelines.bin");
+    let cache = dir.join("dxil");
+    let blob = console_cs(&program(), 2 << 1 | 1 << 7 | 1 << 8 | 1 << 11, [16, 8, 1]);
+    let shader_hash = xcl::gpu::shader::fnv64(&blob);
+    // The journal stores the shader hash, desc size, then a pointer-free desc.
+    let mut payload = shader_hash.to_le_bytes().to_vec();
+    let desc_size = std::mem::size_of::<D3D12_COMPUTE_PIPELINE_STATE_DESC>();
+    le(&mut payload, desc_size as u32);
+    payload.resize(payload.len() + desc_size, 0);
+    let hash = xcl::gpu::shader::fnv64(&[payload.as_slice(), &[4]].concat());
+    let mut bytes = xcl::hle::d3d12x::pso_journal::MAGIC.to_vec();
+    for (tag, windows, hash, data) in [(b'S', 0, shader_hash, blob.as_slice()), (b'C', 4, hash, payload.as_slice()), (b'U', 0, hash, &[][..])] {
+        bytes.extend_from_slice(&[tag, windows, 0, 0]);
+        le(&mut bytes, data.len() as u32);
+        bytes.extend_from_slice(&hash.to_le_bytes());
+        bytes.extend_from_slice(data);
+    }
+    std::fs::write(&journal, bytes).unwrap();
+    let command = || {
+        let mut cmd = std::process::Command::new(env!("CARGO_BIN_EXE_xcl"));
+        cmd.arg("pipelines").arg(&journal).args(["--threads", "1"])
+            .env("XCL_DXIL_CACHE", &cache).env("XCL_PIPELINE_THREADS", "1");
+        cmd
+    };
+    let run = |expected: &str, failed: usize| {
+        let out = command().output().unwrap();
+        let log = format!("{}\n{}", String::from_utf8_lossy(&out.stdout), String::from_utf8_lossy(&out.stderr));
+        println!("{log}");
+        assert!(out.status.success(), "{log}");
+        assert!(log.contains(expected), "{log}");
+        assert!(log.contains(&format!("failed {failed},")), "{log}");
+        assert!(!journal.with_extension("trying").exists(), "a clean exit must remove in-flight state");
+        log
+    };
+    assert!(!cache.exists(), "first run must start without an application cache");
+    run("made 1,", 0);
+    let done = journal.with_extension("done");
+    let progress = std::fs::read(&done).unwrap();
+    assert_eq!(progress.len(), 16, "binary key and one completed pipeline");
+    assert_eq!(&progress[8..], &hash.to_le_bytes());
+    // The second process must refuse a progress file held by another writer.
+    use std::os::windows::fs::OpenOptionsExt;
+    let held = std::fs::OpenOptions::new().read(true).write(true).share_mode(1).open(&done).unwrap();
+    let refused = command().output().unwrap();
+    assert_eq!(refused.status.code(), Some(2), "{refused:?}");
+    assert!(String::from_utf8_lossy(&refused.stderr).contains("pipelines.done"), "{refused:?}");
+    assert_eq!(std::fs::read(&done).unwrap(), progress);
+    assert!(!journal.with_extension("trying").exists());
+    drop(held);
+    // A torn final progress record must not offset the next completed hash.
+    std::fs::write(&done, [progress.as_slice(), &[0xaa, 0xbb, 0xcc]].concat()).unwrap();
+    let resumed = run("made 0,", 0);
+    assert!(resumed.contains("1 done before"), "{resumed}");
+    assert_eq!(std::fs::read(&done).unwrap(), progress);
+    // A different binary key invalidates progress, even with a populated DXIL cache.
+    let mut stale = progress.clone();
+    stale[0] ^= 1;
+    std::fs::write(&done, stale).unwrap();
+    run("made 1,", 0);
+    assert_eq!(std::fs::read(&done).unwrap(), progress);
+    // An incomplete compute payload cannot be replayed and must remain retryable.
+    let mut broken = vec![b'C', 4, 0, 0];
+    le(&mut broken, 8);
+    broken.extend_from_slice(&(hash ^ 1).to_le_bytes());
+    broken.extend_from_slice(&shader_hash.to_le_bytes());
+    use std::io::Write;
+    std::fs::OpenOptions::new().append(true).open(&journal).unwrap().write_all(&broken).unwrap();
+    for _ in 0..2 {
+        let retried = run("made 0,", 1);
+        assert!(retried.contains("1 pipelines to make"), "{retried}");
+        assert!(retried.contains("not readable from the journal"), "{retried}");
+        assert_eq!(std::fs::read(&done).unwrap(), progress, "a failure must not enter completed progress");
+    }
+    std::fs::remove_dir_all(&dir).unwrap();
+}
+
 /// 16×8 threads per group (two wave64s), s[0:1] = output base and row width, TGID_X/Y in
 /// s2/s3, thread ids in v0/v1: each thread writes its global (x, y), and through LDS +
 /// s_barrier the (x, y) of the thread at the mirrored index, which is in the other wave.

AI use: Codex (GPT-6; exact variant unavailable) ported the test, ran the validation, and prepared this follow-up.

Current-main integration: build failure reproduced and fixed

I also confirmed @3L1A5-1's build report. After resolving the merge with main fc0462b4f442f390e7b9b637c168271b7720935f, cargo check --locked -p xcl --lib -j 4 failed with E0599 (Slots::acquire) and E0425 (wait_for_commit) in the offline compute warmer.

82bd8fd is a tested integration tree with parents fc0462b and your unchanged head 3407393. The offline call becomes:

let _big = (compiled.dxil.len() >= BIG_DRIVER_COMPILE).then(|| big_compile_turn(&BIG_COMPILES, big_compile_commit_free, || false));

The tool has no waiting title thread; the title path keeps main's build_is_wanted predicate. Merge resolution retains main's demand-aware worker code, collision-safe driver-cache writes, sparse fixes and CI tests; it keeps this stack's graphics preparation and journal callbacks. Main's Discord URL is retained too.

On the same RTX 3060 / Windows 10 / Rust 1.100.0 MSVC / DXC 1.9 / Agility 1.620.2 setup:

  • cargo build --locked --workspace -j 4: passed.
  • cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output: integration before the optional CLI test 774 passed / 0 failed / 41 ignored; final tree with it 775 / 0 / 41, exit 0.
  • Focused pipeline_journal_cli_compiles_and_resumes: 1 passed / 0 failed. It executes the generated compute journal in child CLI processes and checks progress/retry behavior.

Both workspace runs printed the same two native-wave64 skips. Samples remain unset. This validates the merge tree, not the old head by itself; it does not establish stable title behavior, a large-program driver compile, graphics replay, --watch, Wine, or main/head retail smoke. Runtime code changed, so the required title smoke is still outstanding before merge.

AI use: Codex (GPT-6; exact variant unavailable) resolved and checked the integration, ported the synthetic test, ran these commands and prepared this update.

New regression: an existing but invalid blob was counted as complete

1e7047b fixes a separate issue in warm's compute branch, on top of the tested 82bd8fd integration.

The old is_file() shortcut returned Ok(()) without asking the driver to load the file. In the synthetic CLI test I wrote invalid cached journal pipeline into the matching driver-cache file, removed progress, and replayed the same journal. The tool printed made 1, failed 0 and wrote completed progress, but the invalid bytes remained untouched. The new assertion fails before the fix.

The patch loads the blob into CachedPSO, asks the driver to create the pipeline, and falls back to a normal compile after dropping a refused blob. Valid blobs are reused and left unchanged. It retains the existing driver-slot and big-compile admission guards and updates the README. The 26-line regression extension also seeds a valid blob via the same executable's xcl shaders --precompile --pipelines, then requires the warmer's actual driver-blob-hit message.

Measured with the fix: invalid blob refused and removed/replaced, normal creation succeeds; the valid blob is accepted and stays byte-identical. Focused CLI test 1 passed / 0 failed. Build passed; full workspace 775 passed / 0 failed / 41 ignored, exit 0, with the same two native-wave64 skips. Commands and native RTX 3060 setup are unchanged from the integration report above.

This matters when .done starts over while incompatible files remain, including the situation the driver-key change is intended to cover. I did not change the installed driver: the regression uses an invalid synthetic blob. No retail smoke, Wine, AMD/Intel or large-program timing measurement. Runtime changed, so main/head title smoke remains required before merge. Static-sampler key separation (#1420) and NodeMask normalization (#1368) are separate changes.

AI use: Codex (GPT-6; exact variant unavailable) reproduced the failure, wrote the patch and regression, ran the tests and prepared this follow-up.

CLI help regression

ffc40b3 adds a one-line help guard and a standalone CLI regression on top of 1e7047b.

Before the fix, xcl pipelines --help tried to open a path named --help and exited 2. The new test reproduces that failure. It now checks all four forms (--help, -h, and each after a missing target path) with XCL_ADAPTER deliberately set to a nonmatching name: each exits 0, prints the command's options, and leaves stderr empty. No GPU or title data is needed for the test.

Focused test 1 passed / 0 failed; build passed; full workspace 776 passed / 0 failed / 41 ignored, exit 0, the same two native-wave64 skips. This is still the fc0462b-based integration, not a fresh merge of every later main change. No retail smoke. Codex (GPT-6; exact variant unavailable) wrote the guard/test, ran validation, and prepared this update.

Combined #759 / #1420 native cache check

83ac24b combines the #759 integration/cache/help fixes (ffc40b3) with #1420's rebased 867d307 on main b7aa9f3. The clean merge initially failed E0061: the journal warmer still supplied two arguments to the new three-argument driver_cache::path. It now passes &compiled.samplers.

A new synthetic native-driver regression goes beyond the filename unit test:

  • two console CS containers differ only in static U addressing (wrap/clamp);
  • both cached DXIL files are byte-identical, while the offline compiler writes two distinct driver blobs;
  • each journal replay must report an actual saved-driver-blob hit and preserve both files byte-for-byte.

The focused test journal_warmer_reuses_offline_blobs_for_distinct_static_samplers passed 1 / 0, no skips. A control that supplied an empty sampler slice to the warmer made the code compile but failed its cache-hit assertion. The corrected caller passed. The shared journal encoder is the existing synthetic fixture, factored for reuse.

Full results on the RTX 3060 / Windows 10 / Rust 1.100.0 / DXC 1.9 / Agility 1.620.2 setup:

  • Build passed.
  • cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=1 --show-output: 780 passed / 0 failed / 41 ignored, exit 0, two native-wave64 skips.
  • The same command with --test-threads=4: 777 / 3 / 41, five explicit skips. Failures were list_x::tests::write_buffer_immediate_on_open_existing_heap_visible_to_cpu, rotating_queue_self_deadlock_and_non_monotonic_rescue_do_not_hang, and timestamps_outside_unified_memory_land_after_the_queue, at queue creation. Additional no-device skips were the console depth-target test, shader-cache-session fallback test and placed-texture test. The cause of these parallel failures is unresolved; this is not a green default-suite claim.

Samples were unset. The new regression compiles pipelines and checks cache loading; it does not dispatch the sampler shaders or compare rendered output. No retail title smoke, Wine, AMD/Intel, native wave64, or real driver update. #1368 is not part of this integration.

AI use: Codex (GPT-6; exact variant unavailable) prepared the integration and fixture, reproduced the API/caller failures, ran validation and wrote this update.

Invalid option values could start an unlimited pass

f5a2e21 is a separate input-validation fix on ffc40b3.

Reproduced with the one-record synthetic journal: --limit with no value selected usize::MAX, compiled the pipeline, wrote progress and exited 0. The new assertion expects 2 and fails before the patch. Missing/invalid --threads values also fell back to the default. The patch validates supported options before journal/device resolution, rejects bad values and unknown arguments, preserves first-value precedence, and keeps --limit 0 valid.

The no-GPU CLI suite covers ten invalid forms plus the four help forms (2 test functions passed). The journal regression (1 passed) checks that bad limits produce no cache/progress files; limit 0 creates only the 8-byte key and compiles nothing.

Build passed. Full serial workspace: 777 passed / 0 failed / 41 ignored, two native-wave64 skips. Parallel run: 775 / 2 / 41, four skips (two wave64, console depth target/no GPU, placed textures/no device); the rotating-queue and mid-list-write64/wait64 tests failed creating queues. Those parallel failures remain unresolved. No title smoke. Same hardware/toolchain and commands as above, with the reported test-thread setting.

Codex (GPT-6; exact variant unavailable) reproduced the behavior, wrote the parser/regressions and ran validation.

Invalid journal headers were reported as successful empty work

3a1be15, on f5a2e21, checks the journal header before GPU selection or progress creation.

Before the fix, an ASCII .bin containing not an XCL pipeline journal exited 0 and created an 8-byte .done file. With the fix it exits 2 with invalid pipeline journal header; an already-existing progress file also stays unchanged (hash checked).

Four no-GPU CLI cases cover wrong magic, an unsupported full header under --watch, and empty/short non-watch input. They require error 2 before the deliberately nonmatching adapter can be selected and no new progress files. The existing GPU journal test checks that --watch --limit 0 still accepts empty and partial initial headers. Complete frames and torn payload handling are unchanged; live appending beside a running title was not tested.

Focused CLI 3 test functions passed; focused journal 1 passed; build passed. Full serial workspace 778 passed / 0 failed / 41 ignored, two native-wave64 skips. Parallel workspace 777 / 1 / 41, four skips; mid_list_write64_wait64_split_avoids_cycle_and_reuses_spares failed at queue creation. The extra skips were the console depth target and placed textures (no device). This remains an unresolved parallel GPU-test limitation, not a green default-suite result. No title smoke or proprietary inputs.

Codex (GPT-6; exact variant unavailable) reproduced the input behavior, wrote the validation/regressions and ran these checks.

@JoaoPauluu

Copy link
Copy Markdown

Test report: #759 under Wine (Linux, NVIDIA): xcl pipelines dies of a stack overflow in a warm thread, on the same journal entries every time

I ran the whole flow on GTA VI under Wine / vkd3d-proton: a run that writes the journal, xcl pipelines on it, then a second run. The journal and most of the command work. But xcl pipelines ends with a Rust stack overflow in one of its xcl-warm-* threads, after about 50,600 of 53,315 pipelines. Every rerun stops the same way within 1–2 s, a few entries further on.

Setup

1. First run (writes the journal)

  • XCL logs pipeline journal <data>\RockstarGamesInc.28872443D20A7\cache\pipelines.bin: Sharing violation. (os error 32) – none in this run
  • Even so, <data>\RockstarGamesInc.28872443D20A7\cache\pipelines.bin was written during that run (102,084,864 bytes). I didn't look into which process held it; XCL runs the title in a second process.
  • 861 frames, 0 device removals, 0 crashes; the block says exit: killed (no exit) (the process outlived the 15 s grace).

2. xcl pipelines <data>\RockstarGamesInc.28872443D20A7 (same Wine environment, XCL_DXC_DIR set)

  • Start: <data>\RockstarGamesInc.28872443D20A7\cache\pipelines.bin: 53315 pipelines to make (225 the title used), 0 done before, 3503 shaders; 4 memory windows; 6 threads, 4 driver compiles at once
  • Progress lines up to 50600 done, 2715 left (233.9/s …) and 32 driver blobs kept on disk for the next run, then the process ended: exit code 5 after 256 s, with thread 'xcl-warm-2' (1896) has overflowed its stack in its output. pipelines.done was written (405,176 bytes).
  • Rerun: <data>\RockstarGamesInc.28872443D20A7\cache\pipelines.bin: 7161 pipelines to make (3 the title used), 50646 done before, 5659 shaders; 4 memory windows; 6 threads, 4 driver compiles at once, then thread 'xcl-warm-3' (360) has overflowed its stack, exit 5 after 2 s. A third run: 50649 done before, thread 'xcl-warm-0' (464) has overflowed its stack, exit 5 after 1 s.
  • So it is the same few entries each time (about 3 more are done per run), not timing. Which entries they are, or what kind of pipeline, the output doesn't say. I don't know whether a Windows / MSVC build has a larger default thread stack and so doesn't hit this, or whether it is the same there.

3. Second run (same data root, after the CLI)

  • XCL logs: pipeline journal: <data>\RockstarGamesInc.28872443D20A7\cache\pipelines.bin (57043 entries from earlier runs) – xcl pipelines compiles them outside the title
  • 967 frames, 0 device removals, 0 crashes, exit: 0x0; first presents at 22 s (the first run: 28 s).
xcl-smoke v1
commit: 6dd5c1d7c36652cfecef6ad517828b443c140715
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: killed (no exit)
frames shown: 861 (PresentX 861)
presents per 2 s (last 3): 60 60 55
device removals: 0
crashes: 0
peak commit: 0 MB
xcl-smoke v1
commit: 6dd5c1d7c36652cfecef6ad517828b443c140715
gpu: NVIDIA GeForce RTX 3060
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 967 (PresentX 967)
presents per 2 s (last 3): 44 60 22
device removals: 0
crashes: 0
peak commit: 0 MB

(peak commit: 0 MB is XCL reading 0 MB committed under Wine, see #257.)

Not tested

  • Windows / MSVC builds, AMD; --watch; a cold DXIL cache; which journal entries overflow the stack; a main pair for the title runs

AI use: Claude Code (Claude Opus 5.5) built the commit, ran everything above on the machine above and wrote this report. The blocks, counts and log lines are pasted from those runs (data-folder paths shortened to <data>). The account owner asked for test reports to be posted while they were away and has not reviewed this one.

oishigeso pushed a commit to oishigeso/xcl that referenced this pull request Nov 24, 2026
The progress file was opened for appending, and on Windows an append
handle cannot be truncated: the set_len(0) for a new binary failed
unseen and its key was appended after the old records. It is now opened
for writing; a file of another binary starts over and a torn last record
is cut off, and an open error ends the run (2).

Reported by @anes66 on ivall#759.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oishigeso

Copy link
Copy Markdown
Author

Thanks @anes66, and @crosettiremi and @JoaoPauluu for the runs on #757 / #759.

The pipelines.done reset was a real bug: the file was opened for appending, and on Windows an append handle can't be truncated, so set_len(0) failed unseen. a0390ea opens it for writing instead (a file of another binary starts over, a torn last record is cut off, an open error ends the run with 2) and adds a test for both. I wrote the fix here rather than taking d2a3e01 so the PR stays one author's; the report is credited in the commit.

A fresh review of the whole stack afterwards found four more of the same kind, now fixed:

  • b617c88 (D3D12.X: a journal of the pipelines a title queues (<data>\cache\pipelines.bin) #758): a journal write error (a full disk) left half a frame mid-file and noted it as written. A frame is now written whole or cut back, and the journal is off for the rest of the run. An input-layout count from the file is checked against the bytes there before allocating.
  • ab1479a: --watch kept a torn frame's bytes after the next run cut it and wrote over it, misaligning everything after; the unparsed tail is now read again on each poll (test added). The tool built the oldest run's memory windows; it now builds the newest run's. pipelines.done is opened without write sharing, so a second tool on the same journal is refused.

Still open (not fixed here): the tool's device takes the first adapter matching the title's d3d12_adapter without the title's fallback to auto, and the wave32 split flags aren't in the journal, so a different adapter than the title's would compile under other cache keys. Both only matter with several GPUs.

New smoke runs on the fixed heads are in #758's and this PR's descriptions.

oishigeso pushed a commit to oishigeso/xcl that referenced this pull request Nov 24, 2026
…goes past one it crashed on

- A big compute pipeline (256 KB of DXIL and more) now takes the title's
  BIG_COMPILES turn and waits for 3 GB of free commit, as the title's own
  background compiles do. The tool's threads (xcl-warm-*) missed that rule
  and ran up to four of these at once, 1.5 to 3 GB each in the driver.
- The pipelines being made are noted in pipelines.trying, which a run that
  ends by itself removes. A run that died (a crash in the driver or DXC on
  one pipeline, reported under Wine on xcl-dev#759) leaves it behind, and the next
  run leaves those pipelines to the title instead of ending the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oishigeso

Copy link
Copy Markdown
Author

@JoaoPauluu thanks for the Wine run, and sorry, I missed your report when I wrote the reply above.

The last ~5 % of a journal are the title's huge compute pipelines: on an RX 6700 XT one took 62 s and 1.5–3 GB in the driver. The tool had two problems there, both fixed now:

  • dc39e5c: the title makes those one at a time, and only with 3 GB of commit free (BIG_COMPILES, wait_for_commit), but only on its xcl-pso* threads. The tool's xcl-warm-* threads went around that rule and ran up to four at once. They now take the same turn.
  • dc39e5c: what a run is making is noted in pipelines.trying, which a run that ends by itself removes. After a crash, the next run leaves those pipelines to the title and goes on. Tested here by stopping a run: the next one printed the last run ended while making 6 pipelines: left to the title and continued with the remaining 5 937.
  • 788e366: the tool now keeps 6 GB of commit free for DXC (it was 2 GB without --watch).

The stack overflow itself I can't reproduce on Windows: there the driver compiles these without a crash. Under Wine the driver compile is vkd3d-proton's DXIL→SPIR-V in the calling thread (64 MB of stack, as the title's own compile threads have), so I suspect the #611 kind of deep recursion on those shaders; the title would meet it too when it builds them. With the change above, a re-run goes past them instead of ending every time.

The Sharing violation on the journal: only one process writes it at a time (by design). On Windows each run logs one journal open; under Wine a second process of the same run seems to have opened it. If you still have that run's log, does it show two pipeline journal lines with different thread ids?

@milas6669

milas6669 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Test report for the xcl pipelines tool, on this PR's head 788e366 with its stack (#758 and the earlier parts) merged onto main 09940bb (clean merge, release build, 9 commits over main).

Tested

  • NVIDIA GeForce RTX 3070 (8 GB, 32-lane waves), Intel i9-10900KF, 31.9 GB RAM, Windows 11 Pro 10.0.26200, rustc 1.100.0; retail title, XCL_NETWORK=0, warm DXIL cache from earlier runs, 4095 MB coherent window.
  • Step 1: one 100 s run of the title with scripts/smoke.ps1. It wrote cache\pipelines.bin (124,907 KB, about 58,970 queued pipelines).
  • Step 2: xcl pipelines <game folder> with the game closed. It made 51,000 of the 58,970 pipelines in about 22 minutes: it printed about 1,070 pipelines a second around 50,500 done, then it stopped advancing at 51,000 done / 7,953 left. In the last 11 minutes it did 100 pipelines, and in the 90 s before I stopped it none, while using about 2.6 cores and 3.4 GB. The lines just before were driver compiles of 767 KB / 614 KB programs taking 13.5 s and 7.1 s each. I stopped it by hand (so its exit code 1 is mine); at this speed the remaining 7,953 would have taken hours. I did not check whether pipelines.done resumes.
  • Step 3: another run of the title (300 s limit) with 51,000 pipelines prebuilt.
run 1 (before the tool) run 3 (after the tool, 51,000 of 58,970 built)
compute PSO with the translated console CS lines in the title's log 172 192
sum of their build times 37,062 ms 2,215 ms
of them slower than 2 s 1 0
last 2 s window with presents ends at 100.1 s (the run's time limit) ends at 106.1 s, then 0 presents until my 28 GB watchdog killed the run
pipelines built ahead of their first use / mesh refused 1024 / 40 1024 / 40

Not tested

  • running the tool to the end (the last 7,953 pipelines), resuming it, --watch, graphics pipelines separately, AMD
  • one run each before and after, so the 100 s vs 106 s is not a measurement

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.

@S1m0ne1997

Copy link
Copy Markdown

Test report: xcl pipelines on a retail journal, RTX 4090 / Windows. It works and is the most useful tool of the stack here. In one process the driver compiles stop scaling: NVIDIA's compiler serializes on the process heap lock.

Setup: RTX 4090 (driver 621.24), Ryzen 9 9950X3D (32 threads), 47 GB RAM, Windows 11 26300, release. Tree: main 47efa2e + this PR's 8 commits (clean cherry-pick) + #688 + #744 + #820 + #684. Tests: pso_journal 1 passed, pipelines:: 3 passed, driver_cache 4 passed, pso_async 3 passed.

  • A journal run that reached the world load wrote pipelines.bin (128 MB): 58 752 pipelines to make (1 358 the title used), 6 102 shaders. About 51 500 were done within minutes (graphics, and compute already in driver_cache). What remains is compute programs of 250 KB – 1.2 MB of DXIL, 30 – 150 s each in the driver.
  • One process scales badly. XCL_PIPELINE_THREADS=8 + XCL_BIG_COMPILES=8 (D3D12.X: XCL_BIG_COMPILES sets how many big compute pipelines the driver builds at once #820) used 3 – 6.5 of 32 cores; 24 + 24 used 3.2 – 6.5 cores and wrote no blob in 2 min. A stack sample of the same pattern (in --precompile --pipelines, 32 driver compiles) showed 32 threads in nvgpucomp64: 19 waiting in RtlAllocateHeap and 13 in RtlFreeHeap on the process heap's critical section, 1 running. That is the contention Shaders: isolate DXC compiler heaps for parallel AOT #688 removes for DXC, but the driver's compiler takes no allocator.
  • Several processes do scale. A local, unpublished change: XCL_PIPELINES_SHARD=k/n makes a process take only the pipelines whose hash is k modulo n, with its own pipelines.<k>of<n>.done / .trying, and read the unsharded .done. With 4 processes × 6 driver compiles (--threads 8, XCL_DXC_THREADS=4), the four used 25.7 of 32 cores, about 20 compute blobs a minute, 4 – 8.5 GB each. Memory is then the limit, and the 6 GB commit reserve kept it in bounds.

If a shard option (or several xcl pipelines processes coordinated through the done file) fits this PR, I can send the change as a follow-up on top of it.

AI use: Claude Code with Claude Opus 5.5 applied the stack, ran the builds, tests and passes, took the stack samples and wrote and posted this comment at my request.

@JoaoPauluu

Copy link
Copy Markdown

@oishigeso, answers to your question, and a rerun on this PR's head 788e366 under Wine.

The Sharing violation: the log of that run (6dd5c1d) has only one pipeline journal line, the warning at 2.204 s on thread 904. There is no second line on another thread and no successful open. The 102 MB journal was still written during that run, so something did open it, but that log does not show what. On 788e366, with another new, empty data root, I could not reproduce it: one line, pipeline journal: … (0 entries from earlier runs) at 3.301 s, no warning, and one xcl.exe run process (under start.exe) at 10 s. I tried to see which Linux processes held pipelines.bin open, but under Wine the file descriptors are held by wineserver, so that check shows nothing either way. That leaves it unexplained: one run hit it, one did not.

xcl pipelines on 788e366 (same journal throughout: 57 807 pipelines, 5 659 shaders, 4 memory windows; tool output with 6 threads and 4 driver compiles):

run start end exit
1 0 done before thread 'xcl-warm-5' has overflowed its stack at about 50 600 done, after 52 s 5
2 the last run ended while making 6 pipelines: left to the title, 50 655 done before thread 'xcl-warm-3' has overflowed its stack after 408 s (97 more done) 5
3 the same message, 6 left to the title, 50 752 done before 16 driver blobs in the first ~20 s, pipelines.done last changed about 1 min in, then nothing for the ~19 min until my timeout 1200 stopped it 124 (mine)
  • pipelines.trying works as described: each rerun printed the message, did not start those 6 pipelines, and went on with the rest.
  • A rerun still does not get through the last ~7 000 pipelines here. Run 2 hit the overflow on other pipelines. Run 3 stopped advancing without a crash. I did not sample its threads or CPU use, so I can't say whether it was compiling slowly, as @milas6669 saw on Windows at 51 000 done, or waiting.

Title runs (scripts/linux/smoke.sh, 60 s, before and after the tool runs): 961 and 950 frames, exit: 0x0, no device removal, no crash. The second run read the journal with 63 694 entries. Under Wine, peak commit reads 0 MB, so it is left out.

Tested

Not tested

  • the test suite on this head; --watch; native Windows; why run 3 stopped advancing.

AI use

  • Claude Code (Claude Opus 5.5) built the head, ran the runs and wrote this reply. The account owner asked me to answer the questions addressed to them but has not reviewed this one.

@Filip722

Filip722 commented Nov 24, 2026 •

Copy link
Copy Markdown

Tested

  • RTX 5060 Laptop GPU with 8 GB VRAM, NVIDIA 615.78.08, Intel Core 7 240H, 16 GB RAM, Bazzite 44 Testing (F44.20261011), Proton Experimental 11.0-20261112. Windows MSVC release build with the local vkd3d-proton 3.1.0 test runtime based on 4522cc1 and dxil-spirv 1dc543f.
  • Shaders: xcl pipelines compiles a run's queued pipelines outside the title #759 head 788e366af54169678bb6f5f43ad3f3e43ec0824c and its earlier stack on 47efa2e, with local Series X loading changes and a private diagnostic that put the journal ID in the existing PSO wait warning. The focused journal tests passed 1/1 under Proton. Replaying 32 previously built compute records succeeded in 1.0 s.
  • The traced Series X loading run reached 2,507 sampled presents before the title GPU watchdog. The trace identified seven distinct compute pipeline timeouts. Three had a successful build marker when the run ended.
  • A separate copy of the journal with just those seven entries replayed 7/7 in 130.7 s using xcl pipelines <journal> --threads 1 --limit 32 on the baseline test runtime. A local dxil-spirv dominance experiment on matched cache copies also replayed 7/7 in 130.0 s. Neither run reported a replay failure. The baseline added four driver blobs.
  • The follow-up title launch used the same XCL executable and vkd3d build with the warmed cache and a 5 s bind budget. It reached 2,444 sampled presents before the same title watchdog. Four of the seven original compute pipeline IDs timed out again. The warmed run logged 15 total timeout warnings across compute and graphics. Both runs reached loading artwork, with no D3D12 device removal or NVIDIA Xid.

This shows that the offline compiler can finish the exact entries that missed the in-title deadline.

A cache-status trace confirmed that all four recurrent compute timeouts found a saved blob and entered the driver before the bind deadline. Each blob was 112 bytes and contained only the vkd3d-proton compatibility metadata chunk.

With VKD3D_CONFIG=pipeline_library_app_cache enabled for the offline replay, all seven entries completed in 131.6 s. The four matching cache keys received full blobs totaling 10.2 MB, with inline SPIR-V and Vulkan pipeline cache data. The subsequent title launch used the normal cache configuration and reached 2,442 sampled presents before the watchdog. Three of the original compute timeouts still occurred inside the driver.

Not tested

Native Windows, AMD, and rendered gameplay.

AI use

OpenAI Codex with GPT-6.2-Sol high prepared the local instrumentation, ran the tests, and wrote this report.

@claudetools-gh

claudetools-gh commented Nov 24, 2026 •

Copy link
Copy Markdown

Test report for #759 (with #744 and #573) on NVIDIA, retail title 1.0.2.1: precompiling outside the title cuts the skipped compute work by 85 %.

Setup

What we did

  1. One run of the title wrote the journal: 58,749 pipelines (1,346 the title used).
  2. xcl pipelines <game> ran outside the title for about 70 min. It got through the used pipelines and grew driver\ from 452 to 865 compute blobs, then we stopped it to measure.
  3. Same run as before, with that cache.

Result (same point in the run, ~190–200 s)

before precompile after (partial)
dispatches skipped 17,825 of 82,991 2,701 of 65,536
draws skipped 32,768 of 39,346 17,837 of 37,151
title's fatal handler (+0x23cf683) 230 s 264 s

The intro cinematic plays with sound and letterbox bars, but the scene stays grey/black. Graphics pipelines are warmed only into NVIDIA's own cache, so the draws improve less than the dispatches.

Two things that helped, offered as ideas

  • Several processes, not more threads. NVIDIA's compiler serialises inside one process, so we added --shard i/n locally: process i takes the hashes with hash % n == i and keeps its own pipelines.done{i}of{n} / .trying{i}of{n}. Five processes at below-normal priority kept the CPU busy without slowing the desktop. The bottleneck is the ~1,800 compute programs over 256 KB of DXIL, at 30–60 s each in the driver.
  • Three small fixes from reviewing Shaders: xcl pipelines compiles a run's queued pipelines outside the title #759 / Recompiler: the FSSM header's wave32 flag decides a program's wave size #573 before running them:
    • pipelines.done is keyed only by the exe. After a driver update every pipeline still counts as done while the driver refuses the blobs. Adding the adapters' VendorId/DeviceId and CheckInterfaceSupport UMD version to binary_key() fixes it.
    • .trying keeps every hash a run attempted until a clean exit, and Ctrl+C is the only way to end --watch. The next start then marks finished and failed pipelines as "left to the title". Keeping only in-flight hashes in .trying (add before warm, remove after) avoids it.
    • Recompiler: the FSSM header's wave32 flag decides a program's wave size #573: a wave32 flag in the FSSM header overrides 64-bit EXEC writes in the code. Letting the code win (w64 > 0 || (!wave32 && detect_wave64)) keeps a mislabelled wave64 program correct.

Not tested

AI-assisted.

…form fallback

The tool sets the run's `mem_windows` with its HEAP_WINDOWS flag from the
journal (`mem_windows_of`), so a heap-window run's pipelines get the same
HLSL and cache keys as in the title. A pipeline the driver refuses with
E_OUTOFMEMORY in that form is made again in the switch form through
`with_switch_fallback`, as the title makes it since xcl-dev#680.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013hQzywPUY9kSTPQPh31CWh
suppai-ringo and others added 4 commits November 24, 2026 10:27
Ctrl+C is how --watch ends, and it left `.trying` behind as a crash does: the
next run wrote the pipelines being made at that moment to `pipelines.done`
as left to the title, most often the biggest compute programs, the ones most
worth making ahead. A console control handler now removes `.trying` before
the default handler ends the process, so the next run makes them again; a
crash in the driver or DXC still leaves it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013hQzywPUY9kSTPQPh31CWh
main.rs: the help of `xcl shaders --direct` (xcl-dev#1426) and `xcl pipelines` both
kept, the shaders lines first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013hQzywPUY9kSTPQPh31CWh
…s only to append

The first pipeline the title noted read the frame headers of every earlier
run (about 63 000 for a 123 MB journal) with the journal's lock held, and
each later one hashed its shaders and desc under the same lock, so the
title's pipeline threads waited on one another. An entry is now built and
hashed with no lock held, and the lock covers its append only. The journal
is opened on a thread of its own; what is noted meanwhile waits in memory,
each frame once (up to 256 MB, past which the journal is off for the run),
and is written in order once it is open. `XCL_PSO_JOURNAL` is read once,
and a journal turned off stops entries being built at all. A panic on
another thread while it held the lock no longer ends the journal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013hQzywPUY9kSTPQPh31CWh
… threads) into pipelines-3-tool

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013hQzywPUY9kSTPQPh31CWh
@JoaoPauluu

Copy link
Copy Markdown

A rerun at dd66d20 (this PR's head, with the 512 MB warm stacks): the stack overflow still happens under Wine, and the tool then stops making progress.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu, dd66d20, no uncommitted changes. Retail title 1.0.2.1.
  • Fresh data root, 60 s title run (no input): 1236 frames, exit: 0x0, one journal line, no Sharing violation; pipelines.bin 122,854,761 bytes.
  • xcl pipelines <title data dir>, first run: exit code 3 after 7 s. The log ends after 8 driver blobs kept on disk for the next run, with no panic or error text. It left 266 pipelines done and a 48-byte pipelines.trying.
  • Second run: the last run ended while making 6 pipelines: left to the title, 57541 pipelines to make (0 the title used), 266 done before, 5659 shaders. Progress went at about 50/s, then:
      50384 done, 6 being made, 7151 left (201.5/s)
    thread 'xcl-warm-5' (2016) has overflowed its stack
      50391 done, 6 being made, 7144 left (193.7/s)
    ...
      50399 done, 6 being made, 7136 left (56.6/s)
    
    After 50,399 the count did not move again: pipelines.done stopped changing, and the process was still running when my 900 s cap killed it (exit 124). So the process did not exit on the overflow; the remaining workers finished a few more pipelines and then everything stalled with 6 "being made".

Not tested

  • which pipeline xcl-warm-5 was making when it overflowed (the log does not name it), whether a longer wait gets past the stall, whether the first run's exit 3 is the same overflow, native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built the commit, ran the runs and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.

@itsd-effex

Copy link
Copy Markdown

@oishigeso a heads-up for the next rebase: dd66d20 merges into main 4178e88 without conflicts, but the result doesn't build, because of #1524 (724b9e2, "limit concurrent huge pipeline compiles"), merged today:

error[E0425]: cannot find value `vs_dxil` in this scope      real.rs:4251
error[E0425]: cannot find value `ps_dxil` in this scope      real.rs:4251
error[E0425]: cannot find value `BIG_DRIVER_COMPILE` in this scope   real.rs:4612

What I used locally to build (one way, not necessarily the right one):

// translated_graphics_pso_once
let bytes = _dxil.0.len() + _dxil.1.as_ref().map_or(0, Vec::len) + rect_gs.as_ref().map_or(0, Vec::len);
// warm_once
let _big = (compiled.dxil.len() >= huge_pso_bytes()).then(|| big_compile_turn(compile_slots(compiled.dxil.len()), big_compile_commit_free, || false)).flatten();

With that, xcl pipelines builds and runs on main 4178e88 (plus #688, #684, #1321, #1660; Linux, Proton Experimental's Wine). I haven't run the tests on that tree.

AI use

  • Claude Code (Claude Opus 5.5) found the build errors and wrote this comment.

@itsd-effex

Copy link
Copy Markdown

@JoaoPauluu @oishigeso possibly the cause of the warm-worker overflow above: #1805. On this machine the xcl-warm-* workers overflow the whole 512 MB stack within ~5 s on 12 big compute programs only with XCL_DIRECT_DXIL=1; the same 12 build in 23 s with it off. Was direct DXIL on in that run?

AI use

  • Claude Code (Claude Opus 5.5) wrote this comment.

@VolenNakov

Copy link
Copy Markdown

Stacked --shard k/n for xcl pipelines is in #1826 (same syntax as #1502's xcl shaders --shard): n processes on one journal, each with its own .done / .trying, because NVIDIA's driver builds about one big pipeline at a time per process (2.1 → 9.6–10.6 of 12 cores busy here). Feel free to fold the commit into this PR if that is simpler.

Small thing seen while testing it: Queue::left() counts a pipeline the title used twice when it is also in rest (1 766 of 58 748 here), so the "left" figures run high by that many.

AI use: Claude Code (Claude Opus 5.5) wrote this comment.

@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
The progress file was opened for appending, and on Windows an append
handle cannot be truncated: the set_len(0) for a new binary failed
unseen and its key was appended after the old records. It is now opened
for writing; a file of another binary starts over and a torn last record
is cut off, and an open error ends the run (2).

Reported by @anes66 on xcl-dev#759.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wondercrash pushed a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
…goes past one it crashed on

- A big compute pipeline (256 KB of DXIL and more) now takes the title's
  BIG_COMPILES turn and waits for 3 GB of free commit, as the title's own
  background compiles do. The tool's threads (xcl-warm-*) missed that rule
  and ran up to four of these at once, 1.5 to 3 GB each in the driver.
- The pipelines being made are noted in pipelines.trying, which a run that
  ends by itself removes. A run that died (a crash in the driver or DXC on
  one pipeline, reported under Wine on xcl-dev#759) leaves it behind, and the next
  run leaves those pipelines to the title instead of ending the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.