GPU: load pipeline library entries without the global mutex #1679
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1680"
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?
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T20:42:29Z.
Summary
Loads from the host pipeline library ran under the one mutex that holds the library, so pipeline workers serialised behind loads that take seconds.
CreatePipelineLibraryonly requires that loads of the same pipeline name do not overlap.Reworked on upstream
70564ae(which added the pre-built list):ID3D12PipelineLibrary1beside the bookkeeping, so a load does not take the library mutex.prebuiltstate, which is read and written under the same mutex as before.Based on the original #1680 design by @Vaximous, reduced to the load path for the new library structure.
Validation
cargo test -p victory-gpu --locked pipeline::library— 4 passed.victory-gpusuite: 77 passed, 1 failed, 1 ignored. The failure isdraw::tests::a_texture_written_in_one_format_reads_in_another_through_a_placed_view, which fails identically on plainorigin/mainon this machine (unrelated).--all-targets --all-features -D warningsandcargo xtask policy(174 files) passed.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:42:12Z.
Review: COMMENTED
Static review only: Windows-only code (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; source review of the diff.
Pipeline library loads take a per-name lock instead of one global lock: unsafe impl Sync for Library (justified by the per-name Mutexes), lock_name() returns a guard, and save_interval/save_files add periodic saves with backoff following measured cost (periodic_saves_back_off_and_follow_their_cost test). Replacing a single global lock with per-name locks is the kind of change that needs the Windows playability runs to shake out deadlocks — statically the guard discipline looks consistent.
Imported from Marvisak/VIctory. Originally posted by BaggyALPHA on 2026-11-24T22:01:27Z.
Review: COMMENTED
Independent warm-cache A/B on Windows, RTX 3080 12 GiB, driver 621.24. Both builds used the same diagnostics stack (#1604, #211 and #1702), startup input and Series S profile. Each run received a fresh copy of the same VIctory library and 690-entry early list, plus the same test profile. All four runs accepted the library. The baseline and this PR had identical local timers around the app's load lock, the D3D12 load call, and fallback pipeline creation.
Both builds had 510 cache hits by the 512-request sample in both trials. The lock values are elapsed time summed across workers. The driver cache was left intact across runs, so the speedup magnitude is sensitive to run conditions. The app-side lock reduction and improved startup load throughput held in both orders.
In the longer pair, by 1,024 completed requests each build had 540 hits and 484 fallback creation calls. Those calls accumulated 171.87 s / 195.83 s of worker elapsed time, respectively. This points to native creation as a useful separate target after the warm-library burst. These measurements cover startup and worker activity.
AI-assisted (Codex). Aggregate results only.
[PR #1680] GPU: pipeline library loads take a lock for their name, not one for allto [PR #1680] GPU: load pipeline library entries without the global mutexImported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-24T22:17:24Z.
Marking draft: upstream
70564aerebuilt the library around the pre-built pipeline list (prebuilt, prebuilt_changed, save tagging), which overlaps every hunk of the lock/save split here. It needs a rework against the new state rather than a mechanical conflict resolution. The concurrency issue itself is still real (upstream still has oneMutex<Library>), so I will redo it on the new base.Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T00:46:56Z.
Superseded by main: origin/main (
4118f33) now holds a pipeline's name with NAMES.hold(name) around load/store and keeps the library in OnceLock<Option<Mutex>>, so loads of different names run in parallel while loads/stores of one name are serialised, and saves take the library mutex. That is the same outcome this PR's 64-stripe lock and STORES RwLock produced, with the new pre-build support on top. Closing this in favour of the code already on main; nothing from the PR is lost.Pull request closed