Shaders: xcl pipelines leaves to the title only what a crash cut short #1335

Closed
github-bot wants to merge 9 commits from gh-pr/1335/head into gh-pr/1335/base
Owner

@⁠VolenNakov on GitHub · 2026-11-24 14:56 UTC · original
VolenNakov:pipelines-trying-in-flight → main · +1147 −25 · 11 files · 9 commits · closed without merging

Stacked on #759; only the top commit (Shaders: xcl pipelines leaves to the title only what a crash cut short) belongs here.

xcl pipelines writes each pipeline it starts to pipelines.trying, and the next run marks everything in that file as done ("left to the title") so a pipeline that crashed the driver does not end every run. The file was never trimmed and had no binary key, so the next run also skipped everything the stopped run had finished or was building: after a Ctrl+C the builds in flight, after a rebuild of xcl.exe (pipelines.done starts empty for a new binary) every pipeline the earlier run had started – 12 919 of a 15 129-pipeline share of the retail title's journal here, none of them built by the new binary.

What is in it

  • crates/xcl/src/pipelines.rs: .trying begins with binary_key(), and a pipeline's hash is written when its build starts and again when it ends. in_flight takes only hashes written an odd number of times, in a file of this binary. stop_cleanly_on_ctrl_c (a console control handler) empties the file to its key before the process ends, so a Ctrl+C or a closed console leaves nothing to the title; a crash in the driver or DXC still does. Test: only_what_was_in_flight_with_this_binary_counts_as_crashed.

Tested

  • NVIDIA GeForce RTX 4060 Ti 16 GB (driver 32.0.16.1088), Intel Core i7-8700, 32 GB RAM, Windows 11 build 26200, rustc 1.94.1 MSVC, release.
  • cargo build --release --workspace, then cargo test --release --workspace --no-fail-fast -- --test-threads=4: 703 passed, 3 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware. The 3 failures are title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, title_textures::tests::transitions_apply_when_their_list_is_submitted and vram::tests::d32s8_targets_take_their_own_size_of_video_memory; run on their own they pass, on this commit (twice) and on #759's head 788e366, so they fail only next to the other GPU tests on this 16 GB card. This change touches neither file.
  • xcl pipelines on the retail title's journal with this commit's build, stopped with Ctrl+C after 1 222 pipelines: pipelines.trying went from 2 446 records to 8 bytes (the key only); the next start printed 1222 done before and no "the last run ended while making …" line.
  • Earlier, with the same change on a local tree (#759 + main 930e8b4): four processes on shares of the journal (a local --shard option, not in this PR) stopped with Ctrl+C and restarted on a rebuilt xcl.exe started with "0 done before" and no "the last run ended while making …" line; before the change the same restart reported 12 919 such pipelines per shard.

Regression run

main:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 4060 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1437 (PresentX 1437)
presents per 2 s (last 3): 60 60 61
device removals: 0
crashes: 0
peak commit: 48880 MB

PR:

xcl-smoke v1
commit: d26b19cc7377b107198f580eda959db30f9a4d05
gpu: NVIDIA GeForce RTX 4060 Ti
title: ea3b5e4d
seconds: 60
exit: 0x0
frames shown: 1295 (PresentX 1295)
presents per 2 s (last 3): 60 59 59
device removals: 0
crashes: 0
peak commit: 15572 MB

Not tested

  • A real crash in the driver or DXC during xcl pipelines (the path that should still leave the in-flight pipeline to the title): only the unit test covers it.
  • --watch beside a running title, AMD and Intel GPUs, Wine.
  • The smoke runs do not reach xcl pipelines; they check that the runtime is unchanged. main's peak commit is high because of #1307 (b8b1f49), which #759's base does not have.

AI use

  • Claude Code with Claude Opus 5.5: found the bug in runs on my PC, wrote the change, the test and this description, and ran the tests and the smoke runs.

🤖 Generated with Claude Code

**@⁠VolenNakov** on GitHub · 2026-11-24 14:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1335) `VolenNakov:pipelines-trying-in-flight` → `main` · +1147 −25 · 11 files · 9 commits · closed without merging Stacked on #759; only the top commit (`Shaders: xcl pipelines leaves to the title only what a crash cut short`) belongs here. `xcl pipelines` writes each pipeline it starts to `pipelines.trying`, and the next run marks everything in that file as done ("left to the title") so a pipeline that crashed the driver does not end every run. The file was never trimmed and had no binary key, so the next run also skipped everything the stopped run had finished or was building: after a Ctrl+C the builds in flight, after a rebuild of xcl.exe (`pipelines.done` starts empty for a new binary) every pipeline the earlier run had started – 12 919 of a 15 129-pipeline share of the retail title's journal here, none of them built by the new binary. **What is in it** - `crates/xcl/src/pipelines.rs`: `.trying` begins with `binary_key()`, and a pipeline's hash is written when its build starts and again when it ends. `in_flight` takes only hashes written an odd number of times, in a file of this binary. `stop_cleanly_on_ctrl_c` (a console control handler) empties the file to its key before the process ends, so a Ctrl+C or a closed console leaves nothing to the title; a crash in the driver or DXC still does. Test: `only_what_was_in_flight_with_this_binary_counts_as_crashed`. **Tested** - NVIDIA GeForce RTX 4060 Ti 16 GB (driver 32.0.16.1088), Intel Core i7-8700, 32 GB RAM, Windows 11 build 26200, rustc 1.94.1 MSVC, release. - `cargo build --release --workspace`, then `cargo test --release --workspace --no-fail-fast -- --test-threads=4`: 703 passed, 3 failed, 41 ignored. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. The 3 failures are `title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels`, `title_textures::tests::transitions_apply_when_their_list_is_submitted` and `vram::tests::d32s8_targets_take_their_own_size_of_video_memory`; run on their own they pass, on this commit (twice) and on #759's head `788e366`, so they fail only next to the other GPU tests on this 16 GB card. This change touches neither file. - `xcl pipelines` on the retail title's journal with this commit's build, stopped with Ctrl+C after 1 222 pipelines: `pipelines.trying` went from 2 446 records to 8 bytes (the key only); the next start printed `1222 done before` and no "the last run ended while making …" line. - Earlier, with the same change on a local tree (#759 + `main` `930e8b4`): four processes on shares of the journal (a local `--shard` option, not in this PR) stopped with Ctrl+C and restarted on a rebuilt xcl.exe started with "0 done before" and no "the last run ended while making …" line; before the change the same restart reported 12 919 such pipelines per shard. **Regression run** main: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 4060 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1437 (PresentX 1437) presents per 2 s (last 3): 60 60 61 device removals: 0 crashes: 0 peak commit: 48880 MB ``` PR: ``` xcl-smoke v1 commit: d26b19cc7377b107198f580eda959db30f9a4d05 gpu: NVIDIA GeForce RTX 4060 Ti title: ea3b5e4d seconds: 60 exit: 0x0 frames shown: 1295 (PresentX 1295) presents per 2 s (last 3): 60 59 59 device removals: 0 crashes: 0 peak commit: 15572 MB ``` **Not tested** - A real crash in the driver or DXC during `xcl pipelines` (the path that should still leave the in-flight pipeline to the title): only the unit test covers it. - `--watch` beside a running title, AMD and Intel GPUs, Wine. - The smoke runs do not reach `xcl pipelines`; they check that the runtime is unchanged. `main`'s peak commit is high because of #1307 (`b8b1f49`), which #759's base does not have. **AI use** - Claude Code with Claude Opus 5.5: found the bug in runs on my PC, wrote the change, the test and this description, and ran the tests and the smoke runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
prep_graphics: what translated_graphics_pso did between its checks and the driver call (the
translated shaders, XCL's ABI root signature with their static samplers, the rect list GS, PC
formats and topology), returned with the DXIL it points at. No change in behaviour; a later
change makes the same desc outside the title (xcl pipelines).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every pipeline with console shaders that goes to pso_async (its DXIL not in the cache yet, or
made lazily: a retail title queues ~58 000 in its first minute) is appended to a journal: its
desc field by field (no pointers, no padding: the same pipeline always hashes the same), its
input layout and its shaders by hash, each shader once, with the run's memory windows. A
pipeline's first build is marked as used. Entries of earlier runs are not written again (found
from the frames' headers, the shaders stay on disk); a torn last frame is cut off. One title
process writes it at a time (others get none). The reader (replay) gives the desc back with
everything it points to owned and no pointer from the file. Another process can compile the
title's pipelines from it; XCL_PSO_JOURNAL=0 turns it off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A frame is now noted as written only once all of it is on disk; a failed
write (a full disk) is cut back to where it started, so later frames
stay readable, and the journal is off for the rest of the run. An input
layout count read from the file is checked against the bytes there
before anything is allocated for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`xcl pipelines <game | data folder | pipelines.bin> [--watch]` reads the journal a run wrote
and makes each pipeline on its own D3D12 device as the title would (prep_graphics for VS / PS,
the compute path with XCL's ABI root signature), on the GPU the title's xcl.toml names. The
DXIL cache, the driver's cache and driver_cache (compute blobs) then hold what the title asks
for: before its next run, or during this one with --watch (following the journal; the
pipelines the title used first). Translation and DXC run on half the cores at below-normal
priority, the driver's compiles a few at once (XCL_PIPELINE_THREADS). What was made is kept in
pipelines.done for this binary; a failure is tried again by the next run. GS / HS / DS and
mesh pipelines are left to the title.

The memory windows of the run come from the journal (pso::set_mem_windows: prep_graphics
translates through console_to_dxil_for like the title), and shader::readable no longer creates
the UMA (uma::existing): a process without a title reserved 12 GiB of windows and a 512 MB
coherent window for a pointer check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #759.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- --watch: the bytes after the last whole frame are read again on each
  poll, so a torn frame the next run cut off and wrote over no longer
  misaligns every frame after it.
- The memory windows to build are the last run's, not the first's: a
  journal kept across a change of uma_mb built the stale run's set.
- pipelines.done is opened without write sharing, so a second tool on
  the same journal is refused instead of interleaving its records.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- 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 #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 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`.trying` got the hash of every pipeline a run started and was never
trimmed, so the next run took all of them for builds that had crashed
and marked them done (left to the title). After a Ctrl+C that was the
builds in flight; after a rebuild of xcl.exe (`pipelines.done` is for
one binary, so it started empty) it was every pipeline the earlier run
had started: 12 919 of a shard's 15 129 here, none of them built by the
new binary.

`.trying` now begins with the binary's key, and a pipeline's hash is
written when its build starts and again when it ends. Only a hash
written an odd number of times, in a file of this binary, counts as cut
short (`in_flight`). A console Ctrl+C or close empties the file to its
key before the process ends (`stop_cleanly_on_ctrl_c`), so a stop leaves
nothing to the title; a crash in the driver still does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:51:05 +00:00
github-bot closed this pull request 2026-11-26 04:51:05 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 15:08 UTC · original

Does not compile merged with current main (930e8b4): cargo test -p xcl --lib fails with

  • E0599: no method acquire on d3d12x::real::Slots (used at real.rs:4217, BIG_COMPILES.acquire())
  • E0425: cannot find function wait_for_commit

Looks like the branch was written against an older/different allocator API — needs a rebase onto current main. Also ~1,147 changed lines across 11 files; likely wants splitting per CONTRIBUTING.

**@⁠DavidM1911** on GitHub · 2026-11-24 15:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/1335#issuecomment-7135529802) Does not compile merged with current `main` (`930e8b4`): `cargo test -p xcl --lib` fails with - `E0599`: no method `acquire` on `d3d12x::real::Slots` (used at real.rs:4217, `BIG_COMPILES.acquire()`) - `E0425`: cannot find function `wait_for_commit` Looks like the branch was written against an older/different allocator API — needs a rebase onto current main. Also ~1,147 changed lines across 11 files; likely wants splitting per CONTRIBUTING.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-24 15:05 UTC · original · edited 2026-11-24 15:09 UTC

Full-suite run, since this PR has no test report yet. Tested exact head d26b19c (on its base f4ce27c).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 706 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: graphics_round_trip, a_torn_frame_written_over_is_read_again, done_file_of_another_binary_is_replaced_and_a_torn_record_cut, used_pipelines_first_done_ones_skipped_journal_followed, only_what_was_in_flight_with_this_binary_counts_as_crashed.
  • Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 706 passed, 0 failed, 41 ignored, no skips.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-24 15:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1335#issuecomment-7135447141) · edited 2026-11-24 15:09 UTC Full-suite run, since this PR has no test report yet. Tested exact head `d26b19c` (on its base `f4ce27c`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4`: **706 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `graphics_round_trip`, `a_torn_frame_written_over_is_read_again`, `done_file_of_another_binary_is_replaced_and_a_torn_record_cut`, `used_pipelines_first_done_ones_skipped_journal_followed`, `only_what_was_in_flight_with_this_binary_counts_as_crashed`. - Same head on the AMD Radeon iGPU of the 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **706 passed, 0 failed, 41 ignored**, no skips. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠JoaoPauluu on GitHub · 2026-11-24 15:37 UTC · original

A run of this commit under Wine on Linux, where xcl pipelines still crashes (the stack overflow I reported on #759). That makes it a real crash case for the new .trying handling, which works as described.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. d26b19c as it is (stacked on #759), no uncommitted changes.
  • The retail title's journal from a 60 s run this morning (57 807 pipelines, 5 659 shaders, 4 memory windows). Its pipelines.done (406 272 bytes) and pipelines.trying (296 bytes) were written by #759's 788e366 build.
  • Run 1: 57807 pipelines to make (228 the title used), 0 done before. The other binary's files were not taken, and there was no "last run ended" line. At 50 600 done it ended after 162 s with thread 'xcl-warm-0' has overflowed its stack, exit 5. It left pipelines.trying at 810 424 bytes.
  • Run 2: the last run ended while making 6 pipelines: left to the title, then 7153 pipelines to make (0 the title used), 50654 done before. So of everything run 1 started, only the 6 in flight at the crash were skipped. It made 1 driver blob, then crashed again after 5 s (xcl-warm-1 overflowed its stack, exit 5).
  • On #759's head 788e366 this morning, the reruns also left only 6 to the title after each crash, but there .trying was a fresh file per run. This run covers the binary key and the start / end records.

Not tested

  • Ctrl+C (stop_cleanly_on_ctrl_c); only_what_was_in_flight_with_this_binary_counts_as_crashed and the rest of the suite on this head; native Windows.

AI use

  • Claude Code (Claude Opus 5.5) built the commit, ran the tool and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1335#issuecomment-7136327836) A run of this commit under Wine on Linux, where `xcl pipelines` still crashes (the stack overflow I reported on #759). That makes it a real crash case for the new `.trying` handling, which works as described. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `d26b19c` as it is (stacked on #759), no uncommitted changes. - The retail title's journal from a 60 s run this morning (57 807 pipelines, 5 659 shaders, 4 memory windows). Its `pipelines.done` (406 272 bytes) and `pipelines.trying` (296 bytes) were written by #759's `788e366` build. - Run 1: `57807 pipelines to make (228 the title used), 0 done before`. The other binary's files were not taken, and there was no "last run ended" line. At 50 600 done it ended after 162 s with `thread 'xcl-warm-0' has overflowed its stack`, exit 5. It left `pipelines.trying` at 810 424 bytes. - Run 2: `the last run ended while making 6 pipelines: left to the title`, then `7153 pipelines to make (0 the title used), 50654 done before`. So of everything run 1 started, only the 6 in flight at the crash were skipped. It made 1 driver blob, then crashed again after 5 s (`xcl-warm-1` overflowed its stack, exit 5). - On #759's head `788e366` this morning, the reruns also left only 6 to the title after each crash, but there `.trying` was a fresh file per run. This run covers the binary key and the start / end records. **Not tested** - Ctrl+C (`stop_cleanly_on_ctrl_c`); `only_what_was_in_flight_with_this_binary_counts_as_crashed` and the rest of the suite on this head; native Windows. **AI use** - Claude Code (Claude Opus 5.5) built the commit, ran the tool and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠VolenNakov on GitHub · 2026-11-24 21:10 UTC · original

Closing: #759 now does this itself – d20dc0f keeps only the pipelines being made in .trying, and bbf56a8 makes Ctrl+C a clean stop – so this PR adds nothing on top of it. Thanks @⁠futurepro62 for the full-suite runs (RTX 5070 Ti and the Radeon iGPU), @⁠JoaoPauluu for the real crash case under Wine (only the 6 in-flight pipelines left to the title after 50 600 started), and @⁠DavidM1911 for spotting that the old base no longer builds on main.

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

**@⁠VolenNakov** on GitHub · 2026-11-24 21:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1335#issuecomment-7144570147) Closing: #759 now does this itself – `d20dc0f` keeps only the pipelines being made in `.trying`, and `bbf56a8` makes Ctrl+C a clean stop – so this PR adds nothing on top of it. Thanks @⁠futurepro62 for the full-suite runs (RTX 5070 Ti and the Radeon iGPU), @⁠JoaoPauluu for the real crash case under Wine (only the 6 in-flight pipelines left to the title after 50 600 started), and @⁠DavidM1911 for spotting that the old base no longer builds on `main`. AI use: Claude Code (Claude Opus 5.5) wrote this note.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:53 UTC · original

Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current main on the new head — needs another rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-26 04:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/1335#issuecomment-7182990043) Re-verification on RTX 3060 Ti (Windows 11): still a **merge conflict with current `main`** on the new head — needs another rebase before it can be tested.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.