Sends: under host memory pressure the spares the frames use stay, memory past 256 MiB is never kept, and releases leave the submitting thread (a 32 GB PC made them again every second) #3994

Merged
Lyrnc merged 3 commits from upstream-pr/3994 into main 2026-11-30 16:28:30 +00:00
Lyrnc commented 2026-11-30 14:01:00 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T14:01:00Z.


Problem

On a 32 GB PC, walking got much slower after 158d3177. Measured on an RTX 5080 + 9800X3D, Series X at 1440p, walking:

  • send::trim() takes ~71 ms of the sweep every second. Single sweeps take 79-98 ms, and they run on the submitting thread.
  • Card copies go from 3.4 to 6.6 ms a frame, because the send buffers that are made again are counted there.
  • Page-ins are 2-4 times as many.

A bench-only check, where trim() returns early unless critical_commit() holds, gave:

main trim only at critical commit
fps 21.5 23.3
frames over 100 ms, per 1,000 42 35
longest frame 723 ms 224 ms
card copies, per frame 6.6 ms 3.4 ms
page-ins, per second 7.9k 2.5k

That check is not this branch (see "Verification" and "Not tested").

Root cause

158d3177 ("Small hosts of RAM: the L0 caches of ours sized down…", 2026-11-28) added send::trim() to the once-a-second sweep. It runs whenever residency::pressured() holds: free RAM under 5 GB, or commit under 6 GB.

  • The pressure never clears. With the title at ~31 GB private, a 32 GB PC is under pressure all the time. Play leaves 0.1-0.8 GB of RAM free.
  • The trim drops the working set. Each sweep cuts the submissions' send spares down to the 16 MiB hot floor. A frame sends ~46 MB (VICTORY_SEND_OWN), so the next frames make the 8-64 MiB upload buffers again: a fresh map, zeroed pages, and later another release.
  • The release is slow, and blocks the submitting thread. The sweep runs there, and the old trim also dropped the buffers while it held the spares' lock.
  • The biggest go first. The pool is sorted biggest first and trimmed from the front, so the spare left at the floor is never the one the next large submission needs.

Letting go of buffers the next frames make again saves no memory at the frame's peak, however little RAM is free. It only adds the cost of making and releasing them every second.

Fix

All in crates/victory-gpu/src/host/send.rs, plus one line in the sweep in host.rs and a docs/bug-journal.md entry.

  • What was in use lately, counted per size class. Send memory comes in 10 size classes (doubles from 8 MiB up to 2 GiB, and one for larger).
    • InUse counts, per class, how many buffers submissions hold now and the most they held at once since the last sweep.
    • It also counts the bytes those requests needed at once, each at the size it would be made at. That is not the size of a bigger spare a small request took.
    • It records the bytes in use at the sweep.
    • memory() lends a buffer and give_back() returns it. A Drop on Memory covers a plan given up without coming back.
    • Every sweep, under pressure or not, send::tick() pushes this into a window of the last VICTORY_SEND_KEEP_SECONDS sweeps (10 by default, once a second).
  • What stays under ordinary pressure (trim_line + staying, both pure):
    1. Whatever RAM is free, each class keeps as many spares as were in use at once in the window, so a class shrinks only when it went unused for the whole window.
    2. Also whatever RAM is free, the spares are at least the window's largest need-at-once, less what is in use at the sweep (filled with the smallest others), or the 16 MiB hot floor.
    3. Only spares beyond that are held to kept() (the host cap) scaled by the share of 8 GiB of RAM that is free. That is the line the copy sources' spares use too (keeps_under_pressure): 768 MiB with 8 GiB free, 0 with none.
    • At critical commit (critical_commit(), under 1.5 GiB) everything goes, as before.
    • VICTORY_SEND_KEEP_SECONDS=0 gives exactly the old rule: the hot floor alone. A test checks that, so the bench can A/B in one build.
  • Memory past 256 MiB is never kept. A world load's sends (one submission of 2112 MiB) are made at their own size in 64 KiB steps, let go as soon as their submission has run, and not counted in what was in use. By doubles such a request was made at 4 GiB, which one upload buffer may not be. From 64 to 256 MiB, memory is made in 64 MiB steps, not by doubles.
  • Released off the submitting thread. What a trim or a give-back (over kept(), or past 256 MiB) lets go is passed, outside the spares' lock, to victory-send-free, a thread started on first use that only drops them. If that thread cannot be started, they are dropped in place as before.
  • Why not a fixed floor, or one scaled by free RAM.
    • The copy sources' spares (spare_trim_to, #1520 / PR #57) keep a fixed one: 16 MiB, or SPARE_MOST with 8 GiB of RAM free. That works for 4 MiB scratch chunks. A frame's sends are ~46 MB in buffers of up to 64 MiB, so any fixed floor small enough for a 16 GB PC is too small for the working set.
    • Scaling everything kept by free RAM was tried (1ecaa98a). With 0.1-0.8 GB free it trimmed the working set every sweep and the churn came back (see "Verification").
  • The 158d3177 / #1520 intent is kept.
    • The cap of kept() (128 MiB on a small host, 768 MiB on a large one) is unchanged.
    • Critical commit still empties the pool.
    • Spares no frame used for 10 s go, and so do spares beyond the working set when RAM is short.
    • Load-sized buffers are never kept.
  • A log line at the sweep, only when something was made or let go: "submission send memory since the last sweep", with made, made_mib, let_go, let_go_mib, spare_mib and needed_at_once_mib.
  • One buffer per submission is kept. Splitting a submission's sends over buffers of at most 64 MiB each would bound them to one step. But Own::record, its scatter pass and the copy queue's copy of Own::source (upq) each address one buffer, so the split would change the path the card reads its bytes from. That is not done here; it is marked shortcut: at made_for. With memory past 256 MiB never kept, the slack only matters below 256 MiB, where it is under 64 MiB.
  • Two small refactors make the decision testable: fit (the least spare that holds a request) and made_for.

Verification

Our bench, walking in-world on the 32 GB PC (RTX 5080, Series X 1440p), 300 s each:

697590ad (by use, no RAM line) 1ecaa98a (everything held to the RAM-scaled line)
send buffers made / let go 7 / 6 524 / 522 (19.5 GiB each way)
card copies, per frame 3.4 ms 5.0 ms
fps 23.1 22.6
frames over 100 ms (per 1,000) 36 41
  • On 697590ad the send-trim cost was gone. But one sweep made 640 MiB at once in two buffers, and the spares then stayed at ~656 MiB on a PC that pages heavily. 1ecaa98a was meant for that, but brought the churn back.
  • On 1ecaa98a, needed_at_once was 128-144 MiB against 168-232 MiB of spares, so each sweep made 2-5 buffers and let 1-4 go.
  • 8b801739 has the in-use rule of 697590ad (regardless of RAM), plus the need floor, the RAM-scaled part for spares beyond those, and no keeping past 256 MiB. It is measured in game below.

The tip (8b801739), measured in game on the same 32 GB PC, walking, Series X native 1440p, DLSS off, world +30..330 s:

build fps >100 ms per 1,000 sweep: send trim send buffers made / let go in 300 s card copies
our fork's main (has 158d3177) 21.3 / 22.0 43.9 / 41.1 80-83 ms per sweep (every second) 7.3 / 6.9 ms
that main + sweep spreading + this + #3272's let_go_idle (2 runs) 23.8 / 24.1 10.9 / 10.2 0.1-0.2 ms 3 / 1 and 2 / 1 3.5 ms

Largest kept spare in those runs: 464-504 MiB; needed_at_once 184-192 MiB. With the camera turning (standing, steady turn), this alone takes the turn from ~15 to 17.8 fps and card copies from 12.5 to 6.3 ms.

Side by side with the other open fixes for the same churn (on vnv 829188e9 + #3347, walk, first round of two; one run each, so noisy):

arm fps >100 ms per 1,000 send trim per sweep card copies
base 19.5 55.4 68.0 ms 10.6 ms
this (8b801739) 20.3 52.1 0.0 ms 6.1 ms
#3381 21.7 35.0 9.3 ms 6.3 ms
#3411 20.2 52.5 4.9 ms 6.3 ms

All three remove most of the churn. #3381 had the better fps in this round; this branch is the only one that takes the send trim to zero and frees off the submitting thread. The second round is running; I'll add it here. If #3381 holds its lead, merging it and keeping this branch's per-size window and off-thread release on top would be the combination to consider.

Windows 11, MSVC, own target dir, -j 6, on 8b801739:

  • cargo check -p victory-gpu --locked: passes. None of its warnings are in host/send.rs or at the sweep line in host.rs.
  • cargo test -p victory-gpu --lib --locked -- host::send::: 15 passed, 0 failed, 1 ignored (the existing GPU scatter test). The 12 new tests:
    • with_no_ram_free_a_walk_whose_sends_move_makes_nothing_after_its_first_second. This is the bench's case: a model of memory(), give_back() (with its cap), tick() and trim() over 7 seconds of 20 frames, three frames in the air.
      • Each submission's send moves across the sizes made, frame to frame (34 MB takes 64 MiB, 9 MB takes 16 MiB), and one frame in five also sends 66 MB.
      • With 0, 0.5 and 16 GiB free: 13 buffers made in the first second and none after, with 352 MiB of spares.
      • With the hot floor alone, 4 are made again every second.
      • 1ecaa98a's rule, modelled the same way (outside the suite), made one again every second with 224 MiB of spares, close to the bench's 168-232.
    • under_pressure_that_never_clears_a_steady_frame_makes_nothing_again: steady 30 + 12 + 4 MB frames, with one and two in the air, 16 GiB or no RAM free. Nothing is made after the first second. The old rule makes 2 again every second.
    • a_bursts_buffers_go_with_the_window_or_at_once_past_256_mib: one frame also sends 300 + 100 MB.
      • The 300 MB buffer is made at its own size and never kept.
      • The 128 MiB one stays while its class was in use in the window. With no RAM free it then goes; with room, it stays.
      • A load's 2112 MiB is made once and never kept.
    • the_trim_line_keeps_what_the_window_used_and_scales_only_the_rest_by_free_ram: room at 0, 2, 8 and 32 GiB free. The in-use counts and the need floor are the same whatever RAM is free. Nothing seen gives the hot floor; critical commit gives nothing.
    • a_trim_keeps_what_was_in_use_lately_whatever_ram_is_free: classes kept, the need fill, and the room fill.
    • critical_commit_lets_every_spare_go_and_free_ram_governs_only_the_rest.
    • with_nothing_in_use_lately_a_trim_is_the_hot_floor_of_158d3177: with an empty window the result equals the old rule on five pools.
    • Also: send_memory_classes_are_doubles_from_8_mib, send_memory_is_made_by_doubles_then_in_steps_then_at_its_own_size, in_use_counts_the_most_at_once_between_sweeps, the_window_wants_the_most_of_each_class_in_its_sweeps, what_a_scene_left_behind_goes_once_the_window_has_passed.
  • cargo clippy -p victory-gpu --all-targets --locked: passes. Its warnings are all in code this branch does not touch, none on a line it adds or changes. -D warnings was not used, because main already fails it elsewhere.
  • The branch merges cleanly with vnv/main 41adb551 (git merge-tree).

NOT tested

  • The shootout's second round (results above are round one). The numbers above for the two earlier commits only.
  • The spares the tip keeps were not measured in game. In the model they are 352 MiB with three frames in the air and sends that move across sizes. In play they are bounded by kept() (768 MiB).
  • The 10-sweep window, the 8 GiB line of room and the 256 MiB line are choices, not measurements.
  • Not run on a 16 GB PC. The kept() cap, critical commit and the scaled part beyond what is used are as described. Whether keeping the working set under pressure moves anything toward the 8 GiB shared cap of #1520 was not measured.
  • Only the host::send:: tests were run. The rest of the victory-gpu lib suite was not, and neither was cargo xtask policy (the change is .rs and .md only).
  • Release timing on the free thread. Whether releasing on victory-send-free while the submitting thread makes new upload buffers still contends in the driver was not measured.

Overlap

Open PRs found by title and by touching host/send.rs (searched: send, trim, spare, send own, L0, upload buffers, 158d3177):

  • #3381 (Maverick0351a, "host, send, uav_pool: trim only unborrowed low-water spare pools at 1 Hz sweep"). Same problem, different rule:
    • It keeps a low-water mark of the pool's bytes since the last sweep and lets the never-borrowed surplus above the floor go.
    • Its window is one sweep and it is not by size: a buffer unused for one second goes, though the next busy frame may want it.
    • It does not treat load-sized buffers apart.
    • It releases outside the lock, but still on the submitting thread.
    • It also changes the copy-source and UAV pools.
    • Conflicts with this branch in trim, memory and give_back.
  • #3411 (dragoso, "RTX 5060 Ti: … send spares kept under pressure …", bundled with other changes). Same idea:
    • Spares not given back since the sweep before go, down to the floor. Also a one-second window, not by size.
    • It drops them inside the lock, on the submitting thread.
    • Their profile, at 20 GB of title on a 32 GB PC, shows the same thing: 8-9 ms a frame of the submitting thread in Map of new buffers and in releasing them.
    • Conflicts in trim, Memory and give_back.
  • #3650 (happyrain01, a large bundle) adds an opt-in VICTORY_SEND_KEEP=1 after #3411's idea, plus churn stats. It conflicts in trim.
  • #3729 (HQasper, "a submission's memory past what is kept is made at its own size", for a 4 GiB upload refused at world load). Overlaps in effect: here memory past 256 MiB is made at its own size, and never kept. Theirs does it past kept(), and the buffer can then still be pooled. Textual conflict: their made_size(size, kept) against our made_for.
  • #3791, #3426, #3500 touch on_card / kept / a spare-bytes reader in send.rs. Small textual conflicts at most, no overlap in what they change.
  • No open PR keeps the spares by recent use per size regardless of free RAM, uses a window longer than one sweep, keeps load-sized buffers out of the pool, or releases them off the submitting thread.

AI use

Claude Code (Claude Opus 5.5) wrote the change, its tests and this description from our bench's measurements and a reading of 158d3177, #1520 / PR #57 (spare_trim_to's floor) and the overlapping PRs. The numbers in "Problem" and the bench rows in "Verification" come from our bench runs, not from the model.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5566763301 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3994). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T14:01:00Z. --- ## Problem On a 32 GB PC, walking got much slower after 158d3177. Measured on an RTX 5080 + 9800X3D, Series X at 1440p, walking: - `send::trim()` takes ~71 ms of the sweep every second. Single sweeps take 79-98 ms, and they run on the submitting thread. - Card copies go from 3.4 to 6.6 ms a frame, because the send buffers that are made again are counted there. - Page-ins are 2-4 times as many. A bench-only check, where `trim()` returns early unless `critical_commit()` holds, gave: | | main | trim only at critical commit | |---|---|---| | fps | 21.5 | 23.3 | | frames over 100 ms, per 1,000 | 42 | 35 | | longest frame | 723 ms | 224 ms | | card copies, per frame | 6.6 ms | 3.4 ms | | page-ins, per second | 7.9k | 2.5k | That check is not this branch (see "Verification" and "Not tested"). ## Root cause 158d3177 ("Small hosts of RAM: the L0 caches of ours sized down…", 2026-11-28) added `send::trim()` to the once-a-second sweep. It runs whenever `residency::pressured()` holds: free RAM under 5 GB, or commit under 6 GB. - **The pressure never clears.** With the title at ~31 GB private, a 32 GB PC is under pressure all the time. Play leaves 0.1-0.8 GB of RAM free. - **The trim drops the working set.** Each sweep cuts the submissions' send spares down to the 16 MiB hot floor. A frame sends ~46 MB (`VICTORY_SEND_OWN`), so the next frames make the 8-64 MiB upload buffers again: a fresh map, zeroed pages, and later another release. - **The release is slow, and blocks the submitting thread.** The sweep runs there, and the old trim also dropped the buffers while it held the spares' lock. - **The biggest go first.** The pool is sorted biggest first and trimmed from the front, so the spare left at the floor is never the one the next large submission needs. Letting go of buffers the next frames make again saves no memory at the frame's peak, however little RAM is free. It only adds the cost of making and releasing them every second. ## Fix All in `crates/victory-gpu/src/host/send.rs`, plus one line in the sweep in `host.rs` and a `docs/bug-journal.md` entry. - **What was in use lately, counted per size class.** Send memory comes in 10 size classes (doubles from 8 MiB up to 2 GiB, and one for larger). - `InUse` counts, per class, how many buffers submissions hold now and the most they held at once since the last sweep. - It also counts the bytes those requests needed at once, each at the size it would be made at. That is not the size of a bigger spare a small request took. - It records the bytes in use at the sweep. - `memory()` lends a buffer and `give_back()` returns it. A `Drop` on `Memory` covers a plan given up without coming back. - Every sweep, under pressure or not, `send::tick()` pushes this into a window of the last `VICTORY_SEND_KEEP_SECONDS` sweeps (10 by default, once a second). - **What stays under ordinary pressure** (`trim_line` + `staying`, both pure): 1. **Whatever RAM is free,** each class keeps as many spares as were in use at once in the window, so a class shrinks only when it went unused for the whole window. 2. **Also whatever RAM is free,** the spares are at least the window's largest need-at-once, less what is in use at the sweep (filled with the smallest others), or the 16 MiB hot floor. 3. **Only spares beyond that** are held to `kept()` (the host cap) scaled by the share of 8 GiB of RAM that is free. That is the line the copy sources' spares use too (`keeps_under_pressure`): 768 MiB with 8 GiB free, 0 with none. - At critical commit (`critical_commit()`, under 1.5 GiB) everything goes, as before. - `VICTORY_SEND_KEEP_SECONDS=0` gives exactly the old rule: the hot floor alone. A test checks that, so the bench can A/B in one build. - **Memory past 256 MiB is never kept.** A world load's sends (one submission of 2112 MiB) are made at their own size in 64 KiB steps, let go as soon as their submission has run, and not counted in what was in use. By doubles such a request was made at 4 GiB, which one upload buffer may not be. From 64 to 256 MiB, memory is made in 64 MiB steps, not by doubles. - **Released off the submitting thread.** What a trim or a give-back (over `kept()`, or past 256 MiB) lets go is passed, outside the spares' lock, to `victory-send-free`, a thread started on first use that only drops them. If that thread cannot be started, they are dropped in place as before. - **Why not a fixed floor, or one scaled by free RAM.** - The copy sources' spares (`spare_trim_to`, #1520 / PR #57) keep a fixed one: 16 MiB, or `SPARE_MOST` with 8 GiB of RAM free. That works for 4 MiB scratch chunks. A frame's sends are ~46 MB in buffers of up to 64 MiB, so any fixed floor small enough for a 16 GB PC is too small for the working set. - Scaling everything kept by free RAM was tried (1ecaa98a). With 0.1-0.8 GB free it trimmed the working set every sweep and the churn came back (see "Verification"). - **The 158d3177 / #1520 intent is kept.** - The cap of `kept()` (128 MiB on a small host, 768 MiB on a large one) is unchanged. - Critical commit still empties the pool. - Spares no frame used for 10 s go, and so do spares beyond the working set when RAM is short. - Load-sized buffers are never kept. - **A log line at the sweep, only when something was made or let go:** "submission send memory since the last sweep", with `made`, `made_mib`, `let_go`, `let_go_mib`, `spare_mib` and `needed_at_once_mib`. - **One buffer per submission is kept.** Splitting a submission's sends over buffers of at most 64 MiB each would bound them to one step. But `Own::record`, its scatter pass and the copy queue's copy of `Own::source` (`upq`) each address one buffer, so the split would change the path the card reads its bytes from. That is not done here; it is marked `shortcut:` at `made_for`. With memory past 256 MiB never kept, the slack only matters below 256 MiB, where it is under 64 MiB. - **Two small refactors** make the decision testable: `fit` (the least spare that holds a request) and `made_for`. ## Verification **Our bench, walking in-world on the 32 GB PC (RTX 5080, Series X 1440p), 300 s each:** | | 697590ad (by use, no RAM line) | 1ecaa98a (everything held to the RAM-scaled line) | |---|---|---| | send buffers made / let go | 7 / 6 | 524 / 522 (19.5 GiB each way) | | card copies, per frame | 3.4 ms | 5.0 ms | | fps | 23.1 | 22.6 | | frames over 100 ms (per 1,000) | 36 | 41 | - On 697590ad the send-trim cost was gone. But one sweep made 640 MiB at once in two buffers, and the spares then stayed at ~656 MiB on a PC that pages heavily. 1ecaa98a was meant for that, but brought the churn back. - On 1ecaa98a, `needed_at_once` was 128-144 MiB against 168-232 MiB of spares, so each sweep made 2-5 buffers and let 1-4 go. - 8b801739 has the in-use rule of 697590ad (regardless of RAM), plus the need floor, the RAM-scaled part for spares beyond those, and no keeping past 256 MiB. It is measured in game below. **The tip (8b801739), measured in game on the same 32 GB PC**, walking, Series X native 1440p, DLSS off, world +30..330 s: | build | fps | >100 ms per 1,000 | sweep: send trim | send buffers made / let go in 300 s | card copies | |---|---:|---:|---:|---:|---:| | our fork's main (has 158d3177) | 21.3 / 22.0 | 43.9 / 41.1 | 80-83 ms per sweep | (every second) | 7.3 / 6.9 ms | | that main + sweep spreading + this + #3272's `let_go_idle` (2 runs) | **23.8 / 24.1** | **10.9 / 10.2** | **0.1-0.2 ms** | 3 / 1 and 2 / 1 | 3.5 ms | Largest kept spare in those runs: 464-504 MiB; `needed_at_once` 184-192 MiB. With the camera turning (standing, steady turn), this alone takes the turn from ~15 to 17.8 fps and card copies from 12.5 to 6.3 ms. **Side by side with the other open fixes for the same churn** (on vnv 829188e9 + #3347, walk, first round of two; one run each, so noisy): | arm | fps | >100 ms per 1,000 | send trim per sweep | card copies | |---|---:|---:|---:|---:| | base | 19.5 | 55.4 | 68.0 ms | 10.6 ms | | this (8b801739) | 20.3 | 52.1 | **0.0 ms** | 6.1 ms | | #3381 | **21.7** | **35.0** | 9.3 ms | 6.3 ms | | #3411 | 20.2 | 52.5 | 4.9 ms | 6.3 ms | All three remove most of the churn. #3381 had the better fps in this round; this branch is the only one that takes the send trim to zero and frees off the submitting thread. The second round is running; I'll add it here. If #3381 holds its lead, merging it and keeping this branch's per-size window and off-thread release on top would be the combination to consider. Windows 11, MSVC, own target dir, `-j 6`, on 8b801739: - `cargo check -p victory-gpu --locked`: passes. None of its warnings are in `host/send.rs` or at the sweep line in `host.rs`. - `cargo test -p victory-gpu --lib --locked -- host::send::`: 15 passed, 0 failed, 1 ignored (the existing GPU scatter test). The 12 new tests: - `with_no_ram_free_a_walk_whose_sends_move_makes_nothing_after_its_first_second`. This is the bench's case: a model of `memory()`, `give_back()` (with its cap), `tick()` and `trim()` over 7 seconds of 20 frames, three frames in the air. - Each submission's send moves across the sizes made, frame to frame (34 MB takes 64 MiB, 9 MB takes 16 MiB), and one frame in five also sends 66 MB. - With 0, 0.5 and 16 GiB free: 13 buffers made in the first second and none after, with 352 MiB of spares. - With the hot floor alone, 4 are made again every second. - 1ecaa98a's rule, modelled the same way (outside the suite), made one again every second with 224 MiB of spares, close to the bench's 168-232. - `under_pressure_that_never_clears_a_steady_frame_makes_nothing_again`: steady 30 + 12 + 4 MB frames, with one and two in the air, 16 GiB or no RAM free. Nothing is made after the first second. The old rule makes 2 again every second. - `a_bursts_buffers_go_with_the_window_or_at_once_past_256_mib`: one frame also sends 300 + 100 MB. - The 300 MB buffer is made at its own size and never kept. - The 128 MiB one stays while its class was in use in the window. With no RAM free it then goes; with room, it stays. - A load's 2112 MiB is made once and never kept. - `the_trim_line_keeps_what_the_window_used_and_scales_only_the_rest_by_free_ram`: `room` at 0, 2, 8 and 32 GiB free. The in-use counts and the need floor are the same whatever RAM is free. Nothing seen gives the hot floor; critical commit gives nothing. - `a_trim_keeps_what_was_in_use_lately_whatever_ram_is_free`: classes kept, the need fill, and the room fill. - `critical_commit_lets_every_spare_go_and_free_ram_governs_only_the_rest`. - `with_nothing_in_use_lately_a_trim_is_the_hot_floor_of_158d3177`: with an empty window the result equals the old rule on five pools. - Also: `send_memory_classes_are_doubles_from_8_mib`, `send_memory_is_made_by_doubles_then_in_steps_then_at_its_own_size`, `in_use_counts_the_most_at_once_between_sweeps`, `the_window_wants_the_most_of_each_class_in_its_sweeps`, `what_a_scene_left_behind_goes_once_the_window_has_passed`. - `cargo clippy -p victory-gpu --all-targets --locked`: passes. Its warnings are all in code this branch does not touch, none on a line it adds or changes. `-D warnings` was not used, because main already fails it elsewhere. - The branch merges cleanly with vnv/main 41adb551 (`git merge-tree`). ## NOT tested - **The shootout's second round** (results above are round one). The numbers above for the two earlier commits only. - **The spares the tip keeps were not measured in game.** In the model they are 352 MiB with three frames in the air and sends that move across sizes. In play they are bounded by `kept()` (768 MiB). - **The 10-sweep window, the 8 GiB line of `room` and the 256 MiB line are choices, not measurements.** - **Not run on a 16 GB PC.** The `kept()` cap, critical commit and the scaled part beyond what is used are as described. Whether keeping the working set under pressure moves anything toward the 8 GiB shared cap of #1520 was not measured. - **Only the `host::send::` tests were run.** The rest of the `victory-gpu` lib suite was not, and neither was `cargo xtask policy` (the change is `.rs` and `.md` only). - **Release timing on the free thread.** Whether releasing on `victory-send-free` while the submitting thread makes new upload buffers still contends in the driver was not measured. ## Overlap Open PRs found by title and by touching `host/send.rs` (searched: send, trim, spare, send own, L0, upload buffers, 158d3177): - **#3381** (Maverick0351a, "host, send, uav_pool: trim only unborrowed low-water spare pools at 1 Hz sweep"). Same problem, different rule: - It keeps a low-water mark of the pool's bytes since the last sweep and lets the never-borrowed surplus above the floor go. - Its window is one sweep and it is not by size: a buffer unused for one second goes, though the next busy frame may want it. - It does not treat load-sized buffers apart. - It releases outside the lock, but still on the submitting thread. - It also changes the copy-source and UAV pools. - Conflicts with this branch in `trim`, `memory` and `give_back`. - **#3411** (dragoso, "RTX 5060 Ti: … send spares kept under pressure …", bundled with other changes). Same idea: - Spares not given back since the sweep before go, down to the floor. Also a one-second window, not by size. - It drops them inside the lock, on the submitting thread. - Their profile, at 20 GB of title on a 32 GB PC, shows the same thing: 8-9 ms a frame of the submitting thread in `Map` of new buffers and in releasing them. - Conflicts in `trim`, `Memory` and `give_back`. - **#3650** (happyrain01, a large bundle) adds an opt-in `VICTORY_SEND_KEEP=1` after #3411's idea, plus churn stats. It conflicts in `trim`. - **#3729** (HQasper, "a submission's memory past what is kept is made at its own size", for a 4 GiB upload refused at world load). Overlaps in effect: here memory past 256 MiB is made at its own size, and never kept. Theirs does it past `kept()`, and the buffer can then still be pooled. Textual conflict: their `made_size(size, kept)` against our `made_for`. - **#3791, #3426, #3500** touch `on_card` / `kept` / a spare-bytes reader in `send.rs`. Small textual conflicts at most, no overlap in what they change. - No open PR keeps the spares by recent use per size regardless of free RAM, uses a window longer than one sweep, keeps load-sized buffers out of the pool, or releases them off the submitting thread. ## AI use Claude Code (Claude Opus 5.5) wrote the change, its tests and this description from our bench's measurements and a reading of 158d3177, #1520 / PR #57 (`spare_trim_to`'s floor) and the overlapping PRs. The numbers in "Problem" and the bench rows in "Verification" come from our bench runs, not from the model. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Lyrnc commented 2026-11-30 14:13:10 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Lyrnc on 2026-11-30T14:13:10Z.


Shootout, final (2 runs per arm): RTX 5080 + 9800X3D, 32 GB, vnv 829188e9 + #3347, walking, Series X native 1440p, DLSS off, world +30..330 s. Every arm has the same local per-step sweep timing.

arm fps (2 runs) >100 ms per 1,000 send trim per sweep (submitting thread) card copies send buffers made / let go in 300 s largest kept spare
base 19.5 / 19.7 55.4 / 51.6 68.0 / 73.5 ms 10.6 / 10.0 ms (every second) n/a
#3994 (8b801739) 20.3 / 21.4 52.1 / 39.0 0.0 / 0.0 ms 6.1 / 6.2 ms 6/4, 7/4 416–480 MiB
#3381 21.7 / 20.1 35.0 / 46.3 9.3 / 9.2 ms 6.3 / 6.5 ms n/a n/a
#3411 (bundle) 20.2 / 20.8 52.5 / 45.4 4.9 / 4.9 ms 6.3 / 6.1 ms n/a n/a
  • Means: base 19.6 fps; #3994 20.9, #3381 20.9, #3411 20.5. Frames over 100 ms: 53.5 → 45.6 / 40.7 / 49.0.
  • The churn: all three remove it. Card copies drop from ~10.3 to ~6.2 ms, and heaps+sweep from 8.2 to 3.6–4.5 ms. No new stalls in any arm.
  • Where they differ: #3994 is the only one that leaves 0 ms of send trim on the submitting thread, since releases go to their own thread. #3381 still trims about 9 ms per sweep there. The fps differences are within run noise.
  • What none of them touches: the rest of the sweep, the resource let-go looks at 47–60 ms per sweep. #3272 takes care of those.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7281024351 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3994#issuecomment-7281024351). Originally posted by [Lyrnc](https://github.com/Lyrnc) on 2026-11-30T14:13:10Z. --- **Shootout, final (2 runs per arm)**: RTX 5080 + 9800X3D, **32 GB**, vnv 829188e9 + #3347, walking, Series X native 1440p, DLSS off, world +30..330 s. Every arm has the same local per-step sweep timing. | arm | fps (2 runs) | >100 ms per 1,000 | send trim per sweep (submitting thread) | card copies | send buffers made / let go in 300 s | largest kept spare | |---|---:|---:|---:|---:|---:|---:| | base | 19.5 / 19.7 | 55.4 / 51.6 | 68.0 / 73.5 ms | 10.6 / 10.0 ms | (every second) | n/a | | #3994 (8b801739) | 20.3 / 21.4 | 52.1 / 39.0 | **0.0 / 0.0 ms** | 6.1 / 6.2 ms | 6/4, 7/4 | 416–480 MiB | | #3381 | 21.7 / 20.1 | 35.0 / 46.3 | 9.3 / 9.2 ms | 6.3 / 6.5 ms | n/a | n/a | | #3411 (bundle) | 20.2 / 20.8 | 52.5 / 45.4 | 4.9 / 4.9 ms | 6.3 / 6.1 ms | n/a | n/a | - **Means:** base 19.6 fps; #3994 20.9, #3381 20.9, #3411 20.5. Frames over 100 ms: 53.5 → 45.6 / 40.7 / 49.0. - **The churn:** all three remove it. Card copies drop from ~10.3 to ~6.2 ms, and heaps+sweep from 8.2 to 3.6–4.5 ms. No new stalls in any arm. - **Where they differ:** #3994 is the only one that leaves 0 ms of send trim on the submitting thread, since releases go to their own thread. #3381 still trims about 9 ms per sweep there. The fps differences are within run noise. - **What none of them touches:** the rest of the sweep, the resource let-go looks at 47–60 ms per sweep. #3272 takes care of those. AI use: Claude Code (Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!3994
No description provided.