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
github-bot wants to merge 2 commits from github-bot/gh-3726 into main AGit
Owner

@⁠remijn on GitHub · 2026-11-30 05:02 UTC · original
remijn:send-own-copied → main · +415 −11 · 3 files · 2 commits · closed without merging

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

**@⁠remijn** on GitHub · 2026-11-30 05:02 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726) `remijn:send-own-copied` → `main` · +415 −11 · 3 files · 2 commits · closed without merging ## 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)
Both off by default, diagnostics builds only.

VICTORY_REFRESH_KINDS=1: every 5 s, per frame, the refreshes of host copies
by what the title asked their memory to be (write-combined, read-only to the
GPU, other): how many, how many copied, bytes and time; and the copying's
parts (reading title memory, comparing and updating a card-held copy, noting
what to send up, plain copies). On an RTX 3080 (Series S) ~76 MB were read a
frame, 59 MB of it ordinary cached memory; the copying itself was ~12 ms of
the refreshes' ~90 ms (all threads), the rest asking what was written.

VICTORY_SEND_RUNS=1: the runs of changed bytes refreshes send up (how many,
short or long, what joining runs across gaps would give), the recording of
the sends, and the parts of the submission's step for copies in the card's
memory (finding the dirty ranges, taking their bytes into the submission's
own memory, card_record). There: ~600 copy commands a frame recorded in
0.6 ms; taking 2.8-3.8 ms; card_record 5.3 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each submission's sends to copies in the card's memory are taken into memory
of its own (VICTORY_SEND_OWN), so that a later submission's preparation
cannot change them before the card copies them. That matters for the title's
buffer copies, which we do when a submission is prepared ("a value to a
buffer, a draw that reads it", twice in a row). What the title's CPU writes it
does not write while the card still reads it, as on the console.

With VICTORY_SEND_OWN_COPIED=1 the 64 KiB blocks the title's buffer copies
write are noted (kept 8 frames). Copies with a dirty range in one go up out of
own memory as before; the others send their short runs as pairs (as before)
and their long runs straight out of their CPU side's staging buffer, as with
VICTORY_SEND_OWN=0. Runs are not joined across gaps: a gap may hold what a
shader wrote on the card and has not landed.

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

RTX 3080, Series S, the same save, 30 s runs: taking the sends 2.9 -> 1.7 ms
a frame; with every send straight up (VICTORY_SEND_OWN=0, which also skips
the title's copies) preparing fell 4 ms and p99 93 -> 72 ms.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 05:07:51 +00:00
Author
Owner

@⁠ColorC on GitHub · 2026-11-30 08:58 UTC · original

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.
**@⁠ColorC** on GitHub · 2026-11-30 08:58 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726#issuecomment-7273584017) > **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.
Author
Owner

@⁠shurhundo on GitHub · 2026-12-01 02:48 UTC · original

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.

**@⁠shurhundo** on GitHub · 2026-12-01 02:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726#issuecomment-7299019088) `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.
github-bot closed this pull request 2026-12-01 18:51:27 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:49 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:49 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3726#issuecomment-7321616178) 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!3726
No description provided.