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

Merged
nidea1 merged 1 commit from upstream-pr/2360 into main 2026-11-30 14:12:03 +00:00
nidea1 commented 2026-11-29 12:21:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-11-29T12:21:29Z.


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)
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5550651555 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2360). Originally posted by [nidea1](https://github.com/nidea1) on 2026-11-29T12:21:29Z. --- ## 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`)
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!2360
No description provided.