Window arena: pool tiles taken at first fill (VICTORY_ARENA_LAZY=1, off by default) #5015

Open
github-bot wants to merge 9 commits from github-bot/gh-5014 into main AGit
Owner

@⁠xteral67 on GitHub · 2026-12-01 17:17 UTC · original
xteral67:arena-lazy → main · +1552 −17 · 6 files · 9 commits · draft

Depends on #4751 and #4923 (this branch is built on #4923).

What it changes

With the window arena on, every tile of a window takes a 64 KiB tile of the PC pool when the window is made. Many tiles are never written by the title, so that memory is held for nothing.

With VICTORY_ARENA_LAZY=1 a window tile takes a pool tile only when title bytes are first written into it. Until then:

  • the card side of the tile is mapped to nothing, so the card reads zeros (tiled resources tier 2 and up; on tier 1 tiles are taken as before);
  • the CPU side is one shared read-only tile of zeros, so CPU and card read the same.

A window that shaders are declared to write takes all its tiles at once, because card writes into a tile mapped to nothing would be lost. The diagnostics build also counts window tiles that were never filled.

Off by default. With the switch off nothing changes.

How it was tested

  • RTX 3080 Ti 12 GB, 32 GB RAM, Series X profile, 1440p output, DLSS quality, FSR 3 frame generation 2x.
  • One 26-minute drive into the biggest city, diagnostics build, with the window arena and #4923 on.
  • Before (counter, switch off): 640-690 MB of the 4.5 GB pool were never filled from title memory.
  • After: about 547 MB less pool memory. No crash, no picture problem seen by the player.
  • One run only. Not run: cargo test, other cards, Series S profile, a card with tiled resources tier 1.
  • Draft until CI has built this branch; the same change was built and played in a local tree.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #4751, #4923, #4861

🤖 Generated with Claude Code

**@⁠xteral67** on GitHub · 2026-12-01 17:17 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/5014) `xteral67:arena-lazy` → `main` · +1552 −17 · 6 files · 9 commits · draft Depends on #4751 and #4923 (this branch is built on #4923). ## What it changes With the window arena on, every tile of a window takes a 64 KiB tile of the PC pool when the window is made. Many tiles are never written by the title, so that memory is held for nothing. With `VICTORY_ARENA_LAZY=1` a window tile takes a pool tile only when title bytes are first written into it. Until then: - the card side of the tile is mapped to nothing, so the card reads zeros (tiled resources tier 2 and up; on tier 1 tiles are taken as before); - the CPU side is one shared read-only tile of zeros, so CPU and card read the same. A window that shaders are declared to write takes all its tiles at once, because card writes into a tile mapped to nothing would be lost. The diagnostics build also counts window tiles that were never filled. Off by default. With the switch off nothing changes. ## How it was tested - RTX 3080 Ti 12 GB, 32 GB RAM, Series X profile, 1440p output, DLSS quality, FSR 3 frame generation 2x. - One 26-minute drive into the biggest city, diagnostics build, with the window arena and #4923 on. - Before (counter, switch off): 640-690 MB of the 4.5 GB pool were never filled from title memory. - After: about 547 MB less pool memory. No crash, no picture problem seen by the player. - One run only. Not run: `cargo test`, other cards, Series S profile, a card with tiled resources tier 1. - Draft until CI has built this branch; the same change was built and played in a local tree. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #4751, #4923, #4861 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A window outside buffers is a buffer of its own, and windows overlap: in
a scripted walk through town 837-888 windows held 5.1-5.5 GB for
3.75-3.9 GB of title memory. With VICTORY_WINDOW_ARENA=1 a window is a
reserved buffer whose tiles are tiles of a pool shared by every window
(heaps of VICTORY_WINDOW_ARENA_MB, default 8 MiB, write-combined in the
PC's memory, each mapped once for the CPU): a title tile is held once,
whichever window shows it. The CPU side of such a window is in tiles:
refreshes, sends and readbacks go through Shadow::cpu / cpu_runs. Windows
shaders write, and the recycle pool, stay as before. A heap goes back
when all its tiles are free. A memory line every 20th window census.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clippy without features: arena::line was never used (-D dead-code).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit c86e566cfe1f1d323cefe01abaab98bd4f8adfe0)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 79078956e7bea7c830dae0e3bbf3626eda148c90)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 592bd13348dc082efc439bbf466b572df069da9b)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 9010abf83587b26d98d03a01602429d850272a26)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A pool tile is taken only when a window part is first written. Until then
the CPU side of the part maps a shared read-only zero page. Adds a counter
of window tiles that were never filled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wogQQ6zZK1Wujq7MJhtAS
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 17:19:18 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/lib.rs
  • crates/victory-gpu/src/shadow.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-5014'
git switch 'github-bot/gh-5014'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-5014'
git switch 'github-bot/gh-5014'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-5014'
git switch 'main'
git merge --squash 'github-bot/gh-5014'
git switch 'main'
git merge --ff-only 'github-bot/gh-5014'
git switch 'main'
git merge 'github-bot/gh-5014'
git push origin 'main'
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!5015
No description provided.