Repository navigation
Conversation
…sure let-go (trustno1-coder#3512) Under host memory pressure the sweep lets go unmapped host texture copies after 1 s (5 s). In the minigame the title still reads many of them, so they were made and uploaded again every second (37 GB in ten minutes on an RX 7800 XT) and one frame a second took about 650 ms. A copy made again within 10 s of such a let-go is now kept from the host-pressure sweep for 2 min. The card's own rule and a flush still apply. VICTORY_HOST_SWEEP_PROTECT=0 restores the old behaviour. The diagnostics line counts copies made again and those kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tno1-coder#3512) In the trustno1-coder#3512 minigame log (RTX 4070 Ti SUPER, 32 GB), the host copies made went from 124,000 to 265,000 in 20 minutes (about 100 a second, flat before the minigame), and each once-a-second look of let_go_idle took about 85 ms on the submitting thread (longest 132 ms), on the frame that was then 640 ms long. Under host memory pressure, the host-pressure part and the streamed-out part of a look now stop after VICTORY_SWEEP_BUDGET_MS (default 4 ms, 0: no limit) and go on from there a second later. The diagnostics line counts the looks cut short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…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>
|
Tested on the RX 7800 XT from #3512 (Ryzen 7 7800X3D, 32 GB, Series S, FSR upscaler, no frame generation). Build: The stall is still here with this PR:
The two runs are different areas of the map, so the frame lengths aren't a like-for-like comparison, but the once-a-second pattern is unmistakable and uploads did not drop. The card was under its budget throughout (11.8 GB of 13.3 GB). This was not a diagnostics build, so I don't have the "copies made again" count. I can rerun with the diagnostics feature at the same spot if that would show why the protection isn't catching them here. One correction to the description: the ~650 ms figure is from the 4070 Ti SUPER log; on this card the stalled frame was about 200 ms. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @saltdam36, and noted on the ~200 ms figure for your card. One important point first: this PR targets the minigame of #3512, the mission where you start the game console and play on it, not the open world. Your run was in a dense urban area, so it does not cover the case this fixes. In the minigame the change is large: up to two to three times the frame rate, and the once-a-second stall gone (table below). Could you rerun at 66fe197 inside that minigame? About the open world: your run is at 9099850, before the third commit, and I think it shows the same thing I saw: with the card at 11.8 of 13.3 GB, the card's rule is the one deciding ( My runs, same minigame as in #3512RTX 4070 Ti SUPER, Ryzen 7 7700, 32 GB, Series X 1440p, DLSS Quality, frame generation 4x, ray tracing off, release builds. One log line per second:
The relapse came when the card went from 11.7 to 13.3 GB of its 15.3 GB budget. At that point looks took 60–75 ms again, which matches your 9099850 run. With all three commits, I played the minigame again on my second PC and checked the logs: the stall did not come back, including past the point where it used to. Before (main), in the minigame: With this PR (commits 1–2), in the minigame: For the rerun in the minigame, a diagnostics build would be ideal: the "host memory reclamation" line now gives copies made again, copies protected and looks cut short, so we would see which rule is acting on your card. |
|
Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch |
|
Adding a
|
Fixes #3512
What it changes
Under host memory pressure,
let_go_idlelets go host copies of placed textures whose title memory is unmapped after 1 s (below 8 GiB of headroom, which on a 32 GB PC is every time the PC is pressured) or 5 s. In the minigame the title still reads many of those textures, so the same copies are let go and made again every second, and every look of the sweep gets slower as the table grows.What the logs show:
VICTORY_HOST_TEXTURE_SWEEP=0removed the stall (seconds with a frame over 150 ms: 40–54 of every 58 → 0–2), but it turns the host rule off entirely.Two commits:
host_evicted). If that copy is made again within 10 s (HOST_BACK_MS), the title is still reading it: the host-pressure sweep passes it over for 2 minutes (HOST_PROTECT_MS). The card's own rule and a flush still apply. Copies that do not come back are still freed. Same pattern as the slot eviction protection (slot_evicted/slot_returned).VICTORY_HOST_SWEEP_PROTECT=0turns it off.VICTORY_SWEEP_BUDGET_MS(default 4 ms; 0: no limit) and go on from the same place a second later (theFROMcursors were already there). That bounds the cost on the submitting thread whatever the table size. Reclaiming under pressure is spread over more seconds instead. This is the same idea as GPU: the look for idle textures in slices, the longest refreshes first #3578 (VICTORY_SWEEP_SLICE_US), which I found after writing it. I kept it here so this branch can be tested as a whole fix; if GPU: the look for idle textures in slices, the longest refreshes first #3578 lands first, I will drop this commit and keep only the first one, which GPU: the look for idle textures in slices, the longest refreshes first #3578 does not cover (slices make each look cheaper, but the copies are still let go and remade every second).The diagnostics line "host memory reclamation since the start" now also says how many let-go copies were made again, how many within 10 s, how often a protected one was passed over, and how many looks were cut short, so the effect can be read from a log.
#3475 adds a back-off to the card's rule. That does not apply here: in #3512 the card was under budget and the unmapped-only host rule was the one churning. The two change different branches of
let_go_idle.How it was tested
cargo test -p victory-gpu --lib: 921 passed. The 2 failures (a_change_is_saved_at_once_however_the_game_was_started,every_switch_of_the_translator_is_in_the_key) fail the same way on main. New unit testa_copy_back_soon_after_a_host_pressure_let_go_is_kept_for_a_while. Clippy shows nothing on the changed lines, with and without--features diagnostics.function unwind_copy is never usedincrates/victory-loader/src/crash.rs. That is not touched here and fails the same way on main (41adb55).Checked for overlap
unmapped_onlycheck inlet_go_idle), victory-gpu: eliminate 60 ms let_go_idle sweep stutter, lock-free watch/pending hot paths & recording contention fixes #3502 (sweep stutter), GPU: the look for idle textures in slices, the longest refreshes first #3578 (the look in slices, same idea as the second commit).