GPU: drain fence wait counts and durations together #3169

Open
github-bot wants to merge 1 commit from github-bot/gh-3169 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 10:51 UTC · original
andrewpozdnakov7-jpg:codex2/fence-wait-accounting → main · +67 −7 · 1 files · 1 commits · open

Fence completion records a count and a duration. When the report drains those values separately, it can put the count in one window and its time in the next. The totals across both windows still add up, but the individual rows are wrong.

Accumulate the two values under one lock and drain them as a pair. A signal that completes several queued events records its batch after releasing the fence's waiter lock.

The same synthetic fixture ran a producer with 32,768 waits of 1,250 microseconds while the consumer drained the counters. Each run contained 32,768 events and 40,960,000 microseconds in total.

Build Runs with mismatched report windows Mismatched windows per run
main 63bcca4 20 of 20 86 to 20,688
Patched 0 of 20 0

The app-local WARP diagnostics suite passed 247 tests with one ignored. The native event test passed. Strict GPU Clippy with default and all features and the asset policy passed.

cargo test -p victory-gpu --features diagnostics --locked report_windows_keep_their_fence_counts_and_durations_together -- --nocapture

This collector change is independent of #3157, which logs frames with fence waits even when no command-list segments were held.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 10:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/3169) `andrewpozdnakov7-jpg:codex2/fence-wait-accounting` → `main` · +67 −7 · 1 files · 1 commits · open Fence completion records a count and a duration. When the report drains those values separately, it can put the count in one window and its time in the next. The totals across both windows still add up, but the individual rows are wrong. Accumulate the two values under one lock and drain them as a pair. A signal that completes several queued events records its batch after releasing the fence's waiter lock. The same synthetic fixture ran a producer with 32,768 waits of 1,250 microseconds while the consumer drained the counters. Each run contained 32,768 events and 40,960,000 microseconds in total. | Build | Runs with mismatched report windows | Mismatched windows per run | | --- | --- | --- | | main 63bcca4 | 20 of 20 | 86 to 20,688 | | Patched | 0 of 20 | 0 | The app-local WARP diagnostics suite passed 247 tests with one ignored. The native event test passed. Strict GPU Clippy with default and all features and the asset policy passed. cargo test -p victory-gpu --features diagnostics --locked report_windows_keep_their_fence_counts_and_durations_together -- --nocapture This collector change is independent of #3157, which logs frames with fence waits even when no command-list segments were held.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 11:09:24 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 11:08 UTC · original · approved these changes

Verified against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib fence:: -- --test-threads=1: passed.
  • cargo test -p victory-gpu --lib queue:: -- --test-threads=1: 5/5 passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings & --features diagnostics: clean.
  • cargo xtask policy: 191 files ok.

Cleanly drains fence wait counts and durations atomically together.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 11:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/3169#pullrequestreview-6073061203) · **approved these changes** Verified against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib fence:: -- --test-threads=1`: passed. - `cargo test -p victory-gpu --lib queue:: -- --test-threads=1`: 5/5 passed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` & `--features diagnostics`: clean. - `cargo xtask policy`: 191 files ok. Cleanly drains fence wait counts and durations atomically together. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3169/head:github-bot/gh-3169'
git switch 'github-bot/gh-3169'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3169'
git switch 'github-bot/gh-3169'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3169'
git switch 'github-bot/gh-3169'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3169'
git switch 'main'
git merge --squash 'github-bot/gh-3169'
git switch 'main'
git merge --ff-only 'github-bot/gh-3169'
git switch 'main'
git merge 'github-bot/gh-3169'
git push origin 'main'
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/Marvisak--VIctory!3169
No description provided.