GPU: preserve the latest draw counter sample across presents #2340
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2340
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2340/head"
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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 11:04 UTC · original
andrewpozdnakov7-jpg:codex2/present-counter-order→main· +17 −3 · 1 files · 1 commits · closed without mergingTwo presents can sample the host draw or dispatch counter, then report in the opposite order.
presentusedswapand subtracted the previous value, so a late older sample could underflow and move the saved count backwards.fetch_maxkeeps the highest reported count. An older sample contributes zero, and the next newer sample reports only the additional work.A synthetic Windows regression delivers samples
12,10, then15to the same accounting used bypresent. The calculation from940d32fpanics on the second sample. After the change, the reported deltas are12,0, and3. All five queue tests, strict GPU Clippy with diagnostics, and the staged asset policy pass.Coordination claim
Please retain the Git author when reapplying this change. If you fold it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.@welisonzika14-jpg on GitHub · 2026-11-25 12:00 UTC · original
First run on NVIDIA hardware here, as far as I can see (the reviews above are static or WARP). RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC, no game files. Head
4efd8c7merged ontomain940d32f,cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.The PR's test
queue::tests::an_older_present_sample_cannot_roll_back_the_reported_countpasses on this card. The rest is the same asmainon this card: the 5 known NVIDIA failures from #1744 (2 view heap cap tests invictory-gpu, 3 invictory-shader), nothing new.One run, unit tests only, title not run.
Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
@Marvisak on GitHub · 2026-11-25 15:27 UTC · original
Automated triage for the maintainers.
Merge candidate (small). In
queue.rspresent, the per-line draw and dispatch deltas werenow - last.swap(now). If two presents race, the older sample can arrive second and the subtraction underflows: a panic inside anextern "system"function in debug builds, a huge logged count in release. The newsince_last_countusesfetch_maxwithsaturating_sub, so a late older sample reports 0 and the saved count never goes backwards; the unit test covers exactly that ordering. It only affects logging. CI: passing.Generated by Claude Code
@Marvisak on GitHub · 2026-11-25 22:08 UTC · original
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because the case cannot occur. The deltas are computed only when the presented frame number is a power of two, and the title presents from one thread, so samples arrive in order. The values feed one info log line.
If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed