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

Open
fever308 wants to merge 2 commits from upstream-pr/48 into main
fever308 commented 2026-11-24 20:54:46 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-24T20:54:46Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6591211965 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/48). Originally posted by [fever308](https://github.com/fever308) on 2026-11-24T20:54:46Z. --- ## 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.
im-a-cat commented 2026-11-25 08:08:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by im-a-cat on 2026-11-25T07:21:21Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7155768035 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/48#issuecomment-7155768035). Originally posted by [im-a-cat](https://github.com/im-a-cat) on 2026-11-25T07:21:21Z. --- 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.
fever308 commented 2026-11-25 08:08:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by fever308 on 2026-11-25T07:27:25Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7155880282 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/48#issuecomment-7155880282). Originally posted by [fever308](https://github.com/fever308) on 2026-11-25T07:27:25Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/48:upstream-pr/48'
git switch 'upstream-pr/48'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/48'
git switch 'upstream-pr/48'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/48'
git switch 'upstream-pr/48'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/48'
git switch 'main'
git merge --squash 'upstream-pr/48'
git switch 'main'
git merge --ff-only 'upstream-pr/48'
git switch 'main'
git merge 'upstream-pr/48'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
fxceless/victory-fork!48
No description provided.