Compile a title's queued pipelines outside the title (xcl pipelines) #755

Open
opened 2026-11-26 04:31:27 +00:00 by github-bot · 1 comment
Owner

@⁠oishigeso on GitHub · 2026-11-24 04:43 UTC · original

Problem. A retail title queues ~58 000 pipelines with console shaders in its first minute
(pso_async, lazy). Every one is translated, compiled by DXC and then by the driver inside the
title's process, at the latest when the title first binds it. #690 builds the pipelines an
earlier run used ahead of their first use, and #634 keeps compute blobs on disk. Both of those
work inside the title, from the second run on, and only for pipelines already used.
xcl shaders --precompile [--pipelines] covers single programs and compute pipelines from a
shader package, but not the graphics pipelines (VS + PS + state, input layout, target formats)
the title creates. Those are only known at run time.

Proposal. The title writes the pipelines it queues to a journal
(<data>\cache\pipelines.bin). A new command, xcl pipelines <game> [--watch], makes them in
its own process: before the next run, or next to a running title. It fills the DXIL cache, the
driver's cache and #634's driver_cache, so neither the title's process nor its threads do that
work, including for pipelines no run has used yet.

Three stacked PRs:

  1. prep_graphics: the PC desc of a translated VS / PS pipeline in its own function (no change
    in behaviour).
  2. The journal: each desc field by field, its input layout, and its shaders by hash (each once),
    with the run's memory windows; pipelines the title built are marked as used. It is
    append-only, written by one title process at a time; XCL_PSO_JOURNAL=0 turns it off.
  3. xcl pipelines: makes each pipeline on its own device as the title would (the title's
    adapter, the used ones first), at below-normal priority on half the cores. It can be resumed,
    and failures are retried. GS / HS / DS and mesh pipelines are left to the title.

Measured (RX 6700 XT, retail title, 60 s smoke runs, each with its own empty DXIL cache):

  • 60 s run: the title queued 57 798 pipelines from 5 651 shaders (journal 123 MB).
  • Run A with an empty DXIL cache: the title compiled 4 programs itself. Then xcl pipelines for
    8 min into another empty cache. Run B with only that cache: 4 hits, 0 compilations in the
    title
    . (Few in absolute terms: the title builds lazily, and 60 s ends in its loading screen.)
  • Smoke runs, main and the stack: exit 0x0, no crash or device removal, 395 / 479 frames.

Is this a direction you would take? The three PRs are open as drafts (#757, #758 and #759, stacked in that order) and wait for your answer here. Written with Claude Code (Claude Opus 5.5).

**@⁠oishigeso** on GitHub · 2026-11-24 04:43 UTC · [original](https://github.com/xcl-dev/xcl/issues/755) **Problem.** A retail title queues ~58 000 pipelines with console shaders in its first minute (`pso_async`, lazy). Every one is translated, compiled by DXC and then by the driver inside the title's process, at the latest when the title first binds it. #690 builds the pipelines an earlier run *used* ahead of their first use, and #634 keeps compute blobs on disk. Both of those work inside the title, from the second run on, and only for pipelines already used. `xcl shaders --precompile [--pipelines]` covers single programs and compute pipelines from a shader package, but not the graphics pipelines (VS + PS + state, input layout, target formats) the title creates. Those are only known at run time. **Proposal.** The title writes the pipelines it queues to a journal (`<data>\cache\pipelines.bin`). A new command, `xcl pipelines <game> [--watch]`, makes them in its own process: before the next run, or next to a running title. It fills the DXIL cache, the driver's cache and #634's `driver_cache`, so neither the title's process nor its threads do that work, including for pipelines no run has used yet. Three stacked PRs: 1. `prep_graphics`: the PC desc of a translated VS / PS pipeline in its own function (no change in behaviour). 2. The journal: each desc field by field, its input layout, and its shaders by hash (each once), with the run's memory windows; pipelines the title built are marked as used. It is append-only, written by one title process at a time; `XCL_PSO_JOURNAL=0` turns it off. 3. `xcl pipelines`: makes each pipeline on its own device as the title would (the title's adapter, the used ones first), at below-normal priority on half the cores. It can be resumed, and failures are retried. GS / HS / DS and mesh pipelines are left to the title. **Measured** (RX 6700 XT, retail title, 60 s smoke runs, each with its own empty DXIL cache): - 60 s run: the title queued 57 798 pipelines from 5 651 shaders (journal 123 MB). - Run A with an empty DXIL cache: the title compiled 4 programs itself. Then `xcl pipelines` for 8 min into another empty cache. Run B with only that cache: 4 hits, **0 compilations in the title**. (Few in absolute terms: the title builds lazily, and 60 s ends in its loading screen.) - Smoke runs, `main` and the stack: exit 0x0, no crash or device removal, 395 / 479 frames. Is this a direction you would take? The three PRs are open as drafts (#757, #758 and #759, stacked in that order) and wait for your answer here. Written with Claude Code (Claude Opus 5.5).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:31:27 +00:00
Author
Owner

@⁠oishigeso on GitHub · 2026-11-24 06:06 UTC · original

A fuller measurement, as the first one counted only the 4 programs a 60 s run compiles before its loading screen.

For it, a local build of #759's head adds a read-only counter (XCL_PSO_PROBE, not part of the PRs): on a thread of its own it checks, for every pipeline the title hands to pso_async, whether its DXIL is already in the cache as the title would ask for it (same device, memory windows and wave width), without compiling anything. RX 6700 XT, Series S profile, a fresh data folder and DXIL cache per run, 60 s each:

probe: pipelines checked found in cache title's own DXC compilations frames crashes
Run A, empty cache 35 000 (still checking at 60 s) 0 4 662 0
xcl pipelines, title closed, 10 min 51 210 of the journal's 57 156 made
Run B, only the tool's cache 50 562 (all, done at 33 s) 50 562 (100 %) 0 717 0
  • The tool ran standalone at below-normal priority on 6 of 12 threads; it was stopped after 10 min, and a second start resumed with 51210 done before.
  • Every pipeline run B queued had its DXIL ready; the title compiled nothing itself.
  • Not shown here: driver-blob reuse (the driver's own cache is opaque), world loading (both runs end at the menu), and --watch next to a running title.

Written with Claude Code (Claude Opus 5.5); the runs were made on my PC.

**@⁠oishigeso** on GitHub · 2026-11-24 06:06 UTC · [original](https://github.com/xcl-dev/xcl/issues/755#issuecomment-7123597305) A fuller measurement, as the first one counted only the 4 programs a 60 s run compiles before its loading screen. For it, a local build of #759's head adds a read-only counter (`XCL_PSO_PROBE`, not part of the PRs): on a thread of its own it checks, for every pipeline the title hands to `pso_async`, whether its DXIL is already in the cache as the title would ask for it (same device, memory windows and wave width), without compiling anything. RX 6700 XT, Series S profile, a fresh data folder and DXIL cache per run, 60 s each: | | probe: pipelines checked | found in cache | title's own DXC compilations | frames | crashes | |---|---:|---:|---:|---:|---:| | Run A, empty cache | 35 000 (still checking at 60 s) | 0 | 4 | 662 | 0 | | `xcl pipelines`, title closed, 10 min | 51 210 of the journal's 57 156 made | | | | | | Run B, only the tool's cache | 50 562 (all, done at 33 s) | **50 562 (100 %)** | **0** | 717 | 0 | - The tool ran standalone at below-normal priority on 6 of 12 threads; it was stopped after 10 min, and a second start resumed with `51210 done before`. - Every pipeline run B queued had its DXIL ready; the title compiled nothing itself. - Not shown here: driver-blob reuse (the driver's own cache is opaque), world loading (both runs end at the menu), and `--watch` next to a running title. Written with Claude Code (Claude Opus 5.5); the runs were made on my PC.
This discussion has been locked. Commenting is limited to contributors.
No description provided.