D3D12.X: a journal of the pipelines a title queues (<data>\cache\pipelines.bin) #753

Closed
ghost wants to merge 5 commits from upstream-pr/758 into main
ghost commented 2026-11-24 04:44:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ghost on 2026-11-24T04:44:07Z.


Part 2 of 3 for #755. Stacked on #757; its own commits are the four after #757's head (the journal, its write-error handling, the heap-window flag, the journal off the title's threads).

Every pipeline with console shaders that goes to pso_async (DXIL not cached yet, or made
lazily) is appended to <data>\cache\pipelines.bin. Each entry holds its desc field by field,
with no pointers and no padding, so the same pipeline always hashes the same. It also holds the
input layout and its shaders by hash (each shader written once), together with the run's memory
windows. A pipeline's first build is marked as used. On open, only the frames' headers are read
to skip entries of earlier runs, and a torn last frame is cut off. One title process writes at a
time; a second one gets no journal. replay reads an entry back with everything it points to
owned and no pointer taken from the file. Part 3 (xcl pipelines) compiles from it.
XCL_PSO_JOURNAL=0 turns it off.

It is on by default in this PR: per pipeline the journal costs an fnv64 of its desc and shader bytes, made with
no lock held, and for a new one an append under the journal's lock. The frame headers of earlier
runs (about 63 000 for a 123 MB journal) are read on a thread of its own; what the title notes
meanwhile waits in memory (each frame once, at most 256 MB) and is written once it is open. The
tool in part 3 has nothing to read without it. 605 lines (pso_journal.rs 597), about 150 of them the reader and the tests.

What is in it

  • the format, writer and reader, with a round-trip test that also checks that padding garbage
    gives the same hash (crates/xcl/src/hle/d3d12x/pso_journal.rs)
  • the calls in go_background (crates/xcl/src/hle/d3d12x/real.rs) and the module
    (crates/xcl/src/hle/d3d12x/mod.rs)
  • the heap-window flag of #680 kept in the top bit of a frame's windows byte (windows_byte,
    mem_windows_of), with a test

Tested

  • AMD Radeon RX 6700 XT (driver 32.0.21030.2001), Ryzen 5 3600, Windows 10 Pro 19045, rustc 1.100.0, release
  • c02d059 (opened on its own thread, the lock for appends only): cargo test -p xcl --lib -- pso_journal --test-threads=1: 3 passed, 0 failed, with the new what_is_noted_while_the_journal_opens_is_written_after_in_order; the run below opened a journal of 122 806 entries from earlier runs and appended to it
  • Rebased onto main 9e3831e: cargo test -p xcl --lib -- pso_journal --test-threads=1: 2 passed, 0 failed, with the new the_heap_windows_flag_is_kept (0cc1dee: since #680 mem_windows carries HEAP_WINDOWS = 0x100, which the frame's windows byte cut off; the count is now in its low 7 bits and the flag in the top bit). The workspace run below is from before the rebase, on f4ce27c
  • 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
  • a 60 s run of a retail title wrote 57 807 pipelines and 5 659 shaders
    (pipelines.bin: 123 MB)

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: c02d05921a5dae84d2607af4c61dc063d09ecdfb
gpu: AMD Radeon RX 6700 XT
title: RetailTitle
seconds: 60
exit: 0x0
frames shown: 384 (PresentX 385)
presents per 2 s (last 3): 0 16 61
device removals: 0
crashes: 0
peak commit: 19308 MB

The first smoke run on this commit crashed at 31.7 s in the title's own code (a write to 0, game_scarlett_master.exe+0x2215c35, during the Series S startup stall upstream still has); the run above, on the same build, is the re-run.

Not tested

  • a second title process at the same time (it gets no journal by design; not run)
  • NVIDIA, Intel, RDNA4

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.
<!-- greyfinch-sync:ivall/xcl:issue:5466228637 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/758). Originally posted by [ghost](https://github.com/ghost) on 2026-11-24T04:44:07Z. --- Part 2 of 3 for #755. Stacked on #757; its own commits are the four after #757's head (the journal, its write-error handling, the heap-window flag, the journal off the title's threads). Every pipeline with console shaders that goes to `pso_async` (DXIL not cached yet, or made lazily) is appended to `<data>\cache\pipelines.bin`. Each entry holds its desc field by field, with no pointers and no padding, so the same pipeline always hashes the same. It also holds the input layout and its shaders by hash (each shader written once), together with the run's memory windows. A pipeline's first build is marked as used. On open, only the frames' headers are read to skip entries of earlier runs, and a torn last frame is cut off. One title process writes at a time; a second one gets no journal. `replay` reads an entry back with everything it points to owned and no pointer taken from the file. Part 3 (`xcl pipelines`) compiles from it. `XCL_PSO_JOURNAL=0` turns it off. It is on by default in this PR: per pipeline the journal costs an fnv64 of its desc and shader bytes, made with no lock held, and for a new one an append under the journal's lock. The frame headers of earlier runs (about 63 000 for a 123 MB journal) are read on a thread of its own; what the title notes meanwhile waits in memory (each frame once, at most 256 MB) and is written once it is open. The tool in part 3 has nothing to read without it. 605 lines (`pso_journal.rs` 597), about 150 of them the reader and the tests. **What is in it** - the format, writer and reader, with a round-trip test that also checks that padding garbage gives the same hash (`crates/xcl/src/hle/d3d12x/pso_journal.rs`) - the calls in `go_background` (`crates/xcl/src/hle/d3d12x/real.rs`) and the module (`crates/xcl/src/hle/d3d12x/mod.rs`) - the heap-window flag of #680 kept in the top bit of a frame's windows byte (`windows_byte`, `mem_windows_of`), with a test **Tested** - AMD Radeon RX 6700 XT (driver 32.0.21030.2001), Ryzen 5 3600, Windows 10 Pro 19045, rustc 1.100.0, release - c02d059 (opened on its own thread, the lock for appends only): `cargo test -p xcl --lib -- pso_journal --test-threads=1`: 3 passed, 0 failed, with the new `what_is_noted_while_the_journal_opens_is_written_after_in_order`; the run below opened a journal of 122 806 entries from earlier runs and appended to it - Rebased onto `main` 9e3831e: `cargo test -p xcl --lib -- pso_journal --test-threads=1`: 2 passed, 0 failed, with the new `the_heap_windows_flag_is_kept` (0cc1dee: since #680 `mem_windows` carries `HEAP_WINDOWS` = 0x100, which the frame's windows byte cut off; the count is now in its low 7 bits and the flag in the top bit). The workspace run below is from before the rebase, on f4ce27c - `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 - a 60 s run of a retail title wrote 57 807 pipelines and 5 659 shaders (`pipelines.bin`: 123 MB) **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: c02d05921a5dae84d2607af4c61dc063d09ecdfb gpu: AMD Radeon RX 6700 XT title: RetailTitle seconds: 60 exit: 0x0 frames shown: 384 (PresentX 385) presents per 2 s (last 3): 0 16 61 device removals: 0 crashes: 0 peak commit: 19308 MB ``` The first smoke run on this commit crashed at 31.7 s in the title's own code (a write to 0, `game_scarlett_master.exe+0x2215c35`, during the Series S startup stall upstream still has); the run above, on the same build, is the re-run. **Not tested** - a second title process at the same time (it gets no journal by design; not run) - NVIDIA, Intel, RDNA4 **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.
futurepro62 commented 2026-11-24 07:06:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T07:06:01Z.


Full-suite run, since this PR has no test report yet. Tested exact head b617c88 (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: 702 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.

Not tested

  • AMD, 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.
<!-- greyfinch-sync:ivall/xcl:comment:7124615286 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/758#issuecomment-7124615286). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T07:06:01Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `b617c88` (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`: **702 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`. **Not tested** - AMD, 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.
DavidM1911 commented 2026-11-25 12:06:16 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T11:16:20Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7160825082 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/758#issuecomment-7160825082). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T11:16:20Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
KDenKC commented 2026-11-27 14:34:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-27T14:34:37Z.


@oishigeso, a use for this journal: because it records each description when the title creates the pipeline (go_background), one short run captures pipelines the title only builds minutes later. Fed into #2829's offline corpus, that removed a 135-pipeline graphics compile wall in an in-title A/B (135 of 135 from blobs, against 0 of 135): https://github.com/xcl-dev/xcl/issues/2088#issuecomment-7220952941

Two gaps we noted for that use, if you revisit it: G frames carry no depth-bounds flag (#2829 keys depth-bounds variants separately), and two-pass mesh (OwnedDesc::Stream) isn't journaled. Neither mattered for these 135.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:ivall/xcl:comment:7220958561 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/758#issuecomment-7220958561). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-27T14:34:37Z. --- @oishigeso, a use for this journal: because it records each description when the title creates the pipeline (`go_background`), one short run captures pipelines the title only builds minutes later. Fed into #2829's offline corpus, that removed a 135-pipeline graphics compile wall in an in-title A/B (135 of 135 from blobs, against 0 of 135): https://github.com/xcl-dev/xcl/issues/2088#issuecomment-7220952941 Two gaps we noted for that use, if you revisit it: `G` frames carry no depth-bounds flag (#2829 keys depth-bounds variants separately), and two-pass mesh (`OwnedDesc::Stream`) isn't journaled. Neither mattered for these 135. AI use: Claude Code (Claude Opus 5.5).
Foniass commented 2026-12-01 04:04:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:04:42Z.


Triage (#1607) – head c02d059

Part 2 of the #755 stack: stacked on #757, with #759 and #898 on top of it. Not a duplicate. Its own commits add pso_journal.rs and the journal call in go_background.
Overlap with main: gfx_records.rs (773f028, used-graphics-pipelines.bin) already records each graphics pipeline's desc, input layout and shader keys at first use, for the preparation before the next launch. That is a second on-disk pipeline record in another format. This journal also covers compute and not-yet-used queued pipelines, and keeps the shader bytes. The PR should say why both are needed. #898 changes this journal's U mark from "built" to "first bound", which is what main's gfx_records does.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7300356039 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/758#issuecomment-7300356039). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T04:04:42Z. --- **Triage (#1607)** – head c02d059 Part 2 of the #755 stack: stacked on #757, with #759 and #898 on top of it. Not a duplicate. Its own commits add `pso_journal.rs` and the journal call in `go_background`. Overlap with main: `gfx_records.rs` (773f028, `used-graphics-pipelines.bin`) already records each graphics pipeline's desc, input layout and shader keys at first use, for the preparation before the next launch. That is a second on-disk pipeline record in another format. This journal also covers compute and not-yet-used queued pipelines, and keeps the shader bytes. The PR should say why both are needed. #898 changes this journal's `U` mark from "built" to "first bound", which is what main's `gfx_records` does. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!753
No description provided.