gpu(list): low-water, hysteresis-capped idle-list pressure trim (#756) #2721

Closed
github-bot wants to merge 2 commits from github-bot/gh-2721 into main AGit
Owner

@⁠HailLucifer666 on GitHub · 2026-11-29 16:33 UTC · original
HailLucifer666:perf/idle-list-pressure-trim → main · +294 −5 · 2 files · 2 commits · closed without merging

Part of #756 (Phase 1 low-risk idle-list pressure trim).

What it changes

Adds bounded, hysteresis-gated idle-list trimming under host memory pressure in crates/victory-gpu/src/list.rs + host.rs::sweep():

  • Tracks IDLE_LOW_WATER across frames (shifted left via shift_low_water when recycle() drains stale head entries) and drains only cold surplus above IDLE_PRESSURE_FLOOR = 160 (capped per sweep, dropping drained entries outside the IDLE mutex).
  • PressureState requires 3 consecutive healthy sweeps before exiting pressure mode (prevents boundary flapping).
  • Kill switch: VICTORY_IDLE_PRESSURE_TRIM=0 disables pressure trim cleanly.

How it was tested

  • Not verified here: Live gameplay memory-pressure A/B run.
  • cargo test -p victory-gpu --lib list:: → 25 passed, 0 failed (including pressure_drain_count_respects_low_water_floor_and_cap, pressure_hysteresis_requires_three_healthy_sweeps_to_exit, lifo_cold_head_drain_preserves_newest_and_exact_bytes, stale_head_drain_shifts_low_water_left, and teardown_drops_drained_entries_outside_mutex).
  • cargo clippy -p victory-gpu --lib --tests → exit 0, 0 new warnings in touched files. (Pre-existing diagnostics feature errors on 829188e9 untouched.)
  • cargo test passed for the crates it touches: yes

Checked for overlap

  • Searched open PRs at 829188e9 for list.rs / IDLE / #756. Related: #2334 (touches list.rs, different scope).
**@⁠HailLucifer666** on GitHub · 2026-11-29 16:33 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2721) `HailLucifer666:perf/idle-list-pressure-trim` → `main` · +294 −5 · 2 files · 2 commits · closed without merging Part of #756 (Phase 1 low-risk idle-list pressure trim). ## What it changes Adds bounded, hysteresis-gated idle-list trimming under host memory pressure in `crates/victory-gpu/src/list.rs` + `host.rs::sweep()`: - Tracks `IDLE_LOW_WATER` across frames (shifted left via `shift_low_water` when `recycle()` drains stale head entries) and drains only cold surplus above `IDLE_PRESSURE_FLOOR = 160` (capped per sweep, dropping drained entries outside the `IDLE` mutex). - `PressureState` requires 3 consecutive healthy sweeps before exiting pressure mode (prevents boundary flapping). - Kill switch: `VICTORY_IDLE_PRESSURE_TRIM=0` disables pressure trim cleanly. ## How it was tested - **Not verified here:** Live gameplay memory-pressure A/B run. - `cargo test -p victory-gpu --lib list::` → **25 passed, 0 failed** (including `pressure_drain_count_respects_low_water_floor_and_cap`, `pressure_hysteresis_requires_three_healthy_sweeps_to_exit`, `lifo_cold_head_drain_preserves_newest_and_exact_bytes`, `stale_head_drain_shifts_low_water_left`, and `teardown_drops_drained_entries_outside_mutex`). - `cargo clippy -p victory-gpu --lib --tests` → exit 0, **0 new warnings** in touched files. *(Pre-existing `diagnostics` feature errors on `829188e9` untouched.)* - `cargo test` passed for the crates it touches: **yes** ## Checked for overlap - [x] Searched open PRs at `829188e9` for `list.rs` / `IDLE` / `#756`. Related: #2334 (touches `list.rs`, different scope).
Idle host command lists were previously capped only at IDLE_MOST (512 lists /
256 MiB) and time-aged via VICTORY_ALLOCATOR_TRIM, allowing private commit
bloat to linger during memory/commit pressure. Blindly trimming down to 64
would re-introduce the documented 128-list recreation cliff (12% of the
submitting thread in the opening).

Add sweep_pressure(pressured, critical) called from a separate branch in
Host::sweep():
- Tracks IDLE_LOW_WATER (minimum pool depth after fresh_list() pops since
  the last 1 Hz sweep) so active lists are never trimmed.
- Drains only cold-head entries via drain_cold_head() bounded by low_water,
  IDLE_PRESSURE_FLOOR (160), and per-sweep drop caps (32 normal / 128
  critical commit), dropping drained D3D12 objects strictly outside IDLE's
  mutex.
- Applies a 3-sweep healthy recovery hysteresis (PressureState) that caps
  recycle() refill while pressure is active, preventing 1 Hz allocate/free
  churn.
- Adds VICTORY_IDLE_PRESSURE_TRIM=0 kill switch to restore legacy retention.

Verified:
- cargo test -p victory-gpu --lib --locked -- list::tests:: (9 passed, 0 failed)
- cargo check -p victory-gpu --features diagnostics --tests --locked (0 errors, 0 warnings in touched files)
- Mutation probe (blind len - 64 ignoring low_water/floor/cap) confirmed red before restoring.
When VICTORY_ALLOCATOR_TRIM=1 drains n stale entries from the front of
IDLE.0 inside recycle(), all remaining entries shift left by n. Adjust
IDLE_LOW_WATER via saturating_sub(n) under the same IDLE lock so newly
recycled (<1 s) entries are never miscounted as untouched cold-head lists
on the next sweep_pressure() call.

Caught by /kee preflight independent review.

Verified:
- cargo test -p victory-gpu --lib --locked -- list::tests:: (10 passed, 0 failed)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 16:37:57 +00:00
github-bot closed this pull request 2026-11-29 18:34:46 +00:00
Author
Owner

@⁠HailLucifer666 on GitHub · 2026-11-29 18:29 UTC · original

Closing as superseded by upstream commit \1b4b6cd4\ (\ 2026.11.29.02), which restored \list::trim_idle(now)\ under \VICTORY_IDLE_RECLAIM\ with out-of-lock retirement.

**@⁠HailLucifer666** on GitHub · 2026-11-29 18:29 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2721#issuecomment-7260520387) Closing as superseded by upstream commit \1b4b6cd4\ (\ 2026.11.29.02\), which restored \list::trim_idle(now)\ under \VICTORY_IDLE_RECLAIM\ with out-of-lock retirement.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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