Lists: idle host lists none took are let go after a while (VICTORY_LIST_IDLE_TRIM_S, off by default) #372

Open
github-bot wants to merge 1 commit from github-bot/gh-372 into a-publier AGit
Owner

@⁠Esteban-V on GitHub · 2026-11-26 22:50 UTC · original
Esteban-V:perf/list-pool-trim → a-publier · +126 −11 · 1 files · 1 commits · open

A D3D12 command allocator keeps its memory across Reset, so every list in the idle pool (IDLE, up to 512, crates/victory-gpu/src/list.rs:242) keeps the most its commands ever took, for the rest of the run. The pool is never trimmed, and with the scratch pool on, its byte cap counts 0 after a reset. This adds a low-water trim, off by default.

  • VICTORY_LIST_IDLE_TRIM_S=N: every N seconds (10 to try), the idle lists none took in that window are let go, oldest first, at most 32 per trim, always leaving 16 (trim_count).
  • Trimmed lists are dropped outside the lock, the same way a full pool already drops a list.
  • VICTORY_LIST_IDLE_MOST=N: pool size instead of 512 (16..=4096).
  • Default unchanged: with both unset, nothing changes. land(), bury_lag and the reset order are untouched.

To A/B: VICTORY_LIST_IDLE_TRIM_S=10 with the memory line (VICTORY_MEMORY_MAP), comparing the lists' share.

Already merged in DoubleGhosty/cool_fox (d15a711). Related: #335 also trims this pool (under pressure) and retires allocators. Both touch the same code in list.rs, so whichever lands second needs a rebase.

Testing

  • Windows CI (windows-latest): Clippy, default tests and diagnostics tests pass (run).
  • Type-checked and clippy-clean for x86_64-pc-windows-msvc on a macOS host (cargo clippy --workspace --all-targets -- -D warnings, default features and --all-features).
  • Unit tests trim_count_keeps_the_floor_and_the_step and a_trim_lets_go_what_none_took added.
**@⁠Esteban-V** on GitHub · 2026-11-26 22:50 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/372) `Esteban-V:perf/list-pool-trim` → `a-publier` · +126 −11 · 1 files · 1 commits · open A D3D12 command allocator keeps its memory across `Reset`, so every list in the idle pool (`IDLE`, up to 512, `crates/victory-gpu/src/list.rs:242`) keeps the most its commands ever took, for the rest of the run. The pool is never trimmed, and with the scratch pool on, its byte cap counts 0 after a reset. This adds a low-water trim, off by default. - `VICTORY_LIST_IDLE_TRIM_S=N`: every N seconds (10 to try), the idle lists none took in that window are let go, oldest first, at most 32 per trim, always leaving 16 (`trim_count`). - Trimmed lists are dropped outside the lock, the same way a full pool already drops a list. - `VICTORY_LIST_IDLE_MOST=N`: pool size instead of 512 (16..=4096). - Default unchanged: with both unset, nothing changes. `land()`, `bury_lag` and the reset order are untouched. To A/B: `VICTORY_LIST_IDLE_TRIM_S=10` with the memory line (`VICTORY_MEMORY_MAP`), comparing the lists' share. Already merged in DoubleGhosty/cool_fox (d15a711). Related: #335 also trims this pool (under pressure) and retires allocators. Both touch the same code in `list.rs`, so whichever lands second needs a rebase. ## Testing - Windows CI (`windows-latest`): Clippy, default tests and diagnostics tests pass ([run](https://github.com/Esteban-V/VIctory-Belobug-AMD/actions/runs/45916916769)). - Type-checked and clippy-clean for `x86_64-pc-windows-msvc` on a macOS host (`cargo clippy --workspace --all-targets -- -D warnings`, default features and `--all-features`). - Unit tests `trim_count_keeps_the_floor_and_the_step` and `a_trim_lets_go_what_none_took` added.
A D3D12 allocator keeps its memory over a reset, so a host list kept idle
keeps the most its commands ever took, and the pool of up to 512 is never
trimmed: its byte cap counts only scratch kept over a reset, 0 with the
scratch pool on. docs/findings.md puts lists' allocators at 9 GB.

The pool now notes the fewest idle lists there were since the last trim.
With VICTORY_LIST_IDLE_TRIM_S=N, once N seconds have passed, recycle lets
go of that many above 16, 32 at most, the longest idle first, dropped out
of the lock as a full pool drops a list. VICTORY_LIST_IDLE_MOST sets the
pool's size (512, from 16 to 4096). Unset, nothing changes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:58:41 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 00:22 UTC · original

Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at f5307bf: cargo test --release -p victory-gpu --lib 398 passed, 0 failed, 34 ignored in 3 runs. A fourth, earlier run had one watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view failure, which did not come back (that area is flaky on this card on the base too). Not run in the game with VICTORY_LIST_IDLE_TRIM_S set.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 00:22 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/372#issuecomment-7206402527) Tested on an RX 6950 XT 16 GB (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at `f5307bf`: `cargo test --release -p victory-gpu --lib` 398 passed, 0 failed, 34 ignored in 3 runs. A fourth, earlier run had one `watch::tests::what_the_kernel_writes_through_is_not_guarded_for_another_view` failure, which did not come back (that area is flaky on this card on the base too). Not run in the game with `VICTORY_LIST_IDLE_TRIM_S` set. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠a15106479638-hub on GitHub · 2026-11-27 08:18 UTC · original

Your diagnosis is the other half of what removes the device on RDNA2, and it has been measured from the other side.

On an RX 6950 XT (16 GB, driver 32.0.21045.29003) the removal is the video memory manager running out of room in a 2 GB aperture segment — and the lists in exactly this pool are most of what fills it, since a command allocator keeps its memory across Reset just as you say. From an ETW trace in kyokyotosh/VIctory-6700XT: 1 MB + 64 KB per list, ~830 lists climbing to 1,150–1,250 at the world load, then ReserveResource → 0xC0000001 and the kernel marks the device faulted. There is an independent measurement of the same figure in #329 (1.16 MiB per allocator + list pair, 1.0 MiB of it shared GPU memory, 64 KiB local).

That tree landed an adaptive version of your trim rather than a timer: while an aperture segment is over 80% of its limit, idle host lists are cut to 64 (trim_idle) and idle preludes to 16, and it counts as clear only below 70%. On my card the monitor showed segment 1 (aperture, 2,048 MB) crossing 80% at 1,638 MB six times in nine minutes, each time trimming back to 1,428 MB, with 0 device removals and 18.1 fps average against 2.8 fps with RELAY=0.

So your VICTORY_LIST_IDLE_TRIM_S and that back-off are aimed at the same memory. Worth comparing: a timer trims on a schedule, the segment reading trims only when the memory is actually short. Either way, on RDNA2 the pool size is not a tuning detail — it is the difference between running and losing the card, which is why the default of 512 matters more than it looks.

**@⁠a15106479638-hub** on GitHub · 2026-11-27 08:18 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/372#issuecomment-7213399030) Your diagnosis is the other half of what removes the device on RDNA2, and it has been measured from the other side. On an RX 6950 XT (16 GB, driver 32.0.21045.29003) the removal is the video memory manager running out of room in a **2 GB aperture segment** — and the lists in exactly this pool are most of what fills it, since a command allocator keeps its memory across `Reset` just as you say. From an ETW trace in [kyokyotosh/VIctory-6700XT](https://github.com/kyokyotosh/VIctory-6700XT/blob/main/FINDINGS-6700XT.md): 1 MB + 64 KB per list, ~830 lists climbing to 1,150–1,250 at the world load, then `ReserveResource` → `0xC0000001` and the kernel marks the device faulted. There is an independent measurement of the same figure in #329 (1.16 MiB per allocator + list pair, 1.0 MiB of it shared GPU memory, 64 KiB local). That tree landed an **adaptive** version of your trim rather than a timer: while an aperture segment is over 80% of its limit, idle host lists are cut to 64 (`trim_idle`) and idle preludes to 16, and it counts as clear only below 70%. On my card the monitor showed segment 1 (aperture, 2,048 MB) crossing 80% at 1,638 MB six times in nine minutes, each time trimming back to 1,428 MB, with **0 device removals and 18.1 fps average** against 2.8 fps with `RELAY=0`. So your `VICTORY_LIST_IDLE_TRIM_S` and that back-off are aimed at the same memory. Worth comparing: a timer trims on a schedule, the segment reading trims only when the memory is actually short. Either way, on RDNA2 the pool size is not a tuning detail — it is the difference between running and losing the card, which is why the default of 512 matters more than it looks.
Author
Owner

@⁠Esteban-V on GitHub · 2026-11-27 14:34 UTC · original

Thanks, this is really useful. I hadn't seen the 6700XT findings, and the 1 MB + 64 KB per list lines up with #329 nicely.

Trimming when the aperture segment is actually short makes more sense than a timer if that's what runs out. I'm going to look at their trim_idle and see whether it fits here or works better as a follow-up. One thing to watch from #335: when the pool got cut too hard, lists were being made again all the time (2.9k to 140k in a run) and fps roughly halved, so the floor and the clear threshold really matter.

**@⁠Esteban-V** on GitHub · 2026-11-27 14:34 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/372#issuecomment-7220950671) Thanks, this is really useful. I hadn't seen the 6700XT findings, and the 1 MB + 64 KB per list lines up with #329 nicely. Trimming when the aperture segment is actually short makes more sense than a timer if that's what runs out. I'm going to look at their `trim_idle` and see whether it fits here or works better as a follow-up. One thing to watch from #335: when the pool got cut too hard, lists were being made again all the time (2.9k to 140k in a run) and fps roughly halved, so the floor and the clear threshold really matter.
This pull request can be merged automatically.
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/372/head:github-bot/gh-372'
git switch 'github-bot/gh-372'

Merge

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