Skip to content

Sweeps behind flights every 15 s while memory is not pressed (a 36-100 ms frame every 1.5 s) - #340

Merged
trustno1-coder merged 3 commits into
trustno1-coder:mainfrom
bentsignal:sweep-every
Nov 28, 2026
Merged

trustno1-coder merged 3 commits into
trustno1-coder:mainfrom
bentsignal:sweep-every

Conversation

@bentsignal

Copy link
Copy Markdown
Contributor

What this fixes

A regular stutter: about one frame in every 1.5 s took 36-100 ms instead of ~31, even standing still.

With the present sent ahead (late_free_present), submit makes a moment with nothing in the air for the sweep every 1.5 s. It does that by settling every flight first, so that frame waits for the card to drain. A 45-frame timeline (VICTORY_TIMELINE) of the prologue's cell put the two longest frames on it:

frame of 82.0 ms ...: 58.41 ms  submit: the sweep
frame of 58.8 ms ...: 35.76 ms  submit: the sweep

With VICTORY_SWEEP=0 there was no frame over 50 ms at all. The sweep can't simply go, though: it is what lets idle host copies, staging buffers and textures go.

The change

Host::sweep_every_ms sets how often a sweep is made behind flights:

  • every 15 s (VICTORY_SWEEP_EVERY_MS, 15,000 by default; 1,500 restores the old cadence) while memory is not pressed;
  • every 1.5 s, as before, while it is: residency::pressured(), or the card's use, less the texture pool's free part, at or over resource::room_line (the line textures are made up to). From that line on, textures are held back for room, and the sweep is what frees idle ones. The first version used 97 % of the budget instead, which left textures waiting between ~93 % and 97 %.

It is looked at twice a second, and the log says when it switches (sweeps behind flights pressed=... every_ms=...). Sweeps that need no settle (nothing in the air anyway) are unchanged.

Measured

RTX 5070 Ti 16 GB, Ryzen 9 9900X, 61.6 GB RAM, Windows 11. Series X profile, 2560x1440, DLSS Quality, release, pipelines warmed. Prologue cell, 40 s steady state, frame times from the present intervals:

sweeps every 1.5 s no sweeps (VICTORY_SWEEP=0) this PR, memory not pressed, frame generation 3x
median 30.7 ms 30.7 ms 34.6-35.1 ms (frame generation costs ~3 fps)
p99 60.1 ms 39.1 ms 37-40 ms
worst 99.2 ms 48.3 ms 45-47 ms
frames over 50 ms 0.68 /s 0 0

The first two columns are without frame generation; the third is from five runs with it.

The last column also needs memory not to be pressed. On this PC that needed a separate fix to how commit is counted (a separate PR, "Residency: count what the pagefiles can still grow by as commit left"). Without it, the residency pressure stays on and the sweep keeps its 1.5 s pace, which is the same as today.

Tests

  • cargo test -p victory-gpu --lib: same results as main (indirect::tests::host_list_budget_starts_empty_at_each_submission and warp_batch_charges_every_execution fail on main too). watch::tests::what_is_put_in_beside_the_guards_is_told_at_every_view failed once in a full run and passed alone, on this branch and on main.
  • cargo clippy -p victory-gpu --all-targets: no new warnings.
  • A 6-minute session with this change and frame generation 3x: no error, no frame over 50 ms.

Setup

Own dump of the title. No game files are attached or quoted.

This change and its testing were done with an AI assistant (Claude Code), and the results were checked on my machine.

🤖 Generated with Claude Code

bentsignal and others added 2 commits November 27, 2026 16:05
…_SWEEP_EVERY_MS)

Each sweep made behind flights settles everything in the air first; those
frames took 36-82 ms instead of ~31 on an RTX 5070 Ti, at every 1.5 s: the
0.7 frames a second over 50 ms that made the prison stutter. With no sweeps
the cell had none (p99 60 -> 39 ms, worst 99 -> 48 ms). They stay at 1.5 s
while the PC's memory is pressed (residency thresholds) or the card's use is
over 97% of its budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…7% of its budget

Textures are held back for room from that line on, and it is the sweep that
lets idle ones go; between the line and 97% the sweep would have come every
15 s only.

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

POMXARK commented Nov 28, 2026 •

Copy link
Copy Markdown

Testing feedback on AMD Ryzen 7 5700X (8C/16T), NVIDIA RTX 5080 16 GB, 32 GB RAM, Windows 11, Series X 1440p + DLSS Quality + DLSS MFG 4× (4 MiB default windows, VICTORY_GPU_BCPACK=0, VICTORY_WAIT_RESIDENT=0, VICTORY_TEXTURE_ROOM_PERCENT=70, VICTORY_LAND_SKIP=1, default VICTORY_SWEEP_EVERY_MS=15000).

Full disclosure: tested on a fork branch based on v2026.11.27.7 (with local GPU patches, x86-64-v3/ThinLTO, and PR #516).

Result — 12-minute (720 s) 3D run (3.2k–5.3k draws/frame)

  • Stability & memory safety: 0 errors, 0 DeviceRemoved, 0 guest exceptions, 198/198 Responding, SharedMax = 6,879 MB, loose_mb = 2,808 MB, MinFreeC = 12.86 GB.
  • Automatic pressure switching verified in logs:
    • sweeps behind flights pressed=false every_ms=15000 (initial)
    • sweeps behind flights pressed=true every_ms=1500 (during heavy streaming load)
    • sweeps behind flights pressed=false every_ms=15000 (steady 3D)
  • Frame pacing & audio:
    • Reduced the periodic audio hitches seen under fixed 1500 ms sweeps once memory pressure subsided.
    • Steady 360..760 s stretch (n=56 samples, 4k–5.3k draws/frame): 16.6–17.6 FPS p50 (56.7–60.2 ms), max = 68.8 ms, 0 frames >=250 ms, 0 GPU stalls >=50 ms (66–79 FPS with MFG 4×).
    • Matched 0..360 s stretch vs identical build without PR Sweeps behind flights every 15 s while memory is not pressed (a 36-100 ms frame every 1.5 s) #340: 14.5 FPS p50 (69.2 ms, max 118.4 ms, 0 frames >=250 ms) vs 14.2 FPS (70.2 ms, max 400.2 ms, 1 frame >=250 ms).

Clean frame-pacing win with safe automatic fallback to 1500 ms under memory/VRAM pressure.

LegitCamper added a commit to LegitCamper/VIctory-Fixes that referenced this pull request Nov 28, 2026
Integrate upstream PRs trustno1-coder#850, trustno1-coder#448, trustno1-coder#630/trustno1-coder#682, trustno1-coder#340, trustno1-coder#799 and trustno1-coder#849. Preserve existing refresh batching and facial half views; retain narrow barriers as opt-in. Cover combined half-view dirty tracking and isolate synthetic raw descriptor heaps.
MystifiedSky added a commit to MystifiedSky/VIctory-NVIDIA-Improved that referenced this pull request Nov 28, 2026
…m (VICTORY_SWEEP_PRESS_BY_ROOM)

The pressed test compared the card's use with the texture line but left out
what the pass keeps for render targets and buffer copies, so it said "not
pressed" for seconds at a time while every pass held new textures back: in a
cutscene thousands of slots a second were held, served up to 32 s after their
write, with sweeps every 15 s meanwhile. Now it asks resource::room, as the
pass does. VICTORY_SWEEP_PRESS_BY_ROOM=0: by the use alone, as before.

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

Copy link
Copy Markdown
Contributor Author

One more commit here, since it corrects this PR's own "pressed" rule: the card now counts as pressed when the texture pass finds no room (resource::room, which also counts what is kept for render targets and buffer copies), not by the card's use against the line alone.

Why: in a cutscene on an RTX 5070 Ti (16 GB, Windows giving the process ~10.9 GB, frame generation 3x), the use-only test said "not pressed" for seconds at a time while every texture pass held new textures back: ~9,800 slots a second held for room, served a median 0.9 s and up to 32 s after their write, while sweeps ran every 15 s. Measured together with #1095 (texture pass held-slot cap) and a launcher texture line of 93 %: 23.3 -> 29.7 fps, frames over 50 ms 4.6 -> 2.2 a second, held slots 9,800 -> 1,200 a second, served median 919 -> ~220 ms. This commit's own share was not measured apart.

VICTORY_SWEEP_PRESS_BY_ROOM=0 restores the use-only test.

🤖 Generated with Claude Code

@trustno1-coder
trustno1-coder merged commit e6cf400 into trustno1-coder:main Nov 28, 2026
1 check failed
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.

3 participants