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

Closed
Kenzim wants to merge 1 commit from upstream-pr/4877 into main
Kenzim commented 2026-12-01 12:29:00 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Kenzim on 2026-12-01T12:29:00Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5585692031 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877). Originally posted by [Kenzim](https://github.com/Kenzim) on 2026-12-01T12:29:00Z. --- 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.
cloph-dsp commented 2026-12-01 12:56:38 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-12-01T12:56:38Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7311874370 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877#issuecomment-7311874370). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-12-01T12:56:38Z. --- 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.
tikD1337 commented 2026-12-01 13:28:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tikD1337 on 2026-12-01T13:28:02Z.


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.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7312669939 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877#issuecomment-7312669939). Originally posted by [tikD1337](https://github.com/tikD1337) on 2026-12-01T13:28:02Z. --- 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.
trustno1-coder commented 2026-12-01 18:29:33 +00:00 (Migrated from github.com)

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


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:7321030973 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4877#issuecomment-7321030973). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-12-01T18:29:33Z. --- 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!4877
No description provided.