Page residency: streamed pages wait before the seen moves, read ones stay off #562
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!562
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-562"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@TreXito on GitHub · 2026-12-05 07:21 UTC · original
TreXito:pr/stream-fresh→main· +79 −0 · 3 files · 1 commits · openWith
VICTORY_PAGES_SEEN=1, streamed pages wait a few seconds before the seen moves may take them to the card, and pages our own reads went through stay off those moves. Nothing changes withoutVICTORY_PAGES_SEEN=1.read_throughcovers is marked ours, and the seen moves skip it: texture refreshes and buffer copies read the same pages again later.stream_completedstamps the pages it covers. The seen moves skip a page stamped in the lastVICTORY_PAGES_STREAM_FRESHms (5000 unset, 0 turns it off), and a stamped page that is on the card goes down at the next wave.docs/SETTINGS.mdhas the new switch.Why
The seen bit stays on a page after the title's pools reuse it, so the seen moves take pages to the card that are about to receive streamed textures. The CPU then reads each texture once, right after it lands (its first refresh), through the bus at ~100 MB/s. On main with
VICTORY_PAGES_SEEN=1that came to 1.1-1.3 GB in six minutes. A per-caller counter (local, not in this PR) put almost all of it in the texture refresh read and the blank-check reads.Marking every streamed page ours removed those reads, and the gain went with them: the pages that pay off on the card are streamed buffers the GPU reads. Holding streamed pages for a few seconds separates the two. A texture is read in that time, becomes ours and stays down. A buffer only the GPU reads goes up afterwards.
Measured
Release builds of main (
b581f7e) and this branch, each with a local frame-time logger that is not part of this PR. Same frozen save, standing at the spawn, 360 s per run, three runs per arm, interleaved. i5-13600KF, RX 7800 XT 16 GB on PCIe 4.0 x16, 32 GB, Nobara kernel 7.3.4 with the IOMMU in translated mode,setup.sh's Mesa. fps = 1000 / frame time; 1% low = 1000 / p99.VICTORY_PAGES_SEEN=1 VICTORY_TITLE_VRAM_MB=6100This halves the CPU's reads of the card's memory and steadies the seen moves' gain: +1.5 fps on average and about +3 fps median over main. Frames over 90 ms stay above main's, as with the seen moves alone.
On an older local base (
dc9b7b5plus local work), the seen moves alone read 1.8-2.4 GB per run and had 58-68 frames over 90 ms. With this rule it was 27.9-28.0 fps average and 13.1-14.6 fps 1% low, against 25.8-26.4 and 13.0-14.7 without seen moves. A 15 s window measured the same as 5 s there (28.0-28.7 fps average, three runs).Not checked
CARD_READ_MB_S≥ 1000). There the first reads cost little, and the 5 s hold only delays the buffers' moves.Checked
rustfmt --checkshows no new diffs in the two changed files.🤖 Generated with Claude Code
https://claude.ai/code/session_01WNCfbX5dPKJzSkgbf16GX4
@TreXito on GitHub · 2026-12-05 13:42 UTC · original
Walking runs on the same base (camera turning, new areas streaming in), last 110 s in the world, x16 PCIe:
RADV_PERFTEST=sam, 2 runsStanding, same day: baseline 26.2 / 27.6 / 14.3, with this PR + SAM 28.9-29.0 / 30.3-31.3 / 12.5-13.2. The lows dip in the first minute or two after loading while the moves settle; longer runs earlier settled at lows equal to or above the baseline. A walking run with a diagnostics build and captures showed no visual artifacts.
SAM is a separate setting (run.sh appends
nosam,RADV_PERFTEST=samoverrides it); on its own it measured about +0.5 fps, with this PR about +1-1.5 fps on top.AI-assisted: yes
@TreXito on GitHub · 2026-12-05 16:15 UTC · original
Follow-up with longer runs (7 min, last 200 s in the world): baseline 24.7 / 25.6 avg fps, this PR alone 27.9 avg / 29.0 median / 14.9 1% low with the fewest long frames, this PR +
RADV_PERFTEST=sam28.2 / 29.2 / 14.5. So SAM adds about nothing here; the gain is this PR's. One run per arm in this block, consistent with the earlier ones.AI-assisted: yes
@TreXito on GitHub · 2026-12-05 23:07 UTC · original
Walking runs added (7 min each, last 200 s in the world, release build, same save copy, this PR's switches without SAM):
Standing baseline again the same evening: 26.3 / 27.8 / 14.3. The gain holds while moving and the 1% lows don't drop. Caveat: only one baseline walking run tonight, and walking fps varies a lot between runs (an earlier baseline walk read 30.2 avg), so read the walking delta as the direction more than the size.
AI-assisted: yes
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.