Reduce memory use on 8 GiB GPUs #1411

Merged
mestremario3 merged 5 commits from upstream-pr/1411 into main 2026-11-29 08:16:56 +00:00
mestremario3 commented 2026-11-28 19:16:29 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mestremario3 on 2026-11-28T19:16:29Z.


Summary

  • Enable on-demand mip-level residency automatically for adapters with a DXGI budget up to 8 GiB. Explicit VICTORY_LEVELS_ON_DEMAND=0 opts out; =1 enables it on larger adapters.
  • Reduce the default render-target headroom reserve from 3 GiB to 2.5 GiB for budgets up to 8 GiB; preserve the existing environment override.
  • Cap the idle staging-buffer pool at 256 MiB instead of 512 MiB; existing host-memory pressure handling can trim it further.

Motivation

Small VRAM budgets can leave textures waiting for room while render-target headroom is reserved. On-demand mip residency avoids allocating card memory for texture levels the title does not currently hold. A smaller idle staging cache also reduces retained host RAM.

Validation

  • cargo check -p victory-gpu -p victory passed.
  • git diff --check passed.
  • Not yet validated in a live game session on an 8 GiB GPU.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5543702258 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1411). Originally posted by [mestremario3](https://github.com/mestremario3) on 2026-11-28T19:16:29Z. --- ## Summary - Enable on-demand mip-level residency automatically for adapters with a DXGI budget up to 8 GiB. Explicit `VICTORY_LEVELS_ON_DEMAND=0` opts out; `=1` enables it on larger adapters. - Reduce the default render-target headroom reserve from 3 GiB to 2.5 GiB for budgets up to 8 GiB; preserve the existing environment override. - Cap the idle staging-buffer pool at 256 MiB instead of 512 MiB; existing host-memory pressure handling can trim it further. ## Motivation Small VRAM budgets can leave textures waiting for room while render-target headroom is reserved. On-demand mip residency avoids allocating card memory for texture levels the title does not currently hold. A smaller idle staging cache also reduces retained host RAM. ## Validation - `cargo check -p victory-gpu -p victory` passed. - `git diff --check` passed. - Not yet validated in a live game session on an 8 GiB GPU.
Jesper-Andersson commented 2026-11-28 20:52:54 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-11-28T20:52:54Z.


Measured data on the on-demand-levels part, from an 8 GB card (RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB; trustno1 main 8fc22547 plus #482 (keyboard and mouse, Dyslex1337, off by default); not measured on this PR's base 32ecacfa, which is 77 commits newer. Series S profile, DLSS Performance, VICTORY_CARD_ROOM_FOR_TARGETS_MB=1280 in every arm, so the new 2.5 GiB default was not in play; one open-world route, same length per arm, 2 runs per arm).

arm "no room" lines per run avg fps, last 180 s (per run)
VICTORY_LEVELS_ON_DEMAND=0 111 / 85 18.46 / 18.42
=1 1,124 / 1,168 18.19 / 18.42
=1 + VICTORY_LEVELS_MIN_KB=4096 1,191 / 1,210 18.33 / 18.22 (last run started about when the GPU clock was locked at 1890 MHz, so it is borderline)

The fps differences are all within noise (same-arm spread up to 0.23 fps). In one visual check with =1 we saw more black textures. #1401 (RTX 3070 8 GB, card full on 381 of 494 room checks) reports the same with =1: 15191 uploads left a held level without memory and missing textures, fixed by going back to 0. So on 8 GB cards that run near their budget, turning it on by default may trade VRAM for black textures, without an fps gain.

Not tested here: this PR itself (the automatic default for budgets up to 8 GiB), its 2.5 GiB reserve and the 256 MiB staging cap; other routes; other cards. On the reserve: as far as I can see, without the env var the reserve is already sized from the targets' peak (targets_kept_from_peak), so the 3 → 2.5 GiB change would mostly matter where that peak is large; no data on that from here.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7245611412 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1411#issuecomment-7245611412). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-28T20:52:54Z. --- Measured data on the on-demand-levels part, from an 8 GB card (RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB; trustno1 main 8fc22547 plus #482 (keyboard and mouse, Dyslex1337, off by default); not measured on this PR's base 32ecacfa, which is 77 commits newer. Series S profile, DLSS Performance, `VICTORY_CARD_ROOM_FOR_TARGETS_MB=1280` in every arm, so the new 2.5 GiB default was not in play; one open-world route, same length per arm, 2 runs per arm). | arm | "no room" lines per run | avg fps, last 180 s (per run) | |---|---|---| | `VICTORY_LEVELS_ON_DEMAND=0` | 111 / 85 | 18.46 / 18.42 | | `=1` | 1,124 / 1,168 | 18.19 / 18.42 | | `=1` + `VICTORY_LEVELS_MIN_KB=4096` | 1,191 / 1,210 | 18.33 / 18.22 (last run started about when the GPU clock was locked at 1890 MHz, so it is borderline) | The fps differences are all within noise (same-arm spread up to 0.23 fps). In one visual check with `=1` we saw more black textures. #1401 (RTX 3070 8 GB, card full on 381 of 494 room checks) reports the same with `=1`: `15191 uploads left a held level without memory` and missing textures, fixed by going back to `0`. So on 8 GB cards that run near their budget, turning it on by default may trade VRAM for black textures, without an fps gain. Not tested here: this PR itself (the automatic default for budgets up to 8 GiB), its 2.5 GiB reserve and the 256 MiB staging cap; other routes; other cards. On the reserve: as far as I can see, without the env var the reserve is already sized from the targets' peak (`targets_kept_from_peak`), so the 3 → 2.5 GiB change would mostly matter where that peak is large; no data on that from here.
burgmarcos commented 2026-11-28 21:57:44 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by burgmarcos on 2026-11-28T21:57:44Z.


Validated on RTX 3050 4 GB (Series S, tier 4): enabling VICTORY_LEVELS_ON_DEMAND=1 made performance worse (0.3-4.7 fps vs 29.9 baseline) and increased waiting textures from ~18k to ~27.6k. Not recommended for 4 GB cards.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7246397515 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1411#issuecomment-7246397515). Originally posted by [burgmarcos](https://github.com/burgmarcos) on 2026-11-28T21:57:44Z. --- Validated on RTX 3050 4 GB (Series S, tier 4): enabling VICTORY_LEVELS_ON_DEMAND=1 made performance worse (0.3-4.7 fps vs 29.9 baseline) and increased waiting textures from ~18k to ~27.6k. Not recommended for 4 GB cards.
icdmkg2 commented 2026-11-29 17:46:18 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by icdmkg2 on 2026-11-29T17:46:18Z.


A live 8 GB measurement, since the PR notes it wasn't validated in game yet.

Setup: RTX 5060 Laptop GPU (8 GB, DXGI budget about 7.1 GB, so auto turns it on), Ryzen 7 H 260, 32 GB, Windows 11, driver 621.24. main at 55d06914, release build, play-foxhound.ps1 defaults otherwise, Series S, DLSS performance, the same save (the prologue's cell), driven by a script: 60 s measured after a 30 s settle, shader cache warm. VICTORY_COMMIT_FLOOR_MB=1024 was set in all runs (with the default 4096, the memory guard kept putting compiles off on this PC). Only VICTORY_LEVELS_ON_DEMAND changes in the last row:

fps median frame time median submitting thread, ms per frame of it: snapshots refreshes
defaults (auto → on) 7.8 87.5 ms 87.5 11.7 24.0
defaults + VICTORY_POOL_SMALL=0 (control) 7.6 108.8 ms 86.4 18.5 24.3
defaults + VICTORY_LEVELS_ON_DEMAND=0 17.4 51.8 ms 52.9 0.0 15.3

Texture waits were about the same either way (19–21 "no room, new textures wait" lines a run), so on this card the saving doesn't show up as fewer waiting textures. The cost lands on the submitting thread: snapshots (0 → 12 ms) and refreshes (+9 ms). That fits the reports above from the 2070 SUPER and the 3050.

So auto currently halves the frame rate on at least this 8 GB card, by default. Keeping it opt-in (=1) seems safer until its per-frame cost on the submitting thread is down.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7259951850 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1411#issuecomment-7259951850). Originally posted by [icdmkg2](https://github.com/icdmkg2) on 2026-11-29T17:46:18Z. --- A live 8 GB measurement, since the PR notes it wasn't validated in game yet. **Setup:** RTX 5060 Laptop GPU (8 GB, DXGI budget about 7.1 GB, so `auto` turns it on), Ryzen 7 H 260, 32 GB, Windows 11, driver 621.24. `main` at `55d06914`, release build, `play-foxhound.ps1` defaults otherwise, Series S, DLSS performance, the same save (the prologue's cell), driven by a script: 60 s measured after a 30 s settle, shader cache warm. `VICTORY_COMMIT_FLOOR_MB=1024` was set in all runs (with the default 4096, the memory guard kept putting compiles off on this PC). Only `VICTORY_LEVELS_ON_DEMAND` changes in the last row: | | fps median | frame time median | submitting thread, ms per frame | of it: snapshots | refreshes | |---|---|---|---|---|---| | defaults (`auto` → on) | 7.8 | 87.5 ms | 87.5 | 11.7 | 24.0 | | defaults + `VICTORY_POOL_SMALL=0` (control) | 7.6 | 108.8 ms | 86.4 | 18.5 | 24.3 | | **defaults + `VICTORY_LEVELS_ON_DEMAND=0`** | **17.4** | **51.8 ms** | 52.9 | 0.0 | 15.3 | Texture waits were about the same either way (19–21 "no room, new textures wait" lines a run), so on this card the saving doesn't show up as fewer waiting textures. The cost lands on the submitting thread: snapshots (0 → 12 ms) and refreshes (+9 ms). That fits the reports above from the 2070 SUPER and the 3050. So `auto` currently halves the frame rate on at least this 8 GB card, by default. Keeping it opt-in (`=1`) seems safer until its per-frame cost on the submitting thread is down.
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!1411
No description provided.