feat(gpu/resource): align slot eviction to queue byte line and keep 512 MiB headroom #265

Closed
github-bot wants to merge 1 commit from gh-pr/265/head into gh-pr/265/base
Owner

@⁠Androtim on GitHub · 2026-11-30 22:01 UTC · original
Androtim:feat/iter258-gpu-8gb-vram-keep-free-and-evict-alignment → main · +229 −31 · 1 files · 1 commits · closed without merging

Summary

  • Align slot_evict() with room() in crates/victory-gpu/src/resource.rs by counting reserved bytes for buffer copies and render targets via queue_use (VICTORY_SLOT_EVICT_KEPT=0 restores raw count) and bounding eviction start/stop thresholds by the texture queue's exact room_line(budget) byte line via slot_plan_for_queue.
  • Add VICTORY_TEXTURE_KEEP_FREE_MB (default 512 MiB, 0 disables) dynamic headroom cap via dynamic_texture_cap so unmanaged host texture growth stops before pushing 8 GB GPUs past DXGI budget or starving DLSS/Frame Generation and render targets.
  • Support VICTORY_TEXTURE_SOFT_MB and tighten idle sweeps via soft_keep against either the explicit soft budget or the dynamic headroom cap.
  • Add unit tests covering queue-aligned eviction start, exact byte-line alignment, dynamic headroom capping, and soft_keep sweep tightening.

Verification

  • xtask policy: passed (315 files ok)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu resource:: -- --test-threads=1: passed (37 passed, 0 failed)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings: passed (0 warnings)
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --features diagnostics --all-targets -- -D warnings: passed (0 warnings)
**@⁠Androtim** on GitHub · 2026-11-30 22:01 UTC · [original](https://github.com/Androtim/MiniVI/pull/265) `Androtim:feat/iter258-gpu-8gb-vram-keep-free-and-evict-alignment` → `main` · +229 −31 · 1 files · 1 commits · closed without merging ### Summary - Align `slot_evict()` with `room()` in `crates/victory-gpu/src/resource.rs` by counting reserved bytes for buffer copies and render targets via `queue_use` (`VICTORY_SLOT_EVICT_KEPT=0` restores raw count) and bounding eviction start/stop thresholds by the texture queue's exact `room_line(budget)` byte line via `slot_plan_for_queue`. - Add `VICTORY_TEXTURE_KEEP_FREE_MB` (default 512 MiB, `0` disables) dynamic headroom cap via `dynamic_texture_cap` so unmanaged host texture growth stops before pushing 8 GB GPUs past DXGI budget or starving DLSS/Frame Generation and render targets. - Support `VICTORY_TEXTURE_SOFT_MB` and tighten idle sweeps via `soft_keep` against either the explicit soft budget or the dynamic headroom cap. - Add unit tests covering queue-aligned eviction start, exact byte-line alignment, dynamic headroom capping, and `soft_keep` sweep tightening. ### Verification - `xtask policy`: passed (`315 files ok`) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu resource:: -- --test-threads=1`: passed (37 passed, 0 failed) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings`: passed (0 warnings) - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --features diagnostics --all-targets -- -D warnings`: passed (0 warnings)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:24:12 +00:00
github-bot closed this pull request 2026-12-01 20:24:12 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 22:04 UTC · original · edited 2026-11-30 23:03 UTC

Automated triage for the maintainers (not an approval).

Verdict: needs-gpu-test · CI (check): passing

Review Summary

Changes are well-scoped to crates/victory-gpu/src/resource.rs, CI is passing, and the new unit tests cover dynamic_texture_cap_for, soft_keep, counted_use, slot_plan, and slot_plan_for_queue.

What looks good

  • Queue-aligned slot eviction (slot_evict, queue_use, slot_plan_for_queue): Counting crate::shadow::card_room_kept() + targets_room_kept(budget) less crate::pool::texture_room() and capping the start threshold at room_line(budget) - 1 (with a 6% stop gap) aligns slot_evict() with room()'s refusal line. Raising the per-pass cap to 768 MiB when used > budget is a reasonable safeguard against runaway over-budget usage.
  • Dynamic VRAM headroom (keep_free_bytes, dynamic_texture_cap_for, soft_keep): Preserving VICTORY_TEXTURE_KEEP_FREE_MB (default 512 MiB, 0 disables) via budget - keep - (used - host_textures) saturates cleanly and integrates into both room() and let_go_idle() (with explicit VICTORY_TEXTURE_SOFT_MB taking precedence over the dynamic cap in let_go_idle()).

Notes & minor nits

  • Default-on behavior before texture_floor_bytes: In room(), dynamic_texture_cap(memory) is checked before if filled < floor { return true; }. When non-texture allocations plus textures are already within 512 MiB of DXGI budget, this intentionally prevents the floor from pushing VRAM over budget, but because it is enabled by default it should be smoke-tested on a real GPU (especially 8 GB cards) to verify it does not cause premature texture refusal or sweep thrashing.
  • Minor nits (non-blocking):
    • room() reads HOST_TEXTURES[1] inside dynamic_texture_cap(memory) and reads it a second time immediately afterward.
    • counted_use uses + kept whereas weighed_bytes uses saturating_add(kept).
    • queue_use matches the base formula in weighed_bytes, without the VICTORY_ROOM_REAL / blocks_full floor used by weighed().

Verdict

needs-gpu-test — logic and unit tests look solid and CI is passing, but because this changes default VRAM budgeting, texture admission (room()), idle sweeping (let_go_idle()), and slot_evict() thresholds, a local real-GPU smoke test is warranted before merging.


Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-11-30 22:04 UTC · [original](https://github.com/Androtim/MiniVI/pull/265#issuecomment-7293316081) · edited 2026-11-30 23:03 UTC <!-- minivi-triage v1 head=898dfe8e049b74c10c93c494e1ccce5eb6d3394c verdict=needs-gpu-test ci=passing at=2026-11-30T23:03:56Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-gpu-test` · **CI (`check`):** `passing` ### Review Summary Changes are well-scoped to `crates/victory-gpu/src/resource.rs`, CI is passing, and the new unit tests cover `dynamic_texture_cap_for`, `soft_keep`, `counted_use`, `slot_plan`, and `slot_plan_for_queue`. #### What looks good - **Queue-aligned slot eviction (`slot_evict`, `queue_use`, `slot_plan_for_queue`)**: Counting `crate::shadow::card_room_kept() + targets_room_kept(budget)` less `crate::pool::texture_room()` and capping the start threshold at `room_line(budget) - 1` (with a 6% stop gap) aligns `slot_evict()` with `room()`'s refusal line. Raising the per-pass cap to `768 MiB` when `used > budget` is a reasonable safeguard against runaway over-budget usage. - **Dynamic VRAM headroom (`keep_free_bytes`, `dynamic_texture_cap_for`, `soft_keep`)**: Preserving `VICTORY_TEXTURE_KEEP_FREE_MB` (default `512 MiB`, `0` disables) via `budget - keep - (used - host_textures)` saturates cleanly and integrates into both `room()` and `let_go_idle()` (with explicit `VICTORY_TEXTURE_SOFT_MB` taking precedence over the dynamic cap in `let_go_idle()`). #### Notes & minor nits - **Default-on behavior before `texture_floor_bytes`**: In `room()`, `dynamic_texture_cap(memory)` is checked before `if filled < floor { return true; }`. When non-texture allocations plus textures are already within 512 MiB of DXGI budget, this intentionally prevents the floor from pushing VRAM over budget, but because it is enabled by default it should be smoke-tested on a real GPU (especially 8 GB cards) to verify it does not cause premature texture refusal or sweep thrashing. - **Minor nits (non-blocking)**: - `room()` reads `HOST_TEXTURES[1]` inside `dynamic_texture_cap(memory)` and reads it a second time immediately afterward. - `counted_use` uses `+ kept` whereas `weighed_bytes` uses `saturating_add(kept)`. - `queue_use` matches the base formula in `weighed_bytes`, without the `VICTORY_ROOM_REAL` / `blocks_full` floor used by `weighed()`. #### Verdict `needs-gpu-test` — logic and unit tests look solid and CI is passing, but because this changes default VRAM budgeting, texture admission (`room()`), idle sweeping (`let_go_idle()`), and `slot_evict()` thresholds, a local real-GPU smoke test is warranted before merging. --- _Generated with Antigravity CLI (`agy`)._
Author
Owner

@⁠Androtim on GitHub · 2026-12-01 01:31 UTC · original

Maintainer triage (strict merge gate): holding under triage: needs gpu test.

Before merging any performance or VRAM PR, we require isolated plain --release (no --features diagnostics) A/B measurements against current main (d79b943) showing:

  • median fps (must not regress)
  • preparing ms and copyback ms (must not increase)
  • VRAM max / over-budget MB and final_waiting textures (must not increase)
  • untranslated shaders (must not increase) and 0 crashes / DRED

(Combined-stack --features diagnostics numbers alone cannot pass the perf/VRAM gate because diagnostics instrumentation distorts frame timings and combines unrelated changes.)

**@⁠Androtim** on GitHub · 2026-12-01 01:31 UTC · [original](https://github.com/Androtim/MiniVI/pull/265#issuecomment-7297601132) Maintainer triage (strict merge gate): holding under `triage: needs gpu test`. Before merging any performance or VRAM PR, we require isolated **plain `--release` (no `--features diagnostics`)** A/B measurements against current `main` (`d79b943`) showing: - `median fps` (must not regress) - `preparing ms` and `copyback ms` (must not increase) - `VRAM max` / over-budget MB and `final_waiting` textures (must not increase) - `untranslated` shaders (must not increase) and `0` crashes / DRED (Combined-stack `--features diagnostics` numbers alone cannot pass the perf/VRAM gate because diagnostics instrumentation distorts frame timings and combines unrelated changes.)
Author
Owner

@⁠Androtim on GitHub · 2026-12-01 16:14 UTC · original

Closing as superseded to keep the PR queue focused on core engine bottlenecks: #281 already brought 1440p VRAM under budget (over = 0 MB) with dynamic headroom-reactive spares, and deep audit #282 confirmed the remaining 4K #149 eviction dead-end is in descriptor/host.rs ( abled_lately) and placed-texture
eferences == 1 rather than slot_evict byte thresholds. The real #149 dynamic reclaim fix should land directly against current main.

**@⁠Androtim** on GitHub · 2026-12-01 16:14 UTC · [original](https://github.com/Androtim/MiniVI/pull/265#issuecomment-7317265821) Closing as superseded to keep the PR queue focused on core engine bottlenecks: #281 already brought 1440p VRAM under budget (over = 0 MB) with dynamic headroom-reactive spares, and deep audit #282 confirmed the remaining 4K #149 eviction dead-end is in descriptor/host.rs ( abled_lately) and placed-texture eferences == 1 rather than slot_evict byte thresholds. The real #149 dynamic reclaim fix should land directly against current main.

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/Androtim--MiniVI!265
No description provided.