Pipeline library: some names are stored with a description that differs on the next run (Load mismatch, then StorePipeline 'already exists') #780

Open
opened 2026-11-26 04:13:57 +00:00 by github-bot · 5 comments
Owner

@⁠Sil3ntGam3r on GitHub · 2026-11-24 10:33 UTC · original

finding: some pipelines are stored in the pipeline library under a name whose description differs on the next run, so they are compiled again instead of loaded.

Seen. With VICTORY_D3D12_DEBUG=1 and a pipeline cache warmed by an earlier run of the same build, the debug layer reports pairs of warnings while graphics pipelines are made:

  • ID3D12PipelineLibrary::Load*Pipeline: The pipeline state desc provided does not match the one used to create the PSO stored with name "<name>"
  • then ID3D12PipelineLibrary::StorePipeline: A pipeline with name "<name>" already exists in the library

47 such warnings in one run, against about 770 pipelines made or loaded. The effect is that those pipelines are compiled again on every run (the library keeps its older entry); nothing is drawn wrongly as far as I can tell.

Where. crates/victory-gpu/src/pipeline/library.rs:100 (name) hashes the kind, the root signature blob, the shader code and GraphicsState::describe() (pipeline/host.rs:174); the graphics description is built at pipeline/host.rs:489, the mesh stream in mesh_pipeline.

Ruled out by reading the code (not by a run). Every field of the graphics description and of the mesh stream is in describe(), and the root signature blob in the name is the one the root signature object is created from (root_signature returns both from one serialization). So I have not found what differs. Finding it needs a run that logs the name and the full description at each store and at each mismatch, two runs, and a diff.

Related, minor. describe() records the title's topology, while the description maps RECTANGLES/QUADS to TRIANGLE. That only gives one description two names, not a mismatch.

Setup and limits. RTX 3070, driver 621.14, Windows 11. Tree: main 8e79c80 plus several open PRs (listed in my comment on #439), so it may come from one of them; not checked on plain main. Reproducing needs the game files (a warm pipeline cache, then a second run with the debug layer).

AI-assisted; run on my machine.

**@⁠Sil3ntGam3r** on GitHub · 2026-11-24 10:33 UTC · [original](https://github.com/Marvisak/VIctory/issues/780) finding: some pipelines are stored in the pipeline library under a name whose description differs on the next run, so they are compiled again instead of loaded. **Seen.** With `VICTORY_D3D12_DEBUG=1` and a pipeline cache warmed by an earlier run of the same build, the debug layer reports pairs of warnings while graphics pipelines are made: - `ID3D12PipelineLibrary::Load*Pipeline: The pipeline state desc provided does not match the one used to create the PSO stored with name "<name>"` - then `ID3D12PipelineLibrary::StorePipeline: A pipeline with name "<name>" already exists in the library` 47 such warnings in one run, against about 770 pipelines made or loaded. The effect is that those pipelines are compiled again on every run (the library keeps its older entry); nothing is drawn wrongly as far as I can tell. **Where.** `crates/victory-gpu/src/pipeline/library.rs:100` (`name`) hashes the kind, the root signature blob, the shader code and `GraphicsState::describe()` (`pipeline/host.rs:174`); the graphics description is built at `pipeline/host.rs:489`, the mesh stream in `mesh_pipeline`. **Ruled out by reading the code (not by a run).** Every field of the graphics description and of the mesh stream is in `describe()`, and the root signature blob in the name is the one the root signature object is created from (`root_signature` returns both from one serialization). So I have not found what differs. Finding it needs a run that logs the name and the full description at each store and at each mismatch, two runs, and a diff. **Related, minor.** `describe()` records the title's topology, while the description maps `RECTANGLES`/`QUADS` to `TRIANGLE`. That only gives one description two names, not a mismatch. **Setup and limits.** RTX 3070, driver 621.14, Windows 11. Tree: main `8e79c80` plus several open PRs (listed in my comment on #439), so it may come from one of them; not checked on plain `main`. Reproducing needs the game files (a warm pipeline cache, then a second run with the debug layer). AI-assisted; run on my machine.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:13:57 +00:00
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 11:04 UTC · original

Possibly a known cause, if the 47 pairs are mesh pipelines: #352 found that a mesh pipeline never loads from the library. LoadPipeline refuses it with the same "does not match the one used to create the PSO" (972), even with the very stream it was made from, unless the stream has a PRIMITIVE_TOPOLOGY subobject that isn't UNDEFINED; the store is then refused with "already exists" (970). That's the pair you see, every run. #352 adds the topology (triangles, which is all mesh_prologue makes) and gives mesh entries a new library name.

A quick way to tell, on your next warm run: if the names in the warnings are those of mesh pipelines (mesh_pipeline), #352 should remove them. If some are VS/PS graphics pipelines, there is a second cause, and the name/description log you describe is the way to find it.

AI-assisted (Claude Code); from reading the code and #352, not run.

**@⁠BastienRodz** on GitHub · 2026-11-24 11:04 UTC · [original](https://github.com/Marvisak/VIctory/issues/780#issuecomment-7129614051) Possibly a known cause, if the 47 pairs are mesh pipelines: #352 found that a mesh pipeline never loads from the library. `LoadPipeline` refuses it with the same "does not match the one used to create the PSO" (972), even with the very stream it was made from, unless the stream has a `PRIMITIVE_TOPOLOGY` subobject that isn't `UNDEFINED`; the store is then refused with "already exists" (970). That's the pair you see, every run. #352 adds the topology (triangles, which is all `mesh_prologue` makes) and gives mesh entries a new library name. A quick way to tell, on your next warm run: if the names in the warnings are those of mesh pipelines (`mesh_pipeline`), #352 should remove them. If some are VS/PS graphics pipelines, there is a second cause, and the name/description log you describe is the way to find it. AI-assisted (Claude Code); from reading the code and #352, not run.
Author
Owner

@⁠Kegwed on GitHub · 2026-11-24 11:27 UTC · original

Found it: the mesh pipeline stream leaves the primitive topology out, and the pipeline library cannot load back a mesh pipeline whose topology is undefined.

Standalone repro (no game files). A trivial mesh + pixel shader compiled with DXC 1.9 (ms_6_6 / ps_6_6), a stream laid out like mesh_pipeline's, one ID3D12PipelineLibrary1: CreatePipelineState → StorePipeline → LoadPipeline with the same stream returns E_INVALIDARG ("desc provided does not match"). Variations, each from a fresh library:

stream LoadPipeline
root, MS, PS, RT formats (+ VIctory's blend / raster / depth / DSV / samples) fails
+ node mask, + flags, + sample desc/mask, + DSV format fails
+ topology UNDEFINED given explicitly fails
+ topology TRIANGLE loads
+ topology LINE (shader outputs triangles) loads

Reusing the same root signature object or a copy of the code changes nothing, and a serialised-then-reopened library behaves the same. Any defined topology makes it load. Translated mesh shaders always output triangles (mesh_prologue refuses others), so the fix adds a PRIMITIVE_TOPOLOGY = TRIANGLE subobject.

This means every mesh pipeline was compiled again on every run, not only the names you saw twice: the warning pairs only show for names requested more than once within one run.

In the title (RTX 3060 Laptop, driver 621.01, Windows 11, main at ffe310e, diag build, VICTORY_D3D12_DEBUG=1, scripted keys into the world, each run stopped 4 min after loading the world):

run library at start "desc does not match" "already exists" pipelines made / loaded
before the fix empty 139 (all 41 names mesh) 167 1478 / 4
with the fix empty 0 11 1283 / 157
with the fix the run above's 0 2 45 / 1353

The few remaining "already exists" are two workers creating the same new pipeline at once (both loads miss before either stores), a separate and harmless race.

Branch: https://github.com/Kegwed/VIctory/tree/gpu/mesh-pipeline-topology (commit 38ea605 on ffe310e; PR creation is limited to collaborators) — one file (crates/victory-gpu/src/pipeline/host.rs): the stream becomes a module-level MeshStream with the topology subobject, plus a unit test that the stream names a triangle topology. cargo test -p victory-gpu --features diagnostics passes (54 passed, 1 ignored), cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings is clean, cargo xtask policy ok.

I first suspected uninitialised padding in the stream (it has some); zeroing it changed nothing (135 mismatches), so it is not part of the fix.

AI-assisted (Claude Code); runs on my machine, no game data in the branch or here.

**@⁠Kegwed** on GitHub · 2026-11-24 11:27 UTC · [original](https://github.com/Marvisak/VIctory/issues/780#issuecomment-7130129697) Found it: the mesh pipeline stream leaves the primitive topology out, and the pipeline library cannot load back a mesh pipeline whose topology is undefined. **Standalone repro (no game files).** A trivial mesh + pixel shader compiled with DXC 1.9 (`ms_6_6` / `ps_6_6`), a stream laid out like `mesh_pipeline`'s, one `ID3D12PipelineLibrary1`: `CreatePipelineState` → `StorePipeline` → `LoadPipeline` with the *same* stream returns `E_INVALIDARG` ("desc provided does not match"). Variations, each from a fresh library: | stream | `LoadPipeline` | |---|---| | root, MS, PS, RT formats (+ VIctory's blend / raster / depth / DSV / samples) | fails | | + node mask, + flags, + sample desc/mask, + DSV format | fails | | + topology `UNDEFINED` given explicitly | fails | | + topology `TRIANGLE` | loads | | + topology `LINE` (shader outputs triangles) | loads | Reusing the same root signature object or a copy of the code changes nothing, and a serialised-then-reopened library behaves the same. Any defined topology makes it load. Translated mesh shaders always output triangles (`mesh_prologue` refuses others), so the fix adds a `PRIMITIVE_TOPOLOGY = TRIANGLE` subobject. This means every mesh pipeline was compiled again on every run, not only the names you saw twice: the warning pairs only show for names requested more than once within one run. **In the title** (RTX 3060 Laptop, driver 621.01, Windows 11, `main` at `ffe310e`, diag build, `VICTORY_D3D12_DEBUG=1`, scripted keys into the world, each run stopped 4 min after loading the world): | run | library at start | "desc does not match" | "already exists" | pipelines made / loaded | |---|---|---:|---:|---:| | before the fix | empty | 139 (all 41 names mesh) | 167 | 1478 / 4 | | with the fix | empty | 0 | 11 | 1283 / 157 | | with the fix | the run above's | 0 | 2 | 45 / 1353 | The few remaining "already exists" are two workers creating the same new pipeline at once (both loads miss before either stores), a separate and harmless race. **Branch:** https://github.com/Kegwed/VIctory/tree/gpu/mesh-pipeline-topology (commit `38ea605` on `ffe310e`; PR creation is limited to collaborators) — one file (`crates/victory-gpu/src/pipeline/host.rs`): the stream becomes a module-level `MeshStream` with the topology subobject, plus a unit test that the stream names a triangle topology. `cargo test -p victory-gpu --features diagnostics` passes (54 passed, 1 ignored), `cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings` is clean, `cargo xtask policy` ok. I first suspected uninitialised padding in the stream (it has some); zeroing it changed nothing (135 mismatches), so it is not part of the fix. AI-assisted (Claude Code); runs on my machine, no game data in the branch or here.
Author
Owner

@⁠LAKSHYA-cmd-tech on GitHub · 2026-11-24 11:30 UTC · original

The 972/970 mismatch is caused by mesh pipeline state streams lacking an explicit PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE subobject, which D3D12 LoadPipeline requires to match stored PSOs (as documented by @⁠rhuantac in #352 and #264), combined with uninitialized RTFormats past NumRenderTargets. Resolved and verified in https://github.com/LAKSHYA-cmd-tech/VIctory/pull/17.

**@⁠LAKSHYA-cmd-tech** on GitHub · 2026-11-24 11:30 UTC · [original](https://github.com/Marvisak/VIctory/issues/780#issuecomment-7130186573) The 972/970 mismatch is caused by mesh pipeline state streams lacking an explicit PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE subobject, which D3D12 LoadPipeline requires to match stored PSOs (as documented by @⁠rhuantac in #352 and #264), combined with uninitialized RTFormats past NumRenderTargets. Resolved and verified in https://github.com/LAKSHYA-cmd-tech/VIctory/pull/17.
Author
Owner

@⁠Bullet18x on GitHub · 2026-11-24 19:49 UTC · original

Same on an RTX 5090 (driver 621.40, Windows 11 10.0.28000), main ffe310e: a warm run with VICTORY_D3D12_DEBUG=1 gives 350× id=972 and 358× id=970. With #352 applied: 0 and 5. With #1041: 288 and 211. Numbers and protocol in my comment on #352.

**@⁠Bullet18x** on GitHub · 2026-11-24 19:49 UTC · [original](https://github.com/Marvisak/VIctory/issues/780#issuecomment-7142651790) Same on an RTX 5090 (driver 621.40, Windows 11 10.0.28000), `main` `ffe310e`: a warm run with `VICTORY_D3D12_DEBUG=1` gives 350× id=972 and 358× id=970. With #352 applied: 0 and 5. With #1041: 288 and 211. Numbers and protocol in my comment on #352.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:52 UTC · original

Automated triage for the maintainers. Fixed in main. As found in the comments, the warning pairs (972 then 970) came from mesh pipelines: the library cannot load a mesh pipeline whose stream has no primitive topology. Commit 9c58a1c ("mesh pipelines load from the library") adds a PRIMITIVE_TOPOLOGY subobject to the stream in mesh_pipeline (crates/victory-gpu/src/pipeline/host.rs). The few "already exists" warnings left come from two workers creating the same new pipeline at once, which is harmless.

If a warm run on current main still shows "does not match" for vertex/pixel pipelines, please post the names and this can be reopened. Proposed for closing as fixed in main. It will be closed in 48 hours unless the reporter replies or a maintainer removes the label.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:52 UTC · [original](https://github.com/Marvisak/VIctory/issues/780#issuecomment-7152317846) <!-- victory-issue-triage v1 verdict=proposed-close seen=2026-11-24T19:49:57Z at=2026-11-25T03:52:18Z --> Automated triage for the maintainers. Fixed in `main`. As found in the comments, the warning pairs (972 then 970) came from mesh pipelines: the library cannot load a mesh pipeline whose stream has no primitive topology. Commit 9c58a1c ("mesh pipelines load from the library") adds a `PRIMITIVE_TOPOLOGY` subobject to the stream in `mesh_pipeline` (`crates/victory-gpu/src/pipeline/host.rs`). The few "already exists" warnings left come from two workers creating the same new pipeline at once, which is harmless. If a warm run on current `main` still shows "does not match" for vertex/pixel pipelines, please post the names and this can be reopened. Proposed for closing as fixed in `main`. It will be closed in 48 hours unless the reporter replies or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#780
No description provided.