Repository navigation
GPU: reuse loose windows that hold a range (#402), 256 KiB windows opt-in (VICTORY_LOOSE_WINDOW_KIB) - #2088
GPU: reuse loose windows that hold a range (#402), 256 KiB windows opt-in (VICTORY_LOOSE_WINDOW_KIB)#2088desplmfao wants to merge 10 commits into
Conversation
…oose windows that hold a range `shadow::find` looked at only the 64 buffers starting closest below an address. A big buffer with more than 64 smaller buffers placed in it before the address was missed, and the range fell through to `loose`, which made a second 4 MiB host copy of memory the big buffer's copy already had, not aliased with it. The search now goes back as far as the longest buffer registered so far (`MAX_SPAN`): one starting further below cannot hold the range. `loose` reused a window only for the exact same (start, length), so a range inside a window made for a range spanning two windows got another copy. It now reuses any window holding the range. It also gives no copy for null-page addresses, or for memory that is not committed when a new window would be made, instead of 4 MiB of zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oose windows that hold a range `shadow::find` looked at only the 64 buffers starting closest below an address. A big buffer with more than 64 smaller buffers placed in it before the address was missed, and the range fell through to `loose`, which made a second 4 MiB host copy of memory the big buffer's copy already had, not aliased with it. The search now goes back as far as the longest buffer registered so far (`MAX_SPAN`): one starting further below cannot hold the range. `loose` reused a window only for the exact same (start, length), so a range inside a window made for a range spanning two windows got another copy. It now reuses any window holding the range. It also gives no copy for null-page addresses, or for memory that is not committed when a new window would be made, instead of 4 MiB of zeros. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Memory outside every buffer object gets host copies of the aligned windows lookups touch. While Grand Theft Auto VI loads its world, about 700 such 4 MiB windows (3.4 GB of host memory) were live; the lookups touched about 30% of their bytes (in 64 KiB pieces). With 256 KiB windows, at the same point of loading: 5,713 windows, 2.2 GB, and the process 15.4 GB instead of 17.3 to 20.4 GB. No descriptor-slot warnings for the extra windows' page-table entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Triage verdict — Keep the window-size experiment stacked on #402 ( Evidence
Checks and limits
Next step
This verification was AI-assisted. |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib shadow::— 8 passed, 0 failed (includinga_parent_is_found_past_many_childrenandregistered_buffers_widen_the_search)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean 256 KiB loose title-memory copy windowing and enclosing-entry lookup with solid unit tests. Looks good.
AI-assisted (Gemini 4 Neon).
catminou4
left a comment
There was a problem hiding this comment.
Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.
Loose title memory copied in 256 KiB windows instead of 4 MiB — finer copy granularity, less over-copy; check the window loop's tail handling.
A range in one window, then a range across its end, which gets a window of its own over both: the title's writes reach both copies at their refresh, and a shader's write through the spanning copy goes back to title memory and into the first copy at its next refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, good catch. I added the synthetic case you described (
It passes on the RTX 5080 under Proton. The full What the test can't make safe is two overlapping copies within one submission. If a shader writes through B and another reads the same bytes through A before the copy-back, it reads the old bytes. That's true of any two copies of the same memory, title buffers and windows included, and on On descriptor-pair pressure: in Grand Theft Auto VI's world with 256 KiB windows, I've seen 6,000–8,300 live windows in the |
|
@jeremygold02 here's the number I promised: descriptor pairs per page table with 4 MiB windows (without this PR) vs. 256 KiB (with it). Upstream's page table writes one view pair per host copy of title memory, and the world uses one table, so pairs = host copies ( Same stack otherwise (upstream
So the smaller windows do cost about 3× the pairs, but 17k is still far below the view heap's 2^21 slots. In exchange, the copies hold about 5 GB less, and the process uses about 13 GB less RAM. Without this PR, the run was at 29 GB after 3 minutes and still growing, so I stopped it. |
|
Automated triage for the maintainers. Merge candidate. On your reply: making the small windows opt-in answers the open-world A/B (+428 ms median, ~6 GB copied per frame), so the default path no longer pays that cost. Two notes for the maintainer: the PR title still says "256 KiB windows instead of 4 MiB", which is now only the opt-in; and since this PR carries #402's commit, merging it makes #402 (which conflicts with Generated by Claude Code |
… ones A miss in the buffer lookup scanned every buffer starting within the longest buffer's length below the address (MAX_SPAN, 174 MB in the world): about 480 entries per miss on average, at most 2,842, and some 330,000 misses every 5 s, all under BUFFERS' lock (measured in Grand Theft Auto VI's world, RTX 5080 under Proton). Buffers of 1 MiB or more are now also kept in a small map of their own. A lookup scans BUFFERS only within the longest smaller buffer's length below the address, then the big buffers further below, back to MAX_SPAN. Only a big buffer can hold the range from further below, so the result is the same innermost buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
On the triage's first point, unbounded misses in Before (title's world, RTX 5080, Proton, our stack on top of this PR): every 5 s, about 1.4 million lookups hit after looking at 1 entry, and about 330,000 missed. Each miss scanned every buffer starting within Change: buffers of 1 MiB or more are also kept in a small map of their own. A lookup first scans After, same place: misses look at 4.2 entries on average, at most 218. Hits are unchanged at 1. Frame time didn't move measurably (675 vs 725 ms, within run-to-run noise), so the lookups weren't a big share of a frame, but they no longer hold the lock long.
The second point (two overlapping copies within one submission can disagree, and smaller windows make boundary crossings more frequent) stands as described. |
… the big ones" This reverts commit b73bb8b. With it, Grand Theft Auto VI's world showed spikes out of the player character's head and triangles stretched across the scene in two runs; the same build without it is clean. A stale entry in the map of big buffers (a key registered again shorter) explains the spikes, but with that fixed the triangles stayed, so the change goes until it is understood. The lookup cost it targeted is back as before (about 480 entries per miss). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A correction to my earlier comment: I've reverted the lookup change in In the title, the two-step lookup broke the picture: spikes out of the player character's head and triangles stretched across the scene, in two runs. The same build without it is clean. I found one real bug, a stale entry in the big-buffer map when a key is registered again shorter, and fixing it removed the spikes, but the stretched triangles stayed, so I don't understand the change well enough to keep it here. The triage's first point (misses in |
…kup (it broke the picture)
The previous main (old upstream base) is the first parent; the second is upstream main with the current heads of our pull requests merged in: Marvisak#2143, Marvisak#1849 (carried onto main's per-region runtime_pages), Marvisak#259, Marvisak#491, Marvisak#2153, Marvisak#2099, Marvisak#2071 (main covers it), Marvisak#2162, Marvisak#2218, Marvisak#2088, Marvisak#2389, Marvisak#177's element-type key on main's three handle maps, and the README. Marvisak#2112 (opt-in, in place) stays in the renderer branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@desplmfao, an in-game A/B of this PR on an RTX 5070 (12 GB, Windows 11), for the memory/time trade-off. Our play build is
On memory, the PR does what it says. In an earlier, indoor scene, loose windows took 5,520 MB of host copies with 4 MiB windows; in this run they take 2,640 MB, so roughly 2.9 GB saved. But in the open world the copies per frame grow about tenfold, and that's what the frame time pays for. My guess, not checked in the code: the same loose ranges are now spread over many more windows, and each window that a page-table submission refreshes is copied whole, or a lookup that misses refills a window it just dropped. That would trade bytes held for bytes moved every frame. A diagnostics count of loose windows refreshed per frame, and their bytes, with 4 MiB against 256 KiB, would tell. We've taken it out of our play build for now and kept the numbers for when there's a form that keeps the memory win. AI-assisted |
…#2088 76cdef6: loose title memory in 256 KiB windows, with Marvisak#402's window reuse) into play/main" This reverts merge 75b3f75 (Marvisak#2088) on play/main, with the mainline kept (git revert -m 1). The user's same-save A/B runs in the safehouse, on the RTX 5070: PM1 (play/main 75b3f75, with Marvisak#2088) against PM0 (404c7e0, without it). With Marvisak#2088's 256 KiB windows, host copies of title memory went to about 6 GB a frame, against about 0.55 GB without. Preparing averaged 981 ms against 377 ms, and the median frame was 428 ms longer: PM0 - PM1 95% bootstrap CI [-569, -346] ms. Page faults were 52.7k against 27.6k a frame. Marvisak#2088 did save about 2.9 GB of memory. That win is kept for a later, fixed form, one that does not copy that much more each frame. Everything else on play/main stays, including the read_only: false fix the merge carried (it was in Marvisak#2088's own test, so it goes with it). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…instead of 4 MiB (stacked on Marvisak#402)
…_VRAM), on play/main Fork gpu/tables-in-vram 2a2a602 (F1), ported onto play/main as one commit so it reverts alone. A variant for the GPU thread's A/B (unset, =1, =copy); not part of play/main. Only 2a2a602's own change is taken (a cherry-pick). Its base, upstream main da82e44, is 81 commits past play/main's 940d32f; merging the branch would have brought all of them in, victory-shader too (a new shader cache key), with conflicts in 23 files. Conflicts and how they were resolved: - descriptor/host.rs, the view addresses: F1 was written for upstream main's layout (16 bytes a title slot, texture size words). play/main keeps layer 4's layout, which its shaders read: 8 bytes (the address) for every title AND dynamic slot (address_slots), ray tracing acceleration structures' addresses included (view_address), resident per frame. So: F1's crate::tables::Table for the field, made with address_slots() * 8 bytes and keep_resident(table.resource(), Frame); layer 4's dynamic-slot fill, index check and write_address() words, written through Table::write(2 * index, ..). The test reader address_at() reads through a new test-only Table::read(). The stride and mark tables merged cleanly. - memory.rs: layer 4's D3D12 imports kept (zeros() still uses ID3D12Resource); layer 4's test helpers pipeline() / pipeline_of() kept, pipeline_of() made pub(crate), and tables.rs's test calls memory::tests::pipeline_of(READ) where F1 called upstream's pipeline(source). - host.rs Meter: layer 4's dynamic-slot drop line, then F1's table-copy line. - lib.rs: mod tables and mod threads, each #[cfg(windows)]. - README.md: play/main's VICTORY_SHADER_LOOP_LIMIT row (2^14, as lower.rs's LOOP_LIMIT here) plus F1's VICTORY_TABLES_VRAM row. Merged cleanly, checked by hand: host.rs submit, where the table copy list goes first in `lists` and the later runs' `firsts` move up by one, so the per-run groups VICTORY_GPU_TIMING times (built from firsts) still name whole runs, the copy list joining the first. Also ported, missed in the first form (it did not build): layer 4's resident-table loop in HostHeap::new and the tests view_heap_tables_are_kept_resident, an_acceleration_structures_view_address_is_its_location and view_addresses_cover_tables_made_afresh still took the tables as (buffer, mapping) tuples. They now use Table::resource(), a Table in system memory, and a test-only Table::mapped() (the buffer the host's mapping is of, the staging buffer in =copy mode), so the past-the-end check still looks at the mapped buffer in every mode. Rebased onto play/main aeeaed5 (Marvisak#2088 reverted, 7d9a846's dynamic tables, the test fix): it applied cleanly. host.rs Meter now has 7d9a846's longer dynamic-slot line, then F1's table-copy line. The first form of this commit was 001945d, on play/main 75b3f75. (cherry picked from commit 2a2a602) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…c tables, runs PM0/PM1/PM2, three variants Parts 4 to 7: Marvisak#2088 reverted (64136f6) with the PM0/PM1 numbers, the GPU-cost report fix (e92714a), the dynamic tables (99d3e30) and their test fix (aeeaed5). The runs PM0, PM1 and PM2 side by side. The WARP lib results at each head. The current build (victory-99d3e306.exe), and the variants play/main-tables-vram c49ef67, play/main-shaders f965f80 and play/main-copyback a4ed2b0, each with its exe, sha256 and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts in crates/victory-gpu/src/shadow.rs: main's copies now come back as Arc from Shadow::new and bump GENERATION through changed(); kept that and added Marvisak#402's MAX_SPAN search, the loose-window reuse (LOOSE_SPAN, enclosing_window) and the committed/null-page checks on top. Marvisak#402's tests join main's `pub(crate) mod tests`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
update/402-main is Marvisak#402 with main merged in. Its shadow.rs replaces this branch's copy of Marvisak#402's commit (same change on an older main); this branch's own changes go on top: 256 KiB windows and the overlapping-windows test. The two-step lookup stays reverted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
r4tedx's in-game A/B of this branch (RTX 5070) measured the 256 KiB windows at +428 ms median frame time: host copies grew from about 0.55 GB to about 6 GB per frame in the open world, for about 2.9 GB of host memory saved. Loose windows are 4 MiB again (main's size) unless VICTORY_LOOSE_WINDOW_KIB asks for a power of two from 64 to 4096 KiB. Marvisak#402's window reuse stays as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ICTORY_LOOSE_WINDOW_KIB), default 4 MiB Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@r4tedx thanks for the A/B. +428 ms median, and ~6 GB copied per frame in the open world instead of ~0.55 GB, is far too much for the ~2.9 GB it saves. #402 has conflicted with
|
No range: sizes far from the default are the user's own experiment. Only a value that is not a power of two, or one whose bytes overflow, falls back to 4 MiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_KIB Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_KIB Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n place, opt-in) A plain merge would have dropped Marvisak#2112: the old fork main merged an earlier Marvisak#2112 head (cd079af), so it is a merge base, and the current main left Marvisak#2112 out, which reads as a deletion. Merged against the right base instead: upstream main (67e8ae1) with Marvisak#2088's two commits Marvisak#2112 stacks on (b670a33), and Marvisak#2112's head applied over that file by file (README, host.rs, memory.rs, shadow.rs, watch.rs; no conflicts). Marvisak#2088's reverted two-step lookup is not in Marvisak#2112 and stays out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ICTORY_LOOSE_WINDOW_KIB), default 4 MiB Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_KIB Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous renderer (old upstream base 940d32f) is the first parent and is also kept as the branch renderer-2026-11-25-oldbase; the second parent is the rebuild: fork main (upstream main 63bcca4 + our pull requests) with the renderer stack merged on it: Marvisak#439 (on main: update/439-main's resolution), Marvisak#2309, Marvisak#2167, Marvisak#2118, Marvisak#2311, Marvisak#1722, Marvisak#1751, Marvisak#688, Marvisak#1872, Marvisak#2292, Marvisak#2310, Marvisak#2112 (opt-in), Marvisak#2230 (latch on by default), Marvisak#2389, Marvisak#2088 (small windows opt-in), Marvisak#2099's new head, and tonight's Marvisak#491 journal fixes. Merged upstream since: Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906, Marvisak#1152; superseded by main: Marvisak#1769, Marvisak#1763, Marvisak#2366. The picture on this base still shows the overlay that plain upstream main shows too; that is being looked into. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kotekompotek
left a comment
There was a problem hiding this comment.
LGTM — the delta over #402 (which I just reviewed: enclosing lookup + committed gate) is the window-size switch and its coherence test.
window_fromenforces power-of-two before the align-down& !(window-1)can depend on it,checked_mul/checked_next_multiple_ofcover the arithmetic edges, and the default stays 4 MiB.changed()after LOOSE insert was missing in the base — needed now that more distinct windows appear.overlapping_windows_agree_through_title_memoryis the right test for the new overlapping-window possibility: title write → both copies see it; GPU write through the spanning window → copy-back → title → the enclosed copy picks it up next refresh. The comment honestly documents the intra-submission divergence, which is identical to any two copies of the same bytes.- The measured trade-off (256 KiB: GBs less host memory, ~10x copy bytes/frame in open world) is documented in both the code comment and README — default behavior unchanged.
…B=256 for machines short on memory 256 KiB loose windows: the GPU's system memory 5.6-5.8 GiB instead of 8.7-8.9 GiB in the prison scene, frames no slower; one crash in eight runs with it, none without, so it stays opt-in.
…ash link is ruled out Both title crashes of the night came from builds with Marvisak#402/Marvisak#2088 in: a null read in title code entering the world (256 KiB windows) and one while loading (default 4 MiB windows, dstorage debug log on), 2 of 17 runs, against none in about 30 runs without them. Marvisak#402 changes, by default, which copy a lookup finds. Not proven, but players pull this branch, so the code goes back to b25fd9a's until an A/B says otherwise. Reverts 1669715, dee9e0d, 2cbfd20, ce1351d, 9c29e6a, dce3ee8.
…rash is not theirs Reverts c73cbee. An A/B with the DirectStorage debug log on (which slows the submit path) crashed once in five runs on each side, with and without these commits, the same way as before: title code reading a null pointer in its job system (thread entry +0x2215eca, dispatch +0x2570xxx), while loading or entering the world. All four such crashes of the night share that path. Without the debug log: 1 in 16 runs with these commits (with 256 KiB windows), 0 in about 30 without; with it, 3 in 11 across both builds. So it looks like a timing race around DirectStorage, not these commits. The docs say so; 256 KiB windows stay opt-in.
|
Wine11.0 / NVIDIA RTX4060 Laptop8GiB /16GiB system RAM, driver590.48.1, DXVK3.1.1, diagnostic relaxed vkd3d-proton3.2.0 At Then ran the full owner branch, not a granularity-only transplant, with a local diagnostics-only two-second try-lock probe of This is only~53s after entering loading, not proof that loading completes or the RAM ceiling is solved. Earlier main+#2856 measured2,604MiB loose backing later in loading; source, timing and cache state differ, so that is not a matched-stage memory-saving claim. Compute host-pipeline refusals |
…B=256 for machines short on memory 256 KiB loose windows: the GPU's system memory 5.6-5.8 GiB instead of 8.7-8.9 GiB in the prison scene, frames no slower; one crash in eight runs with it, none without, so it stays opt-in.
…ash link is ruled out Both title crashes of the night came from builds with Marvisak#402/Marvisak#2088 in: a null read in title code entering the world (256 KiB windows) and one while loading (default 4 MiB windows, dstorage debug log on), 2 of 17 runs, against none in about 30 runs without them. Marvisak#402 changes, by default, which copy a lookup finds. Not proven, but players pull this branch, so the code goes back to b25fd9a's until an A/B says otherwise. Reverts 1669715, dee9e0d, 2cbfd20, ce1351d, 9c29e6a, dce3ee8.
…rash is not theirs Reverts c73cbee. An A/B with the DirectStorage debug log on (which slows the submit path) crashed once in five runs on each side, with and without these commits, the same way as before: title code reading a null pointer in its job system (thread entry +0x2215eca, dispatch +0x2570xxx), while loading or entering the world. All four such crashes of the night share that path. Without the debug log: 1 in 16 runs with these commits (with 256 KiB windows), 0 in about 30 without; with it, 3 in 11 across both builds. So it looks like a timing race around DirectStorage, not these commits. The docs say so; 256 KiB windows stay opt-in.
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified at head 6ebed992 against origin/main (63bcca43) on Windows 11 (RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, both default 4 MiB and VICTORY_LOOSE_WINDOW_KIB=256):
- Design & correctness:
- Keeps the 4 MiB default unchanged while making smaller loose windows opt-in via
VICTORY_LOOSE_WINDOW_KIB(crates/victory-gpu/src/shadow.rs:1082-1095, documented inREADME.md:220).window_fromenforcesis_power_of_two()andchecked_mul(1 << 10)so alignment masks andend.checked_next_multiple_of(window)? - start(shadow.rs:1132) cannot overflow or underflow. - Carries
#402's lookup improvements onto63bcca43:enclosing(shadow.rs:1023-1032) searches back byMAX_SPANinstead of a fixed 64 entries,enclosing_window(shadow.rs:1108-1118) reuses existing loose windows containing[address, end),loose(shadow.rs:1124-1148) gates onLOWEST_MAPPED(0x10000) andtexture::committed(address, 1), andchanged()notifies page tables onLOOSEinsertion.overlapping_windows_agree_through_title_memory(shadow.rs:1830-1869) verifies cross-submission coherence through title memory; structured-view arena/stride paths are untouched. - Note for maintainers: since this PR incorporates
#402and modifiesshadow.rs::loose(), it supersedes#402and overlaps#2856inshadow.rs(only one should land, or they should be reconciled).
- Keeps the 4 MiB default unchanged while making smaller loose windows opt-in via
- Verification:
- Clean
git merge-treeagainstorigin/main(63bcca43);cargo xtask policy(191 files ok);cargo clippy -p victory-gpu --all-targets --locked -- -D warningsclean with default features and--all-features. - RTX 5090:
shadow::tests15/15 passed with both 4 MiB default andVICTORY_LOOSE_WINDOW_KIB=256; with--features diagnostics+VICTORY_D3D12_DEBUG=1,shadow::tests+draw::tests35/35 (4 MiB) andshadow::tests15/15 (256 KiB) passed with zero debug-layer errors. - WARP (
VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1):shadow::tests15/15 (256 KiB) andshadow::tests+draw::tests35/35 (4 MiB) passed.
- Clean
LGTM.
… range (Marvisak#402), 256 KiB windows opt-in (VICTORY_LOOSE_WINDOW_KIB)
… range (Marvisak#402), 256 KiB windows opt-in (VICTORY_LOOSE_WINDOW_KIB)
Stacked on #402 by @kxiserino: its commit is the first one here, unchanged apart from resolving its conflict with current
main(940d32f), and keeps its author. The second commit is the change below. If #402 lands first, this reduces to one line plus its comment.Problem
Memory outside every buffer object (
shadow::loose) gets host copies of the aligned windows that lookups touch, and those copies are never freed. A window was 4 MiB. While Grand Theft Auto VI loads its world (Series X 1.0.2.1), about 700 windows are live, 3.4 GB of host memory. They sit inMEMORY_POOL_L0system memory, so it's RAM on top of the title memory they copy, and every page-table submission refreshes them.Measured
I counted which parts of each window lookups ask for (64 KiB pieces, diagnostics build, temporary counters not part of this PR): at the same point of loading, 968 MB of 3,416 MB. That's about 30% of the bytes copied.
main+ #402)no descriptor slots for a title memory copy's viewsThat's about 1.2 GB less while loading. Each window is a host buffer and an entry in the title-memory page table, so smaller windows mean more of them. 256 KiB was chosen to keep that count moderate. 64 KiB would cut more bytes but multiply the windows again.
In the open world
Added later, once the world loaded here (the hang was a single compute pass, skipped with
VICTORY_SKIP_PIPELINES=72f552f4553fb5f9; see #844). Same stack otherwise (940d32f+ other open PRs), same save, about 2 min into the open world. Host copies are counted fromhost copies of title memoryon theheap viewsline; the world uses one page table, and it holds one view pair per copy.main)So in the world the smaller windows save about 5 GB of copies and about 13 GB of RSS. They cost about 3× the descriptor pairs, which is still far below the view heap's 2^21 slots.
Also tried, and not part of this PR: freeing windows no lookup has used for 5 s. During loading, almost all windows are used again within seconds (680 of 734), and others are held by lists or heap slots, so it barely freed anything.
Tested
main+ GPU: free memory is not the runtime's to watch (fixes a world-load deadlock under Wine) #1849 (without it the title hangs at world entry under Wine).+0x23cf683), the same as runs without this change. The open-world numbers above came later, with the one hanging pass skipped. Frame time is not measured.cargo test -p victory-gpu -- --test-threads 1: 133 passed, 14 failed. Plainmainon this machine fails the same 14 (129 passed). GPU: find a buffer holding an address past many smaller ones; reuse loose windows that hold a range #402's four tests pass, and they are written againstWINDOW, so they cover the new size.cargo clippy -p victory-gpu --all-targets -- -D warnings: nothing new.Related
shadow.rs(pooling view copies). It might conflict textually, but the two change different things.AI-assisted (Claude Code).
🤖 Generated with Claude Code