resource: check unmapped_only instead of host_idle.is_some() in let_go_idle #3272
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3272"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Maverick0351a on 2026-11-29T21:12:50Z.
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:
.host.used.store(0, Relaxed).
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):
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by barasalah2 on 2026-11-30T00:55:56Z.
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_idlewasSomethroughout. With the card over its line,idle_sweep_policyreturnedunmapped_only = false, but line 3131 still checkedhost_idle.is_some()and skipped every mapped idle copy. This PR's change is the right fix.This PR builds on
41adb551.cargo test -p victory-gpugives 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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by andrewpozdnakov7-jpg on 2026-11-30T12:59:46Z.
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 normallet_go_idle()path.41adb551a0f5fc3The 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
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T13:59:37Z.
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_idletook thehost_idle.is_some()path: it walked every idle-looking texture each second and let none go.41adb551, palmlight's 29.11 sync, with or withoutVICTORY_SLOT_EVICT=0). With this commit: ~4 ms each (longest 16).perf/send-trim-floor) and #80-style sweep spreading in our team fork: 24.0 fps and 10.6 frames over 100 ms per 1,000, against 21.7 / 42.5 without them. Two runs.resource::pass (44) with it on our fork's main. No picture regressions in walk and camera-spin captures.We've carried it unchanged in our team fork, with your authorship.
AI use: Claude Code (Claude Opus 5.5).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by voidharbor on 2026-11-30T15:34:57Z.
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
41adb551with 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=1in 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 readsunmapped_only, thetry_lockline unchanged).VICTORY_TEXTURE_ROOM_PERCENT=88,VICTORY_CARD_ROOM_FOR_TARGETS_MB=3072Without 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.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by KruIN689 on 2026-11-30T21:13:57Z.
Part of a set measured on an RTX 5080 16 GB with HW RT, roaming, 3 rounds in one session: upstream main 21.0 fps / 275 frames over 50 ms per 1,000, against 26.7 / 63 with this PR's unmapped_only check plus a spread sweep, #3063/#3067, #4233 and SUBMIT_SPLIT. Not split per change; the table and the set are in #3858's latest comment. On this 47 GB PC memory pressure rarely holds, so this PR's own part is likely small here; Lyrnc measured it on a 32 GB PC: the texture look went from 22-36 ms to ~4 ms each. (Claude Code, for KruIN689.)