[gpu]Textures: over the queue's line the card's sweep rule goes first, also while the PC's memory is tight (VICTORY_SWEEP_CARD_FIRST) #2022

Closed
github-bot wants to merge 1 commit from github-bot/gh-2022 into main AGit
Owner

@⁠tupacfan04 on GitHub · 2026-11-29 07:42 UTC · original
tupacfan04:pr-sweep-card-first → main · +83 −0 · 2 files · 1 commits · closed without merging

Related: #1963 (card use past the budget), #1475 (ray tracing on 12 GB).

What it changes

let_go_idle (resource.rs) has two rules for letting idle texture copies go: the card's (vram_keep_below: longest idle first, down to under the texture queue's line) and the PC's (residency::host_texture_idle_ms, taken whenever under 8 GiB of RAM is free). The PC's rule only takes copies whose title memory is unmapped, and while it holds the card's rule is never asked.

On a 32 GB PC the PC's rule holds for the whole play (under 8 GiB free from the first world frames on). So mapped textures that had been idle for minutes were never let go, and the card sat over the queue's line and at or past the system's budget for whole runs: "no room, new textures wait" at every look, while the texture copies still grew.

With this, a look takes the card's rule when the PC's memory is tight and the card's rule wants bytes gone (the card within 2 % of the line or over it). Otherwise nothing changes. VICTORY_SWEEP_CARD_FIRST=0 restores the old behaviour.

It also adds two log lines every 5 s next to the texture queue's room line: both of the system's memory groups at the same look (the shared one was only said when the budget moved), and how many looks took the card's rule while the PC's memory was tight.

Cost: textures idle 5 s or more (1.5 s when 5 % over) go while the card is over the line and are uploaded again on next use, so more mips can be waiting after turning around. I could not judge pop-in by eye (unattended runs).

How it was tested

  • GPU and profile: RTX 5070 12 GB (driver 621.40), i9-14900F, 32 GB, Windows 11. Series X, 1440p, DLSS Quality, no frame generation, 30 cap, ray tracing on (VICTORY_BVH_BUILDER=1 VICTORY_LDS_LAST_RESORT=1). Same scripted 6-minute route, four runs alternating on / off on one build, nothing else running.
  • Before (VICTORY_SWEEP_CARD_FIRST=0), card in use over the run: 9759 → 10765 → 10906 MB and 10014 → 10455 → 10867 MB of a budget of about 10850 MB; no-room waits 255 and 250; looks by the card's rule 0; "on the GPU" averaged over the frame lines 30.8 and 80.9 ms, with 5 and 22 of ~82 lines over 100 ms.
  • After (default), card in use: 8839 → 9412 → 9579 MB and 9209 → 9465 → 9561 MB; no-room waits 152 and 52; looks by the card's rule 68 and 22; "on the GPU" 28.9 and 52.5 ms, with 1 and 9 lines over 100 ms.
  • What it does not change: fps. 10.8 and 9.0 after against 10.8 and 6.8 before at 6-8k draws (medians 86 / 108 ms against 83 / 86 ms). These ray tracing frames are bound by the submitting thread, not by memory; this only takes the card out of the over-budget state. The PC's shared memory stayed at 8.7-9.6 GB in all four runs.
  • The runs above were made on my test branch (main e1f2eb6 + #1939 + local log lines) with this same change; this branch is the change alone on main, where it needed a small adaptation (main's own weighing expression). On this branch I built and ran the tests, not the game.
  • For shader changes, the wave sizes tested: not a shader change.
  • cargo test passed for the crates it touches: yes (GPU 590, shader 395 with 8 ignored, loader 46; 0 failed), including the new the_cards_rule_goes_first_over_the_line_with_the_pcs_memory_tight.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1944 (8 GB cards: no first uploads past the budget; admission side, this is the letting-go side), #1958 (eviction of placed textures; different rule), #1963 (issue: default line lets use exceed the budget).

🤖 Generated with Claude Code

**@⁠tupacfan04** on GitHub · 2026-11-29 07:42 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2022) `tupacfan04:pr-sweep-card-first` → `main` · +83 −0 · 2 files · 1 commits · closed without merging Related: #1963 (card use past the budget), #1475 (ray tracing on 12 GB). ## What it changes `let_go_idle` (resource.rs) has two rules for letting idle texture copies go: the card's (`vram_keep_below`: longest idle first, down to under the texture queue's line) and the PC's (`residency::host_texture_idle_ms`, taken whenever under 8 GiB of RAM is free). The PC's rule only takes copies whose title memory is unmapped, and while it holds the card's rule is never asked. On a 32 GB PC the PC's rule holds for the whole play (under 8 GiB free from the first world frames on). So mapped textures that had been idle for minutes were never let go, and the card sat over the queue's line and at or past the system's budget for whole runs: "no room, new textures wait" at every look, while the texture copies still grew. With this, a look takes the card's rule when the PC's memory is tight **and** the card's rule wants bytes gone (the card within 2 % of the line or over it). Otherwise nothing changes. `VICTORY_SWEEP_CARD_FIRST=0` restores the old behaviour. It also adds two log lines every 5 s next to the texture queue's room line: both of the system's memory groups at the same look (the shared one was only said when the budget moved), and how many looks took the card's rule while the PC's memory was tight. Cost: textures idle 5 s or more (1.5 s when 5 % over) go while the card is over the line and are uploaded again on next use, so more mips can be waiting after turning around. I could not judge pop-in by eye (unattended runs). ## How it was tested - GPU and profile: RTX 5070 12 GB (driver 621.40), i9-14900F, 32 GB, Windows 11. Series X, 1440p, DLSS Quality, no frame generation, 30 cap, ray tracing on (`VICTORY_BVH_BUILDER=1 VICTORY_LDS_LAST_RESORT=1`). Same scripted 6-minute route, four runs alternating on / off on one build, nothing else running. - Before (`VICTORY_SWEEP_CARD_FIRST=0`), card in use over the run: 9759 → 10765 → 10906 MB and 10014 → 10455 → 10867 MB of a budget of about 10850 MB; no-room waits 255 and 250; looks by the card's rule 0; "on the GPU" averaged over the frame lines 30.8 and 80.9 ms, with 5 and 22 of ~82 lines over 100 ms. - After (default), card in use: 8839 → 9412 → 9579 MB and 9209 → 9465 → 9561 MB; no-room waits 152 and 52; looks by the card's rule 68 and 22; "on the GPU" 28.9 and 52.5 ms, with 1 and 9 lines over 100 ms. - What it does **not** change: fps. 10.8 and 9.0 after against 10.8 and 6.8 before at 6-8k draws (medians 86 / 108 ms against 83 / 86 ms). These ray tracing frames are bound by the submitting thread, not by memory; this only takes the card out of the over-budget state. The PC's shared memory stayed at 8.7-9.6 GB in all four runs. - The runs above were made on my test branch (main `e1f2eb6` + #1939 + local log lines) with this same change; this branch is the change alone on main, where it needed a small adaptation (main's own weighing expression). On this branch I built and ran the tests, not the game. - For shader changes, the wave sizes tested: not a shader change. - `cargo test` passed for the crates it touches: yes (GPU 590, shader 395 with 8 ignored, loader 46; 0 failed), including the new `the_cards_rule_goes_first_over_the_line_with_the_pcs_memory_tight`. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1944 (8 GB cards: no first uploads past the budget; admission side, this is the letting-go side), #1958 (eviction of placed textures; different rule), #1963 (issue: default line lets use exceed the budget). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
With under 8 GiB of the PC's memory free (a 32 GB PC, from the first world
frame on) every look for idle textures took the PC's rule: only copies whose
title memory is unmapped go, and the card's rule was never asked. The card
stayed about 1 GB over the texture queue's line and past the system's budget
for whole runs (11,062 MB in use of 10,848 MB with ray tracing on).
Now a look takes the card's rule when that rule wants bytes gone
(VICTORY_SWEEP_CARD_FIRST=0: as before). Log only besides: the system's two
memory groups every 5 s beside the queue's room line, and the count of such
looks. Frame times UNVERIFIED.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 07:43:04 +00:00
github-bot closed this pull request 2026-11-29 12:55:07 +00:00
Author
Owner

@⁠tupacfan04 on GitHub · 2026-11-29 12:54 UTC · original

Closing: current main (829188e9) already does this. idle_sweep_policy lets the card's rule win over the PC-memory rule whenever the card is pressured, with a test for exactly that case (idle_sweep_policy_keeps_vram_eviction_active_under_host_pressure). My branch was cut from e1f2eb6, before that landed, and now conflicts.

The on/off measurements above (card memory staying about 1.3 GB lower on a 12 GB card, with no change in fps) were taken with my own change on the older base, not with main's version, so treat them as supporting the idea rather than as a test of main's code.

🤖 Generated with Claude Code

**@⁠tupacfan04** on GitHub · 2026-11-29 12:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2022#issuecomment-7256148469) Closing: current main (`829188e9`) already does this. `idle_sweep_policy` lets the card's rule win over the PC-memory rule whenever the card is pressured, with a test for exactly that case (`idle_sweep_policy_keeps_vram_eviction_active_under_host_pressure`). My branch was cut from `e1f2eb6`, before that landed, and now conflicts. The on/off measurements above (card memory staying about 1.3 GB lower on a 12 GB card, with no change in fps) were taken with my own change on the older base, not with main's version, so treat them as supporting the idea rather than as a test of main's code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

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