Skip to content

perf(gpu): opt-in switches to keep pools under commit pressure and move landed-list resets off the submit thread - #7

Open
mguttmann wants to merge 1 commit into
CHECK6960:perf/nv-nextfrom
mguttmann:perf/pools-steady-land-aside
Open

mguttmann wants to merge 1 commit into
CHECK6960:perf/nv-nextfrom
mguttmann:perf/pools-steady-land-aside

Conversation

@mguttmann

@mguttmann mguttmann commented Nov 28, 2026 •

Copy link
Copy Markdown

Summary

Two opt-in changes (both off by default, no behaviour change unless switched on) for periodic CPU-side stalls seen on a 32 GB / 16 GB-VRAM machine, plus one diagnostic line. Measured on the user's PC with real logs; details below.

  • VICTORY_POOLS_STEADY=1 ÔÇö a critical commit sample (residency::critical_commit, < 1536 MiB, sampled every 32 ms, no hysteresis) shrinks the send / scratch / idle-list pools to their existing pressured floors instead of to 0. A real E_OUTOFMEMORY still empties everything as before.
  • VICTORY_SEND_MIN_KB=<n> ÔÇö optional minimum size of a send buffer (unset = 8192 KiB as today).
  • VICTORY_LAND_ASIDE=1 ÔÇö with the relay and the helper running, the submitting thread no longer resets landed host lists itself; late_helper does it (falls back to the old behaviour from 96 waiting flights on).
  • VICTORY_CARD_SPLIT=1 ÔÇö diagnostic: one tracing::info line splitting "copies in the card's memory" (send buffers made/freed, lock waits, commit left). Two further always-on lines report landed-list resets (land_line, list::recycle_line).

Why

Hardware: Ryzen 7 9800X3D, RTX 5080 16 GB (driver 621.40), 32 GB RAM, Windows 11 26300, HAGS on, 2560x1440. perf/nv-next @ bd91cb7, release, -C target-cpu=native. Settings: Series X 1440p, DLSS, Frame Gen on, BVH off, VICTORY_THIN unset, VICTORY_ASYNC_SUBMIT=1.

Without the switches, about every third second the submitting thread went from ~25 ms to 90ÔÇô114 ms per frame while the card sat idle behind it (card ~26 % busy). Same scene, spike second vs. normal second:

per frame normal spike
submitting thread total 25.1 ms 114.0 ms
for copies in the card's memory 4.0 ms 85.8 ms
after the sending (landed lists reset and given back) 0.1 ms 37.1 ms
bytes of submissions' own sent up ÔÇö taking them out of the CPU sides 1.76 ms 83.37 ms
land: read-backs and lists 0.42 ms 81.49 ms
hash / compare passes 290 / 421 255 / 422

The pass counts are the same, so it is not more work but waiting. The log showed host memory pressure with available_commit_mib=3280 shortly after start. Reading the code: when the commit sample turns critical the pools go to limit 0, so each of ~37 submissions per frame creates a fresh 8 MiB upload buffer under CARD_WORK/QUEUE_ORDER (the land thread then waits for that lock ÔÇö its excess matches), landed lists are destroyed and remade, memory is returned, the sample recovers, the pools refill, and it starts over.

With POOLS_STEADY=1 + LAND_ASIDE=1 (same PC, same small page file): "copies in the card's memory" 4ÔÇô11 ms as per-minute averages and 32 ms in the worst second (before: 66 ms average over the spike seconds, 86 ms worst), "after the sending" 0.0 ms on the submitting thread (helper 0.8 ms). CARD_SPLIT confirmed the mechanism: in the worst seconds the commit left was 860 MB, "2901 of 2901" samples critical, and making/freeing ~55 MB of send buffers cost 23.5 / 17 ms per frame.

Honest caveat: the largest overall improvement came afterwards from the user's page file (system-managed 5.6 GB  fixed 64 GB; commit limit 36.6  95 GB). After that the commit never went below ~48 GB in a 20-minute run and fps followed scene density only (34 fps at ~2,200 draws/frame, 2021 fps at ~8,500). The point of this PR is that, under commit pressure, the current code makes things worse by throwing all pools away; these switches keep it from doing that. It might be worth mentioning the page file in docs/windows-memory.md for 32 GB machines.

Related observation (no code change here)

The README recommends VICTORY_TEXTURE_ROOM_PERCENT=80 with Frame Gen. On this 16 GB card that set the texture line to 11,881 MB of a 14,851 MB budget (the default line_for would give ~14,083 MB). After ~20 minutes the log showed the texture queue's room: 12681 MB in use  against a line of 11881 MB: no room, new textures wait with 9,703 textures waiting, and pedestrians visibly got wrong clothing/face textures. Maybe the 80 % advice should be limited to cards  12 GB.

Testing

  • Built and run on the machine above (Windows, MSVC, Rust 1.98.1); no crashes or rendering differences seen with the switches on.
  • Not tested on other GPUs/RAM sizes; all switches default to today's behaviour.

The analysis and patches were made with the help of Claude (Anthropic); measurements are from the user's own runs.

­ƒñû Generated with Claude Code

…ve landed-list resets off the submit thread

VICTORY_POOLS_STEADY=1: a critical commit sample shrinks the send/scratch/idle-list pools to their pressured floors instead of 0 (a real E_OUTOFMEMORY still empties them).
VICTORY_SEND_MIN_KB: optional minimum send buffer size (default 8192 KiB as before).
VICTORY_LAND_ASIDE=1: the submitting thread leaves landed-list resets to late_helper.
VICTORY_CARD_SPLIT=1: diagnostic split of 'copies in the card's memory'; plus land/recycle lines.
All default off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HuGTJNMrJLuUZxoXBD4Xjc
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.

1 participant