Repository navigation
Conversation
A load still took the library's lock to clone the interface, and a save holds that lock while it serialises the whole library (230-600 MB in the world, Marvisak#1683, Marvisak#1653). Saves run every 20 s while pipelines are being made, some on the pipeline workers themselves, so every load waited out each save: the part of Marvisak#1615 that Marvisak#1000 left. The library is kept a second time beside its lock, and loads use that one without locking. A load adds nothing to the library, so the size a save asks for still holds when it serialises; the library is free-threaded but for loads of one name, which NAMES keeps apart. Stores and saves keep the lock. New test: a stored pipeline loads while the lock is held as a save holds it. With the old locking it times out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I ran the pipeline-library tests on exact head c8ad2a4 on native Windows with the D3D12 WARP adapter and the diagnostics feature. All nine passed, including the load under a held save mutex and the concurrent load/store/serialize test. For a negative control I put the old lock acquisition back before the load and made unavailable GPU or FXC support fail explicitly. The new test reached the assertion and failed with “the load waited for the save” after 30 seconds. This establishes that the test exercises contention on the project mutex on WARP. Driver latency during serialization remains unmeasured. AI-assisted. Synthetic shaders only. |
|
I also checked the combination with #2129 on native Windows/WARP. The validation merge combines c8ad2a4 with 2ef0c75 and the optional mapped-replacement test f040754. In the mapped save path I kept the staging write and used the mutex on the new Shared state. Both runs passed 15 pipeline-library tests and skipped one memory measurement, with mapping enabled and with VICTORY_LIBRARY_MAP=0. The same build exercised the held-save-mutex test, concurrent loads and serialization, and loading the original PSOs after replacing the mapped file. AI-assisted. Synthetic data only. |
|
RX 9070 XT (RADV) under Wine 11.22: works with #1722 (tests, and menus only) Setup: Arch Linux, RX 9070 XT (RDNA4), RADV / Mesa 26.3.1. System Wine 11.22. vkd3d-proton
Not run: Windows, the world. AI-assisted (Claude Code); numbers from my own runs. |
|
Automated triage for the maintainers. Merge candidate. On The new test For the maintainers: #1653 and #1651 rework the same function for sharding. Whichever lands second needs a rebase onto the other. Generated by Claude Code |
Refs #1615. #1000 took pipeline loads out from under the library's lock, but one part of #1615 is still there.
The problem
library::pipeline()still takes the library's mutex to clone theID3D12PipelineLibrary1before every load.save()holds that mutex throughGetSerializedSize+Serializeof the whole library, which is 230 MB (#1683) to over 600 MB (#1653) in the world. Saves run every 20 s while new pipelines are being made, and some run on the pipeline workers themselves (make.rs). So for the whole of each save, every load waits, on every worker.The change
One file,
crates/victory-gpu/src/pipeline/library.rs:Shared::loads) is kept besideMutex<Library>, and loads use it without taking any lock.ID3D12Device1::CreatePipelineLibrary("Thread Safety"), the library is free-threaded except for loads of the same name, whichNAMESalready keeps apart. The existingpipelines_load_on_many_threads_at_oncealready runs loads alongsideSerialize.New test
a_pipeline_loads_while_a_save_holds_the_library: it stores a pipeline throughpipeline(), holds the library's lock the way a save does, and checks that a load of the same pipeline returns within 30 s. It builds its root signature withD3D12SerializeRootSignatureand uses a compute shader with no resources, because Wine'sd3dcompiler_47does not embed a[RootSignature]attribute.This does not touch the save size itself (#1653) or the empty-blob fix for vkd3d-proton (#1722). It merges cleanly with #1722. It conflicts with #1653, which rewrites the same functions into 16 shards, each loaded under its own lock. The same split (a load handle per shard, beside its lock) would carry over there.
Tested
Linux,
x86_64-pc-windows-msvccross-build (lld-link + xwin), run under Wine 10.0 with vkd3d-proton 3.1 and DXVKdxgifrom Proton Experimental, on an RTX 3050 Laptop GPU (4 GB). Not run on Windows.main's empty library without it, solibrary()isNonethere):cargo test -p victory-gpu --lib pipeline::library: 9 passed.the load waited for the save(Err(Timeout)).victory-gpulib suite gives 130 passed, 14 failed and 2 ignored, andmaingives 129 / 14 / 2 on the same machine. The 14 failures are the same tests on both, and they fail onmainunder vkd3d-proton. The extra pass is the new test, which returns early there because there is no library.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings, with and without--all-features: clean.Side note: under Wine,
pipelines_load_on_many_threads_at_oncereturns at "no shader compiler here", because Wine's compiler fails on its shader. So on Linux hosts it does not run.No game data was used.
🤖 Generated with Claude Code