Repository navigation
Conversation
catminou4
left a comment
There was a problem hiding this comment.
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.
BaggyALPHA
left a comment
There was a problem hiding this comment.
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.
| Trial order | Time to 500 successful library loads, baseline / this PR | Cumulative app load-lock wait at 512 completed requests, baseline / this PR |
|---|---|---|
| Baseline then this PR | 19.32 s / 9.36 s | 103.68 s / 0.84 s |
| This PR then baseline | 7.46 s / 6.37 s | 9.65 s / 0.001 s |
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.
|
Marking draft: upstream 70564ae rebuilt 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 one |
Loads ran under the one mutex that holds the library, so workers serialised behind loads that can take seconds. Keep a cloned `ID3D12PipelineLibrary1` beside the bookkeeping and guard loads with one of 64 locks chosen by pipeline name (`CreatePipelineLibrary` requires only same-name loads not to overlap). Stores and saves stay serialised by the library mutex, so the serialised size cannot change under a save. Based on the original Marvisak#1680 work; adapted to the pre-build/`prebuilt` state added upstream.
2a686eb to
8666a22
Compare
Translation speed (compile-storm CPU): Marvisak#1623 inline instruction words (decode -18..-45%), Marvisak#1834 VALU names without heap vector, Marvisak#1833 live-set bit walk, Marvisak#1802 relative shift bounds, Marvisak#1824 dx.op declarations once. Per-draw/per-list CPU: Marvisak#1825 view-stride table once per list, Marvisak#1826 object names only where logged, Marvisak#1800 capped-heap log spam once per 64Ki. Tooling: Marvisak#1809 list pipeline keys without cache init. Locking: Marvisak#1680 pipeline library loads without the global mutex. Held: Marvisak#1819 (2^20->2^14 loop bound) breaks transcendental convergence tests (sin/cos/exp/sqrt) — accuracy-lowering, rejected per policy.
|
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. |
Upstream moved 70564ae..ccfb029 (GPU pacing, DRED identity, descriptor cursor, xmem commit reporting, hardware-adapter test gating, input layouts, many shader lowerings). Resolved 10 files: - host.rs, pipeline/host.rs (tests), primitive.rs, valu_tests.rs, xasync.rs: kept both sides additive tests. - indirect.rs: took upstream one-group clamp plus INDIRECT_ARGUMENT barriers; draw call sites pass the resource. - pipeline/library.rs: took upstream NAMES-hold plus clone-outside-lock loads (supersedes our Marvisak#1680 LOADS); periodic saves stay best-effort. - emit/host.rs: kept our fence-wait helper; took upstream hardware_adapter gating. - xmem.rs: took upstream OOM reporting; kept our APU allocator-refusal crash log on top of it. - lower.rs: upstream had merged the same Marvisak#1733 helper; dropped our copy. - pipeline/host.rs: kept our padding-zeroing clean_* over upstream reads. Kept from our queue: PSV0 strings, op-cache opcode key, huge gating, Marvisak#1750 wait slices, micro-opts. Verified: workspace green (gpu 151, shader 254), clippy -D warnings clean, policy 185 files ok.
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.