gpu: scope indirect clamp UAV barriers to source, count, and budget buffers #2360

Manually merged
github merged 1 commit from github-bot/gh-2360 into main 2026-11-30 14:17:17 +00:00 AGit
Owner

@⁠nidea1 on GitHub · 2026-11-29 12:21 UTC · original
nidea1:perf/scoped-indirect-uav-barriers → main · +286 −66 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC

What it changes

Replaces global NULL UAV barriers around indirect-argument clamps (crates/victory-gpu/src/indirect.rs, crates/victory-gpu/src/indirect/batch.rs, crates/victory-gpu/src/indirect/bench.rs, crates/victory-gpu/src/host.rs) with resource-scoped, deduplicated UAV barriers:

  • HostList::budget() returns Option<(&ID3D12Resource, u64)> (zero-cost borrow of the active card or CPU-mapped budget buffer alongside its GPU virtual address).
  • pre_clamp_barriers emits deduplicated resource-scoped UAV barriers (pResource != NULL) only for the source argument buffer(s), optional count buffer, and budget buffer when wait is true (still honoring VICTORY_QUIET_WAITS and VICTORY_BARRIER_TEST=indirect), combined with dst's before -> UNORDERED_ACCESS transition through crate::barstat::rb.
  • Drops the redundant post-clamp global NULL UAV barrier in record_clamp (matching batch::record): dst's UNORDERED_ACCESS -> INDIRECT_ARGUMENT transition makes clamped records visible to ExecuteIndirect, and budget is ordered by the next clamp's scoped UAV barrier (and card_budget_out's copy transition on list close).

How it was tested

  • GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 3060 Ti 8 GB and D3D12 WARP adapter, Series S profile, 1440p, FSR 3 2x FG, RT off
  • Before: every single and batched indirect clamp with wait = true issued a global NULL UAV barrier before dispatch, and record_clamp issued a second global NULL UAV barrier after dispatch (when VICTORY_QUIET_WAITS was off)
  • After: clamps emit scoped, deduplicated UAV barriers only for the buffers they read/write and a single dst transition after dispatch; verified with pre_clamp_barriers_scopes_and_deduplicates_uavs, warp_scoped_indirect_barriers_order_compute_writes_and_budget (GPU compute writer -> batched clamp -> single clamp sharing budget -> ExecuteIndirect), and live gameplay on RTX 3060 Ti
  • For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A
  • cargo test passed for the crates it touches: yes (cargo test -p victory-gpu --lib --locked indirect::tests:: — 35 passed, 0 failed, 10 ignored benchmarks/opt-in hardware checks)

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: none (respects VICTORY_QUIET_WAITS and crate::barstat::rb already on main)
**@⁠nidea1** on GitHub · 2026-11-29 12:21 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2360) `nidea1:perf/scoped-indirect-uav-barriers` → `main` · +286 −66 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC ## What it changes Replaces global `NULL` UAV barriers around indirect-argument clamps (`crates/victory-gpu/src/indirect.rs`, `crates/victory-gpu/src/indirect/batch.rs`, `crates/victory-gpu/src/indirect/bench.rs`, `crates/victory-gpu/src/host.rs`) with resource-scoped, deduplicated UAV barriers: - `HostList::budget()` returns `Option<(&ID3D12Resource, u64)>` (zero-cost borrow of the active card or CPU-mapped budget buffer alongside its GPU virtual address). - `pre_clamp_barriers` emits deduplicated resource-scoped UAV barriers (`pResource != NULL`) only for the source argument buffer(s), optional count buffer, and budget buffer when `wait` is true (still honoring `VICTORY_QUIET_WAITS` and `VICTORY_BARRIER_TEST=indirect`), combined with `dst`'s `before -> UNORDERED_ACCESS` transition through `crate::barstat::rb`. - Drops the redundant post-clamp global `NULL` UAV barrier in `record_clamp` (matching `batch::record`): `dst`'s `UNORDERED_ACCESS -> INDIRECT_ARGUMENT` transition makes clamped records visible to `ExecuteIndirect`, and `budget` is ordered by the next clamp's scoped UAV barrier (and `card_budget_out`'s copy transition on list close). ## How it was tested - GPU and profile (Series X or S, resolution, DLSS, frame generation, ray tracing): RTX 3060 Ti 8 GB and D3D12 WARP adapter, Series S profile, 1440p, FSR 3 2x FG, RT off - Before: every single and batched indirect clamp with `wait = true` issued a global `NULL` UAV barrier before dispatch, and `record_clamp` issued a second global `NULL` UAV barrier after dispatch (when `VICTORY_QUIET_WAITS` was off) - After: clamps emit scoped, deduplicated UAV barriers only for the buffers they read/write and a single `dst` transition after dispatch; verified with `pre_clamp_barriers_scopes_and_deduplicates_uavs`, `warp_scoped_indirect_barriers_order_compute_writes_and_budget` (GPU compute writer -> batched clamp -> single clamp sharing budget -> `ExecuteIndirect`), and live gameplay on RTX 3060 Ti - For shader changes, the wave sizes tested (32 and/or 64 lanes): N/A - `cargo test` passed for the crates it touches: yes (`cargo test -p victory-gpu --lib --locked indirect::tests::` — 35 passed, 0 failed, 10 ignored benchmarks/opt-in hardware checks) ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: none (respects `VICTORY_QUIET_WAITS` and `crate::barstat::rb` already on `main`)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 12:27:20 +00:00
github manually merged commit 3e216812f3 into main 2026-11-30 14:17:17 +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/trustno1-coder--VIctory-NVIDIA!2360
No description provided.