Submit thread: fills split by bytes, journal skips writes overwritten in the same round (VICTORY_COPIES_FILLS_FAST, VICTORY_WATCH_FAST_JOURNAL) #4757

Closed
henriazz10 wants to merge 4 commits from upstream-pr/4757 into main
henriazz10 commented 2026-12-01 05:25:20 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by henriazz10 on 2026-12-01T05:25:20Z.


What it changes

Two parts of the submit thread that grow with how much the title writes:

  • VICTORY_COPIES_FILLS_FAST=1 (host/send.rs, host.rs): splits the fills by bytes instead of by count across the workers, so one large fill no longer holds the others back. The CARDED lookup in send_copied is filtered to the range being sent.
  • VICTORY_WATCH_FAST_JOURNAL=1 (watch.rs, shadow.rs): Journal::note skips the BTreeMap writes that would be overwritten in the same round, through PageEpochs::swap.
  • Both are turned on in play.rs.

How it was tested

  • GPU and profile: RTX 5080 16 GB, Ryzen 9 5950X, 32 GB RAM, Windows 11; Series X profile, 1706×960 → 2560×1440, DLSS Quality, frame generation off, ray tracing off.
  • Bench: fixed in-game route, 120 s, 2 alternated runs, from the submit-thread sub-phase lines of victory.log: copies and fills 5.0 → 1.7 ms per frame, asking the write watch 4.7 → 4.4 ms. That run also carried other switches that were later dropped; with them, frame time was −9.4 % against v2026.11.30.03. These two switches, measured on their own sub-phases, account for about 3.6 ms of it.
  • Checks on Windows with the repo's toolchain (1.98.1), same commands as ci.yml: cargo build --release passes. cargo clippy --workspace --all-targets --locked -- -D warnings gives no new finding (it already fails on main, in the same 3 files). cargo test --workspace --locked: 2486 pass; modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it fails on every branch of this set and on none of the files they touch, and host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue once in the full parallel run, and each passes when run alone (--exact); main itself fails host::refresh_tests::chunked_nothing_new_with_matches_individual in the same run. cargo fmt --check already reports hundreds of hunks per file on main; the new code follows the style of the code around it.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related, not duplicates: #3705 (refresh sift with a worker pool), #4571 (trims write-watch scans across scattered ranges), #4247, #4653, #4576, #3945, #3760, #3756, #2267.

AI-assisted. Neon (Gemini) wrote the change; Claude Code reviewed it, rebased it on main, built it, ran the checks and measured it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5579644939 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4757). Originally posted by [henriazz10](https://github.com/henriazz10) on 2026-12-01T05:25:20Z. --- <!-- Thanks for the pull request. Please label it (pr-fix, pr-feature, pr-performance, pr-diagnostics, pr-refactor, pr-docs or pr-tests, plus the area labels), or put the label in the title, like [pr-fix]. --> ## What it changes Two parts of the submit thread that grow with how much the title writes: - `VICTORY_COPIES_FILLS_FAST=1` (`host/send.rs`, `host.rs`): splits the fills by bytes instead of by count across the workers, so one large fill no longer holds the others back. The `CARDED` lookup in `send_copied` is filtered to the range being sent. - `VICTORY_WATCH_FAST_JOURNAL=1` (`watch.rs`, `shadow.rs`): `Journal::note` skips the `BTreeMap` writes that would be overwritten in the same round, through `PageEpochs::swap`. - Both are turned on in `play.rs`. ## How it was tested - GPU and profile: RTX 5080 16 GB, Ryzen 9 5950X, 32 GB RAM, Windows 11; Series X profile, 1706×960 → 2560×1440, DLSS Quality, frame generation off, ray tracing off. - Bench: fixed in-game route, 120 s, 2 alternated runs, from the submit-thread sub-phase lines of `victory.log`: `copies and fills` **5.0 → 1.7 ms per frame**, `asking the write watch` 4.7 → 4.4 ms. That run also carried other switches that were later dropped; with them, frame time was −9.4 % against `v2026.11.30.03`. These two switches, measured on their own sub-phases, account for about 3.6 ms of it. - Checks on Windows with the repo's toolchain (1.98.1), same commands as `ci.yml`: `cargo build --release` passes. `cargo clippy --workspace --all-targets --locked -- -D warnings` gives no new finding (it already fails on `main`, in the same 3 files). `cargo test --workspace --locked`: 2486 pass; `modules::xmem::tests::a_read_by_range_waits_only_for_a_remapping_that_meets_it` fails on every branch of this set and on none of the files they touch, and `host::uav_pool::tests::host_list_uav_pool_lifecycle_retire_trim_and_info_queue` once in the full parallel run, and each passes when run alone (`--exact`); `main` itself fails `host::refresh_tests::chunked_nothing_new_with_matches_individual` in the same run. `cargo fmt --check` already reports hundreds of hunks per file on `main`; the new code follows the style of the code around it. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related, not duplicates: #3705 (refresh sift with a worker pool), #4571 (trims write-watch scans across scattered ranges), #4247, #4653, #4576, #3945, #3760, #3756, #2267. AI-assisted. Neon (Gemini) wrote the change; Claude Code reviewed it, rebased it on `main`, built it, ran the checks and measured it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
IRennie74 commented 2026-12-01 06:28:33 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by IRennie74 on 2026-12-01T06:28:33Z.


Some notes from reading the diff.

VICTORY_WATCH_FAST_JOURNAL also changes ask_once: its join gap becomes ahead_gap() instead of AHEAD_GAP. By default that's the same 8 MiB, but VICTORY_AHEAD_GAP_KB then sets the gap for ask_once too, not only for the flush path. The PR description doesn't mention this, and the switch's name doesn't suggest it. #4571 edits the same ask_once loop and deliberately keeps the two apart (VICTORY_ASK_ONCE_GAP_KB for ask_once, while VICTORY_AHEAD_GAP_KB "continues to govern its own path"). The two will conflict there, and it's unclear which behaviour is intended. Leaving that hunk out would keep this PR to the journal.

I checked the journal part and found no problem. Journal::note is the only writer of WRITTEN_EPOCHS and runs under the journal's write lock, so swap's plain load-then-store is safe. asked, writes and writes_since already read WRITTEN_EPOCHS when sync_epochs is set, and new_in was the one reader still walking written, which the PR covers. Pages past MAX_PAGES still go to the map, as before.

For scale on a smaller CPU: on a Ryzen 5 5600X with an RTX 3060 (Series S, DLSS Performance, standing), "copies and fills" is about 4 ms and "asking the write watch" 3-4 ms of the submitting thread's roughly 47 ms. That thread is the bottleneck there. The 5.0 -> 1.7 ms here is a sub-phase figure from one run with other switches present. A frame-time A/B with only these two switches would tell how much reaches the frame.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7302916210 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4757#issuecomment-7302916210). Originally posted by [IRennie74](https://github.com/IRennie74) on 2026-12-01T06:28:33Z. --- Some notes from reading the diff. `VICTORY_WATCH_FAST_JOURNAL` also changes `ask_once`: its join gap becomes `ahead_gap()` instead of `AHEAD_GAP`. By default that's the same 8 MiB, but `VICTORY_AHEAD_GAP_KB` then sets the gap for `ask_once` too, not only for the flush path. The PR description doesn't mention this, and the switch's name doesn't suggest it. #4571 edits the same `ask_once` loop and deliberately keeps the two apart (`VICTORY_ASK_ONCE_GAP_KB` for `ask_once`, while `VICTORY_AHEAD_GAP_KB` "continues to govern its own path"). The two will conflict there, and it's unclear which behaviour is intended. Leaving that hunk out would keep this PR to the journal. I checked the journal part and found no problem. `Journal::note` is the only writer of `WRITTEN_EPOCHS` and runs under the journal's write lock, so `swap`'s plain load-then-store is safe. `asked`, `writes` and `writes_since` already read `WRITTEN_EPOCHS` when `sync_epochs` is set, and `new_in` was the one reader still walking `written`, which the PR covers. Pages past `MAX_PAGES` still go to the map, as before. For scale on a smaller CPU: on a Ryzen 5 5600X with an RTX 3060 (Series S, DLSS Performance, standing), "copies and fills" is about 4 ms and "asking the write watch" 3-4 ms of the submitting thread's roughly 47 ms. That thread is the bottleneck there. The 5.0 -> 1.7 ms here is a sub-phase figure from one run with other switches present. A frame-time A/B with only these two switches would tell how much reaches the frame.
DoubleD17 commented 2026-12-01 10:51:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by DoubleD17 on 2026-12-01T10:51:02Z.


A measurement of this PR on an 8-core CPU, in case it helps.

Setup

  • Hardware: RTX 5070 12 GB (driver 621.40), Ryzen 7 5800X (8 cores, 16 threads), 64 GB RAM, Windows 11.
  • Build: one release build, main 5fabb46e with this PR and #4774 merged. The only conflict was the play.rs defaults block, where both sets were kept.
  • Arms: every run passes all four switches by --set, so the arms differ only by them:
    • control: all 0;
    • this PR: VICTORY_COPIES_FILLS_FAST=1 and VICTORY_WATCH_FAST_JOURNAL=1, #4774's two at 0.
  • Profile: Series X, 2560x1440 DLAA, frame generation off, ray tracing off.
  • Runs: idle camera from the same starting point, 150 s from the first world frame, four runs per arm, alternated with a third arm (#4774, reported there). Each run ends with 200 frames captured at 10 a second.

Submitting thread, per frame (the "preparing per frame, the submitting thread" line, mean of each run's 150 s):

control (4 runs) this PR (4 runs)
copies and fills 3.63 ms (3.33 to 3.78) 1.83 ms (1.75 to 1.90)
asking the write watch 5.08 ms 4.88 ms
refreshes 20.50 ms 20.00 ms
in its submissions 57.3 ms (53.8 to 60.5) 54.7 ms (52.5 to 58.0)
  • "Copies and fills" halves in every run: the slowest run with this PR is under the fastest control run.
  • Frame rate: base fps mean 16.29 (control) against 16.95 (this PR).
    • On the light view only (the seconds where the idle camera's heavier view is not on screen), preparation is -1.1 ms and fps +1.9 %.
    • That is inside our control spread (2.4 ms), so four runs resolve the sub-phase cut but not a frame-rate gain on this PC.

Picture: 800 frames per arm; we looked at every frame a frame-to-frame check flagged.

  • With this PR, one frame was flagged: distant foliage missing for one frame.
  • We see that one-frame vegetation gap on main as well, so it is not from this change.

Not tested:

  • VICTORY_AHEAD_GAP_KB / ask_once (the point raised above).
  • Movement (idle camera only), Series S, frame generation on, other cards.

AI Assisted

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7308817128 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4757#issuecomment-7308817128). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-12-01T10:51:02Z. --- A measurement of this PR on an 8-core CPU, in case it helps. **Setup** - **Hardware:** RTX 5070 12 GB (driver 621.40), Ryzen 7 5800X (8 cores, 16 threads), 64 GB RAM, Windows 11. - **Build:** one release build, main 5fabb46e with this PR and #4774 merged. The only conflict was the `play.rs` defaults block, where both sets were kept. - **Arms:** every run passes all four switches by `--set`, so the arms differ only by them: - control: all `0`; - this PR: `VICTORY_COPIES_FILLS_FAST=1` and `VICTORY_WATCH_FAST_JOURNAL=1`, #4774's two at `0`. - **Profile:** Series X, 2560x1440 DLAA, frame generation off, ray tracing off. - **Runs:** idle camera from the same starting point, 150 s from the first world frame, four runs per arm, alternated with a third arm (#4774, reported there). Each run ends with 200 frames captured at 10 a second. **Submitting thread, per frame** (the "preparing per frame, the submitting thread" line, mean of each run's 150 s): | | control (4 runs) | this PR (4 runs) | |---|---|---| | copies and fills | 3.63 ms (3.33 to 3.78) | **1.83 ms** (1.75 to 1.90) | | asking the write watch | 5.08 ms | 4.88 ms | | refreshes | 20.50 ms | 20.00 ms | | in its submissions | 57.3 ms (53.8 to 60.5) | 54.7 ms (52.5 to 58.0) | - "Copies and fills" halves in every run: the slowest run with this PR is under the fastest control run. - **Frame rate:** base fps mean 16.29 (control) against 16.95 (this PR). - On the light view only (the seconds where the idle camera's heavier view is not on screen), preparation is -1.1 ms and fps +1.9 %. - That is inside our control spread (2.4 ms), so four runs resolve the sub-phase cut but not a frame-rate gain on this PC. **Picture:** 800 frames per arm; we looked at every frame a frame-to-frame check flagged. - With this PR, one frame was flagged: distant foliage missing for one frame. - We see that one-frame vegetation gap on main as well, so it is not from this change. **Not tested:** - `VICTORY_AHEAD_GAP_KB` / `ask_once` (the point raised above). - Movement (idle camera only), Series S, frame generation on, other cards. AI Assisted
korbannour578-alt commented 2026-12-01 12:05:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by korbannour578-alt on 2026-12-01T12:05:47Z.


Test result on an RTX 4060 Laptop 8 GB (i7-13620H 6P+4E, 32 GB RAM, NVIDIA 610.78), Series S profile, build 5fabb46e + the warpGTAIV/VIctory-8GB small-card policy.

I applied #4757 and #3958 together (one build, so I can't split the effect between them), with COPIES_FILLS_FAST, WATCH_FAST_JOURNAL, SUBMIT_SPLIT=1 and OFF_LINE=1 set.

  • fps went down: 9-11 fps driving vs ~11.4 before
  • preparing time on the submit thread went up: 40-50 ms/frame vs ~33 ms before
  • a brown patch/wall appeared over the road while driving (not seen without these changes)

So on this laptop it was a regression and I reverted it. Happy to test one PR at a time if that helps narrow it down.

Full laptop report: #4867

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7310643641 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4757#issuecomment-7310643641). Originally posted by [korbannour578-alt](https://github.com/korbannour578-alt) on 2026-12-01T12:05:47Z. --- Test result on an RTX 4060 Laptop 8 GB (i7-13620H 6P+4E, 32 GB RAM, NVIDIA 610.78), Series S profile, build 5fabb46e + the warpGTAIV/VIctory-8GB small-card policy. I applied #4757 and #3958 together (one build, so I can't split the effect between them), with COPIES_FILLS_FAST, WATCH_FAST_JOURNAL, SUBMIT_SPLIT=1 and OFF_LINE=1 set. - fps went **down**: 9-11 fps driving vs ~11.4 before - preparing time on the submit thread went **up**: 40-50 ms/frame vs ~33 ms before - a brown patch/wall appeared over the road while driving (not seen without these changes) So on this laptop it was a regression and I reverted it. Happy to test one PR at a time if that helps narrow it down. Full laptop report: #4867
trustno1-coder commented 2026-12-01 18:33:07 +00:00 (Migrated from github.com)

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


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