Sends: snapshot only near the title's own buffer copies (VICTORY_SEND_OWN_COPIED, opt-in; RTX 3080 21.1 → 21.8 fps), with refresh and send diagnostics #3726

Closed
remijn wants to merge 2 commits from upstream-pr/3726 into main
remijn commented 2026-11-30 05:02:12 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by remijn on 2026-11-30T05:02:12Z.


Summary

Two changes to how the bytes a submission changed reach host copies in the card's memory, plus the diagnostics used to find where that time goes. No defaults change: the new behaviour is opt-in (VICTORY_SEND_OWN_COPIED=1) and the diagnostics are off unless set.

On an RTX 3080 (Series S, the same save, 60 s measured per run), turning it on took the median from 21.1 to 21.8 fps, preparing a frame from 35.1 to 32.9 ms, and p99 from 84 to 82 ms.

VICTORY_SEND_OWN_COPIED=1: a snapshot only where it's needed

Each submission's sends to copies in the card's memory are first copied into memory of the submission's own (VICTORY_SEND_OWN, on by default), so that a later submission's preparation can't change those bytes before the card copies them up. The module's own notes say what that protects: the title's buffer copies, which we perform when a submission is prepared. "A value to a buffer, a draw that reads it", repeated in the next submission with another value, would otherwise have the first draw read the second value. What the title's CPU writes, it doesn't write while the card still reads it, as on the console.

With the switch on:

  • The 64 KiB blocks the title's buffer copies write (defer_copy) are recorded, and kept for 8 frames.
  • Host copies with a dirty range in such a block go up out of the snapshot, as before.
  • The others send their short runs (≤256 B) as scatter pairs, as before, and their long runs straight from their CPU side's staging buffer, as VICTORY_SEND_OWN=0 does.
  • Runs are not merged across gaps on the direct path: a gap may hold bytes a shader wrote on the card that haven't landed yet, and copying the CPU side over them would destroy them.

Measured on the 3080, per frame: taking the sends into the snapshot fell from 2.8 to 1.9 ms. For comparison, VICTORY_SEND_OWN=0 (no snapshot at all, including for the title's copies, which isn't safe) took preparing down 4 ms in a 30 s A/B.

card_record also sizes its range lists once instead of growing them push by push.

Why opt-in: it relies on the assumption that the CPU doesn't rewrite memory the GPU is still reading. If some title does, those bytes could reach the card one submission late. It has run on one PC.

Diagnostics (off by default, diagnostics builds)

Switch Logs every 5 s, per frame
VICTORY_REFRESH_KINDS=1 Refreshes of host copies by the kind of title memory they read (write-combined, GPU-read-only, other): how many, how many copied, bytes and time; and the copying split into reading, comparing, noting what to send, and plain copies
VICTORY_SEND_RUNS=1 The runs of changed bytes sent up (short or long, and what merging across gaps would give); the time recording the sends; and the parts of the submission's step for copies in the card's memory (finding the dirty ranges, taking the bytes, card_record)

What they showed on the 3080:

  • The refreshes read about 76 MB of title memory a frame, 59 MB of it ordinary cached memory. The copying itself is only ~12 ms of their ~90 ms (summed over threads); the rest is finding out what was written.
  • Recording the sends is cheap (about 600 copy commands, 0.6 ms a frame). The snapshot and card_record are where that step's time goes.

Tested

  • cargo check with and without diagnostics.
  • victory-gpu tests for sends, host copies and the compare (124 pass).
  • clippy: no findings on changed lines.
  • The A/B above, 60 s per run, diagnostics build.

Measured

RTX 3080 10 GB, 32 GB RAM, Series S profile, DLSS Quality, FSR 3 frame generation (rendered frames counted), ray tracing off, play-foxhound.ps1's switches; the same save, 15 s warm-up then 60 s:

VICTORY_SEND_OWN_COPIED fps ms/frame preparing 1 % low p99
off 21.1 47.4 35.1 11.9 84 ms
on 21.8 45.8 32.9 12.2 82 ms

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5559314357 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726). Originally posted by [remijn](https://github.com/remijn) on 2026-11-30T05:02:12Z. --- ## Summary Two changes to how the bytes a submission changed reach host copies in the card's memory, plus the diagnostics used to find where that time goes. **No defaults change:** the new behaviour is opt-in (`VICTORY_SEND_OWN_COPIED=1`) and the diagnostics are off unless set. On an RTX 3080 (Series S, the same save, 60 s measured per run), turning it on took the median from **21.1 to 21.8 fps**, preparing a frame from 35.1 to 32.9 ms, and p99 from 84 to 82 ms. ## `VICTORY_SEND_OWN_COPIED=1`: a snapshot only where it's needed Each submission's sends to copies in the card's memory are first copied into memory of the submission's own (`VICTORY_SEND_OWN`, on by default), so that a later submission's preparation can't change those bytes before the card copies them up. The module's own notes say what that protects: **the title's buffer copies**, which we perform when a submission is prepared. "A value to a buffer, a draw that reads it", repeated in the next submission with another value, would otherwise have the first draw read the second value. What the title's **CPU** writes, it doesn't write while the card still reads it, as on the console. With the switch on: - The 64 KiB blocks the title's buffer copies write (`defer_copy`) are recorded, and kept for 8 frames. - Host copies with a dirty range in such a block go up out of the snapshot, as before. - The others send their short runs (≤256 B) as scatter pairs, as before, and their **long runs straight from their CPU side's staging buffer**, as `VICTORY_SEND_OWN=0` does. - Runs are **not** merged across gaps on the direct path: a gap may hold bytes a shader wrote on the card that haven't landed yet, and copying the CPU side over them would destroy them. Measured on the 3080, per frame: taking the sends into the snapshot fell from 2.8 to 1.9 ms. For comparison, `VICTORY_SEND_OWN=0` (no snapshot at all, including for the title's copies, which isn't safe) took preparing down 4 ms in a 30 s A/B. `card_record` also sizes its range lists once instead of growing them push by push. **Why opt-in:** it relies on the assumption that the CPU doesn't rewrite memory the GPU is still reading. If some title does, those bytes could reach the card one submission late. It has run on one PC. ## Diagnostics (off by default, diagnostics builds) | Switch | Logs every 5 s, per frame | |---|---| | `VICTORY_REFRESH_KINDS=1` | Refreshes of host copies by the kind of title memory they read (write-combined, GPU-read-only, other): how many, how many copied, bytes and time; and the copying split into reading, comparing, noting what to send, and plain copies | | `VICTORY_SEND_RUNS=1` | The runs of changed bytes sent up (short or long, and what merging across gaps would give); the time recording the sends; and the parts of the submission's step for copies in the card's memory (finding the dirty ranges, taking the bytes, `card_record`) | What they showed on the 3080: - The refreshes read about 76 MB of title memory a frame, 59 MB of it ordinary cached memory. The copying itself is only ~12 ms of their ~90 ms (summed over threads); the rest is finding out what was written. - Recording the sends is cheap (about 600 copy commands, 0.6 ms a frame). The snapshot and `card_record` are where that step's time goes. ## Tested - `cargo check` with and without `diagnostics`. - `victory-gpu` tests for sends, host copies and the compare (124 pass). - clippy: no findings on changed lines. - The A/B above, 60 s per run, diagnostics build. ## Measured RTX 3080 10 GB, 32 GB RAM, Series S profile, DLSS Quality, FSR 3 frame generation (rendered frames counted), ray tracing off, `play-foxhound.ps1`'s switches; the same save, 15 s warm-up then 60 s: | `VICTORY_SEND_OWN_COPIED` | fps | ms/frame | preparing | 1 % low | p99 | |---|---|---|---|---|---| | off | 21.1 | 47.4 | 35.1 | 11.9 | 84 ms | | on | 21.8 | 45.8 | 32.9 | 12.2 | 82 ms | 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ColorC commented 2026-11-30 08:58:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ColorC on 2026-11-30T08:58:49Z.


AI Disclosure: This hardware benchmark, log analysis, and report were automated and posted by an AI assistant on behalf of the hardware owner (Ryzen 7 9800X3D, 32 GB DDR5, RTX 5070 Ti 16 GB, Windows 11 26200). No game screenshots or title assets are included.

Independent cross-validation on RTX 5070 Ti + Ryzen 7 9800X3D (Series X 1440p, DLSS Quality + 3x MFG), via same-binary toggle A/B (VICTORY_SEND_OWN_COPIED=1 vs 0) at ~10,250 draws/frame:

Variant (same binary, same save) Draws Avg Native FPS Avg / Med ms CPU Prep Submitting copies in card's memory Peak VRAM Errors
VICTORY_SEND_OWN_COPIED=0 10,238 27.56 36.3 / 36.3 ms 26.0 ms 4.9 ms 11,990 MB 0
VICTORY_SEND_OWN_COPIED=1 10,266 28.34 (+0.78) 35.3 / 35.6 ms 24.3 ms (-1.7) 2.3 ms (-2.6 ms!) 11,292 MB (-698 MB!) 0

Takeaway

  • Even stacked on top of VICTORY_SUBMIT_SPLIT=1 + VICTORY_LAZY_COMPARE_MB=64 + VICTORY_REFLEX_ASIDE=1, VICTORY_SEND_OWN_COPIED=1 still delivered a clean -2.6 ms drop in submitting-thread card-copy work, +0.78 FPS (-1.0 ms frame time), and -698 MB lower peak VRAM with zero visual issues or errors across 8+ minutes of walking tests.

Test Setup

  • Hardware: AMD Ryzen 7 9800X3D (Zen 5, 8C/16T), 32 GB DDR5, NVIDIA RTX 5070 Ti 16 GB (ReBAR ON), Windows 11 26200
  • Profile: Series X, 2560x1440, DLSS Quality, 3x MFG (--res 1440 --dlss quality --framegen 3 --fps 1000)
  • Build: Release ThinLTO (-C target-cpu=znver5) rebased on main (41adb551) with a curated local PR stack; all A/B numbers below are same-binary toggle ablations from the exact same restored save (~10.0k–10.4k draws/frame standing scene) after official 1-time warmup.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7273584017 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726#issuecomment-7273584017). Originally posted by [ColorC](https://github.com/ColorC) on 2026-11-30T08:58:49Z. --- > **AI Disclosure:** This hardware benchmark, log analysis, and report were automated and posted by an AI assistant on behalf of the hardware owner (Ryzen 7 9800X3D, 32 GB DDR5, RTX 5070 Ti 16 GB, Windows 11 26200). No game screenshots or title assets are included. Independent cross-validation on **RTX 5070 Ti + Ryzen 7 9800X3D** (Series X 1440p, DLSS Quality + 3x MFG), via **same-binary toggle A/B** (`VICTORY_SEND_OWN_COPIED=1` vs `0`) at ~10,250 draws/frame: | Variant (same binary, same save) | Draws | Avg Native FPS | Avg / Med ms | CPU Prep | Submitting `copies in card's memory` | Peak VRAM | Errors | |---|---:|---:|---:|---:|---:|---:|---:| | `VICTORY_SEND_OWN_COPIED=0` | 10,238 | 27.56 | 36.3 / 36.3 ms | 26.0 ms | 4.9 ms | 11,990 MB | 0 | | **`VICTORY_SEND_OWN_COPIED=1`** | **10,266** | **28.34 (+0.78)** | **35.3 / 35.6 ms** | **24.3 ms (-1.7)** | **2.3 ms (-2.6 ms!)** | **11,292 MB (-698 MB!)** | **0** | ### Takeaway - Even stacked on top of `VICTORY_SUBMIT_SPLIT=1` + `VICTORY_LAZY_COMPARE_MB=64` + `VICTORY_REFLEX_ASIDE=1`, `VICTORY_SEND_OWN_COPIED=1` still delivered a clean **`-2.6 ms`** drop in submitting-thread card-copy work, **`+0.78 FPS` (`-1.0 ms` frame time)**, and **`-698 MB` lower peak VRAM** with zero visual issues or errors across 8+ minutes of walking tests. ### Test Setup - **Hardware:** AMD Ryzen 7 9800X3D (Zen 5, 8C/16T), 32 GB DDR5, NVIDIA RTX 5070 Ti 16 GB (ReBAR ON), Windows 11 26200 - **Profile:** Series X, 2560x1440, DLSS Quality, 3x MFG (`--res 1440 --dlss quality --framegen 3 --fps 1000`) - **Build:** Release ThinLTO (`-C target-cpu=znver5`) rebased on `main` (`41adb551`) with a curated local PR stack; all A/B numbers below are **same-binary toggle ablations** from the exact same restored save (~10.0k–10.4k draws/frame standing scene) after official 1-time warmup.
shurhundo commented 2026-12-01 02:48:41 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by shurhundo on 2026-12-01T02:48:41Z.


copied_lately() is only ever populated by note_copied(), which defer_copy() calls for the title's explicit CopyBufferRegion path (host.rs:10840/10847). The ordinary write-watch refresh path (update_free_inner → copy_stale, shadow.rs:6425-6442) also writes fresh title bytes into self.data for the same submissions, but never calls note_copied. So a range dirtied by a plain CPU store rather than an explicit buffer copy won't be flagged "copied lately" and takes the new unprotected direct-CPU-read path under VICTORY_SEND_OWN_COPIED=1, even though it's exposed to the same CPU-write-while-GPU-reads race own() exists to guard against. Is that an intentional scope limit (buffer-copy writes specifically are the hazard, not all title writes), or a gap? The COPIED_FRAMES comment about submissions still in the air when this fires reads like the latter is possible.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299019088 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726#issuecomment-7299019088). Originally posted by [shurhundo](https://github.com/shurhundo) on 2026-12-01T02:48:41Z. --- `copied_lately()` is only ever populated by `note_copied()`, which `defer_copy()` calls for the title's explicit CopyBufferRegion path (`host.rs:10840`/`10847`). The ordinary write-watch refresh path (`update_free_inner` → `copy_stale`, `shadow.rs:6425-6442`) also writes fresh title bytes into `self.data` for the same submissions, but never calls `note_copied`. So a range dirtied by a plain CPU store rather than an explicit buffer copy won't be flagged "copied lately" and takes the new unprotected direct-CPU-read path under `VICTORY_SEND_OWN_COPIED=1`, even though it's exposed to the same CPU-write-while-GPU-reads race `own()` exists to guard against. Is that an intentional scope limit (buffer-copy writes specifically are the hazard, not all title writes), or a gap? The `COPIED_FRAMES` comment about submissions still in the air when this fires reads like the latter is possible.
trustno1-coder commented 2026-12-01 18:49:26 +00:00 (Migrated from github.com)

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


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