Diagnostics for finding what paces a frame: causal profiling switches, a capture trigger, a multi-lane stress harness #3508

Closed
Aseoriy wants to merge 3 commits from upstream-pr/3508 into main
Aseoriy commented 2026-11-30 00:12:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Aseoriy on 2026-11-30T00:12:01Z.


Three independent commits on top of main 41adb551. Each builds alone (normal and diagnostics), and the tests they add pass.

1. Causal profiling switches (diagnostics builds only)

VICTORY_SLOW_SUBMIT (the submitting thread busy-waits 120 µs per submission) and VICTORY_SLOW_LISTS (each translating thread 80 µs per recording); VICTORY_SLOW_US overrides the amount. Used with VICTORY_AB, they tell whether a stage sets the frame's pace: if frames get slower by about as much as was added, it does.

What it showed while driving (RTX 5070, i7-14700F, Series X profile, 4-way in-run A/B): neither stage slowed frames by the ~2 ms added (−0.3 ms and −0.7 ms over 12 and 11 matched pairs). The card was 76–90 % busy by the card clock, with the title waiting ~11 ms a frame at present. So on this machine, driving frames are paced by the card, and cutting CPU work on either stage alone is neutral; that matched several CPU reductions measured neutral the same day.

2. Capture: a file named shot in the capture folder captures the next frame, as F9 does

For tools outside the process (unattended test runs with the display off). Checked every 15 frames; diagnostics builds only.

3. Stress harness for preparing on more than one thread (shadow::lane_tests)

No game needed, about 4 s. Rounds race two writer threads against two lanes' refreshes of random pieces of five nested and overlapping copies of write-watched memory, then stop the writers, refresh every copy whole and check every dword against title memory. A planted lost write (a thread clearing the kernel's write bits behind the journal) is caught, so the harness is known to see what it is for. VICTORY_LANE_ROUNDS=<n> for longer runs (2,000 rounds clean). Meant as a safety net for work that splits submission preparing across threads.

Tested

  • cargo check -p victory-gpu -p victory-hle, with and without diagnostics; cargo check -p victory --features diagnostics.
  • VICTORY_LANE_ROUNDS=40 cargo test -p victory-gpu --lib lane_tests: 3 passed (including the planted-lost-write check).
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5556671415 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3508). Originally posted by [Aseoriy](https://github.com/Aseoriy) on 2026-11-30T00:12:01Z. --- Three independent commits on top of main 41adb551. Each builds alone (normal and `diagnostics`), and the tests they add pass. ## 1. Causal profiling switches (diagnostics builds only) `VICTORY_SLOW_SUBMIT` (the submitting thread busy-waits 120 µs per submission) and `VICTORY_SLOW_LISTS` (each translating thread 80 µs per recording); `VICTORY_SLOW_US` overrides the amount. Used with `VICTORY_AB`, they tell whether a stage sets the frame's pace: if frames get slower by about as much as was added, it does. What it showed while driving (RTX 5070, i7-14700F, Series X profile, 4-way in-run A/B): neither stage slowed frames by the ~2 ms added (−0.3 ms and −0.7 ms over 12 and 11 matched pairs). The card was 76–90 % busy by the card clock, with the title waiting ~11 ms a frame at present. So on this machine, driving frames are paced by the card, and cutting CPU work on either stage alone is neutral; that matched several CPU reductions measured neutral the same day. ## 2. Capture: a file named `shot` in the capture folder captures the next frame, as F9 does For tools outside the process (unattended test runs with the display off). Checked every 15 frames; diagnostics builds only. ## 3. Stress harness for preparing on more than one thread (`shadow::lane_tests`) No game needed, about 4 s. Rounds race two writer threads against two lanes' refreshes of random pieces of five nested and overlapping copies of write-watched memory, then stop the writers, refresh every copy whole and check every dword against title memory. A planted lost write (a thread clearing the kernel's write bits behind the journal) is caught, so the harness is known to see what it is for. `VICTORY_LANE_ROUNDS=<n>` for longer runs (2,000 rounds clean). Meant as a safety net for work that splits submission preparing across threads. ## Tested - `cargo check -p victory-gpu -p victory-hle`, with and without `diagnostics`; `cargo check -p victory --features diagnostics`. - `VICTORY_LANE_ROUNDS=40 cargo test -p victory-gpu --lib lane_tests`: 3 passed (including the planted-lost-write check).
trustno1-coder commented 2026-12-01 18:51:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-12-01T18:51:31Z.


Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7321686090 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3508#issuecomment-7321686090). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:51:31Z. --- Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

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
trustno1-coder/VIctory-NVIDIA!3508
No description provided.