Skip to content

[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

Open
tupacfan04 wants to merge 1 commit into
trustno1-coder:mainfrom
tupacfan04:pr-sweep-card-first
Open

tupacfan04 wants to merge 1 commit into
trustno1-coder:mainfrom
tupacfan04:pr-sweep-card-first

Conversation

@tupacfan04

Copy link
Copy Markdown
Contributor

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 + Shaders: an atomic subtraction on group memory is a compare-exchange loop on NVIDIA (port of Marvisak/VIctory#3619) #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

🤖 Generated with Claude Code

…o with the PC's memory tight

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 <noreply@anthropic.com>
@github-actions github-actions Bot added memory RAM or VRAM use, out of memory, leaks pr-fix Pull request: fixes a bug labels Nov 29, 2026
@github-actions github-actions Bot changed the title [pr-fix][gpu][memory] 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) [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) Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memory RAM or VRAM use, out of memory, leaks pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant