Reuse a live window that holds an ask, so its memory is copied once #55
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/DexNom--VIctory!55
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-55"
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?
@wymd-wn118 on GitHub · 2026-11-25 22:28 UTC · original
wymd-wn118:window-reuse-holds-the-ask→main· +59 −1 · 1 files · 1 commits · closed without mergingWhat
A loose window is looked up by its
(start, len)exactly, but the two kinds of ask make different lengths for the same memory: an ask without a length takes a tail of its 4 MiB cell (tail_of), one with a length takes the grid's window (window_of). An ask that found no window of its own then made a second one over memory another window already held, and that memory was copied once for each.loosenow takes a window that begins at or below the ask, no lower than the ask's own line, and holds all of it. That isholder_below, split out from the map walk so it is tested without a card.Measured
In the world,
VICTORY_WINDOW_TAILS=1 VICTORY_WINDOW_KB=256, from the memory line (the N MB of windows lie over M MB of title memory):Repeat ratios sampled across a run, before: 864, 886, 999, 1,049, 953, 860 MB (34-38%). After: 226, 271, 301 MB (17-20%).
Limitation: this is one title, one configuration, and the scene reached differs between runs. The window and cover numbers above are what moved; frame times alongside them are not comparable run to run.
Not a duplicate
Checked against all 53 open PRs: none changes the body of
loose()or takes a window that holds an ask.cache registered shadow buffer lookups) only callloose- they cache registered-buffer hits and state that loose windows are not cached.overlapping_waits_charge_one_window) is wait accounting.deduplication of repeated ranges) is refresh ranges per draw.Tests
Two new tests in
window_tests(7 passed). Release build ofvictorywith--features diagnosticssucceeds.@j-fuxa on GitHub · 2026-11-26 01:41 UTC · original
Cross-check of the window-copy numbers: how much of a loose window is touched
This is an independent measurement of the loose 4 MiB window scheme, from a different fork, to cross-check the table above. It was taken on an RTX 4060 Laptop 8 GB, 32 GB RAM, Windows 11, at world entry.
The overlap here is far lower than the 34-38% in the "before" rows. The settings differ (this PR measures with
VICTORY_WINDOW_TAILS=1 VICTORY_WINDOW_KB=256), so the numbers may not be comparable. In our run the larger saving was in the roughly half to two thirds of window bytes that no submission read, not in duplicates.Suggestion. Add "bytes of each window touched by any submission" to the memory line, next to the windows-over-title-memory figure. If untouched bytes dominate on your setup, fetching windows by touched sub-range would save more than merging duplicates. If overlap dominates, this PR's approach is the right lever.
Caveats. Different code base and GPU. We did not vary window size or tail settings, and the scene reached differs from run to run.
@wymd-wn118 on GitHub · 2026-11-26 04:50 UTC · original
Thanks for the cross-check - it changed our conclusion. This PR is not the main lever, and we are closing it.
Our setup
Windows 11, i7-14650HX, RTX 4060 Laptop 8 GB, 15.7 GB of physical memory (pagefile forced onto C: at 800 MB, so the box hits its ceiling early).
We reproduced your finding
Rerunning with the default window settings (no
VICTORY_WINDOW_KB, noVICTORY_WINDOW_TAILS), the windows overlap 4-7%, consistent with your 24-48 MiB. So the 34-38% in the table above is not what the default configuration does - it is introduced byVICTORY_WINDOW_KB=256, which we had turned on to save memory on this machine.The touched-bytes figure you asked for
The project already tracks it:
window_use()reports "MB of their pages ever copied" on thememory, what holds it:line. Measured here:That is in the same place as your 665-838 MiB of 1.76-1.99 GB. You are right that untouched bytes dominate: 37-54% of window bytes are never copied, well above the 4-27% duplication. Fetching windows by touched sub-range is the better lever.
Why this PR is being closed
passes that made none for lack of room: 377.One thing we suspect but have not proven
On this machine, character faces and some models sometimes load and sometimes do not. In the same runs the memory line records hundreds of refused host copies for lack of room, and the timings coincide. We have not isolated a cause, so treat this as a hypothesis only. If it is real, it points at the same place you do: window lifetime and the default window size under memory pressure, rather than deduplication.
Conclusion
Both datasets point the same way: window lifetime management and the default window size have more room than merging duplicates. Thanks again - this saved us from pushing a change that only pays off in a configuration we had chosen for our own machine's limits.
@wymd-wn118 on GitHub · 2026-11-26 04:50 UTC · original
Closing as agreed in the discussion above: on the default window grid the overlap is 4-7%, so this change only pays off together with a smaller window, and even then it does not relieve a 15.7 GB machine. Thank you both for the cross-check.
Pull request closed