Refreshes inside a recorded run left out (VICTORY_REFRESH_WITHIN), and the one asking's gap 2 MiB (VICTORY_ONCE_GAP_KB) #4878

Closed
github-bot wants to merge 1 commit from github-bot/gh-4877 into main AGit
Owner

@⁠Kenzim on GitHub · 2026-12-01 12:29 UTC · original
Kenzim:refresh → main · +127 −1 · 2 files · 1 commits · closed without merging

Two changes to what the submitting thread does before its refreshes.

  1. VICTORY_REFRESH_WITHIN (on). A list leaves out a refresh whose bytes one run of refreshes it recorded since its last title copy already names; a draw's piece of a vertex buffer bound whole earlier, for one.
    • Before, only the very same range was left out (Deferred::refreshed), and the submitting thread walked every step three times.
    • Nothing is missed: the run per copy grows only by refreshes that touch it, and starts anew at a title write (title_written) or a shader write of that copy (defer_gpu_write).
    • Every reader of the steps takes their union, which is the same without the step.
  2. A submission's one asking of the write watch (ask_once) joins ranges over 2 MiB instead of 8 MiB (AHEAD_GAP).
    • An asking costs by the megabyte asked about, written or not, so fewer pages walked pay for a few more calls.
    • VICTORY_ONCE_GAP_KB=<KiB> sets the gap; VICTORY_AHEAD_GAP_KB stays ask_ahead's.

Measurements (RTX 3090, native 2560x1440, DLSS off, street scene, 4,600 draws; switches flipped inside one run with VICTORY_AB), per frame:

  • REFRESH_WITHIN (every 10 s, three phases each way, twice):
    • 10,269 of about 23,000 steps left out.
    • "finding what to ask" 0.667 -> 0.607 and 0.671 -> 0.610 ms.
    • planning the steps done on the card 0.565 -> 0.520 and 0.568 -> 0.514 ms.
  • Gap 2 MiB (three phases each way):
    • 305 askings over 1,101 MB instead of 240 over 1,376 MB.
    • "asking the write watch" 4.30 -> 3.80 ms.

In this card-bound scene the frame time does not move (median unchanged). The gains are in the processor stages named above.

Not measured: gaps below 2 MiB; the lists' own threads and list reset; other scenes.

To restore the old behaviour: VICTORY_REFRESH_WITHIN=0, VICTORY_ONCE_GAP_KB=8192.

Shader cache / translator key: not affected.

Tests: new host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other; watch:: 69 pass. watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour is an existing parallel-only flake on main (8 of 40 runs fail there; 0 of 20 single-threaded). The rest of host:: aborts on the test PC (Windows 10, no Shader Model 6.6), as on main.

**@⁠Kenzim** on GitHub · 2026-12-01 12:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877) `Kenzim:refresh` → `main` · +127 −1 · 2 files · 1 commits · closed without merging Two changes to what the submitting thread does before its refreshes. 1. `VICTORY_REFRESH_WITHIN` (on). A list leaves out a refresh whose bytes one run of refreshes it recorded since its last title copy already names; a draw's piece of a vertex buffer bound whole earlier, for one. - Before, only the very same range was left out (`Deferred::refreshed`), and the submitting thread walked every step three times. - Nothing is missed: the run per copy grows only by refreshes that touch it, and starts anew at a title write (`title_written`) or a shader write of that copy (`defer_gpu_write`). - Every reader of the steps takes their union, which is the same without the step. 2. A submission's one asking of the write watch (`ask_once`) joins ranges over 2 MiB instead of 8 MiB (`AHEAD_GAP`). - An asking costs by the megabyte asked about, written or not, so fewer pages walked pay for a few more calls. - `VICTORY_ONCE_GAP_KB=<KiB>` sets the gap; `VICTORY_AHEAD_GAP_KB` stays `ask_ahead`'s. Measurements (RTX 3090, native 2560x1440, DLSS off, street scene, 4,600 draws; switches flipped inside one run with `VICTORY_AB`), per frame: - REFRESH_WITHIN (every 10 s, three phases each way, twice): - 10,269 of about 23,000 steps left out. - "finding what to ask" 0.667 -> 0.607 and 0.671 -> 0.610 ms. - planning the steps done on the card 0.565 -> 0.520 and 0.568 -> 0.514 ms. - Gap 2 MiB (three phases each way): - 305 askings over 1,101 MB instead of 240 over 1,376 MB. - "asking the write watch" 4.30 -> 3.80 ms. **In this card-bound scene the frame time does not move** (median unchanged). The gains are in the processor stages named above. Not measured: gaps below 2 MiB; the lists' own threads and list reset; other scenes. To restore the old behaviour: `VICTORY_REFRESH_WITHIN=0`, `VICTORY_ONCE_GAP_KB=8192`. Shader cache / translator key: not affected. Tests: new `host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other`; `watch::` 69 pass. `watch::tests::ask_rest_falls_back_per_piece_when_touching_unwatched_neighbour` is an existing parallel-only flake on main (8 of 40 runs fail there; 0 of 20 single-threaded). The rest of `host::` aborts on the test PC (Windows 10, no Shader Model 6.6), as on main.
A list leaves out a refresh of bytes that one run of refreshes it recorded
since its last title copy names already: a draw's piece of a vertex buffer
bound whole earlier, for one. Such a step went in as a step of its own,
and the submitting thread walks every step three times (the spans it asks
the write watch about, those it refreshes in front, and the steps
themselves). Nothing is missed: the run grows only by refreshes that touch
it, and starts anew at a step that writes title memory or gives the copy to
shaders; every reader of the steps takes their union, which is the same
without the step. VICTORY_REFRESH_WITHIN=0: as before.

A submission's one asking of the write watch joins its ranges over 2 MiB,
not 8 (AHEAD_GAP, which it used until now). An asking costs by the
megabyte asked about, written or not, so fewer pages walked between pieces
pay for a few more calls. VICTORY_ONCE_GAP_KB=<KiB> sets another gap;
8192 is the old behaviour. VICTORY_AHEAD_GAP_KB stays ask_ahead's, which a
submission with its one asking never makes.

Measured in the street scene (RTX 3090, 2560x1440, DLSS off, 4,600 draws),
switches flipped inside one run (VICTORY_AB), per frame:

- REFRESH_WITHIN (run cr-ab-long, every 10 s, three phases each way,
  twice): 10,269 of some 23,000 steps left out; the submitting thread's
  "finding what to ask" 0.667 -> 0.607 and 0.671 -> 0.610 ms, its planning
  of the steps done on the card 0.565 -> 0.520 and 0.568 -> 0.514 ms.
- the gap (run cr-ab-ask, three phases each way): 305 askings over 1,101
  MB in place of 240 over 1,376, "asking the write watch" 4.30 -> 3.80 ms.

The frame time does not move there: the scene is bound by the card. The
gains are in the submitting thread's stages named. Not measured: gaps
smaller than 2 MiB, the lists' own threads, other scenes.

Test: host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 12:32:10 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-12-01 12:56 UTC · original

Verification of this PR (AI-assisted: Hy4 flash), source only, no game data.

Windows / rustc 1.100.0 / MSVC. Worktree at head 37562c20, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\NVIDIA-Contrib\target-4877), never shared.

Negative control on base 5fabb46e:

  • git grep -F a_refresh_inside_the_run_recorded_is_left_out_and_no_other 5fabb46e -- . -> exit 1 (test is new)
    Whitespace: git diff --check 5fabb46e..37562c20 -> exit 0, clean.
cargo test --locked -p victory-gpu --lib -- host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other --exact --test-threads=1 --quiet

-> running 1 test / test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out.

Note on the name: unlike its neighbours this #[test] sits at the crate root of host.rs (line 13924), not inside mod written_spans_tests, so the filter is host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other. Filtering under host::written_spans_tests:: reports running 0 tests — a false negative, not a failure. It may be worth moving it next to held_within's companions in that module so the names stay together.

GPU/driver: N/A (the test drives held_within over a synthetic run set; no device is opened).

Verdict: PASS for the new synthetic test on this host.

**@⁠cloph-dsp** on GitHub · 2026-12-01 12:56 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877#issuecomment-7311874370) Verification of this PR (AI-assisted: Hy4 flash), source only, no game data. Windows / rustc 1.100.0 / MSVC. Worktree at head 37562c20, dedicated per-worktree CARGO_TARGET_DIR (D:\Victory-Contrib\NVIDIA-Contrib\target-4877), never shared. Negative control on base 5fabb46e: - `git grep -F a_refresh_inside_the_run_recorded_is_left_out_and_no_other 5fabb46e -- .` -> exit 1 (test is new) Whitespace: `git diff --check 5fabb46e..37562c20` -> exit 0, clean. ``` cargo test --locked -p victory-gpu --lib -- host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other --exact --test-threads=1 --quiet ``` -> `running 1 test` / `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 1161 filtered out`. Note on the name: unlike its neighbours this `#[test]` sits at the crate root of host.rs (line 13924), not inside `mod written_spans_tests`, so the filter is `host::a_refresh_inside_the_run_recorded_is_left_out_and_no_other`. Filtering under `host::written_spans_tests::` reports `running 0 tests` — a false negative, not a failure. It may be worth moving it next to `held_within`'s companions in that module so the names stay together. GPU/driver: N/A (the test drives `held_within` over a synthetic run set; no device is opened). Verdict: PASS for the new synthetic test on this host.
Author
Owner

@⁠tikD1337 on GitHub · 2026-12-01 13:28 UTC · original

Tested stacked on origin/main (5fabb46e) in --release alongside #4872, #4885 (VICTORY_THIN_PEEPHOLE=1), and #3556 01/03/04 (VICTORY_PORT_CONSTANTS=0, VICTORY_WC_BAR=0):

  • Rig: Ryzen 5 7600 + RTX 4070 Ti SUPER 16 GB (Driver 621.1.0, ReBAR ON) + Win11 26300, DLSS Quality, 105 s steady 3D runs (0 crashes).
  • Result vs identical stack without #4877 + #4872:
    • Steady 3D FPS (>=200 lists): 27.41 -> 27.93 FPS (36.48 -> 35.80 ms)
    • submit_prep: 32.7 -> 31.6 ms (ww 8.10 -> 7.60 ms)
    • Matched 5.3k–6.5k draws host_prep: 30.8 -> 29.4 ms (down to 28.9 ms)

Clean apply, watch::tests 43/43 PASS, 0 crashes.

**@⁠tikD1337** on GitHub · 2026-12-01 13:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877#issuecomment-7312669939) Tested stacked on `origin/main` (`5fabb46e`) in `--release` alongside `#4872`, `#4885` (`VICTORY_THIN_PEEPHOLE=1`), and `#3556` `01/03/04` (`VICTORY_PORT_CONSTANTS=0`, `VICTORY_WC_BAR=0`): - **Rig:** Ryzen 5 7600 + RTX 4070 Ti SUPER 16 GB (Driver `621.1.0`, ReBAR ON) + Win11 `26300`, DLSS Quality, `105 s` steady 3D runs (`0` crashes). - **Result vs identical stack without `#4877` + `#4872`:** - Steady 3D FPS (`>=200` lists): **`27.41 -> 27.93 FPS`** (`36.48 -> 35.80 ms`) - `submit_prep`: **`32.7 -> 31.6 ms`** (`ww` **`8.10 -> 7.60 ms`**) - Matched `5.3k–6.5k` draws `host_prep`: **`30.8 -> 29.4 ms`** (down to `28.9 ms`) Clean apply, `watch::tests` **43/43 PASS**, 0 crashes.
github-bot closed this pull request 2026-12-01 18:30:39 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:29 UTC · original

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.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877#issuecomment-7321030973) 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

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