VICTORY_BARRIER_STATS: count barriers by kind and estimate redundant UAV waits (off by default) #1789
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1789
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1789"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Jesper-Andersson on GitHub · 2026-11-29 00:05 UTC · original
Jesper-Andersson:pr/barrier-stats→main· +581 −131 · 26 files · 2 commits · merged 2026-11-29 08:16 UTCTested in game: the numbers below come from one in-game run (180 s window, 2026-11-28) on our fork. This exact PR branch has not been run in game. The wrapping of the newer upstream calls is checked by build and tests only.
Relates to: no issue; this PR is my claim for the idea.
What it changes
This is a diagnostic. It is off by default and costs one cached flag read when off. With
VICTORY_BARRIER_STATS=1, it logs one line per frame-rate report:ResourceBarrierthe layer records goes throughbarstat::rb(crates/victory-gpu/src/barstat.rs), which counts it as a global UAV, per-resource UAV, transition or aliasing barrier. EnhancedBarriercalls are counted too (global / buffer / texture).Adapted to current main. Our branch was first written on an older base. Current main has added
ResourceBarriercalls since then, and this PR wraps those too (inhost.rs,host/place.rs,list.rs,gpudetile.rs,descriptor/host.rs,host/upq.rs,ambient.rsandcompose.rs), so the counts are not low. The only calls left unwrapped are in the offline replay tool (replay/), examples and tests, none of which run in the game. The narrow-barrier counters that main has since removed are not touched.Why: measured numbers (our fork, not this exact branch)
RTX 2070 SUPER, Series S + DLSS Performance, free-roam scene. This is one 180 s run on our t1-next base (upstream
923e38ccplus our ports), per frame.ResourceBarriercalls and barriers are different units: one call can carry several barriers. The first row counts calls. The next three rows count barriers, so they add up to more than the calls.ResourceBarriercallsThe last four rows add up to the 904 waits (32 + 152 + 650 + 71, with rounding).
The estimate is conservative, and the unknowns dominate. Every unknown is counted as needed. Only 3.5 % of the waits are provably redundant by this test, and about 72 % can't be classed either way. So this does not show that removing waits would pay off. It shows where the counting has to get better (binding coverage first) before anyone can tell. It is also consistent with #1449's finding that barriers alone are not the cost in a replay, and it gives a way to measure what #799 (narrow barriers) actually removes in a live run.
How it was tested
923e38ccplus our ports and its other switches). This exact branch has not been run in game yet. The wrapping of the newer upstream calls is checked by build and tests only.cargo testpassed for the crates it touches: yes: 551 passed, 0 failed, 43 ignored (-p victory-gpu).cargo clippy -p victory-gpu --all-targets: no warnings from this change (the ones that remain are main's own: 2 in victory-shader, 9 in the victory-gpu lib, a few more in its tests, all in lines this PR does not change).cargo xtask policy: fails only on upstream's owncrates/victory-shader/src/emit/lower.rs(667,523 bytes, over the 655,360-byte limit; the same on main, see #1429/#1493/#1527). This PR does not touch that file, and every changed file passes.Checked for overlap
host.rs, so expect a small rebase conflict on the wrapped lines). None of them counts barriers by kind or estimates redundant waits.This was written with AI assistance (Claude Code).