Windows' card side in shared 64 KiB tiles; the windows read most move to the card (with VICTORY_WINDOW_ARENA=1) #4923

Closed
github-bot wants to merge 10 commits from github-bot/gh-4922 into main AGit
Owner

@⁠xteral67 on GitHub · 2026-12-01 14:08 UTC · original
xteral67:hot-windows-card → main · +1399 −17 · 6 files · 10 commits · closed without merging

Depends on #4751. This branch holds #4751's commits; the new ones are the last five. Merge #4751 first.

Refs #4036

What it changes

With VICTORY_WINDOW_ARENA=1 (#4751), windows share one copy of title memory in 64 KiB tiles on the PC. Their card side was still a committed buffer per window, so overlapping windows held the same bytes on the card two or three times. The room for windows on the card (about 1 GB on a 12 GB card) was full in the first minute, and about 4.7 GB of windows were read over the bus.

  • VICTORY_WINDOW_ARENA_CARD (on with the arena, =0 as before): the card side is a reserved buffer over 64 KiB tiles of a second pool, shared by windows. The room counts only new tiles. Free tiles of the pool are weighed against the windows' cap only.
  • When the room is 95 % full, the card windows least recently read and held by nothing go, once in 30 frames.
  • Windows are counted by the bytes asked of them, by draws (loose()) and by the heap pass (heap_read()), as #4036 asks: windows read only through the heap were never counted. Once every 30 frames, up to 16 of the most-read windows without a card side move to the card, and windows on the card read at most half as much make room. Moves go through take-overs, as VICTORY_WINDOW_GROW does.
  • With the arena off (the default), nothing changes.

How it was tested

  • RTX 3080 Ti 12 GB, i5-14600KF, 32 GB RAM, driver 621.40. Series X profile, 1440p, DLSS quality, FSR frame generation 2x, no ray tracing. Diagnostics build.
  • Shared card tiles, scripted walking route, about 350 s in the world, one run each:
    • before (VICTORY_WINDOW_ARENA_CARD=0): 51.1 ms a frame, card 45 ms at 4.3–4.7k draws;
    • after: 41.6 ms a frame, card 31 ms at the same draws, VRAM 9.9 of 11.1 GB both times.
  • Moving windows by bytes read, one ride by hand in town (about 9 minutes): 460 windows moved onto the card and 1,759 off it. Windows in PC memory asked for 941, 870, 536, 683, then 306 MB a frame. No new picture errors seen. That ride also ran another change (render-target memory), so its frame times are not given as this change's effect.
  • Not tested: cargo test, other cards, the Series S profile, Linux.
  • These commits were built and played in a tree based on v2026.11.30.03, not on this branch as such.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1756, #3574, #4457 (when windows get a card side), #4894, #4190 (windows in CPU-mapped card memory), #2910 (window growing and a card ledger).

🤖 Generated with Claude Code

**@⁠xteral67** on GitHub · 2026-12-01 14:08 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4922) `xteral67:hot-windows-card` → `main` · +1399 −17 · 6 files · 10 commits · closed without merging Depends on #4751. This branch holds #4751's commits; the new ones are the last five. Merge #4751 first. Refs #4036 ## What it changes With `VICTORY_WINDOW_ARENA=1` (#4751), windows share one copy of title memory in 64 KiB tiles on the PC. Their card side was still a committed buffer per window, so overlapping windows held the same bytes on the card two or three times. The room for windows on the card (about 1 GB on a 12 GB card) was full in the first minute, and about 4.7 GB of windows were read over the bus. - `VICTORY_WINDOW_ARENA_CARD` (on with the arena, `=0` as before): the card side is a reserved buffer over 64 KiB tiles of a second pool, shared by windows. The room counts only new tiles. Free tiles of the pool are weighed against the windows' cap only. - When the room is 95 % full, the card windows least recently read and held by nothing go, once in 30 frames. - Windows are counted by the bytes asked of them, by draws (`loose()`) and by the heap pass (`heap_read()`), as #4036 asks: windows read only through the heap were never counted. Once every 30 frames, up to 16 of the most-read windows without a card side move to the card, and windows on the card read at most half as much make room. Moves go through take-overs, as `VICTORY_WINDOW_GROW` does. - With the arena off (the default), nothing changes. ## How it was tested - RTX 3080 Ti 12 GB, i5-14600KF, 32 GB RAM, driver 621.40. Series X profile, 1440p, DLSS quality, FSR frame generation 2x, no ray tracing. Diagnostics build. - Shared card tiles, scripted walking route, about 350 s in the world, one run each: - before (`VICTORY_WINDOW_ARENA_CARD=0`): 51.1 ms a frame, card 45 ms at 4.3–4.7k draws; - after: 41.6 ms a frame, card 31 ms at the same draws, VRAM 9.9 of 11.1 GB both times. - Moving windows by bytes read, one ride by hand in town (about 9 minutes): 460 windows moved onto the card and 1,759 off it. Windows in PC memory asked for 941, 870, 536, 683, then 306 MB a frame. No new picture errors seen. That ride also ran another change (render-target memory), so its frame times are not given as this change's effect. - Not tested: `cargo test`, other cards, the Series S profile, Linux. - These commits were built and played in a tree based on v2026.11.30.03, not on this branch as such. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1756, #3574, #4457 (when windows get a card side), #4894, #4190 (windows in CPU-mapped card memory), #2910 (window growing and a card ledger). 🤖 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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 14:11:46 +00:00
Author
Owner

@⁠gut0to on GitHub · 2026-12-01 14:27 UTC · original · reviewed

AI-assisted review; I used an AI assistant to inspect this diff.

**@⁠gut0to** on GitHub · 2026-12-01 14:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4922#pullrequestreview-6133279172) · **reviewed** AI-assisted review; I used an AI assistant to inspect this diff.
@ -0,0 +304,4 @@
STATS[3].fetch_add(1, Ordering::Relaxed);
continue;
}
let heap = match pool.heap_for_tile(device) {
Author
Owner

@⁠gut0to on GitHub · 2026-12-01 14:27 UTC · original

Could this rollback bookkeeping get a CPU-only test with a mix of already-shared and newly allocated tiles? On a later-tile allocation failure, this branch decrements the refs for every entry in placed and returns tiles whose count reaches zero; a regression here could either strand tiles or free one still used by another window. The added arena test covers run coalescing, but not this lifecycle path. Factoring the refcount/rollback operations into a pure helper would make the failure and overlapping-window cases testable without D3D12. AI-assisted review; I traced the partial-allocation cleanup against the shared-window reference counts.

**@⁠gut0to** on GitHub · 2026-12-01 14:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4922#discussion_r4755626624) Could this rollback bookkeeping get a CPU-only test with a mix of already-shared and newly allocated tiles? On a later-tile allocation failure, this branch decrements the refs for every entry in `placed` and returns tiles whose count reaches zero; a regression here could either strand tiles or free one still used by another window. The added arena test covers run coalescing, but not this lifecycle path. Factoring the refcount/rollback operations into a pure helper would make the failure and overlapping-window cases testable without D3D12. AI-assisted review; I traced the partial-allocation cleanup against the shared-window reference counts.
Author
Owner

@⁠vi-tester-8gb on GitHub · 2026-12-01 16:16 UTC · original

A result from an 8 GB laptop card, where the arena with card tiles came out slower. One session, played by hand, so treat it as one data point.

PC: RTX 5060 Laptop GPU 8 GB (driver 621.24), i7-13620H, 32 GB RAM, Windows 11.
Build: v2026.11.30.03 + #4207 + #4295 + #4944 (first commit only) + #4948 (with e41f18ea) + this PR (all eight commits, so #4751 included), local --release. Series S profile, DLSS Performance, DLSS FG 2x, --fps 16, VICTORY_SAMPLED_EVICT=1, VICTORY_WAIT_RESIDENT=textures, VICTORY_VRAM_BUDGET_MB=6400, VICTORY_WINDOW_ARENA=1 (card tiles on by default). The log confirmed the arena was on.

Compared with our previous session (same base and settings, no arena and no #4944/#4947, but with #4582 + #4881):

arena + card tiles (21 min) previous (79 min)
card time per frame (card meter, title lists), median / p90 62.7 / 91.9 ms 48.1 / 73.2 ms
submitting thread preparing, median / p90 54.9 / 79.8 ms 46.6 / 68.6 ms
PC memory shared with the card, median 5753 MB 6803 MB
frames over 100 ms, min 3-10 / 10-20 17.0 % / 10.9 % 4.5 % / 2.5 %

So the arena did what it says on the memory side (about 1 GB less shared memory), but on this card the card's own time went up, not down.

End of the session: after 21 minutes, DXGI_ERROR_DEVICE_HUNG (0x887A0006) with nvlddmkm event 153 three times. The log says the submitting thread was between submissions (nothing of ours was running on the card), of 0 lists, for 12392.7 ms just before. The card had ~470 MB of real headroom (6531 of ~7000 MB), so unlike our earlier hangs it wasn't at its budget. I can't say the arena caused it: we've had hangs without it, and this was one run. But it's the first hang we've seen with this much headroom, and the reserved buffers / tile mappings are the new thing in this run.

Next we'll run the same build with the arena off (just #4944 + #4948) to separate the two.

Written up with help from Claude (AI); numbers are from our own logs.

**@⁠vi-tester-8gb** on GitHub · 2026-12-01 16:16 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4922#issuecomment-7317319392) A result from an 8 GB laptop card, where the arena with card tiles came out slower. One session, played by hand, so treat it as one data point. **PC:** RTX 5060 Laptop GPU 8 GB (driver 621.24), i7-13620H, 32 GB RAM, Windows 11. **Build:** `v2026.11.30.03` + #4207 + #4295 + #4944 (first commit only) + #4948 (with e41f18ea) + this PR (all eight commits, so #4751 included), local `--release`. Series S profile, DLSS Performance, DLSS FG 2x, `--fps 16`, `VICTORY_SAMPLED_EVICT=1`, `VICTORY_WAIT_RESIDENT=textures`, `VICTORY_VRAM_BUDGET_MB=6400`, **`VICTORY_WINDOW_ARENA=1`** (card tiles on by default). The log confirmed the arena was on. Compared with our previous session (same base and settings, no arena and no #4944/#4947, but with #4582 + #4881): | | arena + card tiles (21 min) | previous (79 min) | |---|---|---| | card time per frame (card meter, title lists), median / p90 | **62.7 / 91.9 ms** | 48.1 / 73.2 ms | | submitting thread preparing, median / p90 | 54.9 / 79.8 ms | 46.6 / 68.6 ms | | PC memory shared with the card, median | 5753 MB | 6803 MB | | frames over 100 ms, min 3-10 / 10-20 | 17.0 % / 10.9 % | 4.5 % / 2.5 % | So the arena did what it says on the memory side (about 1 GB less shared memory), but on this card the card's own time went up, not down. **End of the session:** after 21 minutes, `DXGI_ERROR_DEVICE_HUNG` (0x887A0006) with nvlddmkm event 153 three times. The log says `the submitting thread was between submissions (nothing of ours was running on the card), of 0 lists, for 12392.7 ms` just before. The card had ~470 MB of real headroom (6531 of ~7000 MB), so unlike our earlier hangs it wasn't at its budget. I can't say the arena caused it: we've had hangs without it, and this was one run. But it's the first hang we've seen with this much headroom, and the reserved buffers / tile mappings are the new thing in this run. Next we'll run the same build with the arena off (just #4944 + #4948) to separate the two. _Written up with help from Claude (AI); numbers are from our own logs._
Author
Owner

@⁠xteral67 on GitHub · 2026-12-01 17:01 UTC · original

Thanks for testing. Two notes: (1) I'll add a CPU-only test for the rollback path. (2) To split the card-time rise, a run with VICTORY_WINDOW_ARENA=1 VICTORY_WINDOW_ARENA_CARD=0 (arena on, card tiles off, windows' old card buffers) next to your arena-off run would show whether it is the shared card tiles or something else in the build; on an 8 GB card the windows' card room is about 9 % of the budget, so the tiles compete with textures there. I can't tell from here whether the hang is related.

**@⁠xteral67** on GitHub · 2026-12-01 17:01 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4922#issuecomment-7318619514) Thanks for testing. Two notes: (1) I'll add a CPU-only test for the rollback path. (2) To split the card-time rise, a run with `VICTORY_WINDOW_ARENA=1 VICTORY_WINDOW_ARENA_CARD=0` (arena on, card tiles off, windows' old card buffers) next to your arena-off run would show whether it is the shared card tiles or something else in the build; on an 8 GB card the windows' card room is about 9 % of the budget, so the tiles compete with textures there. I can't tell from here whether the hang is related.
A window made on the card started with warm 0, so its first look averaged
it to a quarter of its heat and it was the first moved off; new windows
then filled the room the moves freed. Now the first look takes the heat as
it is (per frame lived, from Shadow::born), a window made or moved onto the
card stays CARD_STAY frames, windows go off only when the windows' room is
what refused the move on, windows made take at most 90% of the room, and
windows shaders write are never moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wogQQ6zZK1Wujq7MJhtAS
take_place's map and chain work is take_place_in, over a small Place trait
Shadow implements; the counters a moved window carries are carry (used by
card_late_tiles and pc_side_of alike); card_rebalance's warm and stay rules
are looked and may_make_way. take_place_tests runs them on windows without
buffers: on and back off leaves the PC's side under the key with the first
window's counts, both copies taken over kept once and chained oldest first;
a move from a window no longer there changes nothing; a window stays
CARD_STAY frames and written windows never make way; the first look takes
the heat as it is. No change in behaviour intended.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013wogQQ6zZK1Wujq7MJhtAS
github-bot closed this pull request 2026-12-01 18:30:33 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:28 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4922#issuecomment-7320999755) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

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!4923
No description provided.