host: base in-block texture eviction idle time on net occupancy #164

Manually merged
github merged 1 commit from github-bot/gh-164 into main 2026-12-02 19:57:22 +00:00 AGit
Owner

@⁠eirik200 on GitHub · 2026-12-02 05:42 UTC · original
eirik200:pr/texture-eviction-room-ms → main · +69 −4 · 2 files · 1 commits · merged 2026-12-02 19:52 UTC

Summary

vram_plan computed room (bytes to evict inside staying texture blocks) from net occupancy (settled - free + kept), but still used the gross idle_ms from whole-card occupancy (settled + kept) when deciding how long a texture had to be idle.

When the card sat around 88% gross with 6–12% free inside our own 64 MiB texture blocks, in-block textures were evicted after 2 s idle instead of 4 s (or kept for 10 min when net occupancy was under 80%).

Changes

  • Split Keep to carry a dedicated room_ms (room_ms >= idle_ms) derived from vram_keep(budget, settled - free + kept) when admissions are open.
  • Use keep.room_ms in resource::let_go_idle for in-block eviction; whole-block release (back) continues to use gross idle_ms so blocks still return to the card before admissions close.
  • Add unit test room_in_blocks_goes_by_what_textures_hold covering net vs gross thresholds and closed admissions.

Testing

  • JOBS=6 ./build.sh check passes cleanly.
  • Verified in 10-minute open-world driving runs on RX 9060 XT (16 GiB, RADV).
**@⁠eirik200** on GitHub · 2026-12-02 05:42 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/164) `eirik200:pr/texture-eviction-room-ms` → `main` · +69 −4 · 2 files · 1 commits · merged 2026-12-02 19:52 UTC ## Summary `vram_plan` computed `room` (bytes to evict inside staying texture blocks) from net occupancy (`settled - free + kept`), but still used the gross `idle_ms` from whole-card occupancy (`settled + kept`) when deciding how long a texture had to be idle. When the card sat around 88% gross with 6–12% free inside our own 64 MiB texture blocks, in-block textures were evicted after 2 s idle instead of 4 s (or kept for 10 min when net occupancy was under 80%). ## Changes - Split `Keep` to carry a dedicated `room_ms` (`room_ms >= idle_ms`) derived from `vram_keep(budget, settled - free + kept)` when admissions are open. - Use `keep.room_ms` in `resource::let_go_idle` for in-block eviction; whole-block release (`back`) continues to use gross `idle_ms` so blocks still return to the card before admissions close. - Add unit test `room_in_blocks_goes_by_what_textures_hold` covering net vs gross thresholds and closed admissions. ## Testing - `JOBS=6 ./build.sh check` passes cleanly. - Verified in 10-minute open-world driving runs on RX 9060 XT (16 GiB, RADV).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 05:45:33 +00:00
Author
Owner

@⁠joaowtrdev on GitHub · 2026-12-02 12:39 UTC · original

Tested on an RX 9070 XT 16 GB / Ryzen 7 5700X3D / 32 GB (CachyOS, KDE Wayland, system Wine 11.22). Settings: 4K output, FSR 4 Performance, RT off, VICTORY_CARD_PULL=0 VICTORY_PAGES_SEEN=1, VICTORY_ROOM_TIMING=1. It is an A/B: d044248 with this PR and #163 applied, against plain d044248. Same save and route, ~5 min each, back-to-back. VRAM sits at 88–91% of the budget while driving, so the new path is exercised.

#163 + #164 d044248
Sweeps where room_ms > idle_ms 99 of 299 0 of 253
Textures let go 173,215 (18.4 GB) 182,466 (19.2 GB)
reuse at the end [25456, 1.94 GB, 4122, 0.42 GB] [29155, 2.20 GB, 4988, 0.52 GB]
Refused in index passes 6,249 13,856
Real fps / median / 1% low 27.6 / 33.1 / 9.0 28.0 / 33.2 / 10.0
texture_mb per frame 8.8 7.4

It does what it says: textures are used again 13% less after being let go, and 55% fewer are refused for room. On this machine, the frame rate does not change beyond run-to-run noise. The run with the PRs also streamed more new textures per frame (8.8 vs 7.4 MB). Both builds still let go ~180k textures in 5 min, so here the drops seem to come from the streaming volume itself (see #159). The two PRs were tested together, so this does not separate #163 from #164.

**@⁠joaowtrdev** on GitHub · 2026-12-02 12:39 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/164#issuecomment-7345674467) Tested on an RX 9070 XT 16 GB / Ryzen 7 5700X3D / 32 GB (CachyOS, KDE Wayland, system Wine 11.22). Settings: 4K output, FSR 4 Performance, RT off, `VICTORY_CARD_PULL=0 VICTORY_PAGES_SEEN=1`, `VICTORY_ROOM_TIMING=1`. It is an A/B: `d044248` with this PR and #163 applied, against plain `d044248`. Same save and route, ~5 min each, back-to-back. VRAM sits at 88–91% of the budget while driving, so the new path is exercised. | | #163 + #164 | `d044248` | |---|---|---| | Sweeps where `room_ms > idle_ms` | 99 of 299 | 0 of 253 | | Textures let go | 173,215 (18.4 GB) | 182,466 (19.2 GB) | | `reuse` at the end | [25456, 1.94 GB, 4122, 0.42 GB] | [29155, 2.20 GB, 4988, 0.52 GB] | | Refused in index passes | 6,249 | 13,856 | | Real fps / median / 1% low | 27.6 / 33.1 / 9.0 | 28.0 / 33.2 / 10.0 | | `texture_mb` per frame | 8.8 | 7.4 | It does what it says: textures are used again 13% less after being let go, and 55% fewer are refused for room. On this machine, the frame rate does not change beyond run-to-run noise. The run with the PRs also streamed more new textures per frame (8.8 vs 7.4 MB). Both builds still let go ~180k textures in 5 min, so here the drops seem to come from the streaming volume itself (see #159). The two PRs were tested together, so this does not separate #163 from #164.
Author
Owner

@⁠csj0oe on GitHub · 2026-12-02 18:51 UTC · original

8 GB RX 7600 XT / Ryzen 5 5600G field result, with FSR off (title's built-in scaler at 0.5, 1080p output).

Build: 241c79e + this commit. After the intro reached the world:

texture blocks: 52 alive, 8 being emptied, 0 given back to the card since the start,
4 taken into use again for want of room elsewhere; host copies let go since the start:
0 to empty blocks, 35623 for room or age (3015 MB); without room, since the start
35400 textures put in free space of blocks already made, 2781 found none;
room line 92% of the budget, 86% with texture blocks' free space taken off

Two runs on the same setup without the commit showed ~68k-73k copies / 5.5-6.1 GB at a similar point, but that is not a controlled A/B — different scenes and loading states. The useful part is that the new reuse path is active on an 8 GB card, and the churn is substantially lower in this run. FPS was 20-33 depending on the scene; no crash.

Texture popping is still visible on 8 GB, so this helps but does not eliminate it here.

**@⁠csj0oe** on GitHub · 2026-12-02 18:51 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/164#issuecomment-7355269959) 8 GB RX 7600 XT / Ryzen 5 5600G field result, with FSR off (title's built-in scaler at 0.5, 1080p output). Build: `241c79e` + this commit. After the intro reached the world: ``` texture blocks: 52 alive, 8 being emptied, 0 given back to the card since the start, 4 taken into use again for want of room elsewhere; host copies let go since the start: 0 to empty blocks, 35623 for room or age (3015 MB); without room, since the start 35400 textures put in free space of blocks already made, 2781 found none; room line 92% of the budget, 86% with texture blocks' free space taken off ``` Two runs on the same setup without the commit showed ~68k-73k copies / 5.5-6.1 GB at a similar point, but that is **not a controlled A/B** — different scenes and loading states. The useful part is that the new reuse path is active on an 8 GB card, and the churn is substantially lower in this run. FPS was 20-33 depending on the scene; no crash. Texture popping is still visible on 8 GB, so this helps but does not eliminate it here.
github manually merged commit 2d43a2cb2e into main 2026-12-02 19:57:22 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.