Skip to content

D3D12.X: name persisted compute driver blobs for NodeMask 1 as node 0 - #3214

Closed
Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:followup/node-mask-blob-name
Closed

Kalmarv wants to merge 1 commit into
xcl-dev:mainfrom
Kalmarv:followup/node-mask-blob-name

Conversation

@Kalmarv

@Kalmarv Kalmarv commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Since efdebc8 a compute pipeline's driver blob name carries its NodeMask when it is nonzero (-n<mask>), so the nodes of a linked adapter keep their blobs apart. A title creates its compute pipelines with NodeMask 1. xcl shaders --precompile and the startup-preparation workers create them with 0. D3D12 reads both masks as the first node, but the names differ, so in play none of the precompiled compute blobs are found and the driver compiles each one cold.

On title: ea3b5e4d, after a full precompile, a 600 s run from a save past the prologue logged driver blob absent for programs whose blob the precompile had saved under the name without the node part. 323 compute pipelines were built cold in play. 71 of the compiles were of 256 KB or more of DXIL; 65 finished, most of them 0.7-1 MB at 30-131 s each. They held the huge-pipeline slots, graphics queued behind them, and presents stopped at 231 s. Afterwards the cache held 15,376 blobs without a node part and 378 with -n1, all written by title runs.

This change maps mask 1 to 0 wherever the blob is named. Masks 2 and up keep their own names. The desc passed to the driver is not changed.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs:
    • adds driver_cache::persisted_node_mask();
    • name_for_root_node_with_ext (plain, chain and indirect-chain names, also used as the compute pipeline-library name) and compute_blob_key_for (the in-memory blob key) use it;
    • adds two tests: a unit test that masks 0 and 1 share one name in every root namespace and in the in-memory key while mask 2 stays apart, and a GPU test that the driver accepts a blob made with NodeMask 0 for a pipeline created with NodeMask 1 (it skips on more than one node).

Graphics pipelines need no change. Their recipes record the title's own NodeMask and preparation replays it, so both sides use the same name; in the run above, every graphics and mesh compile in play had driver blob supplied. Two-pass compute takes its node from the recorded stream in the same way.

Tested

  • RTX 5070 Ti (driver 610.74), Ryzen 9 9950X (16 cores / 32 threads), 32 GB RAM, Windows 11 Pro 26200, Rust 1.99.0. Release build for the title run, debug for the tests.
  • cargo test -p xcl --lib -- node_masks_zero_and_one_share_a_blob_name a_node_zero_compute_blob_is_accepted_for_node_mask_one linked_adapter_nodes_have_distinct_compatible_names direct_and_indirect_chain_roots --test-threads=1: 4 passed, 0 failed, 0 skipped.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4 (DXC 1.9.2609 via XCL_DXC_DIR), at 30a3994: 2595 passed, 1 failed, 49 ignored.
    • The failure is gpu_compute_e2e::a_preparation_worker_also_builds_a_split_programs_whole_form. It fails the same way on main 765b2c5 with the same command, where the counts are 2590 passed, 1 failed, 49 ignored; that run skipped three uma_driver tests, and this change adds two tests.
    • 26 SKIPPED lines: 21 "no wave64", 3 refused f16 forms, 2 "no heap windows".
  • Title: ea3b5e4d, the 600 s run from the save past the prologue described above, run again with this change on the same precompiled cache with the 378 -n1 blobs moved out. The exe was built from 309c44f7, which has the same tree as the head 30a3994; the exe built at 30a3994 is byte-identical. Before → after:
    • compute compiles with driver blob absent: 71 → 0;
    • compute pipelines built cold in play: 323 (65 of them 256 KB or more) → 65, all small, 113 ms in total; 0 new -n1 blobs;
    • presents: they stopped at 231 s (last three 2 s windows 0 0 0) → the title reached the world at about 150 s and kept presenting to the end (2 to 5 per 2 s from 240 s on, never 0);
    • smoke-block numbers: 1384 → 2272 frames; peak commit 30808 → 35767 MB; 0 device removals and 0 crashes in both.
    • What is left in the world is a low frame rate, 1.6 fps, with most Present calls taking 250 ms or more in the driver. This change does not address it, and pipeline builds do not set it: from 240 s on, binds waited under 20 ms per 2 s.

Regression run
Main (daae033, whose tree is main 765b2c5; main has since gained #3213, a test-only change):

xcl-smoke v1
commit: daae0330b95c43b868f8957c29dc4ccae90ac8ef
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 3709 (PresentX 3709)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 34128 MB

This PR (30a3994):

xcl-smoke v1
commit: 30a39948bc7a8e7dbe93bf6dd59e3fd9b2a08f2b
gpu: NVIDIA GeForce RTX 5070 Ti
title: ea3b5e4d
seconds: 150
exit: 0x0
frames shown: 3777 (PresentX 3777)
presents per 2 s (last 3): 32 47 2
device removals: 0
crashes: 0
peak commit: 36575 MB

Both runs use the same 150 s recipe on the same warm cache, and the blocks are pasted from the runner. Their timelines match. Main: startup preparation 40 s, first button press at 125.0 s, window end 191.5 s. This PR: 35 s, 125.0 s, 189.7 s. In the 60 s after the press, main presented 1300 frames and this PR 1332. Main started 10 compute driver compiles of 256 KB or more with driver blob absent, and its presents stopped about 6 s before the end of the window (last eight 2 s windows: 17 34 34 45 7 0 0 0). This PR had 0 compute compiles with driver blob absent. The 150 s window ends close to where main stops, so the 600 s pair under Tested is the proof of the fix.

Not tested

  • AMD and other NVIDIA GPUs, and drivers other than 610.74. Whether another driver accepts a NodeMask 0 blob for NodeMask 1 is checked only by the GPU test, on the GPU it runs on.
  • Linked adapters (more than one node): the GPU test skips there. Masks 2 and up keep their names; that is checked only by the unit test.
  • The first-use manifest's recipe ids (XCL_PSO_MANIFEST) were read, not run: they are graphics-only and hash the title's own serialized recipe, so this change does not touch them.
  • Caches written before this change keep their -n1 blobs. They are no longer looked up, and they are not deleted.

AI use

  • Claude Code with Claude Opus 5.5: found the cause from the run logs and the cache, wrote the change, the tests and this description, and ran the tests and the title runs.
  • Claude Code with Claude Fable 5: coordinated the runs and read the change.

🤖 Generated with Claude Code

Since efdebc8 the driver blob name carries the pipeline's NodeMask when
it is nonzero, so linked-adapter nodes keep their blobs apart. A title
creates its compute pipelines with NodeMask 1, while the offline
precompile and the startup-preparation workers create them with 0. Both
masks name the first node (D3D12 takes 0 as node 0), but the names
differed ("-n1"), so in play every precompiled compute blob was absent
and the driver compiled each one cold.

On title: ea3b5e4d after a full precompile, a load into the world logged
"driver blob absent" for programs whose blob the precompile had saved
under the name without the node part. 323 compute pipelines were built
cold in play, 65 of them of 256 KB or more DXIL (71 such compiles were
started). They held the huge-pipeline slots, graphics queued behind
them, and presents stopped at 231 s. The cache held 15,376 blobs without
a node part and 378 with "-n1", all written by title runs.

persisted_node_mask() maps mask 1 to 0 for the blob name (plain, chain
and indirect-chain roots) and for the in-memory blob key. Masks 2 and up
keep their own names. The desc passed to the driver is unchanged; a GPU
test checks that the driver accepts a blob made with NodeMask 0 for a
pipeline created with NodeMask 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Kalmarv

Kalmarv commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

The 4 failures in Build and test (Windows, no GPU) are main's own. The same tests fail on main beeb81b's CI run (job 141111232719): shaders::pipeline_library::tests::builder_deduplicates_names_and_atomically_replaces_output, plus the three tests that fail on its poisoned lock (graphics_pipeline_round_trips_through_serialized_library, mesh_pipeline_round_trips_through_serialized_library, warm_library::tests::cold_publish_makes_an_unchanged_corpus_reusable). This change does not touch pipeline_library.

@Prime1997 Prime1997 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on a merge-check run on an RTX 3060 Ti 8 GB (driver 32.0.16.1714, i5-10400, Windows 11 Pro 26200, Rust 1.100.0).

  • Head 30a39948bc7a8e7dbe93bf6dd59e3fd9b2a08f2b merged cleanly onto main 7db2f391, and the workspace builds.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on the merge: 2,596 passed, 0 failed, 49 ignored, 29 SKIPPED (21 of them no wave64). Both new tests pass, including the driver check: this card accepts a NodeMask 0 blob for a NodeMask 1 pipeline.
  • 60 s scripts/smoke.ps1 with XCL_PREPARE=0: 1,460 frames against 1,385 on main, peak commit 15,280 MB against 15,626 MB, no device removal, no crash.
  • Whole diff read, no blocking finding. Not tested here: a precompile followed by a play run that counts driver blob absent.
  • The red Build and test run on this head failed in the four pipeline-library tests that #3221 fixes (builder_deduplicates_names_and_atomically_replaces_output and the three behind its poisoned lock). The same four fail intermittently on plain main here, so it is not this change.

AI use: Claude Code ran the builds, tests and smoke on Prime's PC and wrote this text. Approving is Prime's decision.

I use a temporary Discord to coordinate my work. Anyone helping test XCL or compare results is welcome. Test coordination on Discord

@UncommonDLL

Copy link
Copy Markdown

Following up on the RTX 3060 Ti explicit CachedPSO result, we tested the named pipeline-library path on a physical RTX 5070 Ti with NVIDIA driver 621.40, using 30a39948bc7a8e7dbe93bf6dd59e3fd9b2a08f2b plus a local synthetic validation fixture.

A fresh process loaded the pipeline by name with NodeMask 1 after a writer stored it with NodeMask 0. LoadComputePipeline returned S_OK. The exact returned PSO reached dispatch with zero target fallback creations, the fence completed, and all 64 output words matched.

Named 0→0 and 1→1 also passed. Explicit CachedPSO 0→0, 1→1 and 0→1 succeeded on their first creation calls. The deliberately missing-name control returned E_INVALIDARG, then successfully used the saved blob on its first creation call.

All three writers and seven readers passed in fresh processes, with zero failures, skips or timeouts. An independent review verified all 448 output words.

This covers one synthetic whole-compute shader on one single-node adapter and driver. The D3D12 information queue was unavailable. No performance timings or retail preparation/play comparison were performed, and this is not a full merge-check.

AI assistance: ChatGPT Work/Codex coordinated execution, and a separate Codex reviewer checked the evidence. The session exposed the GPT-6 family but not the exact model variant.

@moombathepilot

Copy link
Copy Markdown

merge-check
base: fa20459
head: 30a3994
merge: clean
build: cargo build --workspace --offline --locked -> ok; release xcl build also passed
tests: cargo test --workspace --offline --locked --no-fail-fast -- --test-threads=4 --nocapture -> 2602 passed, 12 failed, 49 ignored; SKIPPED: 12 notices (6 unsupported per-lane float cases, 2 no heap windows, 3 missing D3D12 debug layer, 1 driver cache could not be disabled). Both new tests passed. All 12 failures also appeared on this exact base in an earlier run: DXIL fuzz (1), mesh shader-cache (1), title-texture tests (8), and two-pass driver-cache integration test (parent and child, 2).
review: Read the full diff. No blocking code finding. The cache-key change preserves the descriptor passed to the driver. Linked-adapter hardware was not tested.
performance: On RX 7800 XT, offline precompile through present 512 wrote one compute blob. The retail title reused it for record 1e32f25121c1552f with XCL_PSO_DISK_CACHE=1 (408 ms cold on main, 0 ms logged in the driver on the trial merge). In 60 s smoke runs, main showed 1583 frames at 16085 MB peak commit and the trial merge showed 1597 frames at 15106 MB. Both exited 0x0 with zero crashes or device removals. Reused the earlier smoke result from the exact base with matching settings. Time to gameplay was not measured.
verdict: not yet: the required Windows CI check is red. The targeted AMD cache test passed, and the local suite showed no failure unique to the trial merge.
hardware / tool and model: AMD Radeon RX 7800 XT, driver 32.0.32029.2010, Ryzen 7 5700X3D, Windows 11 build 26300.9974, rustc 1.100.0 MSVC / OpenAI Codex (GPT-6, exact variant unavailable) ran the tests, reviewed the diff, and drafted this report.

@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 29, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 30a3994, diff read, not a merge-check; it conflicts with main, so not built or run):

  • Superseded by main. 52f0288 ("D3D12.X: canonicalize single-node NodeMask 1 to 0 so precompiled driver blobs hit at runtime", same author, merged via D3D12.X/Shaders: canonicalize single-node NodeMask 1 to 0 and accept driver-cache mesh receipts #3495) adds canonical_node_mask (1 -> 0) and applies it in name_for_root_node_with_ext (so plain, chain and indirect-chain names all match), in compute_container's desc and so its in-memory key, in finish_two_pass and in ComputeBuildKey. The conflict is that same line (real.rs ~6526). Nothing behavioural is left to rebase.
  • What main lacks is this PR's unit test over the chain names and the in-memory key; it could go in as a test-only PR. The GPU test (driver accepts a NodeMask 0 blob for NodeMask 1) no longer applies, since main passes NodeMask 0 to the driver.

Fine: the change and its tests were right for their base, and the before/after measurement is what motivated main's fix. Recommendation: close as superseded by 52f0288.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@throny

throny commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Closing as superseded: this change is already on main (52f0288). main real.rs canonical_node_mask (1 to 0) is applied in name_for_root_node_with_ext, the compute build key and the PSO desc copy, with a test; PR's only extra is a GPU blob-acceptance test

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

@throny throny added the duplicate This issue or pull request already exists label Dec 1, 2026
@throny throny closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory duplicate This issue or pull request already exists gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants