GPU: add per-frame breakdown log, GPU list timestamp meter, and Windows driver watch #103

Closed
github-bot wants to merge 2 commits from gh-pr/103/head into gh-pr/103/base
Owner

@⁠dutch2005 on GitHub · 2026-11-25 14:10 UTC · original
feat/frame-log-card-meter-driver-watch → main · +1848 −19 · 14 files · 2 commits · closed without merging

Summary

Ports framelog, cardmeter, and drvwatch from fxceless/victory-fork (a253706), adapted cleanly to Belobug/VIctory-Belobug-AMD:

  • Per-frame breakdown log (victory_gpu::framelog, VICTORY_FRAME_LOG=1/0, default on in diagnostics builds):
    • Monotonic relaxed-atomic counters across submissions (Submissions, PrepareUs, CardWaitUs), title-memory copies (CopyUs, CopyBytes), copy-back (CopyBackUs, CopyBackBytes), queue::execute (ExecuteUs), queue::present / Host::present / Host::present_over (PresentUs, PresentShowUs), texture staging refreshes & uploads (RefreshUs, Uploads), pipeline wait (PipelineWaitUs, plus MADE / LOADED via pipeline::frame_log_counts()), guard faults (GuardFaults), memory remaps (Remaps, RemapUs), DirectStorage (DiskReads, DiskBytes, DiskUs), frame pacing (PaceUs), and CPU thread/process times, page faults, free physical MB, draws/dispatches, and hybrid-core GetSystemCpuSetInformation checks.
    • Emits 5-second frame times summary (shortest / median / longest / each ms), usual frame mean, and individual long frame breakdowns (> max(1.5x, +40 ms)).
  • GPU card timestamp meter (victory_gpu::cardmeter, VICTORY_CARD_METER=0/1, default on in diagnostics builds):
    • Asynchronous ID3D12QueryHeap timestamp pairs around CardEngine::record_before (Kind::Sync), CardEngine::record_after (Kind::Check), and HostList reset..close (Kind::Lists), resolved into a persistent readback ring and collected 1.5 s later without extra GPU stalls.
  • Windows driver event log watch (victory_gpu::drvwatch, VICTORY_DRIVER_WATCH=0 to disable) + live Host::drain_messages() on 5-second ticks:
    • Subscribes via EvtSubscribe to System event-log errors from nvlddmkm, amdkmdag, amdwddmg, igfx, igfxn, and Display, logging each event with layer timestamps to correlate driver resets/timeouts (amdkmdag / TDR warnings) with active submissions.
  • Also fixes pre-existing unused_variables: wait clippy warning in crates/victory-gpu/src/frame.rs.

Verification

Verified locally on Windows 11 with AMD Radeon RX 6700 XT + WARP (CARGO_TARGET_DIR isolated to worktree):

  • cargo clippy -p victory-gpu -p victory-hle --no-deps --all-targets --locked and --all-features: 0 warnings or errors on all new/modified files (pre-existing clippy warnings elsewhere in victory-gpu / victory-hle unchanged).
  • cargo test -p victory-gpu --lib -- --test-threads=1: 115 passed, 1 failed, 4 ignored — all 7 new tests (cardmeter::tests, drvwatch::tests including live EvtSubscribe the_system_takes_the_subscription, and framelog::tests x4) passed; the 1 failure is the pre-existing baseline watch::tests::written_pages_are_reported_to_every_asker at watch.rs:1005.
  • cargo test -p victory-hle --lib -- modules::dstorage::tests: 13 passed, 0 failed.
  • cargo xtask policy --staged: asset policy: 14 files ok.
**@⁠dutch2005** on GitHub · 2026-11-25 14:10 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/103) `feat/frame-log-card-meter-driver-watch` → `main` · +1848 −19 · 14 files · 2 commits · closed without merging ## Summary Ports `framelog`, `cardmeter`, and `drvwatch` from `fxceless/victory-fork` (`a253706`), adapted cleanly to `Belobug/VIctory-Belobug-AMD`: - **Per-frame breakdown log (`victory_gpu::framelog`, `VICTORY_FRAME_LOG=1/0`, default on in `diagnostics` builds)**: - Monotonic relaxed-atomic counters across submissions (`Submissions`, `PrepareUs`, `CardWaitUs`), title-memory copies (`CopyUs`, `CopyBytes`), copy-back (`CopyBackUs`, `CopyBackBytes`), `queue::execute` (`ExecuteUs`), `queue::present` / `Host::present` / `Host::present_over` (`PresentUs`, `PresentShowUs`), texture staging refreshes & uploads (`RefreshUs`, `Uploads`), pipeline wait (`PipelineWaitUs`, plus `MADE` / `LOADED` via `pipeline::frame_log_counts()`), guard faults (`GuardFaults`), memory remaps (`Remaps`, `RemapUs`), DirectStorage (`DiskReads`, `DiskBytes`, `DiskUs`), frame pacing (`PaceUs`), and CPU thread/process times, page faults, free physical MB, draws/dispatches, and hybrid-core `GetSystemCpuSetInformation` checks. - Emits 5-second `frame times` summary (shortest / median / longest / each ms), `usual frame` mean, and individual `long frame` breakdowns (`> max(1.5x, +40 ms)`). - **GPU card timestamp meter (`victory_gpu::cardmeter`, `VICTORY_CARD_METER=0/1`, default on in `diagnostics` builds)**: - Asynchronous `ID3D12QueryHeap` timestamp pairs around `CardEngine::record_before` (`Kind::Sync`), `CardEngine::record_after` (`Kind::Check`), and `HostList` reset..close (`Kind::Lists`), resolved into a persistent readback ring and collected 1.5 s later without extra GPU stalls. - **Windows driver event log watch (`victory_gpu::drvwatch`, `VICTORY_DRIVER_WATCH=0` to disable)** + live `Host::drain_messages()` on 5-second ticks: - Subscribes via `EvtSubscribe` to `System` event-log errors from `nvlddmkm`, `amdkmdag`, `amdwddmg`, `igfx`, `igfxn`, and `Display`, logging each event with layer timestamps to correlate driver resets/timeouts (`amdkmdag` / TDR warnings) with active submissions. - Also fixes pre-existing `unused_variables: wait` clippy warning in `crates/victory-gpu/src/frame.rs`. ## Verification Verified locally on Windows 11 with **AMD Radeon RX 6700 XT** + WARP (`CARGO_TARGET_DIR` isolated to worktree): - `cargo clippy -p victory-gpu -p victory-hle --no-deps --all-targets --locked` and `--all-features`: 0 warnings or errors on all new/modified files (pre-existing clippy warnings elsewhere in `victory-gpu` / `victory-hle` unchanged). - `cargo test -p victory-gpu --lib -- --test-threads=1`: **115 passed, 1 failed, 4 ignored** — all 7 new tests (`cardmeter::tests`, `drvwatch::tests` including live `EvtSubscribe` `the_system_takes_the_subscription`, and `framelog::tests` x4) passed; the 1 failure is the pre-existing baseline `watch::tests::written_pages_are_reported_to_every_asker` at `watch.rs:1005`. - `cargo test -p victory-hle --lib -- modules::dstorage::tests`: **13 passed, 0 failed**. - `cargo xtask policy --staged`: `asset policy: 14 files ok`.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:49 +00:00
github-bot closed this pull request 2026-11-26 03:35:49 +00:00
Author
Owner

@⁠dutch2005 on GitHub · 2026-11-25 14:49 UTC · original

Updated \ eat/frame-log-card-meter-driver-watch\ with mutant-hardened unit and D3D12 tests:

  • \cardmeter::tests: added \parse_on, \Span\ round-trip, timestamp slot-1 resolve, ring wraparound, capacity limit, \micros, and \collect_ready\ tests (5 passed; \cargo mutants\ on \lloc_slot|begin_list|end_list: 29 caught, 2 unviable, 0 missed; overall earlier \cardmeter.rs\ run caught the remaining helpers via \micros/\collect_ready/\parse_on).
  • \drvwatch::tests: added \should_watch,
    ecord_seen, \on_event, and system subscription tests (3 passed; \cargo mutants\ on \drvwatch.rs: 13 caught, 0 missed).
  • \ ramelog::tests: added \parse_on, \FILETIME\ conversion (+\ over equivalent |/^), \median, \long_over, strict >\ boundary, \LONG_MOST\ boundary, \mean, and full \ ext()\ formatting checks (5 passed; \cargo mutants\ on \parse_on|micros|median|long_over|lines|mean|text|add|here|total\ + \micros|lines\ follow-up: 0 missed).
  • \pipeline::tests: added \ rame_log_counts_read_library_counters\ (3 passed).
  • Full \cargo test -p victory-gpu --lib -- --test-threads=1: 122 passed, 1 failed (pre-existing \watch::tests::written_pages_are_reported_to_every_asker, #102), 4 ignored. \cargo clippy -p victory-gpu -p victory-hle --no-deps --all-targets --locked\ (and --all-features): 0 warnings in PR #103 files. \cargo xtask policy --staged: ok.
**@⁠dutch2005** on GitHub · 2026-11-25 14:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/103#issuecomment-7165873505) Updated \ eat/frame-log-card-meter-driver-watch\ with mutant-hardened unit and D3D12 tests: - \cardmeter::tests\: added \parse_on\, \Span\ round-trip, timestamp slot-1 resolve, ring wraparound, capacity limit, \micros\, and \collect_ready\ tests (**5 passed**; \cargo mutants\ on \lloc_slot|begin_list|end_list\: **29 caught, 2 unviable, 0 missed**; overall earlier \cardmeter.rs\ run caught the remaining helpers via \micros\/\collect_ready\/\parse_on\). - \drvwatch::tests\: added \should_watch\, \ ecord_seen\, \on_event\, and system subscription tests (**3 passed**; \cargo mutants\ on \drvwatch.rs\: **13 caught, 0 missed**). - \ ramelog::tests\: added \parse_on\, \FILETIME\ conversion (\+\ over equivalent \|\/\^\), \median\, \long_over\, strict \>\ boundary, \LONG_MOST\ boundary, \mean\, and full \ ext()\ formatting checks (**5 passed**; \cargo mutants\ on \parse_on|micros|median|long_over|lines|mean|text|add|here|total\ + \micros|lines\ follow-up: **0 missed**). - \pipeline::tests\: added \ rame_log_counts_read_library_counters\ (**3 passed**). - Full \cargo test -p victory-gpu --lib -- --test-threads=1\: **122 passed, 1 failed** (pre-existing \watch::tests::written_pages_are_reported_to_every_asker\, #102), **4 ignored**. \cargo clippy -p victory-gpu -p victory-hle --no-deps --all-targets --locked\ (and \--all-features\): **0 warnings** in PR #103 files. \cargo xtask policy --staged\: ok.
Author
Owner

@⁠dutch2005 on GitHub · 2026-11-25 16:50 UTC · original

Rebased onto upstream/main (01aadd1), updated copy-back timing (copy_back(0, ...) before finish_submission), and hardened tests to close missed mutants across the testable PR diff:

  • dstorage.rs: added lanes_count_accumulates_completed_requests_and_bytes (1/1 caught).
  • drvwatch.rs: exercised start() subscription state directly in the_system_takes_the_subscription (16/16 caught).
  • cardmeter.rs: added end-to-end VICTORY_CARD_METER=1 subprocess coverage (on(), make(), begin(), end(), collect()), initial zeroed-slot check, and PAIRS - 1 slot resolution (70 caught, 6 unviable, 0 missed).
  • framelog.rs: extracted slow_mask, parse_cpu_sets, and ready_to_flush helpers and added OS sampler + frame() lifecycle subprocess tests (117 caught, 5 unviable, 1 timeout, 1 missed: on_slow_core -> false at framelog.rs:110, equivalent on symmetric CPUs where all cores share an efficiency class).
  • pipeline.rs / pipeline/make.rs / frame.rs / queue.rs / texture.rs / watch.rs: tested together in the preceding cargo mutants pass (task-2407, alongside pre-fix cardmeter/drvwatch): 0 missed across those six files (watch::try_open_guarded -> true timed out as detected).

Verification (commit d0f3034)

  • cargo test -p victory-gpu --lib --locked -- --test-threads=1: 127 passed, 0 failed, 4 ignored
  • cargo test -p victory-hle --lib --locked modules::dstorage::tests: 14 passed, 0 failed
  • cargo clippy -p victory-gpu -p victory-hle --lib --tests --locked --no-deps: 0 new warnings in touched files
  • cargo xtask policy --staged: 4 files ok
**@⁠dutch2005** on GitHub · 2026-11-25 16:50 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/103#issuecomment-7168620411) Rebased onto `upstream/main` (`01aadd1`), updated copy-back timing (`copy_back(0, ...)` before `finish_submission`), and hardened tests to close missed mutants across the testable PR diff: - **`dstorage.rs`**: added `lanes_count_accumulates_completed_requests_and_bytes` (**1/1 caught**). - **`drvwatch.rs`**: exercised `start()` subscription state directly in `the_system_takes_the_subscription` (**16/16 caught**). - **`cardmeter.rs`**: added end-to-end `VICTORY_CARD_METER=1` subprocess coverage (`on()`, `make()`, `begin()`, `end()`, `collect()`), initial zeroed-slot check, and `PAIRS - 1` slot resolution (**70 caught, 6 unviable, 0 missed**). - **`framelog.rs`**: extracted `slow_mask`, `parse_cpu_sets`, and `ready_to_flush` helpers and added OS sampler + `frame()` lifecycle subprocess tests (**117 caught, 5 unviable, 1 timeout, 1 missed**: `on_slow_core -> false` at `framelog.rs:110`, equivalent on symmetric CPUs where all cores share an efficiency class). - **`pipeline.rs` / `pipeline/make.rs` / `frame.rs` / `queue.rs` / `texture.rs` / `watch.rs`**: tested together in the preceding `cargo mutants` pass (`task-2407`, alongside pre-fix `cardmeter`/`drvwatch`): **0 missed** across those six files (`watch::try_open_guarded -> true` timed out as detected). ### Verification (commit `d0f3034`) - `cargo test -p victory-gpu --lib --locked -- --test-threads=1`: **127 passed, 0 failed, 4 ignored** - `cargo test -p victory-hle --lib --locked modules::dstorage::tests`: **14 passed, 0 failed** - `cargo clippy -p victory-gpu -p victory-hle --lib --tests --locked --no-deps`: 0 new warnings in touched files - `cargo xtask policy --staged`: **4 files ok**

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.