residency: VICTORY_PAGES_CPU_QUIET keeps pages our copies read off the card for a while (off by default) #126

Closed
github-bot wants to merge 3 commits from github-bot/gh-126 into main AGit
Owner

@⁠AndreRese on GitHub · 2026-12-01 23:04 UTC · original
AndreRese:pages-cpu-quiet → main · +42 −4 · 3 files · 3 commits · closed without merging

Off by default. With VICTORY_PAGES_CPU_QUIET=<ticks>, a page of title memory that our reads cover stays off the card for that many ticks of 200 ms (75 = 15 s). These are the reads that refresh the host's copies, such as texture refreshes and buffer copies. Pages on the card go down at the next wave, as read_through already does.

Why it's still needed after #93 and the pull changes

On this card (RX 7600 XT, Ryzen 7 5800X), the card's own copies of title memory ran at 14-25 MB/s and the processor's reads at 10-13 MB/s. Since 8e8d4b6/ff57de2, pull therefore turns the copies off after the first 64 MiB, and the processor reads the card's memory itself. read_through takes those pages down, but they go up again once their strike runs out, while the same refreshes still read them every frame.

A play session from a save with ray tracing on, on 32b136e without the switch, read 4,296 MiB of title memory from the card in 4.4 minutes. It ran at 17.5 fps, with preparing_ms 12.2.

What changed since it was closed

  • Merged current main.
  • The hook moved from copy_mapped to the top of host::read, which copy_mapped, read_sparse, read_pieces and read_into all go through. Reads that the card's copies serve now count too. Before, pull::read returned before read_through, so the pages it read stayed on the card and were read back again every frame. Without the switch, nothing changes.

Measured

All runs: RX 7600 XT, Series S, VICTORY_FSR_HOST=1, 1080p, ray tracing on. Figures come from the log's 5 s stats: frame lines.

Same build (this branch, diag), same day, unattended: scripts/local/bench.sh presses through the menus, then stays 240 s in the opening scenes.

fps median ms worst 5 s window preparing ms read from the card (processor + card copies)
without 21.6 44.7 78 ms 10.8 96 + 64 MiB
=75 22.6 44.1 47 ms 10.3 31 + 64 MiB

The opening scenes read little from the card either way, so the difference there is small.

Played from a save, where the read-back shows. These runs are on different builds:

fps median ms read from the card
32b136e, without 17.5 53.5 4,296 + 117 MiB in 4.4 min
f7f0360 + this switch (=75) 22.5 45.4 18 + 112 MiB in 1.8 min

Test plan

  • diag and release builds; rustfmt clean on the touched files
  • Unattended pair above on this branch; no GPU faults in the kernel log
  • Same-build session from a save, and other cards (Series X, faster BARs where pull stays off)

🤖 Generated with Claude Code

**@⁠AndreRese** on GitHub · 2026-12-01 23:04 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/126) `AndreRese:pages-cpu-quiet` → `main` · +42 −4 · 3 files · 3 commits · closed without merging Off by default. With `VICTORY_PAGES_CPU_QUIET=<ticks>`, a page of title memory that our reads cover stays off the card for that many ticks of 200 ms (75 = 15 s). These are the reads that refresh the host's copies, such as texture refreshes and buffer copies. Pages on the card go down at the next wave, as `read_through` already does. ### Why it's still needed after #93 and the pull changes On this card (RX 7600 XT, Ryzen 7 5800X), the card's own copies of title memory ran at 14-25 MB/s and the processor's reads at 10-13 MB/s. Since 8e8d4b6/ff57de2, `pull` therefore turns the copies off after the first 64 MiB, and the processor reads the card's memory itself. `read_through` takes those pages down, but they go up again once their strike runs out, while the same refreshes still read them every frame. A play session from a save with ray tracing on, on 32b136e without the switch, read **4,296 MiB of title memory from the card in 4.4 minutes**. It ran at 17.5 fps, with `preparing_ms` 12.2. ### What changed since it was closed - Merged current main. - The hook moved from `copy_mapped` to the top of `host::read`, which `copy_mapped`, `read_sparse`, `read_pieces` and `read_into` all go through. Reads that the card's copies serve now count too. Before, `pull::read` returned before `read_through`, so the pages it read stayed on the card and were read back again every frame. Without the switch, nothing changes. ### Measured All runs: RX 7600 XT, Series S, `VICTORY_FSR_HOST=1`, 1080p, ray tracing on. Figures come from the log's 5 s `stats: frame` lines. **Same build (this branch, diag), same day, unattended:** `scripts/local/bench.sh` presses through the menus, then stays 240 s in the opening scenes. | | fps | median ms | worst 5 s window | preparing ms | read from the card (processor + card copies) | |---|---|---|---|---|---| | without | 21.6 | 44.7 | 78 ms | 10.8 | 96 + 64 MiB | | `=75` | 22.6 | 44.1 | 47 ms | 10.3 | 31 + 64 MiB | The opening scenes read little from the card either way, so the difference there is small. **Played from a save,** where the read-back shows. These runs are on different builds: | | fps | median ms | read from the card | |---|---|---|---| | 32b136e, without | 17.5 | 53.5 | 4,296 + 117 MiB in 4.4 min | | f7f0360 + this switch (`=75`) | 22.5 | 45.4 | 18 + 112 MiB in 1.8 min | ### Test plan - [x] diag and release builds; rustfmt clean on the touched files - [x] Unattended pair above on this branch; no GPU faults in the kernel log - [ ] Same-build session from a save, and other cards (Series X, faster BARs where `pull` stays off) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
read_through (f68c5c9) takes pages on the card that our reads cover down at
the next wave, and a strike keeps them down a short while; they go up again
after it while the copies that refresh the host's copies still read them
every frame. With VICTORY_PAGES_CPU_QUIET=<ticks>, a page off the card that
such a read covers also stays off that many ticks (of 200 ms), and the
kernel reads of copy_mapped count too.

RX 7600 XT, Ryzen 7 5800X, Series S, VICTORY_FSR_HOST=1, 1080p, ray tracing
on, the same save, from the log's 5 s stats lines:
  without: 17.8 fps, median 54.6 ms, preparing 19.1 ms, copy 10.9 ms,
           550 MiB read from the card (4.8 min in the world)
  =75:     22.5 fps, median 45.4 ms, preparing 8.8 ms, copy 2.1 ms,
           18 MiB read from the card (1.8 min in the world)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 23:06:51 +00:00
Author
Owner

@⁠AndreRese on GitHub · 2026-12-01 23:58 UTC · original

RT ON is causing copy_back to return, need more testing, but this quick fix partially resolves it

**@⁠AndreRese** on GitHub · 2026-12-01 23:58 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/126#issuecomment-7329996591) RT ON is causing copy_back to return, need more testing, but this quick fix partially resolves it
github-bot closed this pull request 2026-12-02 11:53:27 +00:00
Author
Owner

@⁠AndreRese on GitHub · 2026-12-02 11:48 UTC · original

Problem already solved on PR #93

**@⁠AndreRese** on GitHub · 2026-12-02 11:48 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/126#issuecomment-7344442844) Problem already solved on PR #93
github-bot reopened this pull request 2026-12-02 22:22:05 +00:00
# Conflicts:
#	README.md
The switch's hook sat in copy_mapped, before the read. Since 8e8d4b6 and
e790442, host::read serves reads of title memory on the card by the card's
own copies where those are faster, and returns before read_through: the
pages they read stay on the card and are read back again every frame. The
hook is now at the top of host::read, which copy_mapped, read_sparse,
read_pieces and read_into all go through; without the switch nothing
changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠AndreRese on GitHub · 2026-12-02 22:21 UTC · original

Reopening: on current main this card still reads title memory from the card every frame (4.3 GB in a 4.4 min session from a save, RT on), because pull turns its copies off here and the pages go back up. Merged main and moved the hook into host::read so reads served by the card's copies count too; numbers in the description.

**@⁠AndreRese** on GitHub · 2026-12-02 22:21 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/126#issuecomment-7360579287) Reopening: on current main this card still reads title memory from the card every frame (4.3 GB in a 4.4 min session from a save, RT on), because `pull` turns its copies off here and the pages go back up. Merged main and moved the hook into `host::read` so reads served by the card's copies count too; numbers in the description.
github-bot closed this pull request 2026-12-02 22:38:50 +00:00
Author
Owner

@⁠goldfishdev on GitHub · 2026-12-02 22:36 UTC · original

superseded by #255

**@⁠goldfishdev** on GitHub · 2026-12-02 22:36 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/126#issuecomment-7360917896) superseded by #255

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.