fix(gpu): distinguish CPU waits from GPU timestamp intervals #67

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

@⁠LZJ-Developer on GitHub · 2026-11-26 03:45 UTC · original
LZJ-Developer:fix/separate-cpu-wait-gpu-timing → main · +578 −42 · 4 files · 1 commits · open

Window captions and frame logs currently derive “GPU busy” from CPU-side submission waits. Long CPU completion waits can therefore be mistaken for high device utilization. Report CPU completion waits explicitly in ms/frame, measure the blocking event wait separately from submission/bookkeeping, and exclude nested settling from CPU preparation in the synchronous path.

Add optional GPU queue timestamps in diagnostics builds with VICTORY_GPU_QUEUE_TIMING=1 (off by default). Two marker lists bracket each main direct-queue batch. The original list order and ExecuteCommandLists grouping are retained, and results are polled only after the existing completion fence is reached. A bounded 32-slot pool skips samples under backpressure instead of adding a CPU wait or fence signal. Completed slots are reused.

The HUD and log report completed-batch mean/total intervals and completed, pending, skipped and invalid counts. Off, unavailable and no completed samples remain distinct from a measured zero. The older fence-clock estimate is labeled as outstanding work rather than device utilization. docs/timing.md describes scope and the no-game reproduction command.

Measurement boundaries:

  • CPU completion waits include CPU publication waits in relay mode; they are accumulated thread time and may overlap other work.
  • GPU intervals include the bracketed main-queue preludes and comparisons, exclude auxiliary submissions and the separate relay, and can include stalls within the interval. They are not whole-device active time.
  • Completed samples can originate in earlier frames, so their total is not divided by current-frame counts. Sampling adds marker/query overhead; it is not a performance optimization or a gameplay-FPS claim.

Synthetic regression uses a private queue, generated 1 MiB copy data, a closed queue gate and a two-slot pool. It verifies that incomplete samples remain pending, a full pool skips without waiting, completed copies contain the expected bytes, results are counted once, delayed CPU observation preserves GPU elapsed time, and completed slots can be reused. Conversion tests cover fractional ticks, zero frequency, reversed timestamps and large counters. No timing-performance threshold is asserted.

Validation on Windows 11, i7-12800HX, RTX 4060 Laptop 8 GB, driver 572.83, Rust 1.98.1 MSVC, MSVC 14.44.35207 and Windows SDK 10.0.26100.0:

Check Local result
cargo clippy --workspace --all-targets --locked -- -D warnings Passed
Same Clippy command with --all-features Passed
cargo test --workspace --locked --no-fail-fast 685 passed, 0 failed, 12 ignored
GPU tests with --features diagnostics and queue sampling enabled 241 passed, 0 failed, 4 ignored
WARP targeted synthetic tests 2 passed, 0 failed
README diagnostics release build, all three programs Passed
Release synthetic tests on RTX 4060 2 passed, 0 failed
Staged asset policy, new module rustfmt and focused new helpers, diff whitespace Passed

In one release synthetic run, CPU fence waiting was 40.787 ms while the two GPU timestamp intervals totaled 0.194 ms. This illustrates the controlled queue gate, not a speedup. The WARP run likewise completed both tests. No game installation or FidelityFX provider was used.

A local application of Screen's path/binary/added-line patterns found no matches. GitHub workflow status is separate from these local results.

**@⁠LZJ-Developer** on GitHub · 2026-11-26 03:45 UTC · [original](https://github.com/DexNom/VIctory/pull/67) `LZJ-Developer:fix/separate-cpu-wait-gpu-timing` → `main` · +578 −42 · 4 files · 1 commits · open Window captions and frame logs currently derive “GPU busy” from CPU-side submission waits. Long CPU completion waits can therefore be mistaken for high device utilization. Report CPU completion waits explicitly in ms/frame, measure the blocking event wait separately from submission/bookkeeping, and exclude nested settling from CPU preparation in the synchronous path. Add optional GPU queue timestamps in diagnostics builds with `VICTORY_GPU_QUEUE_TIMING=1` (off by default). Two marker lists bracket each main direct-queue batch. The original list order and ExecuteCommandLists grouping are retained, and results are polled only after the existing completion fence is reached. A bounded 32-slot pool skips samples under backpressure instead of adding a CPU wait or fence signal. Completed slots are reused. The HUD and log report completed-batch mean/total intervals and completed, pending, skipped and invalid counts. Off, unavailable and no completed samples remain distinct from a measured zero. The older fence-clock estimate is labeled as outstanding work rather than device utilization. `docs/timing.md` describes scope and the no-game reproduction command. Measurement boundaries: - CPU completion waits include CPU publication waits in relay mode; they are accumulated thread time and may overlap other work. - GPU intervals include the bracketed main-queue preludes and comparisons, exclude auxiliary submissions and the separate relay, and can include stalls within the interval. They are not whole-device active time. - Completed samples can originate in earlier frames, so their total is not divided by current-frame counts. Sampling adds marker/query overhead; it is not a performance optimization or a gameplay-FPS claim. Synthetic regression uses a private queue, generated 1 MiB copy data, a closed queue gate and a two-slot pool. It verifies that incomplete samples remain pending, a full pool skips without waiting, completed copies contain the expected bytes, results are counted once, delayed CPU observation preserves GPU elapsed time, and completed slots can be reused. Conversion tests cover fractional ticks, zero frequency, reversed timestamps and large counters. No timing-performance threshold is asserted. Validation on Windows 11, i7-12800HX, RTX 4060 Laptop 8 GB, driver 572.83, Rust 1.98.1 MSVC, MSVC 14.44.35207 and Windows SDK 10.0.26100.0: | Check | Local result | | --- | --- | | `cargo clippy --workspace --all-targets --locked -- -D warnings` | Passed | | Same Clippy command with `--all-features` | Passed | | `cargo test --workspace --locked --no-fail-fast` | 685 passed, 0 failed, 12 ignored | | GPU tests with `--features diagnostics` and queue sampling enabled | 241 passed, 0 failed, 4 ignored | | WARP targeted synthetic tests | 2 passed, 0 failed | | README diagnostics release build, all three programs | Passed | | Release synthetic tests on RTX 4060 | 2 passed, 0 failed | | Staged asset policy, new module rustfmt and focused new helpers, diff whitespace | Passed | In one release synthetic run, CPU fence waiting was 40.787 ms while the two GPU timestamp intervals totaled 0.194 ms. This illustrates the controlled queue gate, not a speedup. The WARP run likewise completed both tests. No game installation or FidelityFX provider was used. A local application of Screen's path/binary/added-line patterns found no matches. GitHub workflow status is separate from these local results.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:25:11 +00:00
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/67/head:github-bot/gh-67'
git switch 'github-bot/gh-67'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-67'
git switch 'github-bot/gh-67'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-67'
git switch 'github-bot/gh-67'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-67'
git switch 'main'
git merge --squash 'github-bot/gh-67'
git switch 'main'
git merge --ff-only 'github-bot/gh-67'
git switch 'main'
git merge 'github-bot/gh-67'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.