Repository navigation
GPU: keep PresentX statistics monotonic across concurrent reports - #2769
andrewpozdnakov7-jpg wants to merge 1 commit into
Conversation
|
Reviewed and verified
|
|
Independent verification of head
Method: WARP/CPU only (no physical GPU; AI-assisted review (Claude Code / Claude Sonnet 5.5). |
|
Correct and minimal: fetch_max + saturating_sub makes the reported deltas monotonic when two presenters race on the same counter (stale snapshot contributes 0 instead of wrapping). The test covers exactly the interleaving that broke it. |
|
Automated triage for the maintainers. In This is a recommendation for a maintainer to look, not an approval. Generated by Claude Code |
Dukestar69
left a comment
There was a problem hiding this comment.
Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):
cargo test -p victory-gpu --lib queue::tests: 6 passed, 0 failed (including newstale_present_totals_do_not_move_the_reported_count_back).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…oncurrent reports
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified at head 63a2edbe against origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, D3D12 Debug Layer):
- Design & correctness: replacing
now - last.swap(now, Ordering::Relaxed)withcount_since(now.saturating_sub(last.fetch_max(now, Ordering::Relaxed))incrates/victory-gpu/src/queue.rs:473-476, 511-512) keepsDRAWNandDISPATCHEDmonotonic across concurrentPresentXreporters, returns0for stale snapshots instead of panicking on unsigned underflow in debug builds or wrapping in release builds, and preserves accurate delta sums. The unit test atqueue.rs:818-825directly verifies the out-of-order[5, 8, 6, 8, 11]sequence. - Verification:
- Clean
git merge-treeagainstorigin/main(63bcca43);cargo xtask policy(184 files ok);cargo clippy -p victory-gpu --all-targets -- -D warningsclean with default features and--all-features. queue::tests5/5 passed on all three configurations: RTX 5090 (default), RTX 5090 +VICTORY_D3D12_DEBUG=1(--features diagnostics), and WARP (VICTORY_D3D12_WARP=1) +VICTORY_D3D12_DEBUG=1.
- Clean
LGTM.
Two concurrent PresentX calls can report draw and dispatch totals out of order. If a call samples 6 and pauses while another reports 8, subtracting the previous total from 6 panics in a debug build and also moves the saved total backwards. Retain the highest reported total atomically and return a zero delta for a stale snapshot.
The same synthetic test supplies totals [5, 8, 6, 8, 11]. On 13f91ca it panics on the third sample with subtraction overflow. On 63a2edb the deltas are [5, 3, 0, 0, 3], and the saved total is 11. Six paired runs reproduced the result. The serial GPU suite on WARP passed 199 tests with one ignored in both debug settings. Strict GPU Clippy in both feature configurations and asset policy passed.
The exact heads of #1997 and #2666 merge cleanly with this commit. The local composition with #1997 at fdc5ff5 passes the primary-plane fallback, shared texture state restore, compositor build and counter tests. Its full serial GPU suite passed 202 tests with one ignored in both WARP debug settings. Coordination claim
Please retain the Git author on cherry-pick or rebase. If you fold the fix or test into another commit, please add the following trailer.
Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com
AI-assisted with Codex. Synthetic test.