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

Open
opened 2026-11-24 04:43:47 +00:00 by oishigeso · 2 comments
oishigeso commented 2026-11-24 04:43:47 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by oishigeso on 2026-11-24T04:43:47Z.


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).

<!-- greyfinch-sync:ivall/xcl:issue:6574788606 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/755). Originally posted by [oishigeso](https://github.com/oishigeso) on 2026-11-24T04:43:47Z. --- **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 commented 2026-11-24 07:06:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by oishigeso on 2026-11-24T06:06:50Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7123597305 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/issues/755#issuecomment-7123597305). Originally posted by [oishigeso](https://github.com/oishigeso) on 2026-11-24T06:06:50Z. --- 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.
Royalflamejlh commented 2026-12-01 03:06:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-01T03:06:40Z.


A Linux data point for building in another process (NVIDIA 615.71.09, RTX 4060 Ti 16 GB, Wine 11.21 Staging, vkd3d-proton master 71cae091 with local patches): the title did not find another process's driver compiles through the driver's disk cache, and did find them when they came as XCL's driver blobs.

The driver keeps one disk-cache file per process and a process reads only its own (a small Vulkan test: 10.1 s again from another process's file, 4 ms from its own; 1 run each). Two title runs on a driver cache folder with no file of the title's had 25 % then 83 % of their large compiles under 0.3 s after the 16-worker launch pass, and 26 % then 80 % with XCL_PREPARE=0. With VKD3D_CONFIG=pipeline_library_app_cache,no_descriptor_heap vkd3d-proton's blobs hold the driver's data, and 173 of 176 and 178 of 181 large compute compiles with a blob supplied took under 0.3 s in the title (2 runs; 63 of 116 with the first setting alone, 1 run with the driver's disk cache on and warm). The details are in #2003 and #3067.

Not tested: Windows, AMD, xcl pipelines itself (#759).

AI use: Claude Code (Claude Fable 5.2) made the runs and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7299334710 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/755#issuecomment-7299334710). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-12-01T03:06:40Z. --- A Linux data point for building in another process (NVIDIA 615.71.09, RTX 4060 Ti 16 GB, Wine 11.21 Staging, vkd3d-proton `master` `71cae091` with local patches): the title did not find another process's driver compiles through the driver's disk cache, and did find them when they came as XCL's driver blobs. The driver keeps one disk-cache file per process and a process reads only its own (a small Vulkan test: 10.1 s again from another process's file, 4 ms from its own; 1 run each). Two title runs on a driver cache folder with no file of the title's had 25 % then 83 % of their large compiles under 0.3 s after the 16-worker launch pass, and 26 % then 80 % with `XCL_PREPARE=0`. With `VKD3D_CONFIG=pipeline_library_app_cache,no_descriptor_heap` vkd3d-proton's blobs hold the driver's data, and 173 of 176 and 178 of 181 large compute compiles with a blob supplied took under 0.3 s in the title (2 runs; 63 of 116 with the first setting alone, 1 run with the driver's disk cache on and warm). The details are in #2003 and #3067. Not tested: Windows, AMD, `xcl pipelines` itself (#759). AI use: Claude Code (Claude Fable 5.2) made the runs and wrote this.
Sign in to join this conversation.
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#750
No description provided.