GPU: the host pipeline library never loads a mesh pipeline (D3D12 refuses the description it stored), so 723 are recompiled every run; repro without the title, fix on a fork #1683
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#1683
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Pablo-Barros on GitHub · 2026-11-24 20:43 UTC · original
What happens.
ID3D12PipelineLibrary1::LoadPipelinerefuses every mesh pipeline withE_INVALIDARG. With the D3D12 debug layer on it is message 972, "The pipeline state desc provided does not match the one used to create the PSO stored with name …". It does so with the description that created the PSO, passed right afterStorePipelinesucceeded. Graphics and compute pipelines load back. So the library has never served a mesh pipeline: each is compiled in every run, stored again (refused, message 970 "already exists"), and its entry stays in a library that only grows.In the game. RTX 3070, Windows 11 build 26300, system D3D12 runtime 10.0.26100.10068,
mainatffe310e, debug layer on. A run over the library the previous run wrote (early start of 1,800 pipelines):The 1,000 graphics and compute pipelines load in about 7 s; the 723 mesh pipelines are compiled over the next 55 s as the title creates them. An unmodified
mainlogs them too (567 of 970 and 568 of 972 by the end of the early start).host-pipelines.binis 231 MB here.Without the title. The program below: trivial mesh (
ms_6_5) and pixel shaders compiled with dxc, an empty root signature, a stream of root signature, MS, PS, render target formats, depth format and sample description.CreatePipelineState,StorePipeline("m"), thenLoadPipeline("m", <the same stream>): refused, before and afterSerialize, in the same process. The graphics (VS + PS) and compute pipelines in the same program load. Output on the RTX 3070:The same on:
ID3D12SDKConfiguration1::CreateDeviceFactory,D3D12Core.dll1.618.1 loaded, checked) on the RTX 3070.Also tried with a longer program, all refused: an explicit empty AS subobject; no PS; the ten subobjects VIctory hands over (blend, sample mask, rasterizer, depth-stencil, RT formats, DSV format, sample desc).
Found on the way: padding. The library compares descriptions byte for byte, and two of ours carried bytes that are not fields. The depth-stencil description is copied from the title's stream as it stands, and the two bytes between
StencilWriteMaskandFrontFacehold the title's stack: in one run 192 mesh pipelines differed from a copy of themselves only there, under one name. A mesh pipeline's stream has four unwritten bytes between the type and each eight-byte subobject. This is masked today by the problem above (mesh pipelines do not load either way), but it would bite as soon as they do.A fix on my fork (pull requests are collaborators-only, so a branch): https://github.com/Pablo-Barros/VIctory/tree/gpu/pipeline-library, two commits on
ffe310e. CI's two clippy commands and the workspace tests pass.0707260zeroes that padding where the descriptions are read and built, and in the stream before it is handed over. Two tests: descriptions read from0xffbytes keep their fields and lose their padding; a stream with set values likewise.cae3f32The first pipeline of a kind that is stored is loaded back at once. Refused, the library gets no more of that kind in the run, and says so once:WARN host pipeline library refuses a mesh pipeline it just stored: mesh pipelines are compiled every run, none keptSame cold run as above: 1 of message 970, 2 of 972, and the 1,051 graphics and compute pipelines still load.
What this does not solve. The mesh pipelines are still compiled in every run. That needs a runtime that loads them, or another cache. Old libraries keep their dead mesh entries (
ID3D12PipelineLibrarycannot remove one); deletinghost-pipelines.binonce reclaims the space.I cannot tell whether it is the same with the AMD driver. On a second run,
host pipeline library saved … made=… loaded=…tells: with 1,800 pipelines started early,loadedshould be well over 1,000 if mesh pipelines load.Written with Claude (Anthropic); the runs, the measurements and the program below are from this machine.
The program (Rust,
windows0.62.2) and the four shaders@AgneyaK on GitHub · 2026-11-24 20:57 UTC · original
For the "or another cache" part: the per-pipeline cached blob doesn't work for mesh pipelines either.
I tried
ID3D12PipelineState::GetCachedBlob+ aD3D12_PIPELINE_STATE_SUBOBJECT_TYPE_CACHED_PSOsubobject, with a standalone program: a trivialms_6_5+ps_6_5, an empty root signature, a stream of root signature, MS, PS, RT formats and sample desc, andCreatePipelineState, thenGetCachedBlob, thenCreatePipelineStateof the same stream plusCACHED_PSOwith that blob.E_INVALIDARGE_INVALIDARGSystem runtime
D3D12Core.dll10.0.26100.10068, Windows 11 26300,windows0.62.2. A corrupted or truncated blob is alsoE_INVALIDARG, so a stale cache can't be told apart from this. So it looks like the same runtime-side mismatch for mesh pipeline descriptions as in your library repro, through a second route. Not tried with the Agility SDK runtime.One thing that may make "compiled every run" cheaper than it sounds on NVIDIA: the driver's own shader cache. The same mesh pipeline took 19.4 ms to create in the first process and 0.97–2.1 ms in the following ones. I haven't measured that for the title's 723.
The program is about 120 lines; I can post it if useful.
AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it on my machine and drafted this.
@AgneyaK on GitHub · 2026-11-24 21:52 UTC · original
Correction to my comment above:
CACHED_PSOdoes work for mesh pipelines. My probe had the same gap thatmain9c58a1cfixes for the library: its mesh stream had noPRIMITIVE_TOPOLOGYsubobject.Same standalone program (trivial
ms_6_5+ps_6_5, empty root signature), the only change being aPRIMITIVE_TOPOLOGY=TRIANGLEsubobject in the mesh stream:E_INVALIDARGE_INVALIDARGSo the cause is the same one
9c58a1cnames ("the library refused every mesh pipeline without it"), and a per-pipeline blob is a working fallback too, as long as the stream gives the topology. Sorry for the noise.Not tested: the title itself, or
main70564aeloading mesh pipelines from the library in a run.AI use: Claude Code (Claude Opus 5.5) wrote the probe and this comment; the results are from the runs described.
@BaggyALPHA on GitHub · 2026-11-24 22:23 UTC · original
Independent cold-build and cross-process replay on the RTX 3080 12 GiB, driver 621.24, using main with the mesh topology fix. A bounded local probe selected 48 preparable pack records per kind and forced the normal D3D12 library lookup on replay, including for pipelines marked as prebuilt. Both invocations used the same 144 records and the same local library.
The time column sums elapsed time inside native creation calls across workers and includes failures. In this sample, all 117 usable records hit the library on replay, including every mesh record. Mesh accounted for most of the cold creation time. This measures offline pack compilation and cannot establish the startup gain in the title. In-game runs on this setup hit early device removal before reaching a representative mesh workload.
AI-assisted (Codex). Aggregate results only.
@Marvisak on GitHub · 2026-11-25 12:46 UTC · original
Automated triage for the maintainers.
mainby commit9c58a1c(mesh pipelines load from the library). The mesh stream incrates/victory-gpu/src/pipeline/host.rs(the mesh pipeline builder that callslibrary::pipeline) now carries an explicitPRIMITIVE_TOPOLOGYsubobject. AgneyaK's probe and BaggyALPHA's replay above (48 of 48 mesh hits on a warm run) both show the library now serves mesh pipelines.main940d32f, confirmed): in the same file,GraphicsStatereads the depth-stencil description withread_unalignedstraight from the title's stream (subobject 11), so the two bytes afterStencilWriteMaskkeep whatever the title left there. The meshStreamstruct is built from a struct literal, so its padding between each subobject type and its 8-byte-aligned data is never zeroed either. Now that mesh pipelines load, this can produce library misses for descriptions that differ only in padding.Your fork commit
0707260(zero the padding, with tests) addresses the second part;cae3f32is no longer needed after9c58a1c. Pull requests are open to everyone, so please open0707260as a PR on currentmain.Generated by Claude Code