GPU diagnostics: count clean buffer refreshes once per command list #2667

Closed
SinisterRob wants to merge 1 commit from upstream-pr/2669 into main
SinisterRob commented 2026-11-25 17:47:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SinisterRob on 2026-11-25T17:47:41Z.


On main, the diagnostics frame summary prints skipped refresh requests and their byte count, but both counters stay at zero even when the tracked buffer is clean. This makes it hard to tell how much work the existing clean-buffer check avoids.

Count the clean subset of explicit buffer refresh requests and accumulate all four request totals once per command list. Heap and page-table scans keep their own dirty-bit filters. Copies that pass those filters go straight into the batch. The reported skipped bytes measure the requested range, and the log format stays the same.

GPU verification. Tested with a local synthetic harness on an RX 7900 GRE, RADV, Wine 11.22 and vkd3d-proton, using the Windows GNU LLVM target and the optimized diagnostics profile. A closed command list refreshes one tracked 64 KiB buffer and copies its first word to a separate GPU buffer for CPU readback. Resubmitting unchanged, writing a new word, then resubmitting unchanged again yields:

Submission GPU readback Explicit requests Skipped requests Skipped bytes
Initial write 11 1 0 0
Unchanged 11 1 1 65,536
CPU writes again 29 1 0 0
Unchanged 29 1 1 65,536

The same check fails on 13f91ca at the first unchanged submission: readback is correct, both skip counters are zero. The existing batch refresh test also passes.

Diagnostics overhead. In a separate stress case, one closed list issues 8,192 distinct four-byte refresh requests into one clean buffer plus a GPU copy whose result is checked after each submission. Four runs per build, in counterbalanced order, each with 10 warmups and 60 timed submissions. Per-run median wall time in microseconds:

Base Patched
1264, 1285, 1314, 1256 1208, 1211, 1178, 1186

Game frame time is unmeasured. Synthetic inputs only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6610341003 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2669). Originally posted by [SinisterRob](https://github.com/SinisterRob) on 2026-11-25T17:47:41Z. --- On main, the diagnostics frame summary prints skipped refresh requests and their byte count, but both counters stay at zero even when the tracked buffer is clean. This makes it hard to tell how much work the existing clean-buffer check avoids. Count the clean subset of explicit buffer refresh requests and accumulate all four request totals once per command list. Heap and page-table scans keep their own dirty-bit filters. Copies that pass those filters go straight into the batch. The reported skipped bytes measure the requested range, and the log format stays the same. **GPU verification.** Tested with a local synthetic harness on an RX 7900 GRE, RADV, Wine 11.22 and vkd3d-proton, using the Windows GNU LLVM target and the optimized diagnostics profile. A closed command list refreshes one tracked 64 KiB buffer and copies its first word to a separate GPU buffer for CPU readback. Resubmitting unchanged, writing a new word, then resubmitting unchanged again yields: | Submission | GPU readback | Explicit requests | Skipped requests | Skipped bytes | |---|---:|---:|---:|---:| | Initial write | 11 | 1 | 0 | 0 | | Unchanged | 11 | 1 | 1 | 65,536 | | CPU writes again | 29 | 1 | 0 | 0 | | Unchanged | 29 | 1 | 1 | 65,536 | The same check fails on `13f91ca` at the first unchanged submission: readback is correct, both skip counters are zero. The existing batch refresh test also passes. **Diagnostics overhead.** In a separate stress case, one closed list issues 8,192 distinct four-byte refresh requests into one clean buffer plus a GPU copy whose result is checked after each submission. Four runs per build, in counterbalanced order, each with 10 warmups and 60 timed submissions. Per-run median wall time in microseconds: | Base | Patched | |---|---| | 1264, 1285, 1314, 1256 | 1208, 1211, 1178, 1186 | Game frame time is unmeasured. Synthetic inputs only. AI-assisted.
kotekompotek commented 2026-11-25 18:02:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:55:58Z.


Reviewed: counting clean-vs-dirty refreshes and routing only dirty ones to add_dirty makes the stats mean 'work done' — and skipping clean adds also avoids pointless batch growth. Diagnostics-only paths. CI green.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170201832 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2669#issuecomment-7170201832). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T17:55:58Z. --- Reviewed: counting clean-vs-dirty refreshes and routing only dirty ones to `add_dirty` makes the stats mean 'work done' — and skipping clean adds also avoids pointless batch growth. Diagnostics-only paths. CI green.
oni-swr commented 2026-11-25 19:06:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:13:29Z.


Independent verification of head 1b240444de62b5b133cae208eb92598f3c0ac1a9 on origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca (merges cleanly, fast-forward).

Environment: Windows 11 Pro 10.0.26100, WARP (d3d10warp 10.0.26100.9818) only, rustc/cargo 1.98.1 (per rust-toolchain.toml), DXC 1.8.2502.11 / dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0 x64). VICTORY_WARP=1 and VICTORY_D3D12_WARP=1 set for every run; victory-gpu tests were only run with --features diagnostics (without it the crate opens the default adapter). Limits: no physical GPU, no game files, no title-driven runs; this says nothing about behaviour on real hardware.

  • Focused: ... -p victory-gpu --features diagnostics host::batch -> host::batch::a_copy_is_refreshed_once_per_submission_by_the_pages_written 1 passed (updated to add_dirty).
  • Full crate: 198 passed, 0 failed, 1 ignored. origin/main baseline (cargo test -j 4 --locked -p victory-gpu --features diagnostics): 197 passed, 1 failed (memory::tests::a_submission_that_missed_leaves_the_copies_at_once, memory.rs:886), 1 ignored. That test passed in all four PR runs, so it looks flaky; I did not investigate it, and none of these PRs touch memory.rs.
  • clippy (same four invocations): clean.
  • Negative control: not possible. The PR adds no test, and nothing asserts the Refreshes/Skipped counters, which only exist under diagnostics and are only printed in the stats line. The existing batch test passes before and after, so it covers the unchanged flush behaviour, not this change.
  • Code read: Batch::add's shadow.clean() check moved to the Step::Refresh caller, and Heap/Memory callers already filter on watch::clean_bit (bindless.rs:319, memory.rs:428), so no unfiltered path reaches add_dirty. One small difference: those two paths no longer double-check shadow.clean(), so a shadow whose cached bit is stale-dirty gets a (harmless) no-op update instead of being skipped. No bugs found.
  • Suggestion, non-blocking: a small diagnostics test that runs a deferred list with one clean and one dirty refresh and checks the counter deltas would pin the new once-per-list accounting.

AI disclosure: independent verification by Claude Code / Claude Sonnet 5.5, run for a user; no game files, dumps or hashes involved.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170613729 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2669#issuecomment-7170613729). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T18:13:29Z. --- **Independent verification of head `1b240444de62b5b133cae208eb92598f3c0ac1a9`** on `origin/main` `13f91caee25f2fdf2c062be5f7a27f058e51cbca` (merges cleanly, fast-forward). **Environment:** Windows 11 Pro 10.0.26100, WARP (d3d10warp 10.0.26100.9818) only, rustc/cargo 1.98.1 (per rust-toolchain.toml), DXC 1.8.2502.11 / dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0 x64). `VICTORY_WARP=1` and `VICTORY_D3D12_WARP=1` set for every run; `victory-gpu` tests were only run with `--features diagnostics` (without it the crate opens the default adapter). **Limits:** no physical GPU, no game files, no title-driven runs; this says nothing about behaviour on real hardware. - Focused: `... -p victory-gpu --features diagnostics host::batch` -> `host::batch::a_copy_is_refreshed_once_per_submission_by_the_pages_written` 1 passed (updated to `add_dirty`). - Full crate: 198 passed, 0 failed, 1 ignored. `origin/main` baseline (`cargo test -j 4 --locked -p victory-gpu --features diagnostics`): 197 passed, 1 failed (`memory::tests::a_submission_that_missed_leaves_the_copies_at_once`, `memory.rs:886`), 1 ignored. That test passed in all four PR runs, so it looks flaky; I did not investigate it, and none of these PRs touch `memory.rs`. - clippy (same four invocations): clean. - **Negative control: not possible.** The PR adds no test, and nothing asserts the `Refreshes`/`Skipped` counters, which only exist under `diagnostics` and are only printed in the stats line. The existing batch test passes before and after, so it covers the unchanged flush behaviour, not this change. - Code read: `Batch::add`'s `shadow.clean()` check moved to the `Step::Refresh` caller, and `Heap`/`Memory` callers already filter on `watch::clean_bit` (`bindless.rs:319`, `memory.rs:428`), so no unfiltered path reaches `add_dirty`. One small difference: those two paths no longer double-check `shadow.clean()`, so a shadow whose cached bit is stale-dirty gets a (harmless) no-op `update` instead of being skipped. No bugs found. - Suggestion, non-blocking: a small diagnostics test that runs a deferred list with one clean and one dirty refresh and checks the counter deltas would pin the new once-per-list accounting. AI disclosure: independent verification by Claude Code / Claude Sonnet 5.5, run for a user; no game files, dumps or hashes involved.
fuzeofficlal commented 2026-11-25 19:06:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T19:03:01Z.


Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of 1b240444 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings and --features diagnostics: 0 warnings.
  • RTX 5090: cargo test --locked -p victory-gpu --features diagnostics --lib host::batch: 1 passed, 0 failed.
  • WARP (VICTORY_D3D12_WARP=1): cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1: 198 passed, 0 failed, 1 ignored.

Review Notes

  • Stack-local counters in HostList::run_deferred add zero locks, zero heap allocations, and zero cross-reset state; under non-diagnostics builds all counting compiles away completely and lifting shadow.clean() ahead of batch.add_dirty avoids an extra check on already-filtered Step::Heap/Step::Memory calls. Clean and ready to merge.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7171752103 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2669#issuecomment-7171752103). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T19:03:01Z. --- Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of `1b240444` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` and `--features diagnostics`: **0 warnings**. - **RTX 5090:** `cargo test --locked -p victory-gpu --features diagnostics --lib host::batch`: **1 passed, 0 failed**. - **WARP (`VICTORY_D3D12_WARP=1`):** `cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1`: **198 passed, 0 failed, 1 ignored**. ### Review Notes - Stack-local counters in `HostList::run_deferred` add zero locks, zero heap allocations, and zero cross-reset state; under non-`diagnostics` builds all counting compiles away completely and lifting `shadow.clean()` ahead of `batch.add_dirty` avoids an extra check on already-filtered `Step::Heap`/`Step::Memory` calls. Clean and ready to merge.
Marvisak commented 2026-11-25 23:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:24:05Z.


Automated triage for the maintainers.

Merge candidate (small; diagnostics counters). On main nothing ever adds to C::Skipped/C::SkippedBytes (crates/victory-gpu/src/copystat.rs only prints them), so the frame summary always shows zero skipped refreshes. HostList::run_deferred (crates/victory-gpu/src/host.rs) now checks shadow.clean() at the Step::Refresh caller, counts requests and skips locally, and adds them once per list. Batch::add becomes add_dirty without its own clean check. The Heap and Memory paths already filter on watch::clean_bit (bindless::refresh, memory::prepare), so nothing that was copied before is skipped now; at worst a hull with a stale dirty bit gets a no-op update. It merges cleanly; CI check: passing.

Non-blocking: a small diagnostics test that checks the counter deltas would pin the new accounting.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176315793 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2669#issuecomment-7176315793). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:24:05Z. --- <!-- victory-triage v1 head=1b240444de62b5b133cae208eb92598f3c0ac1a9 verdict=merge-candidate at=2026-11-25T22:30:30Z --> Automated triage for the maintainers. **Merge candidate** (small; diagnostics counters). On `main` nothing ever adds to `C::Skipped`/`C::SkippedBytes` (`crates/victory-gpu/src/copystat.rs` only prints them), so the frame summary always shows zero skipped refreshes. `HostList::run_deferred` (`crates/victory-gpu/src/host.rs`) now checks `shadow.clean()` at the `Step::Refresh` caller, counts requests and skips locally, and adds them once per list. `Batch::add` becomes `add_dirty` without its own clean check. The `Heap` and `Memory` paths already filter on `watch::clean_bit` (`bindless::refresh`, `memory::prepare`), so nothing that was copied before is skipped now; at worst a hull with a stale dirty bit gets a no-op update. It merges cleanly; CI `check`: passing. Non-blocking: a small diagnostics test that checks the counter deltas would pin the new accounting. --- _Generated by [Claude Code](https://claude.ai/code)_
Dukestar69 commented 2026-11-26 05:02:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T04:50:58Z.

Review: APPROVED


Tested merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • cargo test -p victory-gpu --features diagnostics --lib host::tests -- --skip dynamic_slots_are_held_until_released: 30 passed, 0 failed (skipped pre-existing #1744 NVIDIA 1M view-heap cap test).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

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

<!-- greyfinch-sync:Marvisak/VIctory:review:6068712739 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2669#pullrequestreview-6068712739). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T04:50:58Z. **Review:** APPROVED --- Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - `cargo test -p victory-gpu --features diagnostics --lib host::tests -- --skip dynamic_slots_are_held_until_released`: **30 passed, 0 failed** (skipped pre-existing `#1744` NVIDIA 1M view-heap cap test). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
upstream-sync closed this pull request 2026-11-26 06:02:40 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2667
No description provided.