Skip to content

D3D12.X: no disk driver blob for a graphics pipeline with static samplers on NVIDIA - #3169

Open
KDenKC wants to merge 3 commits into
xcl-dev:mainfrom
KDenKC:nvdev-static-sampler-blobs
Open

KDenKC wants to merge 3 commits into
xcl-dev:mainfrom
KDenKC:nvdev-static-sampler-blobs

Conversation

@KDenKC

@KDenKC KDenKC commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

On NVIDIA, a translated graphics pipeline created from what another process made loses the linear filtering of its static samplers. In the retail title the tone map samples its 33³ LUTs through such a sampler, so a tone map made that way sampled them as point, giving contour bands (#505). On main, "what another process made" is two XCL artifacts:

  • the driver blobs on disk (CachedPSO), written by the preparation workers or an earlier run;
  • XCL's pipeline library, which the preparation stores and the title's process loads from.

This keeps translated graphics pipelines with static samplers (and the mesh pass of two-pass ones) off both on NVIDIA, and on an adapter whose vendor is not known (fail closed). Blobs this process keeps in memory still apply. It covers XCL's own artifacts of translated pipelines only: a title's own native pipeline library or cached PSO passes as before.

The cause and the fix are claudetools-gh's (#505 7235526172: RTX 5070 Ti, 621.01: levels and gaps per channel on a flat wall 10/2, 10/2, 13/1 with the tone map from a disk blob; 23/0, 16/0, 12/0 built without it or by the game process; 24/0, 17/0, 13/0 with the fix). They pointed out that the pipeline library is the same cross-process case (7236405511).

Part of #505.

What is in it (one commit, hle/d3d12x/real.rs)

  • One policy, graphics_artifacts_across(device, static_samplers): a pipeline without static samplers always may take and keep what another process made. One with them may only on a known adapter that is not NVIDIA's (blob_across_processes, DXGI VendorId 0x10DE).
    • adapter_vendor asks the device's adapter by LUID, and only for a pipeline with static samplers.
    • It caches only a vendor it found: a failed lookup is not cached, the next pipeline asks again, and meanwhile the pipeline counts as not eligible.
  • Applied at the three XCL graphics paths:
    • translated_graphics_pso_once (descriptions and description-compatible streams): no library load or store, no disk blob. The library load and the disk path go through graphics_from_other_processes, the store through keep_for_other_processes;
    • finish_two_pass: the mesh pass (with its pixel shader's samplers): no library load or store, no disk blob. The NGG compute pass keeps the compute rules as they are;
    • the other translated graphics streams: no disk blob.
  • Tests:
    • the policy (NVIDIA, AMD / Intel / WARP, an adapter not known, with and without static samplers);
    • a_static_sampler_graphics_pipeline_takes_and_keeps_no_artifact_of_another_process: with an entry of XCL's pipeline library and a blob file of a translated graphics pipeline there (a real device), the desc path's load and disk path take them, and its store keeps a new entry, only where the policy lets them across. It fails if a gate in those functions is removed.
  • What it reaches on main: Shaders: import exact PSOs from prior libraries #3100's import of exact pipelines from a previous library goes through pipeline_library::load_graphics, so it is behind the same gate (a guarded pipeline is neither imported from the last run's library nor stored into this one). D3D12.X: record ordered pipeline first use #3175's first-use manifest only logs names and holds no pipeline: nothing to gate there. D3D12.X: strip Xbox root signature flags for PC and honor FORCE_MEMORY_BASED_ABI #3244 changes the title's root signatures only, not the translated pipelines this gates.
  • Libraries and blobs already on disk stay. Builds without this keep loading them.

Tested

  • Rebased head 656ede245a743aab5c91941cef821966c364b21f: the lib suite was rerun with --test-threads=1: 2,728 passed, 5 failed, 31 ignored; e2e: 4 passed, 1 failed. The five failures were gpu_direct_image_get_resinfo_d16, the three stream_recheck_* tests, and test_title_runs_and_game_folder_is_untouched (e2e failure: Invalid bitcode signature). The 5090 retry pair is below.
  • Rebased on main 53e85fb1 (this head 9f81b661; the previous head 2fd98c3c was on main fa204595). The PR checks' earlier failures were 4 pipeline_library / warm_library tests of that older base, which pass on 53e85fb1.
  • RTX 3090 24 GB (VM), NVIDIA 621.24, Intel i7-10700T, Windows 11 build 26300.9974, Rust 1.99.1, debug, at 9f81b661:
    • cargo test -p xcl --lib --no-run, debug and release: both build.
    • cargo test -p xcl --lib -- another_process --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored, 2684 filtered out. -- other_vendors_keep_their_disk_blobs: 1 passed, 0 failed, 0 ignored, 2685 filtered out.
    • cargo test --workspace --no-fail-fast -- --test-threads=4: 2787 passed, 6 failed, 49 ignored. SKIPPED: 31 (22 no wave64, 3 refused per-lane forms, 3 no debug layer, 2 no heap windows, 1 driver cache cannot be disabled). The run leaves out the 3 uma_driver coherent-window remake tests that kill the lib binary on 621.x.
    • Main 53e85fb1 on the same machine: 2784 passed, 6 failed, 49 ignored, 31 SKIPPED. The 6 are main's own: title_textures::tests::placed_title_textures_share_vram_and_preserve_pixels, the 3 stream_recheck_* tests, standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline (main's test does not count the stand-in pipeline's deferred release, Related: Tests: account for deferred stand-in pipeline release #3484), e2e test_title_runs_and_game_folder_is_untouched. This head adds 3 passing tests and changes no other outcome.

Regression run

  • RTX 5090, driver 621.40, 600 seconds per arm, same title. Both arms used the same translated-cache seed (main-full-d8bd), the same frozen accepted-terms profile (r18-terms: gamesave and pls/settings), and held Enter. The first D3D12.X: no disk driver blob for a graphics pipeline with static samplers on NVIDIA #3169 attempt in gate-batch-q ended at 287.5 s with the known two-pass mesh fault (DRED page fault at GPU VA 0, window 10); this is the one retry, completed without removals. The script-made blocks below are verbatim.

Main 9dfbe3ea:

xcl-smoke v1
commit: 9dfbe3ea6653a9c76ef3ea0d66187a4b5407483b
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 1872 (PresentX 1873)
presents per 2 s (last 3): 2 2 1
device removals: 0
crashes: 0
peak commit: 47791 MB

This head 656ede24 (retry):

xcl-smoke v1
commit: 656ede245a743aab5c91941cef821966c364b21f
gpu: NVIDIA GeForce RTX 5090
title: 9cc6a39e
seconds: 600
exit: 0x0
frames shown: 1898 (PresentX 1899)
presents per 2 s (last 3): 2 2 2
device removals: 0
crashes: 0
peak commit: 48060 MB

Not tested

  • Preparation workers still build guarded graphics pipelines they cannot hand off. A worker counts the build done though no file or library entry comes of it, so the title compiles that pipeline again (and a previous receipt can skip preparation that the runtime then does not use). That is a cost in latency and in the preparation's counts, not a way around the rule. A worker-side skip would be a separate change.
  • The new test reaches the desc path's artifact functions (graphics_from_other_processes, keep_for_other_processes), not translated_graphics_pso_once itself (that needs a console shader pair with a static sampler, which no test here builds). finish_two_pass (the mesh pass) and translated_graphics_stream_once inline their own guards instead of calling those functions, so a guard removed there would not fail the test: they are tested only through the desc helpers' policy.
  • AMD and Intel: they keep their disk blobs and library entries.
  • NVIDIA drivers other than 621.x / 616.x.
  • The banding in a title run on this head (claudetools-gh's measurement is on the nvidia-dev form).

AI use

  • Claude Code (Claude Opus 5.5, Claude Sonnet 5.5), Codex (GPT-6.2-Sol), Antigravity (Gemini 4 Neon, Gemini 3.8 Flash): an agent swarm wrote, tested, reviewed and described this change from claudetools-gh's diagnosis.

🤖 Generated with Claude Code
https://claude.ai/code/session_013oPUFCA9W9F8Qb5MPK33bR

@andrewDoing

Copy link
Copy Markdown
Contributor

RTX 5070 12 GB, NVIDIA 616.92, native Windows: A fresh process accepted the graphics PSO blob with a different sampler creation order, then returned the point-sampled value for a static linear sampler. With the PR's disk guard enabled, the same process setup returned the expected linear value on all 16 pixels.

At head 4c20b5c32f1c1458dbcfd7ab2e9de5cd95b8dead, I added a test-only native graphics fixture. A pixel shader samples halfway between black and white texels through a static linear sampler. Each row used a fresh process. PSO state, shader bytes, texture and sample coordinate were identical. In the last two rows the fixture created a point-sampler root signature first and kept it alive. Each process read back the entire 4×4 RGBA32F render target.

Run Disk blob reused Red value on all 16 pixels
Producer, linear first, empty cache No 0.5
Consumer, same order Yes 0.5
Consumer, point first, disk replay allowed Yes 1.0
Consumer, point first, PR guard enabled, same blob present No 0.5

The driver accepted the 2,274-byte blob in both replay controls. The fixture uses XCL's native adapter vendor lookup, ABI static sampler root signatures, blob_across_processes and graphics_pso_through_cache. It supplies synthetic DXIL and the cache path directly. It covers graphics PSO reuse and the resulting pixels. Console shader translation, two-pass mesh, title performance and retail image quality were outside this test. Four runs completed, zero skips.

AI use: OpenAI Codex (GPT-6) designed and ran the native fixture and prepared this report.

@Aniseto

Aniseto commented Nov 28, 2026

Copy link
Copy Markdown

Ran the static-sampler disk-blob tests at 4c20b5c3 on an NVIDIA Blackwell desktop part:

Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib a_pipeline_with_static_samplers_takes_no_disk_blob_on_nvidia -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 1807 filtered out      (exit 0)

XCL_ADAPTER=NVIDIA cargo test -p xcl --lib other_vendors_keep_their_disk_blobs -- --test-threads=1
1 passed; 0 failed; 0 ignored; 0 measured; 1807 filtered out      (exit 0)

Both new tests pass: a graphics pipeline with static samplers skips the cross-process disk blob on NVIDIA, and other vendors keep theirs. The thread already has RTX 5070, 3090 and 5090 reports; this adds a 5070 Ti datapoint for the two focused tests. It is a pipeline-selection test, not a rendered tone-map comparison. The PR is a draft pending the sampler-prelude experiment.

Not tested: a retail title, the tone-map contour A/B, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.

AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.

@Prime1997
Prime1997 changed the base branch from nvidia-dev to main November 28, 2026 20:14
@KDenKC
KDenKC force-pushed the nvdev-static-sampler-blobs branch from 4c20b5c to 2fd98c3 Compare November 29, 2026 08:37
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test) labels Nov 29, 2026
@KDenKC
KDenKC marked this pull request as ready for review November 29, 2026 10:58
@KDenKC
KDenKC force-pushed the nvdev-static-sampler-blobs branch from 2fd98c3 to 9f81b66 Compare November 30, 2026 01:19
@github-actions github-actions Bot added the needs-pr-check Failing the PR description check (CONTRIBUTING.md) label Nov 30, 2026
@github-actions github-actions Bot removed the needs-pr-check Failing the PR description check (CONTRIBUTING.md) label Dec 1, 2026
…atic samplers on NVIDIA

On NVIDIA, a graphics pipeline created from what another process made loses
the linear filtering of its static samplers. The retail title's tone map
samples its 33^3 LUTs through such a sampler, so one made that way sampled
them as point: contour bands (xcl-dev#505). On main "what another process made" is
two things: the driver blobs on disk (CachedPSO, written by the preparation
workers or an earlier run) and the pipeline library the preparation stores.

claudetools-gh measured it (RTX 5070 Ti, 621.01): levels per channel on a
flat wall went from 10/10/13 with gaps (tone map from a disk blob) to
23/16/12 without gaps when the same pipeline was built without the blob or
by the game process itself, and to 24/17/13 with this rule (xcl-dev#505
7235526172). They pointed out that the pipeline library is the same
cross-process case (xcl-dev#505 7236405511).

One policy, graphics_artifacts_across (blob_across_processes on the
adapter's DXGI VendorId, adapter_vendor, per LUID; asked only for a pipeline
with static samplers): such a pipeline takes and keeps neither on NVIDIA
(0x10DE), nor on an adapter whose vendor is not known (fail closed: a failed
lookup is not cached, the next pipeline asks again). Blobs kept in this
process's memory still apply. This covers XCL's own artifacts of translated
graphics pipelines; a title's own native pipeline library or cached PSO
passes as before.
- translated_graphics_pso_once: no library load or store, no disk blob;
- finish_two_pass: the mesh pass (with its pixel samplers): no library load
  or store, no disk blob;
- the stream graphics path: no disk blob.
Compute pipelines (compute_container, the two-pass compute pass, the
preparation's compute pipelines) are not covered here.

Tests: the policy (NVIDIA, other vendors, an adapter not known), and
a_static_sampler_graphics_pipeline_takes_and_keeps_no_artifact_of_another_process:
with a library entry and a blob file of a translated graphics pipeline there,
the desc path's load and disk path (graphics_from_other_processes) and its
store (keep_for_other_processes) take and keep them only where the policy
lets them across.

Old gfx-*.pso files and library entries stay on disk; builds without this
keep loading them.

Ported from claudetools-gh's fix in xcl-dev#505 7235526172 and their note in
7236405511.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KDenKC
KDenKC force-pushed the nvdev-static-sampler-blobs branch from 9f81b66 to 395d6bc Compare December 1, 2026 08:59
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 395d6bc

No open or merged PR makes the same change. #902 (same area, title similar) adds a disk cache for slow graphics blobs and has no vendor or static-sampler gating. Among the other #505 PRs, none skips the pipeline library and driver blobs for static-sampler pipelines on NVIDIA.
The gate (graphics_artifacts_across) is applied to the load and the store in all three translated graphics paths: the desc path, finish_two_pass (the mesh pass) and translated_graphics_stream_once. In-process GRAPHICS_BLOBS still apply. The desc-path store keeps its old cacheable condition through across.
Minor: adapter_vendor repeats uma_driver::vendor, adding a per-LUID cache. Reusing that helper would avoid a second DXGI lookup.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 395d6bc, diff read, not a merge-check; PR description red: its smoke block names 9f81b66, and the text still calls that the head):

  • No test pins the fix. The new tests call new functions, so on main they don't compile rather than fail. The device test passes its own across value to graphics_from_other_processes / keep_for_other_processes. Changing ~8130 to let across = cacheable;, or removing the filters at ~9495 / ~11041, would fail no test. andrewDoing's fixture that reproduces the wrong sampling isn't in the PR.
  • Compute is left exposed. The cause is NVIDIA allocating static samplers in process creation order, so a blob from another process is accepted and samples point instead of linear. Shaders: make static-sampler root signatures first, in one order #2326 measured the same order dependence on compute pipelines. compute_container and the two-pass compute pass (abi_rs_for(tp.samplers)) still take blobs and library entries from other processes. Whether their sampling breaks too is unverified.
  • The cost isn't measured. There's no count of guarded pipelines in the retail title, so no estimate of the recompiles every NVIDIA run now pays. The 600 s pair used XCL_PREPARE=0 from the same translated cache and didn't reach the world. Preparation workers also build pipelines they can no longer hand off, as the description says.
  • A fourth vendor lookup. adapter_vendor (~9390) adds one beside ADAPTER_VENDOR (real.rs ~227 / ~1015), driver_cache::note_vendor and uma_driver::vendor, and Recompiler: programs whose compact table needs more than 12,288 words take the plain form again #3516 (yours) adds gpu::adapter::note_main_vendor. driver_identity already calls EnumAdapterByLuid per LUID and could record it once.
  • Old blobs on disk stop being read on NVIDIA but stay; builds without the PR keep loading them. The commit subject is over 72 characters, and README ~370-373 (the disk cache bullet) doesn't mention the exception.

Fine: the gate covers all three graphics paths (desc, both finish_two_pass callers, stream), and gating the mesh form on ps_samplers is right. Blobs kept in memory still apply. The vendor comes from each device's own adapter by LUID, so preparation and title agree, and an unknown vendor counts as possibly NVIDIA (fail closed). Disabling is a sound stopgap; #2326 (one fixed sampler order) is the structural fix.

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

Checked: xcl-dev#3169 is open at 395d6bc on main 9dfbe3e; REPO-TRACKER and related xcl-dev#505 behavior.
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (head 656ede2, since 395d6bc, diff read, not a merge-check):

  • No test pins the fix: partly fixed. The device test now gets across from graphics_artifacts_across on the real adapter (real.rs ~14307), so the live vendor lookup is exercised. The call sites are still not covered: making ~8131 let across = cacheable;, or dropping the mesh_across filters at ~9496 / ~9498 / ~9671 or the filter at ~11041, fails no test, and the fixture that reproduces the wrong sampling is still not in the PR.
  • Compute is left exposed: still open. compute_container (~6342 library load, ~6353 disk path) and the two-pass compute pass still take blobs and library entries from other processes; whether their static samplers break the same way is unverified.
  • The cost is not measured: still open. The new 600 s RTX 5090 pair (1872 vs 1898 frames) shows no regression but gives no count of guarded pipelines, so the recompiles every NVIDIA run now pays are unknown.
  • A fourth vendor lookup; commit subject and README: still open. adapter_vendor (~9390) is unchanged beside ADAPTER_VENDOR (~227 / ~1015); the first commit's subject is 92 characters; the disk-cache bullet in README.md (~370-372) does not mention the NVIDIA static-sampler exception.
  • PR description red: fixed; the smoke block names 656ede24.

New:

  • The device test now checks only one side of the gate on each machine. Since 656ede24 the test runs only the adapter's own across value (~14307-14318). On AMD, Intel or WARP only across == true runs, so removing the if !across return in graphics_from_other_processes (~9438) or keep_for_other_processes (~9455) fails nothing there, including the maintainer's RDNA4 batch run (CI has no GPU). The previous version ran both values on any GPU; keep the live-policy assertion and also call both helpers with true and false.
  • No full suite at this head. The head run is the lib suite with --test-threads=1 plus e2e and lists gpu_direct_image_get_resinfo_d16 as failing, which is not among main's failures on that machine; the full-workspace counts are from 9f81b661.

Fine: the gate still covers the desc path, the two-pass mesh pass and the stream path; the desc path keeps its old cacheable condition through across; an unknown vendor counts as possibly NVIDIA (fail closed); blobs kept in memory still apply.

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

Keep the static-sampler policy on every translated graphics artifact path, exercise both allow and deny behavior for pipeline-library and disk lookups, and report cumulative guarded pipeline counts. Share the per-adapter vendor and driver identity lookup. Compute pipelines remain outside the policy.
@github-actions github-actions Bot added the area:docs-ci Documentation, scripts, workflows, repo governance label Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Follow-up review (head ea02c3e, since 656ede2, diff read, not a merge-check; checks red):

  • The device test checks only one side of the gate: fixed. It now runs graphics_from_other_processes and keep_for_other_processes with both false and true on any GPU (real.rs ~14327-14346) and still checks the live policy.
  • No test pins the call sites: partly fixed. every_translated_graphics_artifact_path_uses_the_static_sampler_policy (~14355-14368) pins the text of the desc-path line (~8131), the two mesh_across filters (~9512 / ~9514), mesh_stored (~9687) and the stream filter (~11057), but not the line that defines mesh_across (~9511), so let mesh_across = true; still fails nothing. It matches source text, not behaviour.
  • Cost and compute: partly fixed. note_guarded_static_sampler_pipeline (~9413) logs a running count, but no run reports it; README (~374-378) now says compute is outside the rule, which is still unchecked.
  • Vendor lookup, commit subject, README: partly fixed. adapter_vendor shares one DXGI lookup per LUID with driver_identity through adapter_info (~9335-9351) and README describes the NVIDIA exception; the first commit's subject is still 92 characters.
  • No full suite and no smoke block at this head: still open; both smoke blocks name earlier commits, which is why PR description is red again.

New:

  • The Tests: commit changes runtime behaviour. ea02c3e6 also replaces the driver_identity cache with adapter_info (~9335-9351) and adds an info log. A failed DXGI lookup used to be cached as None and now is not, so every pipeline creation on that adapter makes a DXGI factory again; and a failed GetDesc now drops the driver identity too, which turns off disk blobs and pipeline-library keys. That needs its own commit (or a squash into the D3D12.X: one) and a line in the description.
  • Stale "Not tested". It still says removing a guard in finish_two_pass or translated_graphics_stream_once would fail no test; the source-anchor test now catches most of those lines.

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

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 area:docs-ci Documentation, scripts, workflows, repo governance gpu:nvidia Code is specific to NVIDIA / wave32 GPUs (scope tag; see needs:nvidia-test)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants