Residency: VICTORY_RESIDENCY_PRIORITY=1 keeps render targets resident first on 8 GB cards (off by default) #3804

Manually merged
github merged 1 commit from github-bot/gh-3804 into main 2026-11-30 14:14:53 +00:00 AGit
Owner

@⁠RomanFama592 on GitHub · 2026-11-30 07:37 UTC · original
RomanFama592:feature/residency-priority → main · +135 −0 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC

Related #946, #1918

What it changes

VICTORY_RESIDENCY_PRIORITY=1 gives D3D12_RESIDENCY_PRIORITY_HIGH to committed render targets, depth and unordered-access memory on the card when they are made, and to the heaps aliased render targets are placed in (those exist with VICTORY_ALIAS_TARGETS=1). Off by default; nothing changes without the switch.

Past its DXGI budget Windows moves some of the card's memory into the PC's, and with every priority normal it moved render targets too, which every frame reads and writes again. With the switch, textures (normal priority: blocks and copies of their own) go first and what shaders write stays. A hint only: nothing reads or writes differently, and a card under its budget pages nothing. It is opt-in because on a PC with little RAM what Windows pages goes to the PC's memory (see the laptop below).

How it was tested

  • GPU and profile: RTX 4060 Ti 8 GB, Ryzen 9 5900X, 64 GB, Windows 11; Series X at 1440p, DLSS balanced, frame generation off.
  • Before / after, the same places one after the other, 7–9 minutes each (both runs with #1944's first-upload guard):
fps GPU a frame past the budget (median)
without the switch 3.4 181 ms 682 MB
VICTORY_RESIDENCY_PRIORITY=1 14.9 2.3 ms 216 MB
  • Against #1733 (VICTORY_RESIDENCY_HIGH), clock held, two runs each, rotated (automatic runs with victory-probe-mod, #2825): this switch 14.7 fps / p95 93 ms / GPU 57 ms, VICTORY_RESIDENCY_HIGH alone 13.0 / 103 / 70, both 14.3 / 94 / 61. On an 8 GB card past its budget the two are better not combined.
  • An RTX 5060 Ti 8 GB with 32 GB of RAM (thanks @⁠Yuanzer): with the world clock held, three A/B pairs gave an even median and a lower P99 with it on in all three.
  • An RTX 4060 Laptop 8 GB with 16 GB of RAM (thanks @⁠Roybill203): with it on, the device was removed after a 9 s frame; hence off by default.
  • cargo test -p victory-gpu --lib on this head (current main): 920 passed; shader_cache::tests::every_switch_of_the_translator_is_in_the_key fails on current main too, and two tests of other files (host::card_steps, watch) failed in the full run and pass alone. Clippy: no finding in the lines this changes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related:
    • #1733 (merged, VICTORY_RESIDENCY_HIGH): maximum priority for card buffers and textures; measured against it above.
    • #1944: the first-upload guard for 8 GB cards; independent of this (different files), either can land alone. This was part of it before.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KLpN7AVE3kdGsfyVZos7rv

**@⁠RomanFama592** on GitHub · 2026-11-30 07:37 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3804) `RomanFama592:feature/residency-priority` → `main` · +135 −0 · 2 files · 1 commits · merged 2026-11-30 14:12 UTC Related #946, #1918 ## What it changes `VICTORY_RESIDENCY_PRIORITY=1` gives `D3D12_RESIDENCY_PRIORITY_HIGH` to committed render targets, depth and unordered-access memory on the card when they are made, and to the heaps aliased render targets are placed in (those exist with `VICTORY_ALIAS_TARGETS=1`). Off by default; nothing changes without the switch. Past its DXGI budget Windows moves some of the card's memory into the PC's, and with every priority normal it moved render targets too, which every frame reads and writes again. With the switch, textures (normal priority: blocks and copies of their own) go first and what shaders write stays. A hint only: nothing reads or writes differently, and a card under its budget pages nothing. It is opt-in because on a PC with little RAM what Windows pages goes to the PC's memory (see the laptop below). ## How it was tested - GPU and profile: RTX 4060 Ti 8 GB, Ryzen 9 5900X, 64 GB, Windows 11; Series X at 1440p, DLSS balanced, frame generation off. - Before / after, the same places one after the other, 7–9 minutes each (both runs with #1944's first-upload guard): | | fps | GPU a frame | past the budget (median) | |---|---|---|---| | without the switch | 3.4 | 181 ms | 682 MB | | `VICTORY_RESIDENCY_PRIORITY=1` | **14.9** | **2.3 ms** | 216 MB | - Against #1733 (`VICTORY_RESIDENCY_HIGH`), clock held, two runs each, rotated (automatic runs with victory-probe-mod, #2825): this switch 14.7 fps / p95 93 ms / GPU 57 ms, `VICTORY_RESIDENCY_HIGH` alone 13.0 / 103 / 70, both 14.3 / 94 / 61. On an 8 GB card past its budget the two are better not combined. - An RTX 5060 Ti 8 GB with 32 GB of RAM (thanks @⁠Yuanzer): with the world clock held, three A/B pairs gave an even median and a lower P99 with it on in all three. - An RTX 4060 Laptop 8 GB with 16 GB of RAM (thanks @⁠Roybill203): with it on, the device was removed after a 9 s frame; hence off by default. - `cargo test -p victory-gpu --lib` on this head (current main): 920 passed; `shader_cache::tests::every_switch_of_the_translator_is_in_the_key` fails on current main too, and two tests of other files (`host::card_steps`, `watch`) failed in the full run and pass alone. Clippy: no finding in the lines this changes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: - #1733 (merged, `VICTORY_RESIDENCY_HIGH`): maximum priority for card buffers and textures; measured against it above. - #1944: the first-upload guard for 8 GB cards; independent of this (different files), either can land alone. This was part of it before. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KLpN7AVE3kdGsfyVZos7rv
Past the DXGI budget Windows pages the card's memory, and with every priority
normal it pages render targets too. With the switch, committed render targets,
depth and UAV memory on the card, and the heaps aliased targets are placed in,
get a high residency priority. Off unless asked: on a 16 GB PC the memory
paged goes to the PC and a tester saw the device removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KLpN7AVE3kdGsfyVZos7rv
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 07:39:58 +00:00
github manually merged commit 34327d9c9f into main 2026-11-30 14:14:53 +00:00
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!3804
No description provided.