Skip to content

Shaders: save offline compute pipelines to the runtime driver cache - #744

Merged
ivall merged 2 commits into
xcl-dev:mainfrom
CallMeBrado:perf/offline-compute-driver-cache
Nov 24, 2026
Merged

ivall merged 2 commits into
xcl-dev:mainfrom
CallMeBrado:perf/offline-compute-driver-cache

Conversation

@CallMeBrado

Copy link
Copy Markdown
Contributor

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

Running xcl shaders --precompile --pipelines built compute pipelines and then dropped the driver's compiled blobs. The next XCL process had no file to hand back to the driver. This saves those blobs using the runtime cache from #634. I ran into this while investigating #505.

What is in it

  • The offline compiler tries the saved blob for the same DXIL and pipeline flags. If the driver refuses it, XCL builds from DXIL and saves the replacement through the existing cache writer. XCL_PSO_DISK_CACHE=0 disables both reads and writes.
  • The CLI reports how many pipelines the driver accepted from disk. The regression test runs separate CLI processes on a synthetic shader and covers a disabled cache, a warm cache, and an invalid blob.

Tested

  • Windows 11 build 26200, Ryzen 9 9950X3D, RTX 5090, driver 621.24, Rust 1.96.0, release.
  • Six compute shaders, two CLI processes per build, each build starting with an empty XCL cache. Main made all six pipelines and left zero driver blobs. This branch wrote six files (37,788 bytes total), then loaded all six from disk with zero refusals.
  • cargo build --locked --release --workspace --jobs 4 passed. cargo test --locked --release --workspace --jobs 4 --no-fail-fast -- --test-threads=4 --show-output reported 704 passed, 0 failed, 41 ignored. Two GPU tests reported SKIPPED for missing native wave64 and one for missing xgameruntime.dll.

Regression run

Main

xcl-smoke v1
commit: f4ce27ceb6d1b0576d0c659b713b674778bf1968
gpu: NVIDIA GeForce RTX 5090
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1000 (PresentX 1000)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15137 MB

This branch

xcl-smoke v1
commit: 07c535d85dbf084ed6692cbd851744986483e6f3
gpu: NVIDIA GeForce RTX 5090
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 1020 (PresentX 1020)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15147 MB

Not tested

AMD and Intel GPUs. The 60-second game runs stayed at startup. I haven't measured a load-time improvement or seen this change take the game past its loading screen.

AI use

Codex (GPT-6) wrote the change and test, ran the checks on my PC, and drafted this description.

Prime1997 and others added 2 commits November 23, 2026 19:58
The per-process staging pathname was shared by concurrent writes of one key.
A writer paused after opening it could resume after another writer renamed
that file into the cache, changing successfully published bytes through its
older handle.

Create an exclusive sibling file for each invocation using the process ID
and an atomic sequence. Skip occupied names left by an earlier process and
clean up only a staging file this invocation actually created.

A deterministic Windows regression holding the real staging helper's open
handle fails with the old writer and passes with this change. Focused Cargo
writer tests: 4 passed, 0 failed, 0 ignored. Full GPU suite and retail smoke
have not been run for this commit.

Assisted-by: Codex (GPT-6, exact variant not exposed)
An offline build created compute pipelines but dropped the driver blobs. Save them under the same DXIL and flags key used at runtime. Retry a rejected blob without cached data, and report how many pipelines the driver accepted from disk.

Assisted-by: Codex (GPT-6)
@anes66

anes66 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Verified 07c535d85dbf084ed6692cbd851744986483e6f3 on Windows 10 Pro 19045, Ryzen 7 9800X3D, RTX 3060 12 GB / 32.0.16.2114, Rust 1.100.0 MSVC, DXC 1.9.2602.17, Agility SDK 1.620.2, debug.

Tested

  • cargo build --locked --workspace -j 4: passed.
  • cargo test --locked --workspace --no-fail-fast -j 4 -- --test-threads=4 --show-output: 704 passed, 0 failed, 41 ignored, exit 0.
  • Two GPU tests reported SKIPPED (no native wave64). All sample variables were unset; the passed count includes skips and sample-gated early returns.

I also checked the cache's intended consumer, beyond the existing CLI-to-CLI test. 6880f7c adds 17 test-only lines directly on this head. A fresh child process opens the CLI's cache, creates the console pipeline through the runtime hook, and reuses the existing GPU dispatch/readback checks for all 768 threads. It must also report a runtime driver-blob hit, so successful recompilation alone cannot satisfy the test.

The extended focused test passed. As a negative control, disabling only the child's PSO disk cache left its shader execution passing but failed the new reuse assertion. That temporary change was restored. The full four-thread workspace suite with the extension passed 704/0/41, with the same two skips; the tested patch was committed unchanged.

Not tested
Retail title smoke runs, load-time improvements, large retail compute shaders, release builds, AMD/Intel or native-wave64 hardware. The cross-process test demonstrates reuse for this synthetic program, not a gameplay improvement.

AI use
Codex (GPT-6; exact variant unavailable) reviewed the changes, wrote the test extension, ran the tests and negative control, and drafted this report.

@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 07c535d85dbf084ed6692cbd851744986483e6f3 on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, mesh shaders), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 704 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 662 passed, 0 failed, 21 ignored
  • 0 SKIPPED; offline_compute_pipeline_is_reused_by_a_second_process, an_overlapping_writer_cannot_modify_the_published_blob and an_abandoned_staging_file_is_skipped_and_preserved pass.

Review: Keying the file by DXIL and pipeline flags (driver_cache::path(&dxil, flags)) is better than the DXIL alone (my note on #634). The root signature is still not part of the key: if the one the offline compiler builds with differs from the one the title uses, the driver refuses the blob and the pipeline is built and saved again, which wastes the offline work rather than breaking anything. Reviewed only the top commit, as the description asks (stacked on #714).

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@JoaoPauluu

Copy link
Copy Markdown

Test report: #744 under Wine, with vkd3d-proton as the driver whose blobs are cached (Linux, NVIDIA)

The description's run is NVIDIA's Windows driver. Under Wine, the cached-pipeline blobs come from vkd3d-proton (D3D12 on Vulkan), a different implementation of GetCachedBlob / CachedPSO. The new test passes there: a second process is given its blob back, and an invalid blob still builds.

Setup

Result: gpu_compute_e2e test binary under Wine, --exact offline_compute_pipeline_is_reused_by_a_second_process: ok, in 2 of 2 runs (5.1 s and 4.9 s). That covers the disabled cache (no driver folder), the warm run (pipelines loaded from the driver cache 1, which the test asserts) and the invalid blob (pipelines made on the GPU 1, refused 0 still holds).

  • vkd3d-proton keeps a pipeline disk cache of its own as well (vkd3d_pipeline_library_init_disk_cache: Attempting to load disk cache from: vkd3d-proton.cache, in the working directory). So under Wine there are two caches. The test's assertions are on XCL's own counts, so they check XCL's cache, not vkd3d-proton's.

Not tested

AI use: Claude Code (Claude Opus 5.5) built the test, ran it on the machine above and wrote this report. The results and log lines are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.

@burber

burber commented Nov 24, 2026

Copy link
Copy Markdown

Same approach tried with the retail title's world compute programs on an RTX 4070 Ti: the title takes the offline blobs at its first bind

I tried the same idea on a local branch before seeing this PR: --precompile --pipelines keeps each build's driver blob through real::driver_cache, under the same DXIL + flags name. Here is what it did with the retail title. It should apply to this PR as well.

Setup: RTX 4070 Ti 12 GB (driver 32.0.16.1062), i5-13600K, Windows 11 26300, DXC 1.8.2502. main e915150 + #533 + #267 + #708 + #640, plus the precompile change. Title 1.0.2.1.

Offline: xcl shaders <shaders.rpf> --precompile --only cs --pipelines --pipeline-min-kb 256.

  • After ~40 min: 75 pipelines built, 63 blobs written.
  • 8 programs were skipped because the title itself had already written a blob under the same name in earlier runs. So the precompile's DXIL and file names match the title's.
  • Rate on this card: ~25 big pipelines per 6–10 min.

Then the title (world loading reached by ~75 s each run):

run 16 (no offline blobs) run 17 (99 blobs)
compute pipelines made from kept blobs — 32
"still building after 4000 ms" 13 12
watchdog (+0x23cf683) ~128 s ~145 s

The blobs are accepted in the title (0 refused). They don't clear the world load yet, because the programs that stall had not been reached by the precompile when I stopped it; it is running to completion now.

One suggestion: a size filter (I used --pipeline-min-kb) helps on NVIDIA. Every compute program is otherwise built, and only the ~256 KB+ ones take the driver seconds. #758 / #759's journal of a run's queued pipelines would target this even better.

Investigated with AI assistance; all numbers are from runs on my machine.

@mastrr9

mastrr9 commented Nov 24, 2026

Copy link
Copy Markdown

Independent native Windows NVIDIA RTX 5080 build/test run and code review at head 07c535d85dbf084ed6692cbd851744986483e6f3.

Code Review

  • Cleanly wires xcl shaders --precompile --pipelines into the runtime driver_cache (<DXIL cache>\driver\) and hardens driver_cache::write with unique create_new(true) staging files (tmp<pid>-<counter>) so overlapping writers and leftover staging files cannot corrupt published .pso blobs.
  • Tested corruption fallback (invalid cached pipeline) and cross-process reuse cleanly.

Tested

  • Environment: NVIDIA GeForce RTX 5080 (16 GB, wave32, driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09), DXC from Windows SDK 10.0.26100.0, debug build.
  • Command: cargo build --workspace && cargo test --workspace -- --test-threads=4
  • Result: 704 passed, 0 failed, 41 ignored (0 new warnings).
  • PR-specific tests (3/3 ok):
    • hle::d3d12x::real::driver_cache::tests::an_overlapping_writer_cannot_modify_the_published_blob
    • hle::d3d12x::real::driver_cache::tests::an_abandoned_staging_file_is_skipped_and_preserved
    • offline_compute_pipeline_is_reused_by_a_second_process (tests/gpu_compute_e2e.rs, executed on RTX 5080, not skipped)
  • SKIPPED (2):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64)
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)

Not tested

  • D3D12 debug layer, AMD/wave64 hardware, release build, and retail title load-time measurements.

AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the RTX 5080 workspace tests, and drafted this comment.

@mikkelpetersen

Copy link
Copy Markdown

@theaustinayers Can we get this merged too? Compiling the pipelines can take hours. Caching the blobs should speed up consecutive runs significantly.

@throny

throny commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

A full --precompile --only cs --pipelines of a retail pack with this PR on an RTX 4080: it keeps the blobs as described, but the pass does not get through the pack here. It stops advancing at one point and its memory grows without bound.

Tested

  • Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4080 16 GB (driver 610.88, 32-lane waves), Intel i9-12900K, 64 GB (commit limit about 68–77 GB); Rust 1.100.0 stable-x86_64-pc-windows-msvc; release. 07c535d merged onto main 077ce40 (clean merge).
  • xcl shaders <shaders.rpf> --precompile --only cs --pipelines (26 503 records; 4 memory windows, split wave64), DXIL and driver caches of the title's earlier runs present (369 driver blobs).
pass XCL_DXC_THREADS / XCL_PIPELINE_THREADS what happened
1 12 / 3 22 600 of 26 503 records after 1 610 s, 450 pipelines made, 0 refused, driver blobs 369 → 649. Then no further progress line for 25 minutes; the process was at 43.7 GB of commit and the machine had 0.5 GB of commit left when I killed it.
2 (resumed) 6 / 2 no progress line; 1 new blob; killed by my guard at 27.1 GB (free commit under 12 GB)
3 (resumed) 2 / 1 33 minutes, 32.8 CPU-minutes (one thread busy throughout), no new DXIL file and no new blob; 14.2 GB and still growing when I stopped it
  • So the blob writing works: 280 blobs written in pass 1, none refused.
  • What stops the pass is a single compile somewhere after record 22 600 that had not finished after 33 minutes on one thread and takes more memory the longer it runs. With several compile threads the same point takes 27–44 GB. The CLI prints no program name at that point, so I cannot say which program it is.
  • A title run against the cache as pass 1 left it (same build, world loading): the stop came at 111.2 s, as on main (107–118 s), with two compute pipelines built in a bind for the first time (9.7 s and 15.6 s). Whether those two are programs the pass had not reached or ones it built in another form, I have not determined.

Not tested

  • The test suite on this head; --only cs with a size filter; AMD.
  • A pass that skips the program in question (no option for it that I know of).

AI use

  • Claude Code (Claude Fable 5.2) read the diff, built the tree, ran the passes and wrote this report. Counts only, no game data.

@larelgit

Copy link
Copy Markdown

On the newer retail title's shader pack (RTX 5080): the blobs are kept and taken back as described, but a full --pipelines pass stops once the driver reaches the pack's biggest programs, as @throny saw on the RTX 4080. Stack samples of the stalled pass and a size cap that gets past it are below.

Tested

  • RTX 5080 16 GB (driver 610.88, 32-lane waves), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 Pro 22631, Rust 1.100.0, release. DXC 1.8.2502.11 (Windows SDK 10.0.26100).
  • Tree: main 6efdabc + this PR (07c535d, clean merge) + a local change that only deepens XCL's thread dumps. DXIL cache warm (all 2 689 compute programs of the pack precompiled earlier), 175 driver blobs from earlier title runs. For 2 and 3 also D3D12.X: the driver's blob of a slow graphics pipeline is kept on disk #902 (8427ced; one conflict in real.rs driver_cache, both sides kept, its 6 driver_cache tests pass) and the local cap below.

1. Full pass: xcl shaders <shaders.rpf> --precompile --only cs --pipelines (XCL_PIPELINE_THREADS unset = 4)

  • 22 200 / 26 503 records after 5 s, 125 pipelines after ~2.5 min, 0 refused, driver blobs 175 → 292.
  • Then no new pipeline or blob for 4+ min. The process used 0.0–0.2 cores while its private bytes grew from ~3 GB to 11.4 GB (~30 MB/s, ~4 500 page faults/s). I stopped it.
  • Two stack samples of every thread, 60 s apart (dbghelp, one thread suspended at a time): the 4 compile threads were in nvgpucomp64.dll → RtlAllocateHeap / RtlReAllocateHeap / RtlFreeHeap → RtlEnterCriticalSection, waiting. The other 9 workers waited in Pipelines::make for a compile slot. No thread was running. In the second sample, two of the four were in a different heap call, so the lock still changed hands, slowly.
  • Sizes: of the 2 714 compute programs in the DXIL cache, 6 are 4 MB or more (29.1, 28.9, 13.8, 5.5, 5.3 and 5.2 MB) and 521 are 1–4 MB. In three title runs here (124–177 s, world loading reached), the biggest compute program built at run time was 709, 809 and 255 KB of DXIL; D3D12.X: pipelines an earlier run used are built ahead of their first use #690 also preloaded programs of 0.9–1.7 MB that earlier runs had used. None of the six over 4 MB showed up.

2. Pass with the biggest programs left out (a local 6-line filter, XCL_PIPELINE_MAX_KB=1024, not part of this PR; XCL_PIPELINE_THREADS=2)

  • No stall: private bytes stayed at 1.1–1.4 GB. After 2 088 s: 650 pipelines made, 14 programs left out by the cap, driver blobs 292 → 715. I stopped it there, so it did not reach the whole pack.
  • Slow all the way: 408 s of CPU in 2 088 s (0–1.6 busy cores, about 3.2 s per pipeline).

3. The title on the cache from pass 2 (XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_WAIT_MS=50, one run each)

run tree driver blobs at start compute pipelines from a blob / all built at run time ≥ 1 s (build time) dispatches skipped end
before 6efdabc (+ deeper dumps) 148 134 / 311 16 (142 s) 3 979 of 49 652 title crash at 124 s
after + this PR + #902 715 363 / 494 26 (306 s) 4 096 of 69 010 +0x23cf683 at 177 s
  • The 363 blob loads took 8.4 s together (23 ms each on average).
  • The title got further and asked for programs the stopped pass had not reached: 26 compute builds of 1 s or more at run time, the longest 17.9 s (252 KB of DXIL).
  • Most of the remaining skips are draws (19 525 of 24 600), which this PR does not cover.
  • The two runs differ in more than the cache (tree, how far the title got), so the end times say little about this PR.

Not tested

AI use: Claude Code (Claude Opus 5.5) ran the passes and the title runs, sampled the stacks and wrote this report. Counts, sizes and XCL's own function names only.

@ivall
ivall merged commit 6cef69f into xcl-dev:main Nov 24, 2026
1 check passed
@ivall

ivall commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Merged (with #714's commit under it) in 6cef69f – thanks, and thanks to everyone who tested it. It closes a gap in the runtime: without a kept blob a big pipeline counts as not built, and its background build waits for the slot and the commit for big builds even when the driver already has the code.

Tested on the tree that went to main (this PR and three commits on pipeline and shader compiles): cargo test --workspace --no-fail-fast -- --test-threads=4: 749 passed, 0 failed, 41 ignored, no SKIPPED; a retail title, 50 s at its menu without input: exit 0, no crash, no device removal.

Not tested: a full --precompile --pipelines pass over a retail pack with the PR. The stalls reported above are at the pack's few programs of 5 MB of DXIL and more; a size limit for that pass would be a welcome follow-up.

@pr1sm-dev

Copy link
Copy Markdown

Test report: blobs written by xcl shaders --pipelines are refused by the title when it passes a non-zero NodeMask

Tested 07c535d cherry-picked onto main 6efdabc, with other open PRs applied (#688, #793, #1045, #1123) and local changes. Linux, Wine 11.22, vkd3d-proton master 30b0eb9b, RTX 3070 8 GB (driver 595.91.07), Ryzen 7 5800X, a retail title.

What happens. After a precompile pass the title creates the same compute pipelines again. XCL logs a driver blob kept on disk was refused and removes the files (1,034 → 762 during one run). Compute pipelines made from blob files fell from 132 in a run before the pass to 15 in the run after it, because the tool had also replaced blobs the title had written itself.

Cause. With VKD3D_DEBUG=warn, vkd3d-proton reports d3d12_cached_pipeline_state_validate: PSO compatibility hash mismatch. For a compute pipeline that hash covers only node_mask and flags (libs/vkd3d/cache.c). The title's D3D12_COMPUTE_PIPELINE_STATE_DESC has NodeMask = 1; Pipelines::make leaves it at 0. The blob file name covers the DXIL and Flags, so both forms share one file and each side refuses the other's.

Check. Blob folder emptied, the tool alone run for 150 s (273 blobs), then two 25 s runs of the title on exactly those files:

title build "PSO compatibility hash mismatch" lines compute pipelines made from blobs blob files after the run
as in this PR (title's mask 1) 157 0 116
translated_compute_pso creates the pipeline with NodeMask = 0 0 158 273

So setting the mask to 0 on the title's side (one adapter) makes the tool's blobs usable here. Not tried: having the tool use the title's mask, or putting the mask into the file name.

Not tested. Windows, AMD, graphics pipelines, a native D3D12 driver (the check above is vkd3d-proton's; I do not know whether Windows drivers compare the mask), and a full run after a complete pass with the change.

Written with Claude Code (Claude Fable 5.2); the runs and logs are from the machine above.

@ArturoWolff

ArturoWolff commented Nov 24, 2026 •

Copy link
Copy Markdown

Linux / RTX 4060 positive control for the NodeMask report above: with default NodeMask = 0 and flags 0, a fresh D3D12.X runtime process accepted an offline-created compute pipeline above the 256 KiB threshold, dispatched it, and produced the expected output. I did not test mask 1; this does not contradict the RTX 3070 retail result.

Clean main 930e8b49c1c2ec683d22c724a398b39111cd0e56; Ryzen 5 5600, RTX 4060 8 GB, NVIDIA 620.73.04, GE-Proton11-14 with patched vkd3d-proton 3.1.0, DXC 1.9.2609.5. Stock CLI and runtime library; test-only synthetic shader and hook harness, no title data.

  • xcl.exe shaders input --precompile --only cs --windows 4 --split 1 --pipelines, one shader and one worker. DXIL container 286,200 B, executable bitcode 283,768 B, separate driver blob 112 B. Cold CLI: 1 made, 0 refused, 0 loaded from driver cache. Fresh warm CLI: 1 made, 0 refused, 1 loaded.
  • In a third process the real CreateComputePipelineState hook reported 1 on-disk hit, then dispatched the same input. 1,536/1,536 GPU readback words matched the CPU calculation, including the cross-wave shared-memory values. Exact hook test: console_wave64_compute_through_the_pso_hook_dispatch_and_read_back --exact --nocapture --test-threads=1, 1 passed / 0 failed / 0 ignored / 0 skipped / 1 filtered. The input, DXIL and blob hashes matched across the processes.
  • One useful setup trap: an earlier one-window offline translation hit in the CLI, but produced different DXIL from the four-window runtime translation. The hook's dispatch still passed, without the intended disk hit. Checking both the runtime cache counter and the readback caught it.

This demonstrates acceptance and correct execution for this configuration, not a speedup, lower-layer cache independence, or retail progress. No native Windows or full-suite run. AI use: Hermes Agent, gpt-6.2-astra, extended the fixture, ran the tests and checked the logs.

Follow-up: accepted blob vs actual driver reuse. Following the RTX 3070 and 5070 Ti reports, I decoded the original 112-byte blob above against this vkd3d-proton build's cache.c: a 48-byte header, one 8-byte chunk header and 56 bytes of PSO compatibility data. No SPIR-V or Vulkan pipeline-cache payload. The earlier hook result still establishes acceptance + correct dispatch, not avoided compilation.

Same RTX 4060, same 930e8b49c1c2ec683d22c724a398b39111cd0e56 CLI, same synthetic fixture and byte-identical 286,200-byte DXIL. xcl.exe shaders input --precompile --only cs --windows 4 --split 1 --pipelines, with XCL_PSO_DISK_CACHE=1, VKD3D_SHADER_CACHE_PATH=0, __GL_SHADER_DISK_CACHE=0 and pipeline_library_log. Two fresh Wine processes / working directories, one pipeline each, zero refusals. The cold process wrote an 854,728-byte blob containing both a 173,054-byte pipeline-cache chunk and a 681,497-byte encoded SPIR-V chunk; Vulkan feedback reported no reuse, 8.03 s. The restore kept that blob and the same DXIL; vkd3d logged SPIR-V recovered from the cached PSO and Vulkan pipeline-cache reuse. XCL reported 9.2 s / 2.0 s for the whole CLI pass (one pair, not isolated driver timings). No retail run, new hook readback, full suite or native Windows test in this follow-up. No production code change. AI use: Hermes Agent (gpt-6.2-astra) ran the experiment, inspected the records and wrote this update.

@pr1sm-dev

Copy link
Copy Markdown

Test report (Linux, vkd3d-proton): blobs written by xcl shaders --pipelines are refused by the title when it passes a non-zero NodeMask

Linux, Wine 11.22, vkd3d-proton master 30b0eb9b, RTX 3070 8 GB (driver 595.91.07), Ryzen 7 5800X, a retail title. Seen first on main 6efdabc with this PR and other open PRs applied; then checked on unmodified main 930e8b4 (which has this PR).

What happens. After a precompile pass the title creates the same compute pipelines again. XCL logs a driver blob kept on disk was refused and removes the files. On the earlier tree that was 1,034 → 762 files during one run, and compute pipelines made from blob files fell from 132 in a run before the pass to 15 in the run after it, because the tool had also replaced blobs the title had written itself.

Cause. With VKD3D_DEBUG=warn, vkd3d-proton reports d3d12_cached_pipeline_state_validate: PSO compatibility hash mismatch. For a compute pipeline that hash covers only node_mask and flags (libs/vkd3d/cache.c). The title's D3D12_COMPUTE_PIPELINE_STATE_DESC has NodeMask = 1; Pipelines::make leaves it at 0. The blob file name covers the DXIL and Flags, so both forms share one file and each side refuses the other's.

Check on unmodified main 930e8b4. Empty scratch cache (XCL_DXIL_CACHE). The title ran 100 s and built 8 compute pipelines; its blobs were removed and xcl shaders <those 8 programs> --precompile --pipelines --only cs wrote 8 blobs; then the title ran 100 s again on those files, once with each build:

title build "PSO compatibility hash mismatch" lines compute pipelines made from blobs blob files after the run
main 930e8b4 8 0 0
main 930e8b4 + copy.NodeMask = 0; in translated_compute_pso 0 8 8

The same on the earlier tree with 273 tool-written blobs and 25 s runs: 157 mismatches and 0 pipelines from blobs without the change, 0 mismatches and 158 from blobs with it.

So setting the mask to 0 on the title's side (one adapter) makes the tool's blobs usable here. Not tried: having the tool use the title's mask, or putting the mask into the file name.

Not tested. Windows, AMD, graphics pipelines, and a full run after a complete pass with the change. The check that refuses the blobs is vkd3d-proton's: @burber's run above on the native NVIDIA driver had the title accept the tool's blobs (0 refused), so this looks specific to Wine / vkd3d-proton.

Written with Claude Code (Claude Fable 5.2); the runs and logs are from the machine above.

@NAbobo101

NAbobo101 commented Nov 24, 2026 •

Copy link
Copy Markdown

Test of 07c535d (with #714 under it) merged locally onto main 67a3735 (clean merge, tree fabf56e), on an 8 GB NVIDIA card with the retail title's whole shader pack. With two driver compiles at a time, the offline pass kept memory flat for two hours, unlike the stalls with growing memory reported above, and every blob it wrote was taken. In two title runs afterwards, about four fifths of the compute pipelines came from those blobs and the load got further than on main, but neither run reached a visible world.

Setup

  • RTX 5060 8 GB (wave32 only), driver 621.14; Ryzen 7 5700G, 32 GB RAM; Windows 11 Pro 26300; Rust 1.100.0 MSVC; DXC 1.8.2502.11.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on fabf56e (debug): 738 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Offline pass
XCL_DXC_THREADS=8 XCL_PIPELINE_THREADS=2 xcl shaders shaders.rpf --precompile --only cs --pipelines (release), stopped by me at a two-hour cap:

  • It got to 22600 of 26503 programs. The driver blob cache went from 452 files (left by earlier title runs) to 792. The pass printed pipelines: 475 made, 0 refused.
  • Free system RAM never went under 16.4 GB, and xcl.exe stayed around 1.6 GB.
  • From about 22400 programs on, it slowed to roughly a minute per pipeline (22400 → 22600 took 48 minutes), which looks like the pack's biggest programs. It kept moving, slowly, rather than stalling. I didn't try the default of four compiles at a time, so I can't say whether the growth others saw comes from that.

Title runs afterwards (two, with the cache at 817 blobs)
Retail 1.0.2.1, release, XCL_PSO_WAIT_MS=50, XCL_NETWORK=0 XCL_ACTIVITY=1, menus walked with XCL_PRESS_A_AT=14,17,21,125,131,…,197 (as in #505):

run end compute PSOs made from a driver blob skipped draws / dispatches
1 device removed (0x887a0006), 486.6 s 490 385 8955 / 1024
2 title watchdog (+0x23cf683), 423.9 s 496 391 8192 / 583

For comparison, three runs of main 67a3735 with the same settings on this machine ended at the watchdog at 347–396 s. Both runs here went further. In run 1, the loading-screen artwork was still up at 423 s and the title presented at 29 fps until about 430 s, while in the main runs the window went black at about 270 s. So the load got further, but neither run reached a visible world: run 1 ended with a blank window and then the device removal, and run 2 at the watchdog. About four fifths of the compute PSOs came from the blobs, but with the 50 ms wait the title still skipped 8955 and 8192 draws and 1024 and 583 dispatches whose pipelines weren't built yet.

Not tested

  • The whole pack in one pass, and the default XCL_PIPELINE_THREADS.
  • AMD.

AI use

  • Claude Code (Claude Opus 5.5) scripted and ran the build, tests, offline pass and title runs, read the logs and screenshots and drafted this comment. I checked the results.

Edit: corrected two counts. The blob column now counts only programs built from a blob (an earlier version also counted the log lines about blobs being saved), and the last column now gives the skipped draws and dispatches; an earlier "still building" column was miscounted.

brandostrong added a commit to brandostrong/xcl that referenced this pull request Nov 24, 2026
… runtime

The precompile pass stopped advancing on the biggest compute programs:
their driver compile takes tens of minutes and gigabytes (three of
29-30 MB DXIL hung --precompile --only cs --pipelines for 33+ minutes
on three machines, xcl-dev#744). Skip programs whose DXIL is over
XCL_PIPELINE_MAX_KB (8 MiB by default; 0 turns the cap off) when no
blob exists yet, count them, and report the total; the runtime still
builds one when a title needs the pipeline. 8 MiB sits above the
largest program that ever completes (~2.2 MB, the optimized class) and
below the smallest that hangs (14.1 MB), so the pass now finishes.

Part of xcl-dev#1269 (A19).

Co-Authored-By: Claude Code <noreply@anthropic.com>
brandostrong added a commit to brandostrong/xcl that referenced this pull request Nov 24, 2026
… runtime

The precompile pass stopped advancing on the biggest compute programs:
their driver compile takes tens of minutes and gigabytes (three of
29-30 MB DXIL hung --precompile --only cs --pipelines for 33+ minutes
on three machines, xcl-dev#744). Skip programs whose DXIL is over
XCL_PIPELINE_MAX_KB (8 MiB by default; 0 turns the cap off) when no
blob exists yet, count them, and report the total; the runtime still
builds one when a title needs the pipeline. 8 MiB sits above the
largest program that ever completes (~2.2 MB, the optimized class) and
below the smallest that hangs (14.1 MB), so the pass now finishes.

Part of xcl-dev#1269 (A19).

Co-Authored-By: Claude Code <noreply@anthropic.com>
PracticalStudios added a commit to PracticalStudios/xcl that referenced this pull request Nov 24, 2026
Cap on by default where dxc switches to -O0 (xcl-dev#1269, xcl-dev#744);
--max-source-mb 0 turns it off.
wondercrash added a commit to wondercrash/xcl that referenced this pull request Nov 24, 2026
…eads

The compute warm-up (`xcl shaders --precompile --only cs --pipelines`) sat for
20+ minutes at one record range with ~5 cores busy: each translating thread
made its pipeline itself behind a gate of XCL_PIPELINE_THREADS (4), and three
retail programs of 13-28 MB DXIL held 3 slots for 15+ CPU-minutes each. The
other 13 translating threads each held a finished program waiting for the one
slot left, and the DXC pool sat idle.

Port of xcl-dev#256 onto the driver cache of xcl-dev#744:
- A program whose driver blob is cached is made from it on the translating
  thread (a cheap create, no slot). The rest go to a queue served by driver
  threads of their own, XCL_PIPELINE_THREADS or half the logical CPUs. A push
  never waits: the queue holds the DXIL (a pack's compute programs come to a
  few GB at most).
- Each driver thread takes the biggest waiting program that fits: 8 GB of
  commit and memory kept free, a compile counted as 1536 bytes per DXIL byte
  (64 MB - 1.5 GB), 3 GB for one over 8 MB; with nothing running any may go.
- At most 2 programs over 8 MB at once, and one thread always left for the
  rest, so huge programs never hold every driver thread.
- A status line every 15 s while compiles run; programs over 60 s are named.

Assisted-by: omp (Claude Opus 5.5)
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
A title whose compute pipeline descriptions carry a node mask did not take
the blobs `xcl shaders --precompile --pipelines` keeps for it (xcl-dev#744): the
offline pass makes its pipelines with NodeMask 0, the title's are made with
the title's mask, and both use one blob file (its name covers the DXIL and
Flags). vkd3d-proton refuses a cached blob whose description hash differs
("PSO compatibility hash mismatch"; for a compute pipeline that hash is
NodeMask and Flags), so the title refused every blob of the pass, removed
the file and compiled the program again - and the pass in turn replaced the
blobs the title had kept itself.

XCL drives one adapter, where masks 0 and 1 mean the same, so the
translated pipeline is made with 0.

Measured on main 930e8b4 with a retail title that passes mask 1 (Wine
11.22, vkd3d-proton 30b0eb9b, RTX 3070): of 8 blobs the pass wrote for the
programs the title builds in its first 100 s, the title took 0 and removed
8 before, and takes 8 with this change.

Test: a_title_pipeline_with_a_node_mask_takes_the_offline_blob runs the
offline pass on a program and then makes the same pipeline through the
backend hook with NodeMask 1; the pass's blob has to stay as written.
Under vkd3d-proton it fails without the change (the blob is removed).

Assisted-by: Claude Code (Claude Fable 5.2)
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
`xcl shaders <pack> --precompile --pipelines` on a retail title's pack
stops advancing right after record 22 600, its memory growing (reported
on xcl-dev#505 / xcl-dev#744 from three machines, and on this one). The records there
are three screen-probe compute programs of 13 - 29 MB of DXIL (88 863
console instructions for the biggest, unrolled). The NVIDIA driver alone
had not built the smallest after 14 minutes; in the pass, the compiles
queued behind them held up everything after, and the pass printed no
name.

Programs of GIANT_DXIL (4 MB) or more are now kept aside and made after
all the others, one at a time, smallest first, each named with its size
before the driver gets it and timed after. Stopping the pass there keeps
everything made before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anoyarou pushed a commit to anoyarou/xcl that referenced this pull request Nov 25, 2026
…dev#1368)

A title whose compute pipeline descriptions carry a node mask did not take
the blobs `xcl shaders --precompile --pipelines` keeps for it (xcl-dev#744): the
offline pass makes its pipelines with NodeMask 0, the title's are made with
the title's mask, and both use one blob file (its name covers the DXIL and
Flags). vkd3d-proton refuses a cached blob whose description hash differs
("PSO compatibility hash mismatch"; for a compute pipeline that hash is
NodeMask and Flags), so the title refused every blob of the pass, removed
the file and compiled the program again - and the pass in turn replaced the
blobs the title had kept itself.

XCL drives one adapter, where masks 0 and 1 mean the same, so the
translated pipeline is made with 0.

Measured on main 930e8b4 with a retail title that passes mask 1 (Wine
11.22, vkd3d-proton 30b0eb9b, RTX 3070): of 8 blobs the pass wrote for the
programs the title builds in its first 100 s, the title took 0 and removed
8 before, and takes 8 with this change.

Test: a_title_pipeline_with_a_node_mask_takes_the_offline_blob runs the
offline pass on a program and then makes the same pipeline through the
backend hook with NodeMask 1; the pass's blob has to stay as written.
Under vkd3d-proton it fails without the change (the blob is removed).

Assisted-by: Claude Code (Claude Fable 5.2)
PracticalStudios added a commit to PracticalStudios/xcl that referenced this pull request Nov 25, 2026
Cap on by default where dxc switches to -O0 (xcl-dev#1269, xcl-dev#744);
--max-source-mb 0 turns it off.
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.