You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NVIDIA: cached pipeline blobs bake static-sampler slots; a later run with a different sampler order samples the wrong samplers #3044
On NVIDIA, a driver blob from GetCachedBlob (fed back through D3D12_CACHED_PIPELINE_STATE) records which slot of the driver's own sampler table each static sampler took. In a later process that created its samplers in a different order, the driver accepts the blob without error, but the pipeline samples through other samplers: linear becomes unfiltered, point becomes filtered. XCL turns constant S# into static samplers of its ABI root signature (gpu/recomp/pso.rsabi_signature) and keeps driver blobs on disk by default (XCL_PSO_DISK_CACHE, hle/d3d12x/real.rsdriver_cache), so a warm cache can give wrong sampling with no warning. The order XCL creates its ABI static samplers in depends on translation order across the pipeline worker threads, and xcl pso-precompile writes blobs from a different process, so a mismatch is the normal case, not a corner case. Title pipeline libraries (CreatePipelineLibrary) go straight to the driver and carry the same blobs. The refused-blob fallback never triggers, because the blob is not refused.
Reproduced on an RTX 3080 (one GPU so far) (Windows 11), with a probe that runs each case in its own process. The program is translated by XCL with three constant S#: point, linear and trilinear.
case
point
linear
trilinear
store (fresh compile, blob written)
correct
correct
correct
load (blob, same sampler order)
correct
correct
correct
fresh-shifted (10 other samplers first, fresh compile)
correct
correct
correct
load-shifted (10 other samplers first, blob)
correct
unfiltered
unfiltered
load-swapped (same 3 samplers in reverse order first, blob)
filtered
correct
unfiltered
First found by readmet3xt-lab in VIctory-NVIDIA (7fa0e958), through ID3D12PipelineLibrary: posterized colour grading with green and magenta fringes when cached. The same report measured that an NVIDIA driver holds at most 2,032 distinct static samplers per process; one more removes the device.
This matters for the pipeline-library plan: a pipeline library serializes the same driver blobs, so it should have the same problem.
Options
Don't keep driver blobs for pipelines that have static samplers. Simple, but it means more cold driver compiles, and more driver RAM during play.
Create a fixed set of static samplers in a fixed order before any pipeline (e.g. every distinct S# the title uses, from the shader records, at startup), so the slots match across runs and blobs stay valid.
Key the blob cache on the sampler-creation order (or a hash of the process's sampler table at compile time), and drop blobs whose order no longer matches.
Which one should be the default? I have a branch with the probe (an #[ignore] GPU test), a static-sampler counter that warns near 2,032, and an opt-in XCL_PSO_CACHE_STATIC_SAMPLERS=0 (option 1, default unchanged) for A/B. I'll open it as a PR, and can follow up with whichever default you pick.
The public PipelineLibrary controls suggest a useful way to choose the default here. KyleS98 reported silent output changes with an extra static sampler on Windows / RTX 3090 Ti / 616.92. UncommonDLL's standalone fixture kept its expected output on RTX 5070 Ti / 621.40 when the extra BORDER sampler was created first. victory-fork #1459 · XCL C1 extra-sampler control
When your three-sampler probe is public, it could distinguish the cache paths on the same configuration. Run CachedPSO and PipelineLibrary with the same adapter, driver, shaders and sampler descriptors, varying only sampler creation order between the writer and reader processes. Check both a successful cache load and output against the cold baseline. That would show whether to apply a workaround to one cache path or both on that setup.
Codex helped compare these public reports for PortBridge. The hardware runs are credited to the original testers.
Test report for the comparison @akimfomin asked for. I ran CachedPSO and ID3D12PipelineLibrary side by side, with the same GPU, driver, shaders and sampler descriptions. The only thing that changes between the process that writes the blob and the process that loads it is the order in which static samplers get created.
Result on an RTX 5070 (driver 621.01): graphics pipelines loaded from a blob sample through the wrong samplers on both cache paths whenever the loading process created its static samplers in a different order. Compute pipelines sampled correctly in every case. Every load reported success.
How the probe works
It's a standalone D3D12 program that doesn't use XCL code. Every case runs in a fresh process.
The shader samples one small texture three times, once through each of three static samplers: point (s0), linear (s1) and trilinear (s2).
The texture and the coordinates are chosen so that each sampler returns a different value. That way the output shows which sampler the pipeline really used:
sampler
value it should return
point
0
linear
0.25
trilinear
1.1875
(Texture: R32_FLOAT, 2×1 texels with 2 mip levels. Mip 0 holds 0 and 1, mip 1 holds 4. Sampled with SampleLevel(uv = (0.375, 0.5), lod = 0.25).)
The writer process compiles the pipeline cold and saves it twice: as a GetCachedBlob blob and as a serialized pipeline library.
A reader process then creates some other static samplers first (its "prefix") and loads the pipeline in one of three ways: a cold compile with no blob (the control), from the CachedPSO blob, or from the pipeline library.
Reader prefixes:
none: no other static samplers first.
shifted: 10 other static sampler descriptions first (all trilinear, with mip LOD biases from 0.5 to 5.0), in a root signature and a pipeline.
swapped: the same three samplers first, but in reverse order (trilinear, linear, point).
shifted, root signature only and swapped, root signature only: the same prefixes, created as a root signature with no pipeline.
The writer itself ran once with no prefix and once with the "shifted" prefix. Each combination ran 3 times, and the 3 runs always matched.
Graphics pipelines (vertex + pixel shader)
writer prefix → reader prefix
cold compile
CachedPSO blob
pipeline library
none → none
correct
correct
correct
none → shifted (either form)
correct
wrong: all three samplers replaced by prefix samplers
wrong, same as CachedPSO
none → swapped (either form)
correct
wrong: point and trilinear swapped
wrong, same as CachedPSO
shifted → shifted (either form)
correct
correct
correct
shifted → none or swapped (either form)
correct
wrong: all three samplers return 0
wrong, same as CachedPSO
What the wrong results show:
none → shifted: the pipeline sampled through the first three of the reader's 10 prefix samplers instead of its own. Its outputs were exactly what those prefix samplers return (3.0625, 4 and 4, instead of 0, 0.25 and 1.1875).
none → swapped: the "point" sampler returned the trilinear value and the "trilinear" sampler returned the point value. Linear was in the middle position both times, so it stayed correct.
shifted → none or swapped: the writer had its three samplers in positions 11 to 13 of its sampler table. The reader created fewer samplers, so those positions held nothing, and all three samplers returned 0.
So the blob keeps the positions its samplers had in the writer's table, and reads whatever sits in those positions in the reader's table. This matches CharlyRien's model on #505. Creating a root signature on its own is enough to change the positions. No pipeline is needed.
Compute pipelines
I tested two compute shapes:
a plain one: cs_6_0 with root signature 1.0 and a descriptor table for the texture;
one shaped like XCL's root signature: cs_6_6, root signature 1.1 with root UAVs, both descriptor heaps directly indexed, a sampler heap bound, and Agility SDK 1.620.
Each shape ran all of the combinations above (96 runs per shape). Every run returned the correct value from all three samplers on both cache paths. I can't tell from outside the driver whether it used the compute blob or quietly recompiled the pipeline.
What this means for choosing a fix
On this card and driver, the problem is in the driver's blobs, not in one D3D12 path, so a workaround for graphics pipelines has to cover CachedPSO and pipeline libraries alike. Compute showed no failure here, but that doesn't clear compute in general, because upipibi reported compute failures on #505.
Probe source and raw output: <link or gist, to decide>.
Setup: RTX 5070 12 GB, NVIDIA driver 621.01 (UMD 32.0.16.2101), Windows 10 Pro 22H2 (19045), Rust 1.100.0, release build.
Not tested: other NVIDIA cards and drivers, AMD and Intel, mesh pipelines, XCL's own translated pipelines, and the retail title.
AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it and drafted this report.
A standalone two-process test on an RTX 4070 SUPER, driver 621.24. Graphics reads through the wrong static samplers, as reported here. Compute does too, but only on the first load of a pipeline the driver has not seen, which may be why the compute reports disagree.
I did not run XCL. The test is --cache in wave64-prefix-test at commit a01a85c: my own shaders, three static samplers (point, linear, trilinear), gabdam-src's texture and expected values (0 / 0.25 / 1.1875). Every read is a process of its own. Each pipeline gets a root signature that differs only in the register space of an unused root constant, so that NVIDIA's own cache does not know it: with a new space a cold create takes 9 to 14 ms every time, with a repeated one 0.4 to 0.8 ms.
Nothing else created before saving
the loading process creates
cold
graphics: CachedPSO and library
compute: first load, CachedPSO and library
compute: CachedPSO again, next process
nothing else
right
right
right
right
10 other samplers before
right
3.0625 4 4
3.0625 4 4
right
its own three reversed, before
right
1.1875 0.25 0
1.1875 0.25 0
right
10 others after its own
right
right
right
right
10 others before, released
right
right
right
right
With 10 others created before saving, only loading after the same 10 reads right; in compute, that is about the first load. No load is refused.
Compute, first load: wrong, about 3 to 5 ms to create. Second load, in another process that creates the same samplers first: right, about 0.5 ms.
Compute, after a cold create of the same pipeline in that sampler layout: right, about 0.5 ms. In 4 of the 10 runs one such read was still wrong.
Graphics: wrong the first time, the second time and after a cold create.
My reading, from the times only: on this driver compute prefers NVIDIA's own cache when it has an entry for the current sampler layout, and takes the blob as it is when it has none. Then a cold control run before the blob, or repeating with the same shader, hides the compute failure. My first version did exactly that and read compute right in every case. I have not run the other tests posted here or in #505, so whether this is what happened in them is a guess. An easy check is a new pipeline per case and no cold create before the load.
If it holds, #3169 may need compute as well: its rules for compute stay as they are, and the first run after the blobs are written is the one that would read wrong.
Tested: GeForce RTX 4070 SUPER (driver 32.0.16.2124), Windows 11 Pro 26300, 10 runs. The times are from a separate run of 3 rounds. WARP: all 100 reads right, 2 runs. Debug layer: 0 errors and 0 warnings.
Not tested: XCL, a retail title, mesh pipelines, large shaders, other cards and drivers.
AI use
Claude Code (Claude Opus 5.5) wrote the test, ran it and drafted this comment.
Activity
akimfomin commentedon Nov 27, 2026
The public PipelineLibrary controls suggest a useful way to choose the default here. KyleS98 reported silent output changes with an extra static sampler on Windows / RTX 3090 Ti / 616.92. UncommonDLL's standalone fixture kept its expected output on RTX 5070 Ti / 621.40 when the extra BORDER sampler was created first. victory-fork #1459 · XCL C1 extra-sampler control
When your three-sampler probe is public, it could distinguish the cache paths on the same configuration. Run CachedPSO and PipelineLibrary with the same adapter, driver, shaders and sampler descriptors, varying only sampler creation order between the writer and reader processes. Check both a successful cache load and output against the cold baseline. That would show whether to apply a workaround to one cache path or both on that setup.
Codex helped compare these public reports for PortBridge. The hardware runs are credited to the original testers.
gabdam-src commentedon Nov 28, 2026
Test report for the comparison @akimfomin asked for. I ran CachedPSO and ID3D12PipelineLibrary side by side, with the same GPU, driver, shaders and sampler descriptions. The only thing that changes between the process that writes the blob and the process that loads it is the order in which static samplers get created.
Result on an RTX 5070 (driver 621.01): graphics pipelines loaded from a blob sample through the wrong samplers on both cache paths whenever the loading process created its static samplers in a different order. Compute pipelines sampled correctly in every case. Every load reported success.
How the probe works
It's a standalone D3D12 program that doesn't use XCL code. Every case runs in a fresh process.
The shader samples one small texture three times, once through each of three static samplers: point (s0), linear (s1) and trilinear (s2).
The texture and the coordinates are chosen so that each sampler returns a different value. That way the output shows which sampler the pipeline really used:
(Texture: R32_FLOAT, 2×1 texels with 2 mip levels. Mip 0 holds 0 and 1, mip 1 holds 4. Sampled with
SampleLevel(uv = (0.375, 0.5), lod = 0.25).)The writer process compiles the pipeline cold and saves it twice: as a
GetCachedBlobblob and as a serialized pipeline library.A reader process then creates some other static samplers first (its "prefix") and loads the pipeline in one of three ways: a cold compile with no blob (the control), from the CachedPSO blob, or from the pipeline library.
Reader prefixes:
The writer itself ran once with no prefix and once with the "shifted" prefix. Each combination ran 3 times, and the 3 runs always matched.
Graphics pipelines (vertex + pixel shader)
What the wrong results show:
So the blob keeps the positions its samplers had in the writer's table, and reads whatever sits in those positions in the reader's table. This matches CharlyRien's model on #505. Creating a root signature on its own is enough to change the positions. No pipeline is needed.
Compute pipelines
I tested two compute shapes:
Each shape ran all of the combinations above (96 runs per shape). Every run returned the correct value from all three samplers on both cache paths. I can't tell from outside the driver whether it used the compute blob or quietly recompiled the pipeline.
What this means for choosing a fix
On this card and driver, the problem is in the driver's blobs, not in one D3D12 path, so a workaround for graphics pipelines has to cover CachedPSO and pipeline libraries alike. Compute showed no failure here, but that doesn't clear compute in general, because upipibi reported compute failures on #505.
Probe source and raw output: <link or gist, to decide>.
Setup: RTX 5070 12 GB, NVIDIA driver 621.01 (UMD 32.0.16.2101), Windows 10 Pro 22H2 (19045), Rust 1.100.0, release build.
Not tested: other NVIDIA cards and drivers, AMD and Intel, mesh pipelines, XCL's own translated pipelines, and the retail title.
AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it and drafted this report.
Hash-0x commentedon Nov 30, 2026
A standalone two-process test on an RTX 4070 SUPER, driver 621.24. Graphics reads through the wrong static samplers, as reported here. Compute does too, but only on the first load of a pipeline the driver has not seen, which may be why the compute reports disagree.
I did not run XCL. The test is
--cachein wave64-prefix-test at commita01a85c: my own shaders, three static samplers (point, linear, trilinear), gabdam-src's texture and expected values (0 / 0.25 / 1.1875). Every read is a process of its own. Each pipeline gets a root signature that differs only in the register space of an unused root constant, so that NVIDIA's own cache does not know it: with a new space a cold create takes 9 to 14 ms every time, with a repeated one 0.4 to 0.8 ms.Nothing else created before saving
With 10 others created before saving, only loading after the same 10 reads right; in compute, that is about the first load. No load is refused.
My reading, from the times only: on this driver compute prefers NVIDIA's own cache when it has an entry for the current sampler layout, and takes the blob as it is when it has none. Then a cold control run before the blob, or repeating with the same shader, hides the compute failure. My first version did exactly that and read compute right in every case. I have not run the other tests posted here or in #505, so whether this is what happened in them is a guess. An easy check is a new pipeline per case and no cold create before the load.
If it holds, #3169 may need compute as well: its rules for compute stay as they are, and the first run after the blobs are written is the one that would read wrong.
Tested: GeForce RTX 4070 SUPER (driver 32.0.16.2124), Windows 11 Pro 26300, 10 runs. The times are from a separate run of 3 rounds. WARP: all 100 reads right, 2 runs. Debug layer: 0 errors and 0 warnings.
Not tested: XCL, a retail title, mesh pipelines, large shaders, other cards and drivers.
AI use