GPU: mesh pipelines load from the pipeline library (name their topology) #352

Closed
rhuantac wants to merge 1 commit from upstream-pr/352 into main
rhuantac commented 2026-11-24 02:30:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by rhuantac on 2026-11-24T02:30:50Z.


A mesh pipeline never loaded from the host pipeline library: LoadPipeline refused it with E_INVALIDARG (debug layer 972, "does not match the one used to create the PSO") even with the very stream it was made from, so every mesh pipeline was compiled again on every run and its store then refused (970, "already exists") — the 972/970 pair in #264 (item 3; #334 covers its items 1 and 2).

Measured with synthetic pipelines on an RTX 3060 Ti, Windows 11 26300, with and without the debug layer: compute, graphics (DXBC and DXIL) and VS/PS streams load; a mesh stream loads only with a PRIMITIVE_TOPOLOGY subobject that is not UNDEFINED. The debug layer wants it to match the mesh shader's output topology (1323), and our translation makes triangle mesh shaders only (mesh_prologue), so the stream now names TRIANGLE. Mesh pipelines get a new library name ("mesh triangles"), so entries stored without a topology are not looked up again.

Test: a_mesh_pipeline_loads_from_the_library makes a mesh pipeline twice through mesh_pipeline and requires the second to come from the library; it fails before this change and passes after (skipped without a PC dxc.exe). cargo test -p victory-gpu: 44 passed, 1 ignored. Not measured: the effect on the title's loading time.

AI use: Claude Code ran the experiments and wrote the change; I reviewed it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6573279764 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352). Originally posted by [rhuantac](https://github.com/rhuantac) on 2026-11-24T02:30:50Z. --- A mesh pipeline never loaded from the host pipeline library: `LoadPipeline` refused it with `E_INVALIDARG` (debug layer 972, "does not match the one used to create the PSO") even with the very stream it was made from, so every mesh pipeline was compiled again on every run and its store then refused (970, "already exists") — the 972/970 pair in #264 (item 3; #334 covers its items 1 and 2). Measured with synthetic pipelines on an RTX 3060 Ti, Windows 11 26300, with and without the debug layer: compute, graphics (DXBC and DXIL) and VS/PS streams load; a mesh stream loads only with a `PRIMITIVE_TOPOLOGY` subobject that is not `UNDEFINED`. The debug layer wants it to match the mesh shader's output topology (1323), and our translation makes triangle mesh shaders only (`mesh_prologue`), so the stream now names `TRIANGLE`. Mesh pipelines get a new library name (`"mesh triangles"`), so entries stored without a topology are not looked up again. Test: `a_mesh_pipeline_loads_from_the_library` makes a mesh pipeline twice through `mesh_pipeline` and requires the second to come from the library; it fails before this change and passes after (skipped without a PC `dxc.exe`). `cargo test -p victory-gpu`: 44 passed, 1 ignored. Not measured: the effect on the title's loading time. AI use: Claude Code ran the experiments and wrote the change; I reviewed it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ifBars commented 2026-11-24 06:55:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ifBars on 2026-11-24T02:42:33Z.


I reproduced the cache miss on Windows 10 with Agility SDK 620 and the WARP software adapter. I ran the same synthetic triangle mesh pipeline through Causeway's mesh-pipeline creation path 21 times, saved the library, then reopened it in a new process. Without the topology, the reopened library served 0/21 calls. With the triangle topology and the new cache key, it served all 21. On an empty cache the changed build compiled the first pipeline and loaded the next 20.

Our last story trace includes successful mesh pipeline creations, but it only reports aggregate library hits. These results establish the cache behavior. The effect on story loading time and FPS remains unmeasured.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7120405272 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7120405272). Originally posted by [ifBars](https://github.com/ifBars) on 2026-11-24T02:42:33Z. --- I reproduced the cache miss on Windows 10 with Agility SDK 620 and the WARP software adapter. I ran the same synthetic triangle mesh pipeline through Causeway's mesh-pipeline creation path 21 times, saved the library, then reopened it in a new process. Without the topology, the reopened library served 0/21 calls. With the triangle topology and the new cache key, it served all 21. On an empty cache the changed build compiled the first pipeline and loaded the next 20. Our last story trace includes successful mesh pipeline creations, but it only reports aggregate library hits. These results establish the cache behavior. The effect on story loading time and FPS remains unmeasured.
fuzeofficlal commented 2026-11-24 12:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-24T11:20:24Z.


I verified the on-disk pipeline library on exact head f77bd28 with a physical RTX 5090 (driver 616.56) and Windows build 26200. Both processes used VIctory's production HostPipeline::new path with the same synthetic triangle mesh shader and a separate VS/PS control.

Process Mesh created / loaded VS/PS created / loaded
Empty library, then save 1 / 0 1 / 0
New process, reopen saved library 0 / 1 0 / 1

The processes used the same GPU LUID and the same 3,512-byte library. The cold run had two expected name-not-found messages (971). The reopen run had no D3D12 diagnostics. This measures reuse of the synthetic PSOs across process launches.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7129969393 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7129969393). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-24T11:20:24Z. --- I verified the on-disk pipeline library on exact head `f77bd28` with a physical RTX 5090 (driver 616.56) and Windows build 26200. Both processes used VIctory's production `HostPipeline::new` path with the same synthetic triangle mesh shader and a separate VS/PS control. | Process | Mesh created / loaded | VS/PS created / loaded | | --- | ---: | ---: | | Empty library, then save | 1 / 0 | 1 / 0 | | New process, reopen saved library | 0 / 1 | 0 / 1 | The processes used the same GPU LUID and the same 3,512-byte library. The cold run had two expected name-not-found messages (971). The reopen run had no D3D12 diagnostics. This measures reuse of the synthetic PSOs across process launches.
qntic commented 2026-11-24 14:04:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by qntic on 2026-11-24T13:26:40Z.


another data point from amd, rx 6600 xt with driver 32.0.21045.5002.

a_mesh_pipeline_loads_from_the_library passes both with this pr and after removing the topology subobject entirely.

setting it to D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED instead causes E_INVALIDARG.

looks like the original issue may be driver-specific. the fix itself works fine on my card too.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7132837621 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7132837621). Originally posted by [qntic](https://github.com/qntic) on 2026-11-24T13:26:40Z. --- another data point from amd, rx 6600 xt with driver 32.0.21045.5002. a_mesh_pipeline_loads_from_the_library passes both with this pr and after removing the topology subobject entirely. setting it to D3D12_PRIMITIVE_TOPOLOGY_TYPE_UNDEFINED instead causes E_INVALIDARG. looks like the original issue may be driver-specific. the fix itself works fine on my card too.
rhuantac commented 2026-11-24 16:05:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by rhuantac on 2026-11-24T15:22:44Z.


In-title check of this PR, on an RTX 3060 Ti (driver 610.88, Windows 11) with retail 1.0.2.1. Details are in https://github.com/Marvisak/VIctory/issues/732#issuecomment-7135901923.

test/world-stack (e0c3385) with and without this PR (f77bd28, merges cleanly), diag with VICTORY_D3D12_DEBUG=1, two runs per tree from a new empty cache, about 2 min of the intro cutscene each:

run 1: 972 / 970 run 2: 972 / 970
without #352 16 / 17 82 / 82
with #352 0 / 0 0 / 0

No id=1323 with the PR. Not measured: the effect on loading time.

AI-assisted (Claude Code); the numbers are counted from the logs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135923255 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7135923255). Originally posted by [rhuantac](https://github.com/rhuantac) on 2026-11-24T15:22:44Z. --- In-title check of this PR, on an RTX 3060 Ti (driver 610.88, Windows 11) with retail 1.0.2.1. Details are in https://github.com/Marvisak/VIctory/issues/732#issuecomment-7135901923. `test/world-stack` (`e0c3385`) with and without this PR (`f77bd28`, merges cleanly), `diag` with `VICTORY_D3D12_DEBUG=1`, two runs per tree from a new empty cache, about 2 min of the intro cutscene each: | | run 1: 972 / 970 | run 2: 972 / 970 | |---|---|---| | without #352 | 16 / 17 | 82 / 82 | | with #352 | **0 / 0** | **0 / 0** | No id=1323 with the PR. Not measured: the effect on loading time. AI-assisted (Claude Code); the numbers are counted from the logs.
bittertea0323 commented 2026-11-24 16:05:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by bittertea0323 on 2026-11-24T15:56:50Z.


Real-title confirmation: made goes 512 → 72 → 1

Your fix does more than the synthetic case in #780. Measured on a 4070 SUPER, Windows 10, Series X,
try/wave64 (i.e. #189 + #940 + #729 + #737 + this) + VICTORY_WAVE64_EMULATE=emulate +
VICTORY_TEXTURE_MIP_DROP=1, diag build, 240 s per run:

run pipelines rebuilt (made) loaded from library early list
without #352 (4 runs, stable) 512–534 586 → 705 1229 → 1246
with #352, first run 72 743 1246
with #352, after warming the library 1 1272 1307

The first run alone confirms your diagnosis: mesh PSOs that never loaded before start loading, so the
rebuild count drops by 86 % on a cold library. What the later run shows is that the rest was only
cold-miss too — once the library holds the entries, exactly one pipeline still needs compiling, and
1272 load.

Knock-on effects that matter more than the counter:

  • Slowest host submission in the world stage fell from 13318 ms to 1031 ms (the 13 s submission was
    the title compiling a batch that your fix now loads).
  • building … (N being made) during the world dropped from 167–243 to 122–165, and the frame budget
    finally stopped being dominated by compilation.
  • The same 240 s run now reaches 3370 draws/frame and completes without a device removal, where
    before it died at 93 s on a 13.3 s submission.

Not measured: whether made=1 needs a second warm run on other hardware, and which single pipeline it
is (we did not enable VICTORY_D3D12_DEBUG=1 to get its name). If you want that name I can run once
with the debug layer on.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136875650 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7136875650). Originally posted by [bittertea0323](https://github.com/bittertea0323) on 2026-11-24T15:56:50Z. --- ## Real-title confirmation: `made` goes 512 → 72 → 1 Your fix does more than the synthetic case in #780. Measured on a 4070 SUPER, Windows 10, Series X, `try/wave64` (i.e. #189 + #940 + #729 + #737 + this) + `VICTORY_WAVE64_EMULATE=emulate` + `VICTORY_TEXTURE_MIP_DROP=1`, diag build, 240 s per run: | run | pipelines rebuilt (`made`) | loaded from library | early list | |---|---|---|---| | without #352 (4 runs, stable) | **512–534** | 586 → 705 | 1229 → 1246 | | with #352, first run | **72** | 743 | 1246 | | with #352, after warming the library | **1** | **1272** | 1307 | The first run alone confirms your diagnosis: mesh PSOs that never loaded before start loading, so the rebuild count drops by 86 % on a cold library. What the later run shows is that the rest was only cold-miss too — once the library holds the entries, **exactly one pipeline still needs compiling**, and 1272 load. Knock-on effects that matter more than the counter: - Slowest host submission in the world stage fell from **13318 ms to 1031 ms** (the 13 s submission was the title compiling a batch that your fix now loads). - `building … (N being made)` during the world dropped from 167–243 to 122–165, and the frame budget finally stopped being dominated by compilation. - The same 240 s run now reaches **3370 draws/frame** and completes without a device removal, where before it died at 93 s on a 13.3 s submission. Not measured: whether `made=1` needs a second warm run on other hardware, and which single pipeline it is (we did not enable `VICTORY_D3D12_DEBUG=1` to get its name). If you want that name I can run once with the debug layer on.
Yaekai commented 2026-11-24 17:04:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Yaekai on 2026-11-24T16:19:58Z.


Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head f77bd28:

  • cargo test -p victory-gpu --lib: 44 passed, 0 failed (including a_mesh_pipeline_loads_from_the_library).
  • cargo clippy -p victory-gpu -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s): confirmed mesh pipelines save to and reload cleanly from the host pipeline library (loaded=2102 on warm restart). Ready to merge!
<!-- greyfinch-sync:Marvisak/VIctory:comment:7137493631 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7137493631). Originally posted by [Yaekai](https://github.com/Yaekai) on 2026-11-24T16:19:58Z. --- Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head `f77bd28`: - `cargo test -p victory-gpu --lib`: 44 passed, 0 failed (including `a_mesh_pipeline_loads_from_the_library`). - `cargo clippy -p victory-gpu -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`): confirmed mesh pipelines save to and reload cleanly from the host pipeline library (`loaded=2102` on warm restart). Ready to merge!
Bullet18x commented 2026-11-24 20:03:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bullet18x on 2026-11-24T19:48:54Z.


RTX 5090 A/B of the pipeline-library messages: this PR vs #1041 vs plain main, same machine, same protocol.

Machine: RTX 5090 32 GB, driver 621.40 (32.0.16.2114), Ryzen 9 9950X3D, 64 GB, Windows 11 Pro 10.0.28000 (in-box D3D12 10.0.28000.3365, Graphics Tools installed).
Builds: each PR's single commit applied on main ffe310e (f77bd28 for this PR, 4111946 for #1041; each applies cleanly alone, the two conflict in pipeline/host.rs), cargo build --profile diag -p victory --features diagnostics.
Protocol per build: empty pipeline library (host-pipelines.bin and early-pipelines.txt removed, shader translations kept), run 1 to fill it, then run 2 with VICTORY_D3D12_DEBUG=1; debug-layer messages counted in run 2. Both runs: VICTORY_KEYS=8:Enter,20:Enter,35:Enter, VICTORY_D3D12_DRED=1, victory.exe run <dump>\game_scarlett_master.exe --execute.

Build 972 (desc does not match) 970 (already exists) 971 (not stored)
main ffe310e 350 358 256
+ #352 (this PR) 0 5 386
+ #1041 288 211 186
  • With this PR the mismatch / failed-store pairs are gone (972: 350 → 0, 970: 358 → 5), matching the RTX 3060 Laptop numbers in #780 (139 → 0).
  • 971 ("does not have a pipeline stored") is a plain miss for pipelines the first run never made; it depends on how far that run got (every run ended in DXGI_ERROR_DEVICE_HUNG in the world, the first runs after 153 / 84 / 88 s), so it is not comparable between rows.
  • #1041 lowers 970 / 972 by roughly 20–40 % but does not remove them, so zeroing padding is not the cause here; the missing mesh topology is.

Not tested: AMD / Intel, more than one run per build, the two PRs together (they conflict).

No game data, title-content log lines or screenshots attached. AI use: Claude Code (Claude Opus 5.5) built, ran and counted the messages; I checked the results.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7142627096 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/352#issuecomment-7142627096). Originally posted by [Bullet18x](https://github.com/Bullet18x) on 2026-11-24T19:48:54Z. --- RTX 5090 A/B of the pipeline-library messages: this PR vs #1041 vs plain `main`, same machine, same protocol. **Machine**: RTX 5090 32 GB, driver 621.40 (32.0.16.2114), Ryzen 9 9950X3D, 64 GB, Windows 11 Pro 10.0.28000 (in-box D3D12 10.0.28000.3365, Graphics Tools installed). **Builds**: each PR's single commit applied on `main` `ffe310e` (`f77bd28` for this PR, `4111946` for #1041; each applies cleanly alone, the two conflict in `pipeline/host.rs`), `cargo build --profile diag -p victory --features diagnostics`. **Protocol per build**: empty pipeline library (`host-pipelines.bin` and `early-pipelines.txt` removed, shader translations kept), run 1 to fill it, then run 2 with `VICTORY_D3D12_DEBUG=1`; debug-layer messages counted in run 2. Both runs: `VICTORY_KEYS=8:Enter,20:Enter,35:Enter`, `VICTORY_D3D12_DRED=1`, `victory.exe run <dump>\game_scarlett_master.exe --execute`. | Build | 972 (desc does not match) | 970 (already exists) | 971 (not stored) | |---|---|---|---| | `main` `ffe310e` | 350 | 358 | 256 | | + #352 (this PR) | **0** | **5** | 386 | | + #1041 | 288 | 211 | 186 | - With this PR the mismatch / failed-store pairs are gone (972: 350 → 0, 970: 358 → 5), matching the RTX 3060 Laptop numbers in #780 (139 → 0). - 971 ("does not have a pipeline stored") is a plain miss for pipelines the first run never made; it depends on how far that run got (every run ended in `DXGI_ERROR_DEVICE_HUNG` in the world, the first runs after 153 / 84 / 88 s), so it is not comparable between rows. - #1041 lowers 970 / 972 by roughly 20–40 % but does not remove them, so zeroing padding is not the cause here; the missing mesh topology is. **Not tested**: AMD / Intel, more than one run per build, the two PRs together (they conflict). No game data, title-content log lines or screenshots attached. AI use: Claude Code (Claude Opus 5.5) built, ran and counted the messages; I checked the results.
upstream-sync closed this pull request 2026-11-24 23:04:06 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!352
No description provided.