perf(gpu): coalesce direct barriers, skip no-wait join drains, and remove pipeline-name lock contention #415

Manually merged
github merged 3 commits from github-bot/gh-415 into gh-pr/415/base 2026-12-04 02:01:47 +00:00 AGit
Owner

@⁠Androtim on GitHub · 2026-12-04 00:55 UTC · original
Androtim:perf/card-pool-barrier-coalesce-and-pull-early → main · +1166 −47 · 6 files · 3 commits · merged 2026-12-04 01:59 UTC

Summary

Ports verified GPL-3.0 CPU/GPU frame-time optimizations from \ReTerryDavis/ReVIctory\ and \lobomfz/VIctory-xmem, audited against MiniVI's existing 8 GB VRAM eviction, \STREAM_BOUND, and \PLACED_FILL_CARD\ paths:

Ported Changes

  1. Skip no-wait \JOIN_SEND\ GPU drains (\ReTerryDavis/ReVIctory, \GPL-3.0, commit \90eeea4a9ddd03dcb7a797b07094700e606efee):
    • Tracks whether a GPU-satisfied \Job::Value\ / \Job::Wait\ or cross-queue borrow separates joined submission parts in \crates/victory-gpu/src/queue/behind.rs.
    • Preserves full part boundaries for \atch.refresh_front*, while filtering \cuts\ (in both direct submit and \Handoff\ split-send paths in \crates/victory-gpu/src/host.rs) to only \waited_parts, eliminating redundant GPU joint barriers between consecutive parts on the same queue with no GPU wait between them.
  2. Coalesce direct resource barriers (\ReTerryDavis/ReVIctory, \GPL-3.0, commit \90eeea4a9ddd03dcb7a797b07094700e606efee):
    • Adds \crates/victory-gpu/src/host/rec.rs\ (\Rec\ wrapper around \ID3D12GraphicsCommandList\ with \Deref\ auto-flush, UAV barrier deduplication, and safe transition/round-trip folding; \VICTORY_JOIN_BARRIERS\ and \VICTORY_JOIN_BARRIERS_MORE\ enabled by default, =0\ disables).
    • Routes direct \HostList\ \ResourceBarrier\ calls in \host.rs\ and \list.rs\ through \Rec::barriers, with an explicit \self.list.flush()\ before \ID3D12GraphicsCommandList2::WriteBufferImmediate\ in \zero_card_budget\ so the \COMMON -> COPY_DEST\ transition is emitted before the immediate write.
  3. Remove pipeline-name lock contention (\lobomfz/VIctory-xmem, \GPL-3.0, commit \
**@⁠Androtim** on GitHub · 2026-12-04 00:55 UTC · [original](https://github.com/Androtim/MiniVI/pull/415) `Androtim:perf/card-pool-barrier-coalesce-and-pull-early` → `main` · +1166 −47 · 6 files · 3 commits · merged 2026-12-04 01:59 UTC ## Summary Ports verified GPL-3.0 CPU/GPU frame-time optimizations from \ReTerryDavis/ReVIctory\ and \lobomfz/VIctory-xmem\, audited against MiniVI's existing 8 GB VRAM eviction, \STREAM_BOUND\, and \PLACED_FILL_CARD\ paths: ### Ported Changes 1. **Skip no-wait \JOIN_SEND\ GPU drains** (\ReTerryDavis/ReVIctory\, \GPL-3.0\, commit \90eeea4a9ddd03dcb7a797b07094700e606efee\): - Tracks whether a GPU-satisfied \Job::Value\ / \Job::Wait\ or cross-queue borrow separates joined submission parts in \crates/victory-gpu/src/queue/behind.rs\. - Preserves full part boundaries for \atch.refresh_front*\, while filtering \cuts\ (in both direct submit and \Handoff\ split-send paths in \crates/victory-gpu/src/host.rs\) to only \waited_parts\, eliminating redundant GPU joint barriers between consecutive parts on the same queue with no GPU wait between them. 2. **Coalesce direct resource barriers** (\ReTerryDavis/ReVIctory\, \GPL-3.0\, commit \90eeea4a9ddd03dcb7a797b07094700e606efee\): - Adds \crates/victory-gpu/src/host/rec.rs\ (\Rec\ wrapper around \ID3D12GraphicsCommandList\ with \Deref\ auto-flush, UAV barrier deduplication, and safe transition/round-trip folding; \VICTORY_JOIN_BARRIERS\ and \VICTORY_JOIN_BARRIERS_MORE\ enabled by default, \=0\ disables). - Routes direct \HostList\ \ResourceBarrier\ calls in \host.rs\ and \list.rs\ through \Rec::barriers\, with an explicit \self.list.flush()\ before \ID3D12GraphicsCommandList2::WriteBufferImmediate\ in \zero_card_budget\ so the \COMMON -> COPY_DEST\ transition is emitted before the immediate write. 3. **Remove pipeline-name lock contention** (\lobomfz/VIctory-xmem\, \GPL-3.0\, commit \
Ports verified GPL-3.0 CPU/GPU frame-time wins:

1. ReTerryDavis/ReVIctory (GPL-3.0, commit b90eeea4a9ddd03dcb7a797b07094700e606efee):
   - Skip redundant GPU joint drains between joined submission parts when no
     GPU-satisfied wait or cross-queue borrow separates them (queue/behind.rs,
     host.rs), preserving full part boundaries for batch.refresh_front* and
     GPU joint cuts for waited/cross-queue parts in both direct and Handoff
     submission paths.
   - Add host::rec::Rec barrier-coalescing wrapper around HostList.list
     (VICTORY_JOIN_BARRIERS, VICTORY_JOIN_BARRIERS_MORE, default on) and route
     direct host.rs / list.rs ResourceBarrier calls through Rec::barriers,
     with an explicit flush before ID3D12GraphicsCommandList2::WriteBufferImmediate.
   - Note: small device-local card buffer suballocation is already handled in
     MiniVI by ahead::CardPool (alloc_pooled_card up to 1 MiB with COM reclaim
     and idle 4 MiB heap trimming for 8 GB VRAM), so no duplicate non-trimming
     card_pool allocator was added.

2. lobomfz/VIctory-xmem (GPL-3.0, commit 00aa4d38820e94c2f85d14dcf93ee7e12d9d735f, PR #335):
   - Replace the 64-stripe Mutex array in pipeline::library::same_name with an
     exact-name NameGate (Mutex<HashSet<String>> + Condvar) so distinct pipeline
     names never contend during parallel PSO library loads.
   - Note: lobomfz/VIctory-xmem commit 6064c04d86b5968518007223f7752364991e695d
     (pull: judge card copies early when clearly slower) targets the um/pull.rs
     BAR-resident memory pull subsystem, which is not present in MiniVI.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 00:56:30 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-12-04 01:01 UTC · original

Triage (c27416dd, CI queued):

  • Clean, 100% title-neutral 3-part CPU/GPU perf port (+782/-40, 6 files, zero opt-in toggles — VICTORY_JOIN_BARRIERS & VICTORY_JOIN_BARRIERS_MORE are default-on =0 kill-switches): no-wait JOIN_SEND drain skip (queue/behind.rs, host.rs), Rec direct barrier coalescing (host/rec.rs), and exact-name pipeline-library lock (name_gate.rs from lobomfz/VIctory-xmem #335).
  • Holding auto-merge for green CI + Gate 2 Audit (#282) (specifically checking Rec::barriers auto-flush before every raw command-list call / WriteBufferImmediate / UAV hazard, waited_parts boundary soundness, and name_gate panic/unwind cleanup) + Gate 3 plain---release 1440p/4K A/B + --features diagnostics visual check.
  • Overlap note: touches crates/victory-gpu/src/host.rs (shared with #413 & #414) — merge sequentially.
**@⁠Androtim** on GitHub · 2026-12-04 01:01 UTC · [original](https://github.com/Androtim/MiniVI/pull/415#issuecomment-7397406314) Triage (`c27416dd`, CI queued): - Clean, 100% title-neutral 3-part CPU/GPU perf port (`+782/-40`, 6 files, **zero opt-in toggles** — `VICTORY_JOIN_BARRIERS` & `VICTORY_JOIN_BARRIERS_MORE` are default-on `=0` kill-switches): no-wait `JOIN_SEND` drain skip (`queue/behind.rs`, `host.rs`), `Rec` direct barrier coalescing (`host/rec.rs`), and exact-name pipeline-library lock (`name_gate.rs` from `lobomfz/VIctory-xmem` `#335`). - Holding auto-merge for green CI + **Gate 2 Audit (`#282`)** (specifically checking `Rec::barriers` auto-flush before every raw command-list call / `WriteBufferImmediate` / UAV hazard, `waited_parts` boundary soundness, and `name_gate` panic/unwind cleanup) + **Gate 3 plain-`--release` 1440p/4K A/B + `--features diagnostics` visual check**. - *Overlap note:* touches `crates/victory-gpu/src/host.rs` (shared with `#413` & `#414`) — merge sequentially.
- Treat per-resource UAV barriers as conflicting with transitions on the same resource in Rec::enqueue_barriers (both <=64 and >64 paths), and block fold() across intervening UAV/aliasing barriers (both held and intra-batch) so UAV barriers are never left on non-UAV resource states.
- Treat D3D12_RESOURCE_BARRIER_TYPE_ALIASING (specific, half-null, and global NULL) as hard ordering boundaries in Rec::enqueue_barriers and fold(), preventing merging or folding across aliasing barriers.
- Check local joined-list will_meet before late_met_known in behind.rs Job::Value::take_along via classify_value_join so reused memory-wait slots still set wait_on_gpu = true when both local and ahead are true.
- Add regression unit tests covering every repro sequence.
github-bot changed target branch from main to gh-pr/415/base 2026-12-04 02:01:36 +00:00
github manually merged commit b7610ec814 into gh-pr/415/base 2026-12-04 02:01:46 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI!415
No description provided.