Skip to content

Host texture sweep: keep copies the title wants back soon after a host-pressure let-go (#3512) - #3681

Open
Smoodie7 wants to merge 4 commits into
trustno1-coder:mainfrom
Smoodie7:rayane/host-sweep-backoff
Open

Smoodie7 wants to merge 4 commits into
trustno1-coder:mainfrom
Smoodie7:rayane/host-sweep-backoff

Conversation

@Smoodie7

@Smoodie7 Smoodie7 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3512

What it changes

Under host memory pressure, let_go_idle lets 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:

Two commits:

  1. Keep copies that come back. When the host-pressure sweep lets a copy go, it stamps the time (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=0 turns it off.
  2. Cap how long a look holds the texture table. Under host pressure, the host-pressure part and the streamed-out part of a look stop after VICTORY_SWEEP_BUDGET_MS (default 4 ms; 0: no limit) and go on from the same place a second later (the FROM cursors 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

  • GPU and profile: RTX 4070 Ti SUPER 16 GB, Ryzen 7 7700, 32 GB RAM, Series X, 1080p → 1440p, DLSS Quality, frame generation 4x, ray tracing off. Same minigame as in RTX 4070 Ti SUPER, Series X 1440p + 4x FG: a ~650 ms stall every second in a minigame (8-9 fps), texture room 1.1 GB over its line #3512.
  • Before: one frame of about 640 ms every second in the minigame, 8–9 fps (numbers above).
  • After: not measured in game yet. A build of this branch is ready and I will add the before/after numbers here.
  • 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 test a_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.
  • The red CI check is function unwind_copy is never used in crates/victory-loader/src/crash.rs. That is not touched here and fails the same way on main (41adb55).

Checked for overlap

…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>
@github-actions github-actions Bot added the pr-fix Pull request: fixes a bug label Nov 30, 2026
@github-actions github-actions Bot changed the title [pr-fix] Host texture sweep: keep copies the title wants back soon after a host-pressure let-go (#3512) Host texture sweep: keep copies the title wants back soon after a host-pressure let-go (#3512) Nov 30, 2026
Smoodie7 and others added 2 commits November 29, 2026 23:42
…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>
@saltdam36

Copy link
Copy Markdown
Contributor

Tested on the RX 7800 XT from #3512 (Ryzen 7 7800X3D, 32 GB, Series S, FSR upscaler, no frame generation). Build: 41adb551 + #1236 + #2764 + this PR at 90998501, rule on (VICTORY_HOST_TEXTURE_SWEEP unset), dense urban area, host memory pressure on from world entry.

The stall is still here with this PR:

rule off (41adb551, earlier session) rule on + this PR
seconds with a frame over 150 ms 0–2 of 58, some minutes up to 14 34–52 of 57
longest frame in a typical second 70–95 ms 260–300 ms
rendered fps 19–25 16–24
texture uploads 50–106 MB/s 50–80 MB/s

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>
@Smoodie7

Smoodie7 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

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 (vram_keep_below near its line), not the host-pressure rule. The first two commits only act on the host-pressure rule. The card's rule still hit the host_idle/unmapped_only gate (#3272), so every look walked the whole list and freed almost nothing. dea4b48 fixes that gate and applies the look budget to the card's rule as well.

My runs, same minigame as in #3512

RTX 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:

Before (main) Commits 1–2, first 13 min Commits 1–2, after the card filled up
Rendered fps (average) 12.1 24.4 17.8
Seconds with a frame over 300 ms 57 % 2 % 18 %
Seconds with a frame over 150 ms 93 % 59 % 85 %
Longest frame 1,154 ms 620 ms 1,196 ms

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:

23:53:26 INFO victory_gpu::frame_times: frame times: 9 frames, median 45.1 ms, p95 638.8, p99 638.8, longest 638.8; 2 over 50 ms, 1 over 100 ms
23:53:27 INFO victory_gpu::frame_times: frame times: 9 frames, median 44.5 ms, p95 652.8, p99 652.8, longest 652.8; 1 over 50 ms, 1 over 100 ms
23:53:28 INFO victory_gpu::frame_times: frame times: 10 frames, median 45.4 ms, p95 627.0, p99 627.0, longest 627.0; 2 over 50 ms, 1 over 100 ms

With this PR (commits 1–2), in the minigame:

05:06:10 INFO victory_gpu::frame_times: frame times: 22 frames, median 37.9 ms, p95 51.3, p99 166.3, longest 166.3; 2 over 50 ms, 1 over 100 ms
05:06:11 INFO victory_gpu::frame_times: frame times: 26 frames, median 37.6 ms, p95 46.0, p99 48.3, longest 48.3; 0 over 50 ms, 0 over 100 ms
05:06:12 INFO victory_gpu::frame_times: frame times: 23 frames, median 37.6 ms, p95 49.2, p99 153.1, longest 153.1; 1 over 50 ms, 1 over 100 ms

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.

@dyshay

dyshay commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics, and the CPU tests of the touched crates pass. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.

@mia03ther

Copy link
Copy Markdown

Adding a v2026.11.29.05 16 GB RAM data point (#3909) showing why texture/memory-pressure PRs like this matter even when VRAM stays under budget:

  • Hardware / Settings: Ryzen 9 8940HX, RTX 5070 Ti Laptop (12 GB), 16 GB RAM (36–48 GB pagefile), Win11 26300, Series S 540p, DLSS Performance, FG off, VICTORY_TEXTURE_ROOM_PERCENT=78, VICTORY_SLOT_EVICT_PERCENT=80, VICTORY_SLOT_EVICT_LOW_PERCENT=70.
  • Observed: VRAM stayed under budget (8,650–8,856 / 10,818 MB) with 0 pipeline failures or crashes across 10,933 frames, yet private commit hit 20.6–21.0 GB with only 5,494–5,863 MB resident (487–790 MB free RAM). Even after preload (early=3676), 694/10,933 frames exceeded 100 ms (longest 4,295.9 ms) and VICTORY_THIN / land guards swung between 259 ms and 617.8 ms under memory pressure. Hoping to see Host texture sweep: keep copies the title wants back soon after a host-pressure let-go (#3512) #3681 land in .06!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-fix Pull request: fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RTX 4070 Ti SUPER, Series X 1440p + 4x FG: a ~650 ms stall every second in a minigame (8-9 fps), texture room 1.1 GB over its line

4 participants