gpu: tighten idle eviction and library trim timers under VRAM/RAM pressure #48

Open
github-bot wants to merge 2 commits from github-bot/gh-48 into main AGit
Owner

@⁠fever308 on GitHub · 2026-11-24 20:54 UTC · original
fever308:feat/pressure-aware-eviction → main · +107 −8 · 5 files · 2 commits · open

Summary

 host::sweep()  (1 Hz)
   ├── resource::let_go_idle()
-  │     idle_ms = 5_000
+  │     idle_ms = vram_idle_ms(video_memory)            # 5s (<75%) / 2.5s (75-85%) / 1s (>=85%)
   ├── shadow::let_go_idle()      (skip RAM query if empty)
   ├── texture::let_go_idle()     (skip RAM query if empty)
   └── pipeline::library::trim()  (skip RAM query if unmapped/trimmed)
-        idle_ms = 10_000
+        idle_ms = ram_idle_ms(available_physical_ram)   # 10s (>=4 GiB) / 5s (2-4 GiB) / 2s (<2 GiB)

Preserves IDLE_FRAMES = 4 and minimum 1,000 ms (VRAM) / 2,000 ms (RAM) floors.

Evidence

  • Before: Fixed 5,000 ms VRAM idle timeout and 10,000 ms RAM idle/trim timeouts regardless of live host memory pressure.
    After:
    • cargo test -p victory-gpu idle_ms_scales_with_pressure: 2 passed (vram_idle_ms_scales_with_pressure, ram_idle_ms_scales_with_pressure), 0 failed.
    • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.

Merge Danger

Door: two-way

Only tightens existing sweep thresholds under pressure; VICTORY_SWEEP=0, VICTORY_TEXTURE_SWEEP=0, and VICTORY_LIBRARY_TRIM=0 still disable sweeps.

Blast Radius: Eviction

Under high VRAM or host RAM pressure, idle host textures, staging buffers, loose shadows, and mapped library pages are released sooner and recreated if reused.

**@⁠fever308** on GitHub · 2026-11-24 20:54 UTC · [original](https://github.com/fxceless/victory-fork/pull/48) `fever308:feat/pressure-aware-eviction` → `main` · +107 −8 · 5 files · 2 commits · open ## Summary ```diff host::sweep() (1 Hz) ├── resource::let_go_idle() - │ idle_ms = 5_000 + │ idle_ms = vram_idle_ms(video_memory) # 5s (<75%) / 2.5s (75-85%) / 1s (>=85%) ├── shadow::let_go_idle() (skip RAM query if empty) ├── texture::let_go_idle() (skip RAM query if empty) └── pipeline::library::trim() (skip RAM query if unmapped/trimmed) - idle_ms = 10_000 + idle_ms = ram_idle_ms(available_physical_ram) # 10s (>=4 GiB) / 5s (2-4 GiB) / 2s (<2 GiB) ``` Preserves `IDLE_FRAMES = 4` and minimum `1,000 ms` (VRAM) / `2,000 ms` (RAM) floors. ## Evidence - **Before:** Fixed `5,000 ms` VRAM idle timeout and `10,000 ms` RAM idle/trim timeouts regardless of live host memory pressure. **After:** - `cargo test -p victory-gpu idle_ms_scales_with_pressure`: 2 passed (`vram_idle_ms_scales_with_pressure`, `ram_idle_ms_scales_with_pressure`), 0 failed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. ## Merge Danger **Door:** two-way Only tightens existing sweep thresholds under pressure; `VICTORY_SWEEP=0`, `VICTORY_TEXTURE_SWEEP=0`, and `VICTORY_LIBRARY_TRIM=0` still disable sweeps. **Blast Radius:** Eviction Under high VRAM or host RAM pressure, idle host textures, staging buffers, loose shadows, and mapped library pages are released sooner and recreated if reused.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:13 +00:00
github-bot referenced this pull request from a commit 2026-11-26 03:40:07 +00:00
Author
Owner

@⁠im-a-cat on GitHub · 2026-11-25 07:21 UTC · original

Checked against current fxceless/main (a26859f): git merge --no-commit --no-ff pr-48 produces an empty diff (available_physical_ram, vram_idle_ms, ram_idle_ms in host.rs, and the callers in resource.rs, shadow.rs, texture.rs, and pipeline/library.rs are already present on main). Sharing as a heads-up that #48 appears already landed and safe to close.

**@⁠im-a-cat** on GitHub · 2026-11-25 07:21 UTC · [original](https://github.com/fxceless/victory-fork/pull/48#issuecomment-7155768035) Checked against current `fxceless/main` (`a26859f`): `git merge --no-commit --no-ff pr-48` produces an empty diff (`available_physical_ram`, `vram_idle_ms`, `ram_idle_ms` in `host.rs`, and the callers in `resource.rs`, `shadow.rs`, `texture.rs`, and `pipeline/library.rs` are already present on `main`). Sharing as a heads-up that #48 appears already landed and safe to close.
Author
Owner

@⁠fever308 on GitHub · 2026-11-25 07:27 UTC · original

Thanks for checking and for the heads-up, @im-a-cat! Confirmed locally against fxceless/main (a26859f) — merging this branch produces an empty diff (including commit 8845117), so #48 is indeed already landed on main. Leaving it for the maintainer/author to close cleanly.

**@⁠fever308** on GitHub · 2026-11-25 07:27 UTC · [original](https://github.com/fxceless/victory-fork/pull/48#issuecomment-7155880282) Thanks for checking and for the heads-up, `@im-a-cat`! Confirmed locally against `fxceless/main` (`a26859f`) — merging this branch produces an empty diff (including commit `8845117`), so #48 is indeed already landed on `main`. Leaving it for the maintainer/author to close cleanly.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/host.rs
  • crates/victory-gpu/src/shadow.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/48/head:github-bot/gh-48'
git switch 'github-bot/gh-48'

Merge

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