Skip to content

D3D12.X: journal a pipeline when the title first binds it - #898

Open
JFyuhong wants to merge 4 commits into
xcl-dev:mainfrom
JFyuhong:codex/record-pipeline-on-bind
Open

JFyuhong wants to merge 4 commits into
xcl-dev:mainfrom
JFyuhong:codex/record-pipeline-on-bind

Conversation

@JFyuhong

@JFyuhong JFyuhong commented Nov 24, 2026 •

Copy link
Copy Markdown

Stacked on #758. Only the top commit dc4300da36da belongs to this PR.

The journal's U record determines which queued pipeline an offline compiler should prepare first. #758 emits it when a build succeeds. That gives speculative preloads priority and loses a requested pipeline when the title exits during its build.

What is in it

  • Carry the descriptor hash from real::go_background to pso_async::Pending and record demand once, before the first bind starts or waits for a build. The on-disk format stays compatible. Existing journals retain the meaning of marks their older writers already emitted.

Tested

  • Windows 11 build 26300, Core i7-14650HX, 32 GB RAM, GeForce RTX 4060 Laptop 8 GB, driver 616.92, Rust 1.93.1 MSVC, DXC 1.8.2502.11. Debug tests and release title runs.
  • cargo test -p xcl --lib bind_journal_tests -- --nocapture with the new cases on the old writer: 0 passed, 4 failed. On this patch: 4 passed, 0 failed, 0 ignored. Cases exercise failed builds, in-flight builds, eager work and historical speculative preloads.
  • cargo build --workspace and cargo test --workspace --no-fail-fast -- --test-threads=4: D3D12.X: a journal of the pipelines a title queues (<data>\cache\pipelines.bin) #758 parent b617c88: Cargo reported 702 passed, 0 failed, 41 ignored. Of the reported passes, 2 skipped GPU execution. PR head: Cargo reported 706 passed, 0 failed, 41 ignored. Of the reported passes, 2 skipped GPU execution. The same two tests, gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware, require wave64.
  • Retail 1.0.2.1, offline, release xcl run, matched saved profile, 51 previously used shader sets and a fresh pipeline journal per run. On the parent, 43/47 newly bound, single-descriptor compute shader sets carried a use marker. The first parent run stopped in the display driver before the title screen and is excluded from this comparison. On the patched writer, 46/46 newly bound compute sets were marked. Each of the 6 newly bound graphics shader sets had a marked descriptor (6 of 208 recorded variants). Its last sampled image was loading artwork and the title still exited at +0x23cf683.
  • cargo build --release --locked -p xcl and scripts/smoke.ps1 -Game <read-only retail executable> -Seconds 60 on both clean commits.

Regression run

Main:

xcl-smoke v1
commit: 1ec4c98cda119432a4b3f205e146fba2d6f8379a
gpu: NVIDIA GeForce RTX 4060 Laptop GPU
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 472 (PresentX 472)
presents per 2 s (last 3): 21 21 18
device removals: 0
crashes: 0
peak commit: 15250 MB

PR head:

xcl-smoke v1
commit: dc4300da36dac7bc39ac69744af617c0214390c0
gpu: NVIDIA GeForce RTX 4060 Laptop GPU
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 478 (PresentX 478)
presents per 2 s (last 3): 22 22 21
device removals: 0
crashes: 0
peak commit: 15253 MB

Not tested

  • AMD and Intel GPUs, other titles, or playable world rendering. This change records demand for future compilation. Its effect on frame time was not measured.

AI use

  • OpenAI Codex (GPT-6) traced the journal behavior, implemented the change and its regression tests, ran the Windows tests and retail experiments, and wrote this PR.

suppai-ringo and others added 4 commits November 23, 2026 20:06
…tion

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 <noreply@anthropic.com>
…lines.bin)

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 <noreply@anthropic.com>
…al for the run

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 <noreply@anthropic.com>
A successful background build can be speculative. Conversely, a title that exits while waiting for a requested pipeline leaves no use record for the next run. Record the exact descriptor before resolving its stand-in, preserving shader-set tracking and the existing journal format.

Assisted-by: Codex (GPT-6)
@JFyuhong
JFyuhong marked this pull request as ready for review November 24, 2026 08:14
@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 datapoint.

Merged state: head dc4300d onto main 09940bb, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 714 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. pipeline journaling tests green.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. My Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

@Aruku448

Copy link
Copy Markdown

Tested #758 + #898 on a retail title (1.0.2.1, RX 7800 XT 16 GB, Ryzen 7 5700X3D, 32 GB, Windows 11, xcl 930e8b4 + #758's three commits + this one, MSVC release). The journal works; it does not move the load stall yet. Numbers, in case they help:

  • Run 1 (no journal): pipeline journal: …\cache\pipelines.bin (0 entries from earlier runs); at the end the file is 127,914,049 bytes (122 MB).
  • Run 2: (65,948 entries from earlier runs) — 65,948 pipelines the title really bound.
  • Consumption: with XCL_PSO_PRELOAD=0 the journal is not consumed at all (expected — it feeds the preload queue). With preload on (default) the run still shows 0 presents, 0 draws at 118 s: ordering alone does not help, because throughput is the wall.
  • The xcl pipelines command the journal line mentions does not exist in this build: xcl pipelines --help prints the general usage, and there is no pipelines subcommand in the source of this stack. Is that CLI part of a follow-up PR?
  • 10 compile threads (XCL_PIPELINE_THREADS=10) with the journal loaded gives the same shape as 4 or 6: a first interval with ~1,039 draws / 7,564 dispatches, then 0x887a0006. Host commit reached 30,986 MB of 32 GB, so there is not much headroom to raise it further.

The wall on this title: loading needs ~10 pipelines at once, one big translated program takes 16–50 s of driver time on this card (862820 B DXIL → 49,947 ms), and the title's own watchdog fires 30 s after it stops getting GPU progress (+0x23cf683, "GPU Loc Sig", see #505).

What does get the world drawing here: XCL_PSO_WAIT_MS=50 with a warm driver cache — 1,096 draws / 7,707 dispatches in one 2 s interval before 0x887a0006. That is the best this machine reaches, and it matches what @Sr-0w reported in #891.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants