Keep the dynamic VRAM reserve in the idle texture sweep #4340

Open
github-bot wants to merge 1 commit from github-bot/gh-4339 into main AGit
Owner

@⁠tyr0nsur on GitHub · 2026-11-30 19:03 UTC · original
tyr0nsur:codex/keep-sweep-vram-reserve → main · +23 −2 · 1 files · 1 commits · open

Follow-up to #4005. Related to #4310.

What it changes

The first-upload path checks the dynamic cap from VICTORY_TEXTURE_KEEP_FREE_MB. The idle sweep used soft_budget().or_else(...), so a configured VICTORY_TEXTURE_SOFT_MB took precedence over the dynamic cap. This also applies to the default victory play profile, which sets the soft budget to 3,000 MiB.

Use the lower of the two active caps for the idle sweep. With a 3,000 MiB soft budget and 2,000 MiB left for texture copies after the reserve and other allocations, the sweep now asks for enough idle copies to reach 2,000 MiB. The existing age, descriptor and ownership checks still apply. VICTORY_TEXTURE_KEEP_FREE_MB=0 continues to disable the dynamic cap.

How it was tested

  • Windows 11 / RTX 4060 8 GiB. This was a title-independent test of the sweep policy.
  • The regression covers a stricter fixed cap, a stricter dynamic cap, a fully consumed dynamic cap, and either or both caps absent. It also checks the bytes the sweep asks to free.
  • cargo test -p victory-gpu --features diagnostics --locked --lib resource::tests:: --quiet passed (66 passed, 2 ignored). The staged asset-policy check passed.
  • The RTX 4050 report provides context for the change. A matched play run is still needed to measure its effect on VRAM, reuploads and visible mip levels.

Checked for overlap

  • Searched for dynamic_texture_cap and both environment switches. This is a follow-up to #4005. #4306 changes when the sweep is run, and #3754 changes how reusable room is counted.

Developed with Codex and reviewed with Claude Opus 5.5.

**@⁠tyr0nsur** on GitHub · 2026-11-30 19:03 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4339) `tyr0nsur:codex/keep-sweep-vram-reserve` → `main` · +23 −2 · 1 files · 1 commits · open Follow-up to #4005. Related to #4310. ## What it changes The first-upload path checks the dynamic cap from `VICTORY_TEXTURE_KEEP_FREE_MB`. The idle sweep used `soft_budget().or_else(...)`, so a configured `VICTORY_TEXTURE_SOFT_MB` took precedence over the dynamic cap. This also applies to the default `victory play` profile, which sets the soft budget to 3,000 MiB. Use the lower of the two active caps for the idle sweep. With a 3,000 MiB soft budget and 2,000 MiB left for texture copies after the reserve and other allocations, the sweep now asks for enough idle copies to reach 2,000 MiB. The existing age, descriptor and ownership checks still apply. `VICTORY_TEXTURE_KEEP_FREE_MB=0` continues to disable the dynamic cap. ## How it was tested - Windows 11 / RTX 4060 8 GiB. This was a title-independent test of the sweep policy. - The regression covers a stricter fixed cap, a stricter dynamic cap, a fully consumed dynamic cap, and either or both caps absent. It also checks the bytes the sweep asks to free. - `cargo test -p victory-gpu --features diagnostics --locked --lib resource::tests:: --quiet` passed (66 passed, 2 ignored). The staged asset-policy check passed. - The RTX 4050 report provides context for the change. A matched play run is still needed to measure its effect on VRAM, reuploads and visible mip levels. ## Checked for overlap - [x] Searched for `dynamic_texture_cap` and both environment switches. This is a follow-up to #4005. #4306 changes when the sweep is run, and #3754 changes how reusable room is counted. Developed with Codex and reviewed with Claude Opus 5.5.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 19:09:24 +00:00
Author
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-30 19:44 UTC · original

A data point from an 8 GB card, in case it helps size this. This is arithmetic on logged numbers, not a test of the PR.

Setup: RTX 2070 SUPER 8 GB (Turing), driver 621.40, Windows 11, Series S profile with DLSS Performance and FSR 3 frame generation (x2) on. Release build of our fork (v2026.11.30.02 plus opt-in ports, all off unless set), one session. Started through scripts/play-nvidia.ps1, which doesn't set VICTORY_TEXTURE_SOFT_MB. With VICTORY_TEXTURE_KEEP_FREE_MB=0 the dynamic cap was off too, so the idle sweep (let_go_idle) ran on the card-use rule alone, with VICTORY_SWEEP_CAPPED=1; that rule is not a texture cap. VICTORY_HOST_TEXTURE_SWEEP=0 was also set, but that controls a different sweep.

From the memory now: lines of a 26-minute session, I computed what dynamic_texture_cap would have returned with the default 512 MB reserve: budget − 512 − other card bytes. Other card bytes means card use minus host texture bytes. Four sample lines:

time card use budget host textures other card bytes dynamic cap
19:24 7419 7074 5012 2407 4155
19:28 7617 7074 4812 2805 3757
19:31 7769 7074 4486 3283 3279
19:36 7769 7074 4948 2821 3741

(MB.) Across all 699 memory now: lines, leaving out the first one at startup, the computed cap never went below 3,124 MB. That means it stayed above the 3,000 MB soft budget for the whole session. On this card in this scene, min() would pick the soft budget either way. The PR would make a difference here only once other card bytes pass about 3.5 GB, or on smaller cards like the 6 GB one in #4310.

Card use was over the budget in about two thirds of the logged lines, by up to roughly 800 MB. If a 3,000 MB soft budget had been set, min() would have picked it on every line. I can't tell from this log what limited this session.

Not tested: this PR's code, frame generation off, other GPUs, other scenes or areas. One 26-minute session.

We can run a matched pair on this card if that's useful: play-nvidia.ps1 with VICTORY_TEXTURE_SOFT_MB=3000, with and without this PR.

Drafted with AI assistance (Claude Code).

**@⁠Jesper-Andersson** on GitHub · 2026-11-30 19:44 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4339#issuecomment-7289863826) A data point from an 8 GB card, in case it helps size this. This is arithmetic on logged numbers, not a test of the PR. **Setup:** RTX 2070 SUPER 8 GB (Turing), driver 621.40, Windows 11, Series S profile with DLSS Performance and FSR 3 frame generation (x2) on. Release build of our fork (v2026.11.30.02 plus opt-in ports, all off unless set), one session. Started through `scripts/play-nvidia.ps1`, which doesn't set `VICTORY_TEXTURE_SOFT_MB`. With `VICTORY_TEXTURE_KEEP_FREE_MB=0` the dynamic cap was off too, so the idle sweep (`let_go_idle`) ran on the card-use rule alone, with `VICTORY_SWEEP_CAPPED=1`; that rule is not a texture cap. `VICTORY_HOST_TEXTURE_SWEEP=0` was also set, but that controls a different sweep. From the `memory now:` lines of a 26-minute session, I computed what `dynamic_texture_cap` would have returned with the default 512 MB reserve: budget − 512 − other card bytes. Other card bytes means card use minus host texture bytes. Four sample lines: | time | card use | budget | host textures | other card bytes | dynamic cap | |---|---|---|---|---|---| | 19:24 | 7419 | 7074 | 5012 | 2407 | 4155 | | 19:28 | 7617 | 7074 | 4812 | 2805 | 3757 | | 19:31 | 7769 | 7074 | 4486 | 3283 | 3279 | | 19:36 | 7769 | 7074 | 4948 | 2821 | 3741 | (MB.) Across all 699 `memory now:` lines, leaving out the first one at startup, the computed cap never went below 3,124 MB. That means it stayed above the 3,000 MB soft budget for the whole session. On this card in this scene, `min()` would pick the soft budget either way. The PR would make a difference here only once other card bytes pass about 3.5 GB, or on smaller cards like the 6 GB one in #4310. Card use was over the budget in about two thirds of the logged lines, by up to roughly 800 MB. If a 3,000 MB soft budget had been set, `min()` would have picked it on every line. I can't tell from this log what limited this session. Not tested: this PR's code, frame generation off, other GPUs, other scenes or areas. One 26-minute session. We can run a matched pair on this card if that's useful: play-nvidia.ps1 with `VICTORY_TEXTURE_SOFT_MB=3000`, with and without this PR. Drafted with AI assistance (Claude Code).
github-bot force-pushed github-bot/gh-4339 from 1cba1d7d45 to 94726a5b86 2026-12-01 00:05:07 +00:00 Compare
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4340/head:github-bot/gh-4339'
git switch 'github-bot/gh-4339'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4339'
git switch 'github-bot/gh-4339'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4339'
git switch 'github-bot/gh-4339'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4339'
git switch 'main'
git merge --squash 'github-bot/gh-4339'
git switch 'main'
git merge --ff-only 'github-bot/gh-4339'
git switch 'main'
git merge 'github-bot/gh-4339'
git push origin 'main'
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!4340
No description provided.