GPU: VICTORY_LEAN_WINDOWS=1 — windows on the card with no CPU side, mapped in 64 KiB tiles (−0.8 GB commit, −2.1 GB memory in use) #265
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/fxceless--victory-fork!265
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-265"
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?
@CDR-0000 on GitHub · 2026-11-24 23:03 UTC · original
CDR-0000:perf/lean-windows→main· +639 −27 · 2 files · 1 commits · openOpt-in. Windows of title memory go to the card with no CPU side, their buffers reserved and mapped in 64 KiB tiles as bytes are sent, through one 64 MiB upload ring. On an RTX 3080 Ti / 32 GB PC: private memory 0.8 GB lower once the world has settled (1.9 GB at the load), memory in use 2.1 GB lower, nothing seen to render differently.
Follow-up to #54, where the window and in-place switches moved private memory by at most ~0.3 GB.
Why
A window (4 MiB of title memory outside buffers,
shadow.rsloose) was a whole CPU side in the PC's memory, plus a card side withVICTORY_CARD_WINDOWS_MB. In the world that was 2.1–3.0 GB, of which only 1.7–1.9 GB is ever sent. On a 32 GB PC with the page file Windows gave it, the commit ran out at ~23 GB private.What it does (
VICTORY_LEAN_WINDOWS=1, off by default)Shadow::copy→card_changed).Host::card_beforesends them from title memory to the card through one upload buffer used as a ring (Ring,VICTORY_LEAN_UPLOAD_MB, 64): each plan writes after the one before; a fence of our own is signalled behind each plan's copies, and a stretch is written over only once the card is done with it. A plan that would write over its own unsent bytes runs what it has and waits first (the world load). So lean windows hold 64 MiB of the PC's memory however many submissions fly withVICTORY_RELAY/VICTORY_LATE_WAIT. (A first version with one upload buffer per plan held 2.3 GB more write-combined memory with the relay; the ring replaced it.)Host::reserved_buffer). The 64 KiB tiles that bytes are sent to get tiles of a pool of 64 MiB heaps (Host::take_tiles,Shadow::tiles_to_map), mapped on the queue ahead of the copy (Host::map_tiles); a window let go gives its tiles back. A tile never sent reads as zeros, as a fresh buffer did. Below tier 2: a whole buffer. This is what lowers the commit — Windows charges the process for video memory too, so moving windows to the card with whole buffers (first version) saved memory in use but not commit.window_card_for's existing rule (a fifth of the budget stays free, so textures keep theirs);VICTORY_CARD_WINDOWS_MBstill sets it. A window that finds no room stays as it was.VICTORY_BVH_BUILDER=1, whose builder declares writes for every copy it reaches, turns lean windows off with a warning.Measured
RTX 3080 Ti 12 GB (driver 32.0.16.1742), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 26300.
main2119b0e+ this, diag build,VICTORY_RELAY=2, same route (load into the prologue, no input), each run stopped by an outside guard at 20 GB private. Pairs run back to back.VICTORY_LEAN_WINDOWS=1Not fixed by this: the process still reaches ~19–20 GB private in the world (title heaps, texture copies, write-combined buffer copies); this takes ~0.8 GB of commit and ~2 GB of memory in use off it.
Checks
cargo clippy --release -p victory-gpu --all-targets -- -D warnings: clean.cargo test --release -p victory-gpu: 116 passed, 0 failed, 1 ignored, on the card — including newring_tests(placement, wrap-around, long asks in pieces, overlap) andtiles_tests(tiles a range touches).Written with Claude Code (Claude Opus 5.5); the runs are mine.
@SkillIssueXO on GitHub · 2026-11-24 23:06 UTC · original
Baseline data for the memory window change from a longer
2119b0eSeries X run at 1080p withVICTORY_RELAY=2andVICTORY_TEXTURE_BUDGET_MB=3072on an RTX 5070 Ti / 32 GiB system.This gives a later-scene baseline for the opt-in path, in particular for checking peak commit, upload-ring waits and declared writes left out. AI-assisted log analysis.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-25 00:56 UTC · original
To use Codex here, create a Codex account and connect to github.
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.Merge
Merge the changes and update on Forgejo.