24% Less Shared GPU Memory (Window Growing + Card Memory Ledger) #2910

Open
Remorce wants to merge 16 commits from upstream-pr/2910 into main
Remorce commented 2026-11-29 18:46:32 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remorce on 2026-11-29T18:46:32Z.


This turns window growing (VICTORY_WINDOW_GROW) on by default, together with a fix that makes it pay off. On an RTX 4070 Ti with 32 GB of RAM, the PC's memory shared with the card in steady play went from about 7.6 GB to 5.8 GB (-24 %) in the same scene, at the same frame rate. It also adds a card memory line to the log, every 5 seconds in every build, which says what holds the card's memory and the shared memory. That's how the gain was found, and it might help with memory reports from other PCs.

Summary

  • Card memory ledger: a card memory by owner: line, every 5 s in every build. It covers the card's own memory and the PC's memory shared with the card. For each it gives the system's figure, what the layer's own heaps and committed resources hold by owner, and what isn't counted. VICTORY_CARD_MEMORY=0 turns it off. Later commits added descriptor heaps, lists' scratch and textures made for Streamline as owners, and the texture and shared buffer blocks' free space and fill (#4462).
  • Windows outside the shared buffer blocks: with growing, windows of title memory are 4 MiB or less and were cut from pool.rs's 64 MiB shared blocks, which they left fragmented. Each window is now an allocation of its own. VICTORY_WINDOWS_POOLED=1 brings back the old behaviour.
  • Window growing on by default: a cell's window covers what was asked for in it and grows when more is. VICTORY_WINDOW_GROW=0 turns it off.
  • A measurement switch, off by default: VICTORY_VIEW_REACH=1 makes translated programs note how far each root view is read. It's slow (2-3 fps) and only meant for measuring. VICTORY_WINDOW_ROOT_KB uses those numbers to bound a root view's window, also off by default (it saved nothing at a safe margin, see below).

The card memory ledger can be split out into its own PR (with window growing stacked on top) if that's easier to review.

Measurements

One PC: RTX 4070 Ti 12 GB, 32 GB RAM, Windows 11. Series X, 1440p, DLSS Performance, 2x frame generation. Same save and spot, an unattended 12-minute run each, the last few minutes compared.

Before (main) With this
Shared memory in use, steady 7,604 MB 5,776 MB (-24 %)
Windows of title memory 4,682 MB 3,274 MB
Shared buffer blocks (pool.rs) 512 MB 448 MB, 76 % in use
Peak commit 61.3 GB 58.8 GB
Peak private 25.7 GB 24.8 GB
fps (median) 23.1 23.2
Draws a frame 5,395 5,435

A run with the new defaults and no switches at all came out at about 6.0 GB of shared memory, in a slightly lighter stretch (about 4,900 draws). So -20 % to -24 % is a fair range. Moving to a busier area later raised it to about 6.9 GB, with nothing piling up.

Details

What the ledger showed

The shared memory was mostly the layer's own, on purpose, not the driver moving things off a full card:

  • Windows of title memory held 4.7-4.9 GB of the 7.6 GB.
  • About 1.4 GB of the windows asked for with a length lay outside anything ever asked for. Those windows were 6 MiB, and three quarters of each was never asked for.
  • 64 KiB rounding of title buffer copies was only a few MB.

The ledger and the game's RAM

On NVIDIA the driver maps the card's own memory into the process as write-combined private pages, so it counts in the game's private bytes one for one. #4288 found and measured this, and #4204 fixes the process line's accounting that hid it. 16 min into a run on this PR: 18.8 GB of host private bytes were unnamed, and the card's use (9.1 GB) plus the shared memory (6.8 GB) covered 15.9 GB of it. So the ledger's two groups together say where most of the game's RAM goes, and a cut in either is a cut in RAM.

Why growing alone wasn't enough

Growing makes windows fit their asks: the windows asked for with a length went from 24 % to 91 % used. But the smaller windows were then cut from the shared buffer blocks. A block goes back only when it's empty, and each block kept a few long-lived windows. In one run that was 49 blocks holding 3,136 MB, with about 945 MB live and 33 of the blocks under a quarter full. Shared memory went up rather than down.

With windows as allocations of their own, the gain shows. Turning the blocks off on their own changes nothing, because the default windows are 6 MiB and never pooled.

The loading spike

While the world first loads, the windows a longer one replaces are held for about ten seconds beside it. In one run that was 1,754 windows, 3,738 MB, and shared memory peaked at about 9.4 GB. It was back at the steady figure about ten seconds later, and peak commit was still lower than before.

Root views

A root view has no size, so its window runs to the end of its 4 MiB cell plus 2 MiB. VICTORY_VIEW_REACH measured 8,758 of them: 93 % were read no more than 64 KiB past their address, and the furthest 1.4 MB. Bounding them at 2 MiB past their address (VICTORY_WINDOW_ROOT_KB=2048) saved nothing, because the margin needed for the few long ones cancels the gain. So it stays off. A bound per kind of view might do better, and the switch is there to measure that.

Not covered

  • One PC and one scene, plus a short move to another area.
  • I checked the picture by eye outdoors and indoors, on this commit and against main without it. Nothing new or worse.

Tests

  • Ledger: heap types lie in their groups; a buffer and a heap are counted until they go (WARP); asked bytes are counted with their object and go with it; the asker holds inside its scope only.
  • Windows: the span of each window is what was asked for; each window needs up to its furthest read; a root reach bounds an ask without a length by its address.
  • VICTORY_VIEW_REACH: a root view read notes its reach only when asked, and a format load through a root view too. Both validate with dxil.dll.
  • Suites: cargo test -p victory-gpu --lib: 922 pass. Two fail, and they fail without this change too:
    • every_switch_of_the_translator_is_in_the_key: VICTORY_SCALAR_SPLITS is in the cache key, but the translator no longer reads it.
    • a_change_is_saved_at_once_however_the_game_was_started: flaky here, and it passes on its own.
  • cargo test -p victory-shader --lib: 465 pass.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5553908319 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910). Originally posted by [Remorce](https://github.com/Remorce) on 2026-11-29T18:46:32Z. --- This turns window growing (`VICTORY_WINDOW_GROW`) on by default, together with a fix that makes it pay off. On an RTX 4070 Ti with 32 GB of RAM, the PC's memory shared with the card in steady play went from about 7.6 GB to 5.8 GB (-24 %) in the same scene, at the same frame rate. It also adds a card memory line to the log, every 5 seconds in every build, which says what holds the card's memory and the shared memory. That's how the gain was found, and it might help with memory reports from other PCs. ## Summary - **Card memory ledger:** a `card memory by owner:` line, every 5 s in every build. It covers the card's own memory and the PC's memory shared with the card. For each it gives the system's figure, what the layer's own heaps and committed resources hold by owner, and what isn't counted. `VICTORY_CARD_MEMORY=0` turns it off. Later commits added descriptor heaps, lists' scratch and textures made for Streamline as owners, and the texture and shared buffer blocks' free space and fill (#4462). - **Windows outside the shared buffer blocks:** with growing, windows of title memory are 4 MiB or less and were cut from `pool.rs`'s 64 MiB shared blocks, which they left fragmented. Each window is now an allocation of its own. `VICTORY_WINDOWS_POOLED=1` brings back the old behaviour. - **Window growing on by default:** a cell's window covers what was asked for in it and grows when more is. `VICTORY_WINDOW_GROW=0` turns it off. - **A measurement switch, off by default:** `VICTORY_VIEW_REACH=1` makes translated programs note how far each root view is read. It's slow (2-3 fps) and only meant for measuring. `VICTORY_WINDOW_ROOT_KB` uses those numbers to bound a root view's window, also off by default (it saved nothing at a safe margin, see below). The card memory ledger can be split out into its own PR (with window growing stacked on top) if that's easier to review. ## Measurements One PC: RTX 4070 Ti 12 GB, 32 GB RAM, Windows 11. Series X, 1440p, DLSS Performance, 2x frame generation. Same save and spot, an unattended 12-minute run each, the last few minutes compared. | | Before (`main`) | With this | |---|---|---| | Shared memory in use, steady | 7,604 MB | 5,776 MB (-24 %) | | Windows of title memory | 4,682 MB | 3,274 MB | | Shared buffer blocks (`pool.rs`) | 512 MB | 448 MB, 76 % in use | | Peak commit | 61.3 GB | 58.8 GB | | Peak private | 25.7 GB | 24.8 GB | | fps (median) | 23.1 | 23.2 | | Draws a frame | 5,395 | 5,435 | A run with the new defaults and no switches at all came out at about 6.0 GB of shared memory, in a slightly lighter stretch (about 4,900 draws). So -20 % to -24 % is a fair range. Moving to a busier area later raised it to about 6.9 GB, with nothing piling up. ## Details ### What the ledger showed The shared memory was mostly the layer's own, on purpose, not the driver moving things off a full card: - **Windows of title memory held 4.7-4.9 GB of the 7.6 GB.** - **About 1.4 GB of the windows asked for with a length lay outside anything ever asked for.** Those windows were 6 MiB, and three quarters of each was never asked for. - **64 KiB rounding of title buffer copies was only a few MB.** ### The ledger and the game's RAM On NVIDIA the driver maps the card's own memory into the process as write-combined private pages, so it counts in the game's private bytes one for one. #4288 found and measured this, and #4204 fixes the process line's accounting that hid it. 16 min into a run on this PR: 18.8 GB of host private bytes were unnamed, and the card's use (9.1 GB) plus the shared memory (6.8 GB) covered 15.9 GB of it. So the ledger's two groups together say where most of the game's RAM goes, and a cut in either is a cut in RAM. ### Why growing alone wasn't enough Growing makes windows fit their asks: the windows asked for with a length went from 24 % to 91 % used. But the smaller windows were then cut from the shared buffer blocks. A block goes back only when it's empty, and each block kept a few long-lived windows. In one run that was 49 blocks holding 3,136 MB, with about 945 MB live and 33 of the blocks under a quarter full. Shared memory went up rather than down. With windows as allocations of their own, the gain shows. Turning the blocks off on their own changes nothing, because the default windows are 6 MiB and never pooled. ### The loading spike While the world first loads, the windows a longer one replaces are held for about ten seconds beside it. In one run that was 1,754 windows, 3,738 MB, and shared memory peaked at about 9.4 GB. It was back at the steady figure about ten seconds later, and peak commit was still lower than before. ### Root views A root view has no size, so its window runs to the end of its 4 MiB cell plus 2 MiB. `VICTORY_VIEW_REACH` measured 8,758 of them: 93 % were read no more than 64 KiB past their address, and the furthest 1.4 MB. Bounding them at 2 MiB past their address (`VICTORY_WINDOW_ROOT_KB=2048`) saved nothing, because the margin needed for the few long ones cancels the gain. So it stays off. A bound per kind of view might do better, and the switch is there to measure that. ## Not covered - One PC and one scene, plus a short move to another area. - I checked the picture by eye outdoors and indoors, on this commit and against `main` without it. Nothing new or worse. ## Tests - **Ledger:** heap types lie in their groups; a buffer and a heap are counted until they go (WARP); asked bytes are counted with their object and go with it; the asker holds inside its scope only. - **Windows:** the span of each window is what was asked for; each window needs up to its furthest read; a root reach bounds an ask without a length by its address. - **`VICTORY_VIEW_REACH`:** a root view read notes its reach only when asked, and a format load through a root view too. Both validate with `dxil.dll`. - **Suites:** `cargo test -p victory-gpu --lib`: 922 pass. Two fail, and they fail without this change too: - `every_switch_of_the_translator_is_in_the_key`: `VICTORY_SCALAR_SPLITS` is in the cache key, but the translator no longer reads it. - `a_change_is_saved_at_once_however_the_game_was_started`: flaky here, and it passes on its own. - `cargo test -p victory-shader --lib`: 465 pass.
neongatzu commented 2026-11-29 22:02:48 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by neongatzu on 2026-11-29T22:02:48Z.


Tested on an 8 GB card with 16 GB of RAM, where the PC's memory shared with the card is the wall. Caveat first: this was not upstream main. I applied this PR's commit onto another fork's tree (4 conflicts, resolved by hand: buffer_sides takes both the image flag and own; resize_fetch is not in that tree and was left out; shared_buffer there returns a Result). The rest of the run's switches are that fork's launcher defaults.

PC: RTX 3060 Ti 8 GB, 16 GB RAM, Windows 11 26200, NVIDIA 621.24, 64 GB fixed pagefile on NVMe. Series S profile, 1080 upscaled to 1440, DLSS Performance, no frame generation.

Without this PR (same scene): the run ended after about 7 minutes with 0x8007000E when a host command list closed; shared memory peaked at 7,189 MB against a cap of about 7.5 GB, the card at 8,020 MB of a ~7,000 MB budget.

With this PR (defaults): the run lasted 11.5 minutes and was closed by hand, no crash. Shared memory peaked at 7,058 MB, the card at 7,392 MB. Frame rate unchanged (median ~15-17 fps, bound by host-copy refreshes paging on this RAM size). The ledger line was the most useful part, e.g. after 8 minutes:

the PC's memory shared with the card: 6618 MB in use, we counted 6061 MB
(windows of title memory 4650, copies of title buffers 868, uploads 399, ...)
windows: 231 asked for with lengths only, holding 393 MB (91 % asked);
799 asked for without a length, holding 4373 MB, 2184 MB (49 %) between
the lowest and highest address asked
shared buffer blocks: 0 holding 0 MB

So on this PC the shared blocks are gone as intended, windows asked with a length are tight, and nearly all window memory is root views without a length.

With VICTORY_WINDOW_ROOT_KB=2048 added: memory dropped a lot (shared 5,041 MB, windows without a length 609 holding 2,625 MB after 4 minutes), but after 4 minutes a host command list failed to close with 0x80070057 (E_INVALIDARG, "a command recorded into it was invalid"). That error did not appear in any of the earlier runs on this PC today, with or without this PR, so the root reach looks like the cause: perhaps some step still sizes a copy or a view by the cell's extent rather than the shorter window. I had no diagnostics build to name the command with VICTORY_D3D12_DEBUG=1. The ledger showed 8 windows taken over by a longer one at the moment of the crash, 0 in the minutes before.

Happy to run a diagnostics build if that would help.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7263357438 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7263357438). Originally posted by [neongatzu](https://github.com/neongatzu) on 2026-11-29T22:02:48Z. --- Tested on an 8 GB card with 16 GB of RAM, where the PC's memory shared with the card is the wall. Caveat first: this was not upstream main. I applied this PR's commit onto another fork's tree (4 conflicts, resolved by hand: `buffer_sides` takes both the image flag and `own`; `resize_fetch` is not in that tree and was left out; `shared_buffer` there returns a `Result`). The rest of the run's switches are that fork's launcher defaults. **PC:** RTX 3060 Ti 8 GB, 16 GB RAM, Windows 11 26200, NVIDIA 621.24, 64 GB fixed pagefile on NVMe. Series S profile, 1080 upscaled to 1440, DLSS Performance, no frame generation. **Without this PR** (same scene): the run ended after about 7 minutes with `0x8007000E` when a host command list closed; shared memory peaked at 7,189 MB against a cap of about 7.5 GB, the card at 8,020 MB of a ~7,000 MB budget. **With this PR (defaults):** the run lasted 11.5 minutes and was closed by hand, no crash. Shared memory peaked at 7,058 MB, the card at 7,392 MB. Frame rate unchanged (median ~15-17 fps, bound by host-copy refreshes paging on this RAM size). The ledger line was the most useful part, e.g. after 8 minutes: ``` the PC's memory shared with the card: 6618 MB in use, we counted 6061 MB (windows of title memory 4650, copies of title buffers 868, uploads 399, ...) windows: 231 asked for with lengths only, holding 393 MB (91 % asked); 799 asked for without a length, holding 4373 MB, 2184 MB (49 %) between the lowest and highest address asked shared buffer blocks: 0 holding 0 MB ``` So on this PC the shared blocks are gone as intended, windows asked with a length are tight, and nearly all window memory is root views without a length. **With `VICTORY_WINDOW_ROOT_KB=2048` added:** memory dropped a lot (shared 5,041 MB, windows without a length 609 holding 2,625 MB after 4 minutes), but after 4 minutes a host command list failed to close with `0x80070057` (E_INVALIDARG, "a command recorded into it was invalid"). That error did not appear in any of the earlier runs on this PC today, with or without this PR, so the root reach looks like the cause: perhaps some step still sizes a copy or a view by the cell's extent rather than the shorter window. I had no diagnostics build to name the command with `VICTORY_D3D12_DEBUG=1`. The ledger showed 8 windows taken over by a longer one at the moment of the crash, 0 in the minutes before. Happy to run a diagnostics build if that would help.
DoubleD17 commented 2026-11-29 23:01:35 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by DoubleD17 on 2026-11-29T23:01:35Z.


We ran a test of this PR on a 12 GB RTX 50 card, A/B against its own base (f889bb07, the v2026.11.29.02 hotfix this branch sits on). The gain holds there, and is larger than on the 4070 Ti.

Setup:

  • RTX 5070 12 GB, Ryzen 7 5800X, 64 GB RAM, Windows 11;
  • Series X, 1440p, DLSS Performance, frame generation and ray tracing off;
  • both builds fully preloaded, same save, standing still;
  • 150 s per run, base / PR / base / PR;
  • memory as the median of the last ~100 s of per-process GPU counters (steady state, after the loading spike); frame figures as medians of the 5 s host lines.
base (2 runs) this PR (2 runs)
shared GPU memory, steady 7.84 / 7.85 GB 5.57 / 5.41 GB (-30 %)
dedicated GPU memory, steady 9.46 / 9.18 GB 8.70 / 8.61 GB
private bytes, steady 29.4 / 28.9 GB 26.3 / 25.7 GB
fps (mean) 14.3 / 13.6 13.7 / 15.0
preparing, submitting thread 65.1 / 68.1 ms 66.6 / 62.3 ms
frame p95 88 / 96 ms 95 / 86 ms

So it's about -2.3 GB shared and -3 GB private, with no measurable change in frame rate or CPU time on this machine.

Pictures: a burst check (10 captures a second, counted by eye) shows one-frame stretched polygons and flashing trees on both sides at about the same rate. On the base alone it was 12 of 100 frames. That is the folding default of the hotfix, which 05d1c564 fixes on main; current main showed none here. A rebase onto main would let a picture check of this PR come out clean.

AI Assisted

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7264135233 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7264135233). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-11-29T23:01:35Z. --- We ran a test of this PR on a 12 GB RTX 50 card, A/B against its own base (f889bb07, the v2026.11.29.02 hotfix this branch sits on). The gain holds there, and is larger than on the 4070 Ti. **Setup:** - RTX 5070 12 GB, Ryzen 7 5800X, 64 GB RAM, Windows 11; - Series X, 1440p, DLSS Performance, frame generation and ray tracing off; - both builds fully preloaded, same save, standing still; - 150 s per run, base / PR / base / PR; - memory as the median of the last ~100 s of per-process GPU counters (steady state, after the loading spike); frame figures as medians of the 5 s host lines. | | base (2 runs) | this PR (2 runs) | |---|---|---| | shared GPU memory, steady | 7.84 / 7.85 GB | **5.57 / 5.41 GB** (-30 %) | | dedicated GPU memory, steady | 9.46 / 9.18 GB | 8.70 / 8.61 GB | | private bytes, steady | 29.4 / 28.9 GB | 26.3 / 25.7 GB | | fps (mean) | 14.3 / 13.6 | 13.7 / 15.0 | | preparing, submitting thread | 65.1 / 68.1 ms | 66.6 / 62.3 ms | | frame p95 | 88 / 96 ms | 95 / 86 ms | So it's about -2.3 GB shared and -3 GB private, with no measurable change in frame rate or CPU time on this machine. **Pictures:** a burst check (10 captures a second, counted by eye) shows one-frame stretched polygons and flashing trees on both sides at about the same rate. On the base alone it was 12 of 100 frames. That is the folding default of the hotfix, which 05d1c564 fixes on main; current main showed none here. A rebase onto main would let a picture check of this PR come out clean. AI Assisted
Jesper-Andersson commented 2026-11-30 21:03:08 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-11-30T21:03:08Z.


We built a similar per-class counter for the card's memory on our fork, before we saw this PR. Rather than open a second ledger PR, we'd like to offer the few parts of ours that aren't in your card memory by owner: line or on main yet. This is step 0 of #4462, which has our measurements.

What your line already covers, as we read the diff: both memory groups, bytes by owner (texture blocks, render targets, aliased target heaps, depth twins, card copies, buffers made ahead and more), the uncounted rest against QueryVideoMemoryInfo, rounding against what the title asked for, the window spans, and a fill census of the shared buffer blocks. Main also prints the texture blocks' free and resting MB, empty blocks and a four-bucket fullness count on request (VICTORY_POOL_STATS=1). Ours counts only the card's own memory, so most of it overlaps with those.

What ours adds:

  1. In the same 1 Hz line, beside DXGI's CurrentUsage:
    • the texture blocks' free-inside and resting bytes, next to the other owners and the DXGI figure, rather than in a separate line;
    • owners your hooks don't reach yet: shader-visible descriptor heaps, and the resources we make for Streamline;
    • scratch on its own owner (list scratch, linear detile targets, the sampled-marks buffer), with its idle spares. As far as we can tell, scratch lands under "card copies of title memory" today, but we haven't checked each site.
  2. A finer fill histogram of the 64 MiB texture blocks, every ~10 s: six buckets (0 %, 1-25, 25-50, 50-75, 75-99, 100 %) with the MB free in each, not only counts. It shows whether the free space sits in empty blocks (a release would get it back) or is spread over live ones (only compaction would).

From one 28-minute session on our build:

  • At the end, 869 MB was free inside 4,096 MB of texture blocks.
  • At the last histogram (20:28:35 UTC), no block was empty, and 22 of 64 blocks were 50-75 % full, holding 545 MB of that free space.
  • Our counted sum stayed about 0.85 GB below DXGI's in use. That is likely mostly what we don't make ourselves: DLSS and frame generation internals, the swap chain, the driver.

The over-time table is in #4462.

A companion number that is already on main: with VICTORY_SMALL_WHEN_FULL, the "textures made from their small levels for want of room ... waiting to grow now N" line. Next to the texture-block figures it shows when the card is full enough that textures start small.

Setup: our fork's build (upstream v2026.11.30.02, plus opt-in ports that are off unless set, plus our counter commit). RTX 2070 SUPER 8 GB, driver 621.40, Windows 11, Series S profile, DLSS Performance, FSR 3 frame generation. GPU clock state not recorded.

Not tested: we haven't run this PR. Our counter has run in a few sessions on one PC. It counts the card's own memory only.

Two ways this could go:

  • we send these parts as a small follow-up PR on top of this one once it lands, under your owners and your line; or
  • you take them into this PR: we'd push our branch (one commit, on our fork) for you to take them from.

Which do you prefer?

Drafted with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7291847257 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7291847257). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-30T21:03:08Z. --- We built a similar per-class counter for the card's memory on our fork, before we saw this PR. Rather than open a second ledger PR, we'd like to offer the few parts of ours that aren't in your `card memory by owner:` line or on main yet. This is step 0 of #4462, which has our measurements. What your line already covers, as we read the diff: both memory groups, bytes by owner (texture blocks, render targets, aliased target heaps, depth twins, card copies, buffers made ahead and more), the uncounted rest against `QueryVideoMemoryInfo`, rounding against what the title asked for, the window spans, and a fill census of the shared buffer blocks. Main also prints the texture blocks' free and resting MB, empty blocks and a four-bucket fullness count on request (`VICTORY_POOL_STATS=1`). Ours counts only the card's own memory, so most of it overlaps with those. What ours adds: 1. **In the same 1 Hz line, beside DXGI's `CurrentUsage`:** - the texture blocks' free-inside and resting bytes, next to the other owners and the DXGI figure, rather than in a separate line; - owners your hooks don't reach yet: shader-visible descriptor heaps, and the resources we make for Streamline; - scratch on its own owner (list scratch, linear detile targets, the sampled-marks buffer), with its idle spares. As far as we can tell, scratch lands under "card copies of title memory" today, but we haven't checked each site. 2. **A finer fill histogram of the 64 MiB texture blocks**, every ~10 s: six buckets (0 %, 1-25, 25-50, 50-75, 75-99, 100 %) with the MB free in each, not only counts. It shows whether the free space sits in empty blocks (a release would get it back) or is spread over live ones (only compaction would). From one 28-minute session on our build: - At the end, 869 MB was free inside 4,096 MB of texture blocks. - At the last histogram (20:28:35 UTC), no block was empty, and 22 of 64 blocks were 50-75 % full, holding 545 MB of that free space. - Our counted sum stayed about 0.85 GB below DXGI's in use. That is likely mostly what we don't make ourselves: DLSS and frame generation internals, the swap chain, the driver. The over-time table is in #4462. A companion number that is already on main: with `VICTORY_SMALL_WHEN_FULL`, the "textures made from their small levels for want of room ... waiting to grow now N" line. Next to the texture-block figures it shows when the card is full enough that textures start small. Setup: our fork's build (upstream v2026.11.30.02, plus opt-in ports that are off unless set, plus our counter commit). RTX 2070 SUPER 8 GB, driver 621.40, Windows 11, Series S profile, DLSS Performance, FSR 3 frame generation. GPU clock state not recorded. Not tested: we haven't run this PR. Our counter has run in a few sessions on one PC. It counts the card's own memory only. Two ways this could go: - we send these parts as a small follow-up PR on top of this one once it lands, under your owners and your line; or - you take them into this PR: we'd push our branch (one commit, on our fork) for you to take them from. Which do you prefer? Drafted with AI assistance (Claude Code).
Remorce commented 2026-11-30 21:13:54 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remorce on 2026-11-30T21:13:54Z.


@Jesper-Andersson added the texture block detail to the card memory by owner: line (2f58529d). New part, between the windows and the shared buffer blocks:

texture blocks: 64 holding 4096 MB, of which 3268 MB in live pieces, 812 MB free, 16 MB resting; by fill 1/3/9/21/30
  • Covers both texture pools (the 64 MiB blocks and the 4 KiB-placed ones), same as the texture blocks owner earlier in the line.
  • free is free space inside the blocks. DXGI counts it as in use; only an empty block can be given back.
  • resting was given back but can't be reused yet.
  • by fill is blocks that are empty / under ¼ full / ¼–½ / ½–¾ / ¾ and up. Each block is in one, so they add up to the block count. Empty is split out so idle blocks show on their own.
  • The shared buffer blocks use the same format now.
  • Read every 5 s with the rest of the line. Says busy if a pool is locked at that moment.

The per-class split was already in the line (render targets, title buffer copies, card copies of title memory, windows, uploads), so your steps can read from it instead of a second counter.

On a 4070 Ti 12 GB, 10 min in-world: about 30 blocks, 60–200 MB free inside, empty blocks in 12 of 95 samples (never more than 2). Same picture as yours.

NOTE: I started adding this before seeing your comment above since I didn't refresh the page, sorry. Was going off your issue tag. Reviewing the extra notes you added.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7292102812 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7292102812). Originally posted by [Remorce](https://github.com/Remorce) on 2026-11-30T21:13:54Z. --- @Jesper-Andersson added the texture block detail to the `card memory by owner:` line (2f58529d). New part, between the windows and the shared buffer blocks: ``` texture blocks: 64 holding 4096 MB, of which 3268 MB in live pieces, 812 MB free, 16 MB resting; by fill 1/3/9/21/30 ``` - Covers both texture pools (the 64 MiB blocks and the 4 KiB-placed ones), same as the `texture blocks` owner earlier in the line. - `free` is free space inside the blocks. DXGI counts it as in use; only an empty block can be given back. - `resting` was given back but can't be reused yet. - `by fill` is blocks that are empty / under ¼ full / ¼–½ / ½–¾ / ¾ and up. Each block is in one, so they add up to the block count. Empty is split out so idle blocks show on their own. - The shared buffer blocks use the same format now. - Read every 5 s with the rest of the line. Says `busy` if a pool is locked at that moment. The per-class split was already in the line (render targets, title buffer copies, card copies of title memory, windows, uploads), so your steps can read from it instead of a second counter. On a 4070 Ti 12 GB, 10 min in-world: about 30 blocks, 60–200 MB free inside, empty blocks in 12 of 95 samples (never more than 2). Same picture as yours. NOTE: I started adding this before seeing your comment above since I didn't refresh the page, sorry. Was going off your issue tag. Reviewing the extra notes you added.
Remorce commented 2026-11-30 21:36:20 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remorce on 2026-11-30T21:36:20Z.


@Jesper-Andersson went with folding them in, since you offered (ff647c58):

  • Shader-visible descriptor heaps: own owner, sized as descriptors × the device's increment.
  • Textures we make for Streamline (FG depth/motion snapshots, the start checks): own owner. DLSS/FG internals stay uncounted.
  • Lists' scratch on the card (uav_pool::take_uav: between-copies, indirect budgets/args/batches): own owner, with idle spares shown once they pass 1 MB. You were right that it sat under card copies of title memory before.
  • Block fill is your six buckets now, with MB free in each (empty / <¼ / ¼–½ / ½–¾ / ¾–99 / 100). Shared buffer blocks use it too.

2 min in-world on a 4070 Ti 12 GB:

texture blocks: 43 holding 2752 MB, of which 2308 MB in live pieces, 377 MB free, 66 MB resting; by fill 0/1/1/8/26/7 (MB free 0/53/33/194/95/0)

Owners added descriptor heaps 30 and lists' scratch 25. The uncounted card part dropped from ~570–610 to 526 MB at the same point.

GPU detile targets are only made with VICTORY_GPU_DETILE=1 (off by default), so they're not tagged.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7292639544 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7292639544). Originally posted by [Remorce](https://github.com/Remorce) on 2026-11-30T21:36:20Z. --- @Jesper-Andersson went with folding them in, since you offered (ff647c58): - Shader-visible descriptor heaps: own owner, sized as descriptors × the device's increment. - Textures we make for Streamline (FG depth/motion snapshots, the start checks): own owner. DLSS/FG internals stay uncounted. - Lists' scratch on the card (`uav_pool::take_uav`: between-copies, indirect budgets/args/batches): own owner, with idle spares shown once they pass 1 MB. You were right that it sat under card copies of title memory before. - Block fill is your six buckets now, with MB free in each (empty / <¼ / ¼–½ / ½–¾ / ¾–99 / 100). Shared buffer blocks use it too. 2 min in-world on a 4070 Ti 12 GB: ``` texture blocks: 43 holding 2752 MB, of which 2308 MB in live pieces, 377 MB free, 66 MB resting; by fill 0/1/1/8/26/7 (MB free 0/53/33/194/95/0) ``` Owners added `descriptor heaps 30` and `lists' scratch 25`. The uncounted card part dropped from ~570–610 to 526 MB at the same point. GPU detile targets are only made with `VICTORY_GPU_DETILE=1` (off by default), so they're not tagged.
Remorce commented 2026-12-01 02:32:31 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remorce on 2026-12-01T02:32:31Z.


@neongatzu thanks, the 8 GB / 16 GB case is the one this is for, and the 0x8007000E going away matters more than the peak numbers.

Your window line matches ours: on a 4070 Ti over 89 min, the windows asked for without a length grew from 695 to 824 (3.9 to 4.6 GB), with about half their bytes past the highest address read. That's the next thing I'm looking at.

Two PRs that bear on your ledger numbers at 16 GB: #4204 fixes the process line's accounting (console section views were counted as named private bytes, which hid most of the unnamed part; found on a 16 GB / 2060 PC), and #4288 shows that on NVIDIA the card's memory is mapped into the process, so it counts in private bytes, and adds VICTORY_TEXTURE_COMMIT_FLOOR_MB, which lowers the texture limit when the PC's commit left falls under 4 GB. That floor never acted on my 32 GB PC; on yours it likely would.

Yes to the diagnostics run, for the VICTORY_WINDOW_ROOT_KB=2048 case only: a diagnostics build with VICTORY_D3D12_DEBUG=1 names the command when a list fails to close. If it names a copy or view that reads past a root window's end, the cap is cutting off something the card still reads, and the fix has to bound windows by measured reach rather than a fixed size. If it names something else, it's likely the late-session 0x80070057 that main hits without this PR too.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7298727600 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7298727600). Originally posted by [Remorce](https://github.com/Remorce) on 2026-12-01T02:32:31Z. --- @neongatzu thanks, the 8 GB / 16 GB case is the one this is for, and the `0x8007000E` going away matters more than the peak numbers. Your window line matches ours: on a 4070 Ti over 89 min, the windows asked for without a length grew from 695 to 824 (3.9 to 4.6 GB), with about half their bytes past the highest address read. That's the next thing I'm looking at. Two PRs that bear on your ledger numbers at 16 GB: #4204 fixes the process line's accounting (console section views were counted as named private bytes, which hid most of the unnamed part; found on a 16 GB / 2060 PC), and #4288 shows that on NVIDIA the card's memory is mapped into the process, so it counts in private bytes, and adds `VICTORY_TEXTURE_COMMIT_FLOOR_MB`, which lowers the texture limit when the PC's commit left falls under 4 GB. That floor never acted on my 32 GB PC; on yours it likely would. Yes to the diagnostics run, for the `VICTORY_WINDOW_ROOT_KB=2048` case only: a diagnostics build with `VICTORY_D3D12_DEBUG=1` names the command when a list fails to close. If it names a copy or view that reads past a root window's end, the cap is cutting off something the card still reads, and the fix has to bound windows by measured reach rather than a fixed size. If it names something else, it's likely the late-session `0x80070057` that main hits without this PR too.
Remorce commented 2026-12-01 02:32:33 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remorce on 2026-12-01T02:32:33Z.


@DoubleD17 thanks for the A/B. -2.3 GB shared and -3 GB private with no change in frame time is an awesome result to see.

The branch is on current main now (ff647c58), so the folding fix (05d1c564) is in. If you have time for the picture check again, that would tell us whether anything on screen comes from this PR.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7298728020 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7298728020). Originally posted by [Remorce](https://github.com/Remorce) on 2026-12-01T02:32:33Z. --- @DoubleD17 thanks for the A/B. -2.3 GB shared and -3 GB private with no change in frame time is an awesome result to see. The branch is on current main now (ff647c58), so the folding fix (05d1c564) is in. If you have time for the picture check again, that would tell us whether anything on screen comes from this PR.
shurhundo commented 2026-12-01 02:37:39 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by shurhundo on 2026-12-01T02:37:39Z.


Heads up: this overlaps #3723 (open, currently mergeable), which adds a crate::tiers refault/Holds system and a fix (fc7d3930) for grown() not reporting regrown windows to it, exactly the VICTORY_WINDOW_GROW=1 path this PR makes the default. Neither PR currently references the other, and both edit grown()/grow_reach()/made_window()/buffer_sides(), so whichever lands second will need to rethread its changes through the other's reshaped functions. Once this PR's default flip ships, #3723's refault fix stops being opt-in coverage and becomes load-bearing for everyone's default window behavior, so it's worth syncing merge order with that PR rather than landing independently.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7298819528 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7298819528). Originally posted by [shurhundo](https://github.com/shurhundo) on 2026-12-01T02:37:39Z. --- Heads up: this overlaps #3723 (open, currently mergeable), which adds a `crate::tiers` refault/Holds system and a fix (fc7d3930) for `grown()` not reporting regrown windows to it, exactly the `VICTORY_WINDOW_GROW=1` path this PR makes the default. Neither PR currently references the other, and both edit `grown()`/`grow_reach()`/`made_window()`/`buffer_sides()`, so whichever lands second will need to rethread its changes through the other's reshaped functions. Once this PR's default flip ships, #3723's refault fix stops being opt-in coverage and becomes load-bearing for everyone's default window behavior, so it's worth syncing merge order with that PR rather than landing independently.
nidea1 commented 2026-12-01 03:09:24 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nidea1 on 2026-12-01T03:09:24Z.


Tested VICTORY_WINDOW_GROW=1 on an 8 GB VRAM / 32 GB RAM NVIDIA system — strong improvement on both Shared GPU RAM and frame-time stability.

System & profile:

  • GPU: RTX 3060 Ti 8 GB (ReBAR off, 256 MiB BAR1, NVIDIA driver 621.40), 32 GB system RAM, Windows 11
  • Profile: Series S, DLSS Quality, FSR 3 frame generation (--fg-type fsr --framegen 3), ray tracing off, warm pipeline cache (2,742–2,748 pipelines loaded), VICTORY_SAMPLED_EVICT=1, VICTORY_AMBIENT=0.8, VICTORY_AMBIENT_SPECULAR=1

Matched 60 s in-world A/B (+10 s..+58 s steady window):

Metric Baseline (VICTORY_WINDOW_GROW=0) VICTORY_WINDOW_GROW=1 Delta
Shared GPU RAM (end / peak) 8,020 / 8,373 MB 7,075 / 7,395 MB -945 MB end / -978 MB peak
Process PrivateBytes (end / peak) 24,416 / 24,736 MB 24,114 / 24,114 MB -302 MB end / -622 MB peak
GPU CardMeter (T+U+C) 35.7 ms (34.2+1.1+0.4) 34.9 ms (33.4+1.1+0.4) -0.8 ms
FPS mean (median) 25.1 (24.8) 25.5 (24.8) +0.4 FPS
Frametime p99 (max steady) 64.8 ms (153.4 ms) 62.5 ms (103.8 ms) -2.3 ms p99
>100 ms hitches (steady / all) 3 / 6 1 / 4 3x fewer steady hitches
Eviction remakes (<2 s) 2,799 (466) 2,754 (336) -28% <2 s remakes
VRAM / budget 6,840 / 6,991 MB 6,858 / 7,012 MB flat

Both runs logged HERO LEAD = 0, UPLOAD OVER HOST WRITE = 0, and 0 Victory errors.

Extended 12-minute soak stability (VICTORY_WINDOW_GROW=1 + VICTORY_SAMPLED_EVICT=1):

  • Re-tested in a 12-minute (720.7 s in-world, 16,447 frames) live soak on 7d93ee0759 alongside our rebased local optimization stack (VICTORY_POOL_SMALL=0, VICTORY_RIPE_BLOCKS=12).
  • Completed cleanly with 0 crashes, 0 device losses, 0 Victory errors, 0 >100 ms hitches in the final 8.7 minutes, and steady-state Shared GPU RAM down to 5,837 MB (-2.1 GB vs the baseline above) with no visual artifacts across inspected start/mid/end frames.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7299386824 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7299386824). Originally posted by [nidea1](https://github.com/nidea1) on 2026-12-01T03:09:24Z. --- Tested `VICTORY_WINDOW_GROW=1` on an 8 GB VRAM / 32 GB RAM NVIDIA system — strong improvement on both Shared GPU RAM and frame-time stability. **System & profile:** - GPU: RTX 3060 Ti 8 GB (ReBAR off, 256 MiB BAR1, NVIDIA driver 621.40), 32 GB system RAM, Windows 11 - Profile: Series S, DLSS Quality, FSR 3 frame generation (`--fg-type fsr --framegen 3`), ray tracing off, warm pipeline cache (`2,742–2,748` pipelines loaded), `VICTORY_SAMPLED_EVICT=1`, `VICTORY_AMBIENT=0.8`, `VICTORY_AMBIENT_SPECULAR=1` **Matched 60 s in-world A/B (`+10 s..+58 s` steady window):** | Metric | Baseline (`VICTORY_WINDOW_GROW=0`) | `VICTORY_WINDOW_GROW=1` | Delta | |---|---:|---:|---:| | Shared GPU RAM (end / peak) | 8,020 / 8,373 MB | **7,075 / 7,395 MB** | **-945 MB end / -978 MB peak** | | Process PrivateBytes (end / peak) | 24,416 / 24,736 MB | **24,114 / 24,114 MB** | **-302 MB end / -622 MB peak** | | GPU CardMeter (`T+U+C`) | 35.7 ms (`34.2+1.1+0.4`) | **34.9 ms** (`33.4+1.1+0.4`) | **-0.8 ms** | | FPS mean (median) | 25.1 (24.8) | **25.5 (24.8)** | **+0.4 FPS** | | Frametime p99 (max steady) | 64.8 ms (153.4 ms) | **62.5 ms (103.8 ms)** | **-2.3 ms p99** | | `>100 ms` hitches (steady / all) | 3 / 6 | **1 / 4** | **3x fewer steady hitches** | | Eviction remakes (`<2 s`) | 2,799 (466) | **2,754 (336)** | **-28% `<2 s` remakes** | | VRAM / budget | 6,840 / 6,991 MB | 6,858 / 7,012 MB | flat | Both runs logged `HERO LEAD = 0`, `UPLOAD OVER HOST WRITE = 0`, and `0` Victory errors. **Extended 12-minute soak stability (`VICTORY_WINDOW_GROW=1` + `VICTORY_SAMPLED_EVICT=1`):** - Re-tested in a 12-minute (720.7 s in-world, 16,447 frames) live soak on `7d93ee0759` alongside our rebased local optimization stack (`VICTORY_POOL_SMALL=0`, `VICTORY_RIPE_BLOCKS=12`). - Completed cleanly with `0` crashes, `0` device losses, `0` Victory errors, `0` `>100 ms` hitches in the final 8.7 minutes, and steady-state Shared GPU RAM down to `5,837 MB` (`-2.1 GB` vs the baseline above) with no visual artifacts across inspected start/mid/end frames.
Remorce commented 2026-12-01 07:11:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Remorce on 2026-12-01T07:11:44Z.


Heads-up: with ray tracing on, this PR currently loses the device.

  • VICTORY_HW_RT=1 at 4K, DLSS Performance: #2910 alone loses the device (0x887A0005) about 20 s in, where main at the same commit (e1251c31) runs the full 5 min. The emulated path does the same.
  • #4337 stretches it to about 4 min, so this PR seems to make the race #4337 fixes (a top level naming a bottom structure not yet submitted) a lot more likely.
  • It's not #4527 or the 0x80070057 crash fixes; both were ruled out.
  • Without ray tracing it's unaffected. I haven't found the cause yet; a diagnostics run to name the command is next. Use it without ray tracing for now.

Runs and numbers: https://github.com/trustno1-coder/VIctory-NVIDIA/discussions/4773

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7303756729 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2910#issuecomment-7303756729). Originally posted by [Remorce](https://github.com/Remorce) on 2026-12-01T07:11:44Z. --- Heads-up: with ray tracing on, this PR currently loses the device. - `VICTORY_HW_RT=1` at 4K, DLSS Performance: #2910 alone loses the device (`0x887A0005`) about 20 s in, where main at the same commit (e1251c31) runs the full 5 min. The emulated path does the same. - #4337 stretches it to about 4 min, so this PR seems to make the race #4337 fixes (a top level naming a bottom structure not yet submitted) a lot more likely. - It's not #4527 or the 0x80070057 crash fixes; both were ruled out. - Without ray tracing it's unaffected. I haven't found the cause yet; a diagnostics run to name the command is next. Use it without ray tracing for now. Runs and numbers: https://github.com/trustno1-coder/VIctory-NVIDIA/discussions/4773
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2910:upstream-pr/2910'
git switch 'upstream-pr/2910'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2910'
git switch 'upstream-pr/2910'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2910'
git switch 'upstream-pr/2910'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2910'
git switch 'main'
git merge --squash 'upstream-pr/2910'
git switch 'main'
git merge --ff-only 'upstream-pr/2910'
git switch 'main'
git merge 'upstream-pr/2910'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!2910
No description provided.