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

Open
github-bot wants to merge 2 commits from github-bot/gh-340 into main AGit
Owner

@⁠bentsignal on GitHub · 2026-11-27 21:13 UTC · original
bentsignal:sweep-every → main · +42 −1 · 1 files · 2 commits · open

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** on GitHub · 2026-11-27 21:13 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/340) `bentsignal:sweep-every` → `main` · +42 −1 · 1 files · 2 commits · open ## 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](https://claude.com/claude-code)
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 <[email protected]>
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 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 21:17:41 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/340/head:github-bot/gh-340'
git switch 'github-bot/gh-340'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-340'
git switch 'github-bot/gh-340'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-340'
git switch 'github-bot/gh-340'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-340'
git switch 'main'
git merge --squash 'github-bot/gh-340'
git switch 'main'
git merge --ff-only 'github-bot/gh-340'
git switch 'main'
git merge 'github-bot/gh-340'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.