Lists: idle host lists go while an aperture segment of the card's memory is near full (VICTORY_LIST_TIGHT, off by default) #626

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

@⁠Esteban-V on GitHub · 2026-11-27 14:49 UTC · original
Esteban-V:perf/list-aperture-trim → a-publier · +139 −0 · 3 files · 1 commits · open

Follow-up to the RDNA 2 diagnosis in #372's comments. On an RX 6700 XT / 6950 XT the device is removed when a 2 GB aperture segment runs full (ReserveResource -> 0xC0000001 at the world load), and idle host lists' allocators are most of what fills it: a command allocator keeps its memory over Reset (kyokyotosh/VIctory-6700XT FINDINGS-6700XT.md; #329: 1.16 MiB per allocator + list pair, 1.0 MiB of it shared). DXGI's QueryVideoMemoryInfo budgets leave that segment out, so nothing in the tree sees it today.

  • VICTORY_LIST_TIGHT=N (percent, clamped to 50-95, unset by default). The once-a-second sweep reads the adapter's aperture segments with D3DKMTQueryStatistics (Host::fullest_aperture, host.rs), the same counters Task Manager shows.
  • While the fullest one holds more than N% of its commit limit, and until it falls under N-10%, idle host lists past 64 go (list::trim_when_tight). At most once every 10 s, and the dropped lists are freed on a short-lived victory-list-trim thread, not the submitting one.
  • A log line when the segment passes or falls below its tight share, and one per trim with the count.
  • Unset, nothing is queried and nothing changes. windows gains the Wdk_Graphics_Direct3D feature; Cargo.lock is unchanged.

Why it should not churn like #335 (2.9 thousand lists made in a run became 116-142 thousand there): recycle, fresh_list, the 512 idle cap and list reuse are untouched, there is no retirement by reset count, and the trim only runs while the segment is tight, keeps 64 and is spaced 10 s apart. Idle lists have run and been reset, so keep_freed, the bury lag and HostHeap::kept are not involved.

Left out on purpose: the 6700XT tree also settles (no send-ahead) while tight and trims its own prelude pool. Here a prelude lives in its HostList, so dropping the list frees both allocators; the settle can follow if a run shows the trim alone does not keep the device.

Touches IDLE in list.rs like #372; whichever lands second needs a trivial rebase (.0/.1 to the Pool fields).

Testing

  • Windows CI (windows-latest): Clippy, default tests and diagnostics tests pass (run).
  • tight_has_hysteresis_and_trims_are_spaced passes on Windows (default and diagnostics test runs).
  • Type-checked and clippy-clean for x86_64-pc-windows-msvc on a macOS host (cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings, default and --all-features).

Worth an A/B on RDNA 2 (a-publier vs this with VICTORY_LIST_TIGHT=80, same save): device removals, segment MB over time from the new lines, host lists made per run (should stay near the base's ~2.9 thousand), and landed lists reset and given back on victory-submit. On RDNA 3/4 and NVIDIA the aperture limit is usually large enough that it never trips.

**@⁠Esteban-V** on GitHub · 2026-11-27 14:49 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/626) `Esteban-V:perf/list-aperture-trim` → `a-publier` · +139 −0 · 3 files · 1 commits · open Follow-up to the RDNA 2 diagnosis in #372's comments. On an RX 6700 XT / 6950 XT the device is removed when a 2 GB aperture segment runs full (`ReserveResource` -> `0xC0000001` at the world load), and idle host lists' allocators are most of what fills it: a command allocator keeps its memory over `Reset` (kyokyotosh/VIctory-6700XT `FINDINGS-6700XT.md`; #329: 1.16 MiB per allocator + list pair, 1.0 MiB of it shared). DXGI's `QueryVideoMemoryInfo` budgets leave that segment out, so nothing in the tree sees it today. - `VICTORY_LIST_TIGHT=N` (percent, clamped to 50-95, unset by default). The once-a-second `sweep` reads the adapter's aperture segments with `D3DKMTQueryStatistics` (`Host::fullest_aperture`, `host.rs`), the same counters Task Manager shows. - While the fullest one holds more than N% of its commit limit, and until it falls under N-10%, idle host lists past 64 go (`list::trim_when_tight`). At most once every 10 s, and the dropped lists are freed on a short-lived `victory-list-trim` thread, not the submitting one. - A log line when the segment passes or falls below its tight share, and one per trim with the count. - Unset, nothing is queried and nothing changes. `windows` gains the `Wdk_Graphics_Direct3D` feature; `Cargo.lock` is unchanged. Why it should not churn like #335 (2.9 thousand lists made in a run became 116-142 thousand there): `recycle`, `fresh_list`, the 512 idle cap and list reuse are untouched, there is no retirement by reset count, and the trim only runs while the segment is tight, keeps 64 and is spaced 10 s apart. Idle lists have run and been reset, so `keep_freed`, the bury lag and `HostHeap::kept` are not involved. Left out on purpose: the 6700XT tree also settles (no send-ahead) while tight and trims its own prelude pool. Here a prelude lives in its `HostList`, so dropping the list frees both allocators; the settle can follow if a run shows the trim alone does not keep the device. Touches `IDLE` in `list.rs` like #372; whichever lands second needs a trivial rebase (`.0`/`.1` to the `Pool` fields). ## Testing - Windows CI (`windows-latest`): Clippy, default tests and diagnostics tests pass ([run](https://github.com/Esteban-V/VIctory-Belobug-AMD/actions/runs/46018252910)). - `tight_has_hysteresis_and_trims_are_spaced` passes on Windows (default and diagnostics test runs). - Type-checked and clippy-clean for `x86_64-pc-windows-msvc` on a macOS host (`cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings`, default and `--all-features`). Worth an A/B on RDNA 2 (`a-publier` vs this with `VICTORY_LIST_TIGHT=80`, same save): device removals, segment MB over time from the new lines, host lists made per run (should stay near the base's ~2.9 thousand), and `landed lists reset and given back` on `victory-submit`. On RDNA 3/4 and NVIDIA the aperture limit is usually large enough that it never trips.
A D3D12 allocator keeps its command memory over a reset. On RDNA 2 that
memory lies in a 2 GB aperture segment, and running it full removed the
device (kyokyotosh/VIctory-6700XT, FINDINGS-6700XT.md; #329 measures
1.16 MiB a list, 1.0 MiB of it shared). DXGI's budgets do not show that
segment.

With VICTORY_LIST_TIGHT=N (percent, 50 to 95), the once-a-second sweep
reads the adapter's aperture segments with D3DKMTQueryStatistics. While
the fullest holds more than N% of its limit (and until it falls under
N-10%), idle host lists past 64 go, once in 10 s at most, freed on a
thread of their own. Unset, nothing is read and nothing changes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 14:56:45 +00:00
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/626/head:github-bot/gh-626'
git switch 'github-bot/gh-626'

Merge

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