Skip to content

resource: check unmapped_only instead of host_idle.is_some() in let_go_idle - #3272

Merged
trustno1-coder merged 1 commit into
trustno1-coder:mainfrom
Maverick0351a:fix/idle-sweep-policy-unmapped-only
Nov 30, 2026
Merged

trustno1-coder merged 1 commit into
trustno1-coder:mainfrom
Maverick0351a:fix/idle-sweep-policy-unmapped-only

Conversation

@Maverick0351a

Copy link
Copy Markdown
Contributor

Problem

\idle_sweep_policy(host_idle, card_rule)\ returns \unmapped_only = false\ whenever the card itself is pressured (\card_most != u64::MAX || card_idle < 60_000), even when \host_idle.is_some()\ is also true (which is permanently true on a 32 GB RAM PC once < 8 GiB\ of physical RAM is free), so that mapped idle textures continue to be evicted from VRAM to keep the card under budget.

However, inside \let_go_idle()\ (\crates/victory-gpu/src/resource.rs:3119\ and \3131), the inner loop checked \if host_idle.is_some()\ instead of \if unmapped_only. As a result, whenever both \host_idle.is_some()\ and \card_pressured\ were true:

  1. \let_go_idle()\ entered the full \most != u64::MAX\ VRAM sweep, sorting all \60,000+\ idle textures into \�y_age.
  2. For every texture in \�y_age, it entered \if host_idle.is_some()\ at line 3131, called \crate::texture::wholly_unmapped\ (\VirtualQuery), saw the texture was still mapped, and executed \continue\ without evicting the texture or resetting
    .host.used.store(0, Relaxed).
  3. Every sweep therefore walked and called \VirtualQuery\ across all \60,000+\ mapped idle textures from scratch, freeing 0 bytes of mapped textures and taking 41.97–44.27 ms per sweep (up to 166.8 ms) on the submitting thread after ~11 minutes of gameplay on a 32 GB RAM / 16 GB RTX 5080 system.

Fix

Check \if unmapped_only\ instead of \if host_idle.is_some()\ at lines 3119 and 3131 of \crates/victory-gpu/src/resource.rs, matching line 3103 and line 3176 and honoring \idle_sweep_policy's returned \unmapped_only\ decision.

Verification

Verified across a 26-minute continuous gameplay run on an RTX 5080 Laptop GPU (16 GB VRAM, 32 GB RAM):

  • Before fix: \555 looks for textures to let go, 44.27 ms each, the longest 166.8, \84 MB of texture blocks free, VRAM climbed past the room line (\� first host texture was admitted just over the room line so_far=4000).
  • After fix: \414 looks for textures to let go, 7.29 ms each, the longest 18.1, \2283 MB of texture blocks free, \

Broodguy pushed a commit to Broodguy/VIctory-NVIDIA that referenced this pull request Nov 29, 2026
…e (port trustno1-coder#2486, trustno1-coder#3272)

- trustno1-coder#2486 (eljoviz, open), code part only (its .cmd launchers left out):
  slot_evict let a texture go even when evict_slots() found one of its
  slots being made by another thread ("the texture is in use then, and
  stays" said the comment; nothing did it): now it stays (counted in
  SLOT_EVICT[6]). Also: highest_shader_model() uses the adapter it was
  given; card_steps tests forget pages an earlier test left; a duplicate
  '%' glyph arm in font.rs.
- trustno1-coder#3272 (Maverick0351a, open): let_go_idle chose its locking and its
  "only wholly unmapped textures" path by host_idle.is_some() instead of
  the policy's unmapped_only. With host memory AND the card pressured (the
  chase in log 213111: ~34 GB resident, ~3 GB free, VRAM 9.95/9.96 GB) the
  policy picks the card's rule, but every mapped idle texture hit the
  unmapped-only checks and was skipped: no texture left the card.
- Not ported: trustno1-coder#2890 (raw texture key in slot_evict): on .04
  evictable_slots() already returns its map keyed by the title address;
  the PR's translation would have matched nothing and stopped slot eviction.

Expected: VRAM let go again under both pressures (the chase); fewer
textures freed while in use (missing/black textures). fps: indirect, via
less spill (the card's lists went 28 -> 68 ms as VRAM filled in the prison).
Switch: none (revert); slot eviction itself: VICTORY_SLOT_EVICT.
Shader preload: not needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
moritz-eckhard-nickel added a commit to moritz-eckhard-nickel/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…instead of host_idle.is_some() in let_go_idle

trustno1-coder#3272 by Maverick0351a, head a0f5fc3.
@barasalah2

Copy link
Copy Markdown

Confirming this on an RTX 3060 Ti 8 GB (i7-12700, 32 GB, Windows 11, driver 621.40, Series S, frame generation off).

Without this PR, a 45-minute session went from 5.3 GB of card memory at the start to 8.8 GB of a 7.0 GB budget. Host texture copies grew from 2.8 to 5.6 GB, and fps fell from 13 to 5. Then the whole PC froze. Log attached.

The log shows slot eviction "Evicting: yes" all session, but 0 textures let go. PC memory free stayed under 8 GiB, so host_idle was Some throughout. With the card over its line, idle_sweep_policy returned unmapped_only = false, but line 3131 still checked host_idle.is_some() and skipped every mapped idle copy. This PR's change is the right fix.

This PR builds on 41adb55. cargo test -p victory-gpu gives 921 passed, 1 failed (every_switch_of_the_translator_is_in_the_key, which fails on main too and is unrelated).

The log analysis and code review were done with Claude (Claude Code); I ran the session. I'll post an after-run with this PR.Report from an affected 8 GB card. This line is what let the card's memory climb until my PC froze, and this pull request fixes the condition.

victory-nvidia-play-20261129-235149-15000.zip

nevasouls added a commit to nevasouls/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…ped_only instead of host_idle.is_some() in let_go_idle

trustno1-coder#3272
Smoodie7 added a commit to Smoodie7/VIctory-NVIDIA that referenced this pull request Nov 30, 2026
…essure too (trustno1-coder#3512)

Playing with the first two commits, the minigame went from 8-9 fps to two
to three times that, then stuttered again after about 15 minutes: the card
went from 11.7 to 13.3 GB of its 15.3 GB budget, the card's rule took over
from the host-pressure rule, and looks took 60 ms on average (238 ms at
most) again.

With the card's rule in charge and the PC's memory tight, the free loop
still required the copy's title memory to be wholly unmapped (it tested
host_idle instead of unmapped_only), so it asked about every candidate,
freed almost none and walked the whole list each second (as trustno1-coder#3272 found).
It now tests unmapped_only, and the look budget also applies to the card's
rule while the PC's memory is tight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andrewpozdnakov7-jpg

andrewpozdnakov7-jpg commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

I reproduced the mapped-idle case on WARP 1.0.22 against release main 41adb551. The only injected inputs were the host and card pressure rules. The fixture used two 64x64 RGBA8 textures backed by committed CPU memory, let them age four frames and over 1.5 seconds, and held an extra host reference to one. It then ran the normal let_go_idle() path.

Pressure rules Mapped idle copies retired on 41adb551 Mapped idle copies retired with a0f5fc3
Host only, card has room 0 0
Card only 1 1
Host and card 0 1

The held copy survived all cases. After a retirement, the next access created a new host copy and the synthetic CPU backing bytes were intact. The existing resource unit tests passed 44/44 with one ignored on each revision. This measures eviction and recreation on WARP with uncontended locks. The long-session FPS and VRAM figures come from the field reports.

For integration, #2591 contains these same two predicate changes and additional tile work. #3681 also changes the inner detach predicate and adds its own reload protection. Please carry the predicate fix once when landing the overlapping sweep work. This PR is the two-line version. GitHub shows only the label check for this head, so maintainer review and the normal Windows CI run remain pending.

Release follow-up

Both predicates are already present in v2026.11.30.01 (c71899d) through merged #2591. On that release, the same WARP 1.0.22 fixture retires 0 mapped copies with host pressure alone, 1 with card pressure alone, and 1 with both. The held copy survives and the synthetic CPU bytes are intact after recreation. The resource suite ran 61 tests successfully with 2 ignored. The only additional local change was the #4018 unit-test build fix.

Thanks @Lyrnc for the RTX 5080 sweep timings. The current release passes the two-predicate check. The sweep time on the current release and the FPS effect of the stacked changes remain field measurements.

Another matched field pair with the same room settings on an RTX 5070 Ti showed 5.65 GB versus 3.2 GB of texture copies at minute 30 after changing the inner sweep condition. The patched run was under budget in all 175 samples from minute 16. This was one pair on an older locally stacked tree. Our current-release fixture above verifies both conditions. RTX 5070 Ti measurements

@Lyrnc

Lyrnc commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Tested on an RTX 5080 + 9800X3D with 32 GB, Series X native 1440p, DLSS off, a scripted walk route, 300 s windows. On a 32 GB PC free RAM is always under 8 GiB while the game runs, so let_go_idle took the host_idle.is_some() path: it walked every idle-looking texture each second and let none go.

We've carried it unchanged in our team fork, with your authorship.

AI use: Claude Code (Claude Opus 5.5).

@voidharbor

Copy link
Copy Markdown

Numbers for the same gate from a 16 GB card with 64 GB of RAM, where the PC's line is 16 GiB free instead of 8.

Setup. Ryzen 7 9800X3D, RTX 5070 Ti 16 GB, 64 GB RAM, Windows 11. Series X at 2560x1440, DLSS Balanced, frame generation 2x, ray tracing on. Tree: main 41adb55 with a number of open pull requests merged locally, not this one. One scripted route, 31 minutes a run: 10 minutes of walking and camera turns, then standing, from the same save. VICTORY_SLOT_EVICT=1 in all three runs. The third run had the same gate change as this pull request, behind a switch of my own (VICTORY_CARD_SWEEP_FIRST=1: the gate reads unmapped_only, the try_lock line unchanged).

run of 31 minutes texture copies card in use against a budget of about 14.9 GB frame rate at 6,000 to 8,000 draws end
the launcher's default texture room 4.8 GB at minute 4, 6.5 GB at minute 28 over from minute 5, 16.5 GB at the end 20 device lost at 26 minutes
VICTORY_TEXTURE_ROOM_PERCENT=88, VICTORY_CARD_ROOM_FOR_TARGETS_MB=3072 3.3 GB at minute 8, 5.65 GB at minute 30 over from minute 16, 15.3 to 15.8 GB at the end 20 closed normally
the same plus the gate change 2.9 to 3.5 GB throughout (3.2 GB at minute 30) under by 0.5 to 0.85 GB throughout; over in 0 of 175 samples from minute 16 23 closed normally

Without it, the PC fell under 16 GiB free at minute 10 of the second run (minute 2 of the first), and idle copies that no list and no slot held went from 12 at minute 8 to 35,750 at minute 31; slot eviction let go of 0 textures, since no slot shows them. With it, by the end: 247,162 copies let go (25,574 MB), 92,066 made again, 4,035 of them within 2 s (4.4 %), away 156.8 s on average. At 6,000 to 8,000 draws the submitting thread took 35.6 ms a frame against 46.8 ms, the card 41.4 ms against 45.4.

One card, one route, one run per row, on a local tree rather than plain main. The cost to watch is copies made again soon after they go. The counting code (made again, within 2 s, time away) is on a branch if that line is wanted here.

@trustno1-coder
trustno1-coder merged commit a64f9ec into trustno1-coder:main Nov 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants