GPU: VICTORY_BACK_QUIET=1: copy-backs of write-watched memory no longer read as title writes (#1169) #1188

Open
github-bot wants to merge 1 commit from github-bot/gh-1188 into main AGit
Owner

@⁠Yorivel on GitHub · 2026-11-25 23:14 UTC · original
Yorivel:feat/back-quiet → main · +84 −4 · 1 files · 1 commits · open

AI-assisted (Claude Code). Numbers and log lines only, no game data.

What

VICTORY_BACK_QUIET=1, off by default. A copy-back into private, write-watched title memory works as follows:

  1. It is written as before.
  2. The written pages' kernel write-watch bits are reset. That happens only if none of those bits was set before the write: if the title had written one of the pages since the last asking, the copy-back is written the old way.
  3. The journal is told the pages changed, through watch::wrote_own, as put_back_own (VICTORY_BACK_OWN_VIEW) does for view memory. Every other copy holding those pages takes them again at its next refresh.
  4. The copy that made the bytes notes itself current, as put_back_own does.

Today the copy-back's own write shows as a title write at the next asking. The copy that wrote the bytes then copies them in again and sends them back up, although it holds them already. shadow.rs says so itself: "Our write shows as a title write at the copy's next refresh, which copies those pages once more (some dozens of MB a frame)." The read census in #1169 measured this at about 92% of the layer's touches of copied-back pages. VICTORY_BACK_OWN_VIEW already removes it for view memory. This switch is the private-memory side of the same thing.

It is hooked where the copy-back writes: copy_back_with (per run), relay_merge and card_merge_relay (before put_back_own), and card_merge.

The shortcut it takes

A title write to one of the pages between the copy-back's write and the reset would be lost to the write-watch. The window is a few kernel calls long. The check before the write excludes pages the title had already written since the last asking. The census saw the title touch copied-back pages at 0.00-0.05 MB/s.

Measured

RTX 4090 (32-lane waves), driver 621.40, i9-14900K, 64 GB, Windows 11, Series X profile, diagnostics build. The tree is not plain main: it is 085ee7c + #994 (with #854/#993) + #346 (with named windows declared only when marked) + #500 + #501. Structure builder on, RELAY=2 and the README's speed set. Barracks after the hand-off, settled, six readings each:

ms a frame fps copies up per frame preparing
without either switch 192-203 5.0-5.2 ~200 MB, 50-56 ms 99-110 ms
VICTORY_BACK_QUIET=1 188-192 5.2-5.3 160-168 MB, 46-48 ms 88-97 ms
VICTORY_BACK_QUIET=1 + VICTORY_BACK_OWN_VIEW=1 164-168 6.0-6.1 104-108 MB, 30-32 ms 73-80 ms
(the same tree with the builder off, for scale) 161 5.9

The quiet path took about 45% of the copy-back stretches (377k stretches, 17 GB in that run). The rest were view memory, which put_back_own took (353k pages noted current). 0 exceptions in every run. A pulsing light leak under bunks and on a face with the builder on shows with and without both switches, so it is not from them.

cargo test -p victory-gpu --lib shadow::: 30 passed. Not measured on plain main or without the builder yet. Reports welcome.

🤖 Generated with Claude Code

**@⁠Yorivel** on GitHub · 2026-11-25 23:14 UTC · [original](https://github.com/fxceless/victory-fork/pull/1188) `Yorivel:feat/back-quiet` → `main` · +84 −4 · 1 files · 1 commits · open *AI-assisted (Claude Code). Numbers and log lines only, no game data.* ## What `VICTORY_BACK_QUIET=1`, off by default. A copy-back into **private, write-watched** title memory works as follows: 1. It is written as before. 2. The written pages' kernel write-watch bits are reset. That happens only if none of those bits was set before the write: if the title had written one of the pages since the last asking, the copy-back is written the old way. 3. The journal is told the pages changed, through `watch::wrote_own`, as `put_back_own` (`VICTORY_BACK_OWN_VIEW`) does for view memory. Every other copy holding those pages takes them again at its next refresh. 4. The copy that made the bytes notes itself current, as `put_back_own` does. Today the copy-back's own write shows as a title write at the next asking. The copy that wrote the bytes then copies them in again and sends them back up, although it holds them already. `shadow.rs` says so itself: *"Our write shows as a title write at the copy's next refresh, which copies those pages once more (some dozens of MB a frame)."* The read census in #1169 measured this at about 92% of the layer's touches of copied-back pages. `VICTORY_BACK_OWN_VIEW` already removes it for view memory. This switch is the private-memory side of the same thing. It is hooked where the copy-back writes: `copy_back_with` (per run), `relay_merge` and `card_merge_relay` (before `put_back_own`), and `card_merge`. ## The shortcut it takes A title write to one of the pages *between* the copy-back's write and the reset would be lost to the write-watch. The window is a few kernel calls long. The check before the write excludes pages the title had already written since the last asking. The census saw the title touch copied-back pages at 0.00-0.05 MB/s. ## Measured RTX 4090 (32-lane waves), driver 621.40, i9-14900K, 64 GB, Windows 11, Series X profile, diagnostics build. The tree is **not** plain `main`: it is `085ee7c` + #994 (with #854/#993) + #346 (with named windows declared only when marked) + #500 + #501. Structure builder on, `RELAY=2` and the README's speed set. Barracks after the hand-off, settled, six readings each: | | ms a frame | fps | copies up per frame | preparing | |---|---|---|---|---| | without either switch | 192-203 | 5.0-5.2 | ~200 MB, 50-56 ms | 99-110 ms | | `VICTORY_BACK_QUIET=1` | 188-192 | 5.2-5.3 | 160-168 MB, 46-48 ms | 88-97 ms | | `VICTORY_BACK_QUIET=1` + `VICTORY_BACK_OWN_VIEW=1` | **164-168** | **6.0-6.1** | **104-108 MB, 30-32 ms** | **73-80 ms** | | (the same tree with the builder **off**, for scale) | 161 | 5.9 | | | The quiet path took about 45% of the copy-back stretches (377k stretches, 17 GB in that run). The rest were view memory, which `put_back_own` took (353k pages noted current). 0 exceptions in every run. A pulsing light leak under bunks and on a face with the builder on shows **with and without** both switches, so it is not from them. `cargo test -p victory-gpu --lib shadow::`: 30 passed. Not measured on plain `main` or without the builder yet. Reports welcome. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
After a copy-back writes private, write-watched title memory, the pages'
write-watch bits are reset (only if none was set before the write), the
journal is told through wrote_own as put_back_own does for view memory,
and the copy that made the bytes notes itself current. It no longer
takes its own output in again, which the read census (#1169) found to be
about 92% of the layer's touches of copied-back pages. Off by default.

RTX 4090, structure builder on, the barracks: with VICTORY_BACK_OWN_VIEW=1
as well, 192-203 -> 164-168 ms a frame, 0 exceptions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:09 +00:00
Author
Owner

@⁠Ym1r1710 on GitHub · 2026-11-25 23:55 UTC · original

Tried it on an RTX 5080 (Series X, fork main 6d20eed + #690's exact copy-back from the issue, prison cell, two runs each, medians).

One thing first: with #690's putback on (VICTORY_EXACT_BACK unset) none of the quiet hooks are reached, because putback::back returns before them. Same reason BACK_OWN_VIEW did nothing on that tree. So I ran it with VICTORY_EXACT_BACK=0:

  • EXACT_BACK=0 alone: 108.6 / 109.1 ms
  • EXACT_BACK=0 + BACK_QUIET=1 + BACK_OWN_VIEW=1: 103.4 / 105.9 ms
  • #690's putback, neither switch: 102.2 / 96.6 ms

So about 4 ms from the pair on the plain path here, no device loss, picture looked the same. The log said 147k stretches quiet (1.66 GB) and ~66k written the old way in both runs.

**@⁠Ym1r1710** on GitHub · 2026-11-25 23:55 UTC · [original](https://github.com/fxceless/victory-fork/pull/1188#issuecomment-7178209291) Tried it on an RTX 5080 (Series X, fork main 6d20eed + #690's exact copy-back from the issue, prison cell, two runs each, medians). One thing first: with #690's putback on (VICTORY_EXACT_BACK unset) none of the quiet hooks are reached, because putback::back returns before them. Same reason BACK_OWN_VIEW did nothing on that tree. So I ran it with VICTORY_EXACT_BACK=0: - EXACT_BACK=0 alone: 108.6 / 109.1 ms - EXACT_BACK=0 + BACK_QUIET=1 + BACK_OWN_VIEW=1: 103.4 / 105.9 ms - #690's putback, neither switch: 102.2 / 96.6 ms So about 4 ms from the pair on the plain path here, no device loss, picture looked the same. The log said 147k stretches quiet (1.66 GB) and ~66k written the old way in both runs.
Author
Owner

@⁠BitWuehler on GitHub · 2026-11-26 00:01 UTC · original

Tested on Linux (GE-Proton + vkd3d-proton, RTX 5080) with VICTORY_BACK_QUIET=1:

  • CPU preparing median dropped from 122.1 ms to 51.2 ms (copies 84.8 ms -> 31.6 ms, copying back 84.4 ms -> 57.5 ms).
  • Logged 360,448 stretches (15,537 MB) handled quietly without re-flagging title writes.

Note: Log analysis and write-up were AI-assisted based on local runtime measurements.

**@⁠BitWuehler** on GitHub · 2026-11-26 00:01 UTC · [original](https://github.com/fxceless/victory-fork/pull/1188#issuecomment-7178309260) Tested on Linux (GE-Proton + vkd3d-proton, RTX 5080) with `VICTORY_BACK_QUIET=1`: - CPU `preparing` median dropped from `122.1 ms` to **`51.2 ms`** (`copies` `84.8 ms -> 31.6 ms`, `copying back` `84.4 ms -> 57.5 ms`). - Logged `360,448 stretches (15,537 MB)` handled quietly without re-flagging title writes. *Note: Log analysis and write-up were AI-assisted based on local runtime measurements.*
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1188/head:github-bot/gh-1188'
git switch 'github-bot/gh-1188'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1188'
git switch 'github-bot/gh-1188'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1188'
git switch 'github-bot/gh-1188'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1188'
git switch 'main'
git merge --squash 'github-bot/gh-1188'
git switch 'main'
git merge --ff-only 'github-bot/gh-1188'
git switch 'main'
git merge 'github-bot/gh-1188'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.