GPU: pipelines of different names load from the library at the same time #1000
No reviewers
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!1000
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1000/head"
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?
@TG0000 on GitHub · 2026-11-24 14:48 UTC · original
TG0000:perf/parallel-pipeline-loads→main· +230 −7 · 1 files · 1 commits · merged 2026-11-25 00:09 UTCSummary
library::pipeline()held the pipeline library's mutex while a pipeline loaded. On AMD a load is not always a lookup: the library file holds only about 140 bytes per pipeline, and what the driver's own cache lacks is compiled inside the load, for up to seconds. All eight pipeline workers then ran as one, and the backlog kept recording threads inmake::wait.Loads now run outside the library's lock, and only same-name pipelines exclude each other. Microsoft documents the library as thread-safe with exactly that exception. Stores and serialising keep the lock. One file:
pipeline/library.rs.Measured (RX 6800, Ryzen 9 5900X, Windows 11, diagnostics build, sampled stacks)
Two runs per side, order main / PR / PR / main:
Frames are not shorter on their own. Main looks faster because it drops almost every draw; here they run and their cost shows.
Caveats: the worker rows use a build on top of the copy changes of
TG0000:perf/world-frame-copiesfor main's side (same lock) and the first run under a new exe name for this PR's side; the driver's cache appears to be per exe, and the second PR run had it warm while main's second run did not, so the first run of each is the stricter comparison. The lock is proven by the stacks; thatmake::waitis the unaccounted time rests on frames pinned at exactly 500 ms, the backlog and the A/B, not on a stack inside it.Verification
Rust 1.98.1 MSVC, base
ffe310e:cargo test --workspace --locked345 passed, 0 failed, including a GPU test with 8 threads loading while others store and serialise;cargo clippy --workspace --all-targets --locked -- -D warningsclean with and without--all-features. Not tested: NVIDIA, Intel, Wine.Overlap
library.rs(saves and the wait budget); the ideas are complementary.AI-assisted: written and measured by Claude Opus 5.5. No game data is in this PR.
🤖 Generated with Claude Code
@MichaelSmithAI on GitHub · 2026-11-24 15:02 UTC · original
On an RTX 4090 under Wine/vkd3d-proton 3.2, all five focused library tests passed with
f821cb9plus #844’s null-pointer fix for opening an empty host library. The 96-pipeline fixture exercised the host D3D12 library directly, with concurrent loads of distinct names while other threads stored and serialized. The separate name-gate tests verified that different names can proceed together and callers for the same name take turns.We also integrated #983’s early-pipeline list changes. All seven library tests passed. In a separate test using VIctory’s save API, saving before first use preserved both legacy keys, and the next save promoted the newly used pipeline. The first run of that fixture hit an existing temporary directory after Wine reused a process ID. It passed after switching to a unique directory.
These runs verify library behavior on Wine. We did not measure worker backlog, frame time, or title output on the RTX 4090.
@ThomasHFWright on GitHub · 2026-11-24 15:07 UTC · original
Independent NVIDIA/Wine validation of
f821cb9d7550180d7fb1bd8f7318174e3a680041, based onffe310e. This covers compatibility/correctness of the tests, not the performance improvement measured on AMD.Environment: Linux, RTX 5090 / NVIDIA 620.73.04, Wine 11.22, vkd3d-proton
30b0eb9bc12dc9f, DXVK dxgi, Rust 1.98.1,x86_64-pc-windows-msvc. An app-local natived3dcompiler_47.dllfrom an existing Winetricks cache was supplied identically to both full-suite configurations so the synthetic HLSL fixtures could compile. All executions were offline under Xvfb.The empty-library fix in #347 is needed on this runtime. With this PR alone, the focused library suite gives 3 passed / 2 failed: both
a_rejected_blob_gives_an_empty_libraryandpipelines_load_on_many_threads_at_oncefail opening the empty library. Applying #347 (197c7acf) makes all five library tests pass. In that focused run I changed the no-device/no-compiler returns into assertions and printed the compiled shader count: all 96 synthetic shaders compiled, so the concurrency test actually ran. That test-only instrumentation was removed before the full suite.Full workspace unit/integration suite, built with
cargo test --workspace --all-features --locked --offline --target x86_64-pc-windows-msvc --no-run, then all 14 generated test executables run under Wine with--nocapture --test-threads=1:ffe310effe310e+ #1000 + #347The GPU crate improves from 52 passed / 1 failed / 1 ignored to 56 passed / 0 failed / 1 ignored. The three added tests pass, as does the empty-library test fixed by #347. No additional failures appeared.
The four failures shared with baseline are
modules::net::tests::only_loopback_is_reachable(missing Wine Winsock export),loads_binds_and_calls_probe(nested Linux Cargo from a Windows process),emit::tests::stub_pipeline_is_created(checksum-rejection expectation differs under vkd3d-proton), andpolicy::tests::repository_passes_policy(Windowsxtaskcannot launch host Git).cargo test -p xtaskseparately passes all four tests natively on Linux, and asset policy passes. Windows-target GPU Clippy with all targets/features and-D warningsalso passes.Limits: no gameplay or performance measurement; no native Windows or genuine Windows WARP run; doctests were not executed under Wine. Some existing tests return early when optional console compilers or the DXIL validator are absent, so the aggregate is the test harness's result, not a claim those optional paths were exercised. No game data was used or attached.
AI-assisted testing with Codex.
@TG0000 on GitHub · 2026-11-24 15:07 UTC · original
Thanks for both runs. So on vkd3d-proton the library tests need #347 or #844 (opening an empty host library); that failure is in code this PR does not change, so I leave it to those PRs.
@Zipettte on GitHub · 2026-11-24 15:12 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
f821cb9:cargo test -p victory-gpupasses, 53 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@TG0000 on GitHub · 2026-11-24 15:15 UTC · original
A correction on the in-game rows. A later warm main / branch / branch / main run of this branch together with #999 did not reproduce the smaller backlog: 528 pipelines still being made on main and 748 on the branch (medians), 522 and 811 draws run, and 1,433 and 1,434 ms per frame. Each side had its own shader cache (509 and 456 entries), and draws differ up to 5x between two runs of the same exe, so that comparison does not settle it either way. Please read "pipelines still being made", "draws run" and the frame times in the table as not reproduced.
What stands is the lock itself: the workers blocked on it in the sampled stacks, and the test with concurrent loads.
@TG0000 on GitHub · 2026-11-24 16:30 UTC · original
Thanks for the careful check, also of the same-name exception in the docs. Both nits are fair: the test should say when it is skipped (no host GPU or no
D3DCompile), and the order "stored before_helddrops" deserves a line in the comment. I will add them with the next change this branch needs, so that your test run stays valid for the current head.AI-assisted (Claude Code).
@TG0000 on GitHub · 2026-11-24 18:00 UTC · original
Thanks for measuring it directly under Wine and vkd3d-proton: the time inside
LoadPipelineand the wait for the lock are the part I could not measure here (Windows, RX 6800 only).@Mumogg on GitHub · 2026-11-24 17:57 UTC · original · edited 2026-11-24 19:08 UTC
Test report from Linux: this is also what starves a warm start under Wine + vkd3d-proton on NVIDIA, and the PR fixes it here.
Setup: RTX 5070 Ti (driver 615.78.08), Ryzen 5 9600X (6 workers), Nobara 44, Wine 11.22 Staging, vkd3d-proton from GE-Proton11-14. Tree: r4tedx
integration/testersupdate 9 (94e0ea5) plus small local changes; diagnostics build; 1.0.2.1, network off. Same warm cache directory for every run (1,167 pipelines listed for an early start, library file 270 kB, so about 190 bytes per pipeline: vkd3d-proton compiles inside the load as well).Before, measured directly. With a timer around the lock and the load in
library::pipeline(), one 300 s warm run:LoadPipeline, summedSo the workers ran strictly one at a time for the whole run. The world's first vertex or mesh pipeline arrived after about 570 s in an earlier 600 s run; a cold cache got 234 mesh and 109 vertex pipelines in its first world minute.
After. First with the load moved outside the lock by hand (the interface cloned under the lock, as here): 907 loads in 300 s instead of 280, lock wait 0. Then with this PR's code (
f821cb9, merged into that tree; the only conflict was theuse std::syncline): all 1,620 early pipelines were loaded 101 s after start (host pipelines all made made=0 loaded=1621 started_early=1620), no device removal, no error from the library in three runs with concurrent loads. That last run also had a two-level queue (see my note on #546), so the 101 s is not this PR alone.Not tested: AMD, native Windows, a library file from a different driver version.
(AI-assisted, Claude Code: it found the lock from the logs, added the timers and ran the comparisons on my machine.)
Edit: the Wine version was 11.22 Staging, not 11.21 (the system had updated before these runs).