feat(gpu): adapt guest VRAM room with hysteresis and delayed-release damping #356

Open
github-bot wants to merge 7 commits from github-bot/gh-356 into main AGit
Owner

@⁠tommiehansen on GitHub · 2026-12-03 19:31 UTC · original
tommiehansen:perf/adaptive-vram-pressure → main · +408 −9 · 4 files · 7 commits · open

Why

Static pool budgets cannot respond smoothly to changing physical/process headroom.

What changes

Opt-in VICTORY_POOL_PRESSURE_BUDGET=1, hysteresis and delayed-release damping; cache last valid process headroom and combine with fresh physical headroom, accept zero usage and clear on reset.

Benchmark results

CPU Standard Before After Change
Pressure budget 0.003 ms 0.052 ms +1697.20%
Migration planning 0.143 ms 0.143 ms 0.00%

Four ABBA blocks at 7be46b2; roughly 49 µs additional synthetic controller cost.

Why this should be merged / current decision

Potential stability benefit is unverified and CPU overhead measured. Keep opt-in; no performance promotion without live residency/transfer benefit.

Validation

Standard; earlier 1aaf030 six controller tests and all-targets passed. Deterministic traces are not live hardware evidence.

Compatibility

Require actual telemetry dropout, VRAM and transfer/frame data; no default change.

Archived detailed evidence and review history.

Continuous coverage update

47599113068 verified actual budget-adjustment activation 0→81900 and unchanged rejected fallback. Only 1/3 runtime files covered and host drift exceeded the review limit. No new reliable net improvement or physical residency result.

**@⁠tommiehansen** on GitHub · 2026-12-03 19:31 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/356) `tommiehansen:perf/adaptive-vram-pressure` → `main` · +408 −9 · 4 files · 7 commits · open ## Why Static pool budgets cannot respond smoothly to changing physical/process headroom. ## What changes Opt-in `VICTORY_POOL_PRESSURE_BUDGET=1`, hysteresis and delayed-release damping; cache last valid process headroom and combine with fresh physical headroom, accept zero usage and clear on reset. ## Benchmark results | CPU Standard | Before | After | Change | |---|---:|---:|---:| | Pressure budget | 0.003 ms | 0.052 ms | +1697.20% | | Migration planning | 0.143 ms | 0.143 ms | 0.00% | Four ABBA blocks at 7be46b2; roughly 49 µs additional synthetic controller cost. ## Why this should be merged / current decision Potential stability benefit is unverified and CPU overhead measured. Keep opt-in; no performance promotion without live residency/transfer benefit. ## Validation [Standard](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47503640056/job/145622974553); earlier 1aaf030 [six controller tests and all-targets](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47438443784) passed. Deterministic traces are not live hardware evidence. ## Compatibility Require actual telemetry dropout, VRAM and transfer/frame data; no default change. [Archived detailed evidence and review history](https://github.com/tommiehansen/VIctory-xmem/blob/04dd44857abe222961157663b89a4dfed4c7277c/archive/pr-descriptions-20261206.md). ### Continuous coverage update [47599113068](https://github.com/tommiehansen/VIctory-xmem/actions/runs/47599113068) verified actual budget-adjustment activation 0→81900 and unchanged rejected fallback. Only 1/3 runtime files covered and host drift exceeded the review limit. No new reliable net improvement or physical residency result.
Extract pure-Rust PressureController in um/pressure_budget.rs and wire it behind VICTORY_POOL_PRESSURE_BUDGET (off by default) on origin/main without requiring PR #303 or the RayQuery stack (#342). Track the smaller of physical adapter headroom and process budget headroom (honoring VICTORY_VRAM_BUDGET_MB), add post-cut cooldown and sustained-headroom streak hysteresis to curb oscillation, damp double-cuts when eviction lowers live VRAM while GPU release lags (>= LOW), bound per-pass eviction relative to live usage, and reset cleanly to the fixed baseline when telemetry is missing or zeroed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 19:34:15 +00:00
A failed adapter usage query returned before the pressure controller could clear its old cap and hysteresis state. Reset the opt-in controller and skip migration on missing or zero-total physical samples so recovery starts at the fixed baseline. Preserve the existing default path.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:10 UTC · original

The controller is fine and neatly isolated — a unit-testable module with no D3D12 in it is the right shape. The wiring has one real bug, and it is exactly the kind that makes hysteresis look like it oscillates.

  1. Two telemetry bases on alternate ticks. crates/victory-gpu/src/um/residency.rs:578 sets let mut free = physical_free;, and only on a pass tick (:575, :588-591) is it replaced with the adaptive effective free. But room is read unconditionally from the controller (:602), and pressed / COUNTS[FREE_MB] are computed from the pair (:606, :613). So on every non-pass tick, free is a different quantity than on a pass tick while room stays adaptive; with wave() > 1 the down-for-room decisions (:734-751) flip between two bases and the hysteresis is partly defeated. Fix: keep the last effective free in a static, or only compute room where eff_free is fresh.
  2. process_usage == 0 is not "no telemetry". effective_free() returns None for it, which makes the controller reset instead of holding. Zero usage is legitimate — a fresh process, or a driver that reports a budget but not usage. Narrow the missing-data test to the budget/total fields.
  3. VICTORY_POOL_PRESSURE_BUDGET is in docs/SETTINGS.md:60 but not in run.conf.default, where this project keeps the same switch list. (Two other PRs in this batch break the same convention, so maybe the convention needs a decision rather than three separate fixes.)

On the tests: the five in pressure_budget.rs (bounds across 8/12/16/24 GiB, oscillation, release damping, oversized cap, missing telemetry) look reasonable, but nothing in victory-gpu compiles on Linux, so the first person to run them will be you on Windows. And there is no end-to-end measurement in the body — hysteresis without a before/after is a hypothesis, and after the tick fix it is the number that would justify the switch existing at all.

56 commits behind, merges clean. Fix the tick mismatch first, then one A/B run, then it lands.

**@⁠Luxuride** on GitHub · 2026-12-04 12:10 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/356#issuecomment-7411074866) The controller is fine and neatly isolated — a unit-testable module with no D3D12 in it is the right shape. The wiring has one real bug, and it is exactly the kind that makes hysteresis look like it oscillates. 1. **Two telemetry bases on alternate ticks.** `crates/victory-gpu/src/um/residency.rs:578` sets `let mut free = physical_free;`, and only on a pass tick (`:575`, `:588-591`) is it replaced with the adaptive effective free. But `room` is read unconditionally from the controller (`:602`), and `pressed` / `COUNTS[FREE_MB]` are computed from the pair (`:606`, `:613`). So on every non-pass tick, `free` is a different quantity than on a pass tick while `room` stays adaptive; with `wave() > 1` the down-for-room decisions (`:734-751`) flip between two bases and the hysteresis is partly defeated. Fix: keep the last effective free in a `static`, or only compute `room` where `eff_free` is fresh. 2. **`process_usage == 0` is not "no telemetry".** `effective_free()` returns `None` for it, which makes the controller reset instead of holding. Zero usage is legitimate — a fresh process, or a driver that reports a budget but not usage. Narrow the missing-data test to the budget/total fields. 3. `VICTORY_POOL_PRESSURE_BUDGET` is in `docs/SETTINGS.md:60` but not in `run.conf.default`, where this project keeps the same switch list. (Two other PRs in this batch break the same convention, so maybe the convention needs a decision rather than three separate fixes.) On the tests: the five in `pressure_budget.rs` (bounds across 8/12/16/24 GiB, oscillation, release damping, oversized cap, missing telemetry) look reasonable, but nothing in `victory-gpu` compiles on Linux, so the first person to run them will be you on Windows. And there is no end-to-end measurement in the body — hysteresis without a before/after is a hypothesis, and after the tick fix it is the number that would justify the switch existing at all. 56 commits behind, merges clean. Fix the tick mismatch first, then one A/B run, then it lands.
github-bot changed title from residency: adapt guest VRAM room with hysteresis and delayed-release damping to feat(gpu): adapt guest VRAM room with hysteresis and delayed-release damping 2026-12-04 22:20:16 +00:00
Author
Owner

@⁠tommiehansen on GitHub · 2026-12-05 10:19 UTC · original

Thanks @⁠Luxuride for catching the alternating telemetry bases and zero-usage case. 1aaf030 retains process headroom between passes, combines it with fresh physical headroom and accepts legitimate zero usage. Six targeted tests and MSVC compilation passed. The new synthetic benchmark also discloses the ~49 µs controller overhead; end-to-end benefit remains unverified.

**@⁠tommiehansen** on GitHub · 2026-12-05 10:19 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/356#issuecomment-7436364877) Thanks @⁠Luxuride for catching the alternating telemetry bases and zero-usage case. [1aaf030](https://github.com/tommiehansen/VIctory-xmem/commit/1aaf0304bf81ec31ca2dbe5aa7500c0b79058267) retains process headroom between passes, combines it with fresh physical headroom and accepts legitimate zero usage. Six targeted tests and MSVC compilation passed. The new synthetic benchmark also discloses the ~49 µs controller overhead; end-to-end benefit remains unverified.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/356/head:github-bot/gh-356'
git switch 'github-bot/gh-356'

Merge

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