Reduce submit-time refresh work and reuse in-flight write ranges #3958

Closed
vilaris wants to merge 5 commits from upstream-pr/3958 into main
vilaris commented 2026-11-30 13:01:46 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by vilaris on 2026-11-30T13:01:46Z.


Changes

  • Select buffer refreshes using write-watch coverage and each shadow's copy stamps. Skip clean references and trim guarded multi-page ranges to their first and last dirty pages.
  • Keep full refresh ranges when coverage is uncertain or shader writes are in flight. Recheck coverage at the flush boundary.
  • Reuse compacted buffer-write and texture-readback ranges when the relay retires flights.
  • Copy dirty parts of single-page shadow ranges directly and publish copy stamps after the copy completes.
  • Report page-selection discards in submit telemetry. Set VICTORY_SUBMIT_DIRTY_PAGES=0 to use the previous selection path.

Before and after

Windows gameplay logs for the previous local implementation and the retained single-page copy implementation. Both runs used 2x frame generation.

Metric Before, session 13072 After, session 17296
Median Preparing 71.1 ms 57.5 ms
Median buffer refresh 25.2 ms 20.4 ms
Median copied volume 65,053 KiB/frame 57,923 KiB/frame
Frames above 100 ms 75/342 (21.9%) 32/433 (7.4%)

Source logs:

  • Before: victory-nvidia-play-20261130-125651-13072.log
  • After: victory-nvidia-play-20261130-130158-17296.log

Preparing, refresh and copied volume use reporting windows with 9,000 to 11,000 candidates (94 before, 55 after). Slow-frame counts pool the final 30 frame-time windows of each capture. The retained implementation copied about 11% fewer bytes in these windows. These are separate gameplay captures from local builds, so scene load may explain part of the difference.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5565790435 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3958). Originally posted by [vilaris](https://github.com/vilaris) on 2026-11-30T13:01:46Z. --- ## Changes - Select buffer refreshes using write-watch coverage and each shadow's copy stamps. Skip clean references and trim guarded multi-page ranges to their first and last dirty pages. - Keep full refresh ranges when coverage is uncertain or shader writes are in flight. Recheck coverage at the flush boundary. - Reuse compacted buffer-write and texture-readback ranges when the relay retires flights. - Copy dirty parts of single-page shadow ranges directly and publish copy stamps after the copy completes. - Report page-selection discards in submit telemetry. Set `VICTORY_SUBMIT_DIRTY_PAGES=0` to use the previous selection path. ## Before and after Windows gameplay logs for the previous local implementation and the retained single-page copy implementation. Both runs used 2x frame generation. | Metric | Before, session 13072 | After, session 17296 | | --- | ---: | ---: | | Median Preparing | 71.1 ms | 57.5 ms | | Median buffer refresh | 25.2 ms | 20.4 ms | | Median copied volume | 65,053 KiB/frame | 57,923 KiB/frame | | Frames above 100 ms | 75/342 (21.9%) | 32/433 (7.4%) | Source logs: - Before: `victory-nvidia-play-20261130-125651-13072.log` - After: `victory-nvidia-play-20261130-130158-17296.log` Preparing, refresh and copied volume use reporting windows with 9,000 to 11,000 candidates (94 before, 55 after). Slow-frame counts pool the final 30 frame-time windows of each capture. The retained implementation copied about 11% fewer bytes in these windows. These are separate gameplay captures from local builds, so scene load may explain part of the difference.
Zeyphers commented 2026-11-30 20:20:08 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Zeyphers on 2026-11-30T20:20:08Z.


Merged onto main 84bd61e2 and benched on an RTX 2080 Super 8 GB and Ryzen 7 5800X (Series S, DLSS Quality, standing scene, 180 s): 9.8 fps median vs 9.2–9.7 baseline, so no measurable change on this CPU-bound rig. Two baseline runs differed by about 0.5 fps, so that's the noise. Only one run per PR, in a standing scene, not a walk.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7290750720 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3958#issuecomment-7290750720). Originally posted by [Zeyphers](https://github.com/Zeyphers) on 2026-11-30T20:20:08Z. --- Merged onto main `84bd61e2` and benched on an RTX 2080 Super 8 GB and Ryzen 7 5800X (Series S, DLSS Quality, standing scene, 180 s): 9.8 fps median vs 9.2–9.7 baseline, so no measurable change on this CPU-bound rig. Two baseline runs differed by about 0.5 fps, so that's the noise. Only one run per PR, in a standing scene, not a walk.
nicolasabosch commented 2026-11-30 21:52:17 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nicolasabosch on 2026-11-30T21:52:17Z.


Tested on an RTX 4070 Laptop 8 GB: no measurable fps difference in this scene (2 runs).

Tested on main e1251c31 with this PR (3c30b4c9) merged on top and nothing else changed. Release build, same profile as main.

Setup

  • PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11.
  • Command: victory play --series-s --dlss performance --framegen 2, with no fps cap and the window minimized.
  • Route: scripted Enter presses into the world from a save, then the character idles there for 300 s.
  • fps is the mean of the last 40 host: reports, about 200 s. These are real frames, not generated ones.
  • The submit-thread figures come from the "preparing per frame, the submitting thread" line, also over the last 40 reports.
  • The second run starts from a fixed copy of the save. In the first run the save had moved on, so the scene was a little different.
run fps ms/frame submit thread ms refreshes ms
main, 7 runs 15.96 – 18.76 53.4 – 62.7 35.0 – 41.4 13.3 – 15.4
main, fixed save only (4 runs) 16.21 – 18.18 (median 16.37) 55.1 – 61.8 35.0 – 40.5 13.3 – 15.2
this PR, run 1 17.07 58.8 39.7 15.4
this PR, run 2 (fixed save) 16.25 61.6 41.4 16.3

On this laptop, identical main runs differ by up to about 2–2.5 fps, so only an effect of roughly 2–3 fps or more would be visible in this scene. Refresh time on the submit thread was 15.4 and 16.3 ms with this PR, against 13.3–15.4 ms on main, so it did not come down in this scene. The first run also translated every shader again: the PR edits a file under crates/victory-shader/src, which changes the translator fingerprint.

Not tested: driving, camera turns, interiors, an image comparison, other GPUs.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7293022171 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3958#issuecomment-7293022171). Originally posted by [nicolasabosch](https://github.com/nicolasabosch) on 2026-11-30T21:52:17Z. --- **Tested on an RTX 4070 Laptop 8 GB: no measurable fps difference in this scene (2 runs).** Tested on main `e1251c31` with this PR (`3c30b4c9`) merged on top and nothing else changed. Release build, same profile as main. **Setup** - PC: RTX 4070 Laptop 8 GB, i9-14900HX, 32 GB RAM, Windows 11. - Command: `victory play --series-s --dlss performance --framegen 2`, with no fps cap and the window minimized. - Route: scripted Enter presses into the world from a save, then the character idles there for 300 s. - fps is the mean of the last 40 `host:` reports, about 200 s. These are real frames, not generated ones. - The submit-thread figures come from the "preparing per frame, the submitting thread" line, also over the last 40 reports. - The second run starts from a fixed copy of the save. In the first run the save had moved on, so the scene was a little different. | run | fps | ms/frame | submit thread ms | refreshes ms | |---|---|---|---|---| | main, 7 runs | 15.96 – 18.76 | 53.4 – 62.7 | 35.0 – 41.4 | 13.3 – 15.4 | | main, fixed save only (4 runs) | 16.21 – 18.18 (median 16.37) | 55.1 – 61.8 | 35.0 – 40.5 | 13.3 – 15.2 | | this PR, run 1 | 17.07 | 58.8 | 39.7 | 15.4 | | this PR, run 2 (fixed save) | 16.25 | 61.6 | 41.4 | 16.3 | On this laptop, identical main runs differ by up to about 2–2.5 fps, so only an effect of roughly 2–3 fps or more would be visible in this scene. Refresh time on the submit thread was 15.4 and 16.3 ms with this PR, against 13.3–15.4 ms on main, so it did not come down in this scene. The first run also translated every shader again: the PR edits a file under `crates/victory-shader/src`, which changes the translator fingerprint. **Not tested:** driving, camera turns, interiors, an image comparison, other GPUs.
korbannour578-alt commented 2026-12-01 12:05:49 +00:00 (Migrated from github.com)

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


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:7310644317 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3958#issuecomment-7310644317). Originally posted by [korbannour578-alt](https://github.com/korbannour578-alt) on 2026-12-01T12:05:49Z. --- 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
tillo88 commented 2026-12-01 12:06:57 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tillo88 on 2026-12-01T12:06:57Z.


Replay bench: #3958 (head 3c30b4c9, its defaults, so VICTORY_SUBMIT_DIRTY_PAGES on) merged on top of v2026.11.30.03, 2 measured runs, against 18 runs of the same release without it.

fps submitting thread ms refreshes ms p95 ms p99 ms
v2026.11.30.03, 18 runs (mean) 31.99 20.54 6.44 48.2 63.0
v2026.11.30.03, range 31.49-32.46 20.07-21.82 6.19-6.93 46.5-56.5 58.7-71.9
#3958, run 1 32.30 20.57 6.64 50.7 65.0
#3958, run 2 32.27 21.05 6.95 47.3 60.6
  • No measurable fps difference: +0.9% (32.29 vs 31.99), both runs inside the base range (run-to-run sd 0.21 fps on this release).
  • The page selection was active: the submitting thread's line reports it, for example 7575 of them known to copy nothing (7575 by page selection), a line the base runs don't have.
  • The refresh time did not come down on this route: 6.64 and 6.95 ms a frame against 6.44 ms mean for the base (6.19-6.93). The submitting thread was 20.6 and 21.1 ms against 20.5 ms.
  • No crash in 3 runs (warm-up included).

Setup: Ryzen 7 9800X3D, RTX 5070 Ti 16 GB (driver 621.40), 32 GB RAM, Windows 11, release build, Series X 1440p, DLSS Quality, frame generation off, ray tracing off. Same save restored before each run (start of the game), prison cutscene, plane cutscene, first boat section, about 6 minutes; warm-up run not counted.

Measured unattended on a replay bench (same save, recorded controller input via VICTORY_INPUT_REPLAY); numbers and text prepared with Claude.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7310670908 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3958#issuecomment-7310670908). Originally posted by [tillo88](https://github.com/tillo88) on 2026-12-01T12:06:57Z. --- Replay bench: #3958 (head 3c30b4c9, its defaults, so `VICTORY_SUBMIT_DIRTY_PAGES` on) merged on top of **v2026.11.30.03**, 2 measured runs, against 18 runs of the same release without it. | | fps | submitting thread ms | refreshes ms | p95 ms | p99 ms | |---|---:|---:|---:|---:|---:| | v2026.11.30.03, 18 runs (mean) | 31.99 | 20.54 | 6.44 | 48.2 | 63.0 | | v2026.11.30.03, range | 31.49-32.46 | 20.07-21.82 | 6.19-6.93 | 46.5-56.5 | 58.7-71.9 | | #3958, run 1 | 32.30 | 20.57 | 6.64 | 50.7 | 65.0 | | #3958, run 2 | 32.27 | 21.05 | 6.95 | 47.3 | 60.6 | - **No measurable fps difference:** +0.9% (32.29 vs 31.99), both runs inside the base range (run-to-run sd 0.21 fps on this release). - The page selection was active: the submitting thread's line reports it, for example `7575 of them known to copy nothing (7575 by page selection)`, a line the base runs don't have. - The refresh time did not come down on this route: 6.64 and 6.95 ms a frame against 6.44 ms mean for the base (6.19-6.93). The submitting thread was 20.6 and 21.1 ms against 20.5 ms. - No crash in 3 runs (warm-up included). Setup: Ryzen 7 9800X3D, RTX 5070 Ti 16 GB (driver 621.40), 32 GB RAM, Windows 11, release build, Series X 1440p, DLSS Quality, frame generation off, ray tracing off. Same save restored before each run (start of the game), prison cutscene, plane cutscene, first boat section, about 6 minutes; warm-up run not counted. Measured unattended on a replay bench (same save, recorded controller input via VICTORY_INPUT_REPLAY); numbers and text prepared with Claude.
trustno1-coder commented 2026-12-01 18:47:31 +00:00 (Migrated from github.com)

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