texture pool: VICTORY_POOL_MOVE moves textures in use out of blocks being emptied (#21) #31

Closed
github-bot wants to merge 1 commit from github-bot/gh-31 into main AGit
Owner

@⁠LOCKhart07 on GitHub · 2026-11-30 14:09 UTC · original
LOCKhart07:pool-move → main · +129 −1 · 2 files · 1 commits · closed without merging

For #21.

The texture sweep already picks blocks to empty (block_fates → Fate::WaitedOut) and stops placing new pieces in them (pool::drain). But it only lets go of idle host copies (take_idle / sole_idle). A block that still holds even one texture in use therefore never empties while the world streams. That's the "8 being emptied, 0 returned" in #21.

VICTORY_POOL_MOVE=1 (off by default) adds the missing mover:

  • Once a second, inside let_go_idle, it lets go of the host copies of textures the title fills whose piece lies in a waited-out block, up to VICTORY_POOL_MOVE_MB per second (128). It skips textures with a twin, ones the card wrote into, and ones not placed.
  • Same path as want_level: unstage, grown, the old copy into REPLACED. The slots that show the old copy keep showing it until the new one is filled, and then they're remade (levels_changed_after), so nothing shows blank.
  • Making them due: their slots are made due in texture_slots_remapped (new descriptor::host::moved), so the texture pass makes the copies again soon, in another block, from title memory.

The idea and the shape are from crbns/victory-tapin's drain_moves (r30–r35). This is a reimplementation on this tree's sweep, not their code. Their compaction also chooses blocks; here the existing block_fates choice is kept as it is.

Measured (RX 9070 XT 16 GB, cd811c1, 2560x1440, RT on, ~3 minutes of driving each; different routes, so treat fps as noise):

before VICTORY_POOL_MOVE=1
texture blocks given back to the card 1 17
blocks taken into use again "for want of room elsewhere" 5 0
textures moved / bytes — 8,371 / 1,076 MB
texture blocks alive at the end 127 121
fps median (min–max) 22.6 (14–30) 20.8 (16–30)

Subjectively: noticeably less texture flicker while driving, though some remains.

Not solved by this:

  • The pool grows back while streaming, so the net saving at the end was only ~6 blocks. Fragmentation from placement itself is untouched (e.g. best-fit, or keeping long-lived and short-lived textures apart).
  • move_out walks the whole texture table each pass, cheap so far. I haven't measured it at 100k+ textures.

Builds alone on cd811c1 (only resource.rs and descriptor/host.rs change).

🤖 Generated with Claude Code

**@⁠LOCKhart07** on GitHub · 2026-11-30 14:09 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/31) `LOCKhart07:pool-move` → `main` · +129 −1 · 2 files · 1 commits · closed without merging For #21. The texture sweep already picks blocks to empty (`block_fates` → `Fate::WaitedOut`) and stops placing new pieces in them (`pool::drain`). But it only lets go of *idle* host copies (`take_idle` / `sole_idle`). A block that still holds even one texture in use therefore never empties while the world streams. That's the "8 being emptied, 0 returned" in #21. `VICTORY_POOL_MOVE=1` (off by default) adds the missing mover: - **Once a second,** inside `let_go_idle`, it lets go of the host copies of textures the title fills whose piece lies in a waited-out block, up to `VICTORY_POOL_MOVE_MB` per second (128). It skips textures with a twin, ones the card wrote into, and ones not placed. - **Same path as `want_level`:** `unstage`, `grown`, the old copy into `REPLACED`. The slots that show the old copy keep showing it until the new one is filled, and then they're remade (`levels_changed_after`), so nothing shows blank. - **Making them due:** their slots are made due in `texture_slots_remapped` (new `descriptor::host::moved`), so the texture pass makes the copies again soon, in another block, from title memory. The idea and the shape are from [crbns/victory-tapin](https://github.com/crbns/victory-tapin)'s `drain_moves` (r30–r35). This is a reimplementation on this tree's sweep, not their code. Their compaction also chooses blocks; here the existing `block_fates` choice is kept as it is. **Measured** (RX 9070 XT 16 GB, `cd811c1`, 2560x1440, RT on, ~3 minutes of driving each; different routes, so treat fps as noise): | | before | `VICTORY_POOL_MOVE=1` | |---|---|---| | texture blocks given back to the card | 1 | **17** | | blocks taken into use again "for want of room elsewhere" | 5 | **0** | | textures moved / bytes | — | 8,371 / 1,076 MB | | texture blocks alive at the end | 127 | 121 | | fps median (min–max) | 22.6 (14–30) | 20.8 (16–30) | Subjectively: noticeably less texture flicker while driving, though some remains. **Not solved by this:** - The pool grows back while streaming, so the net saving at the end was only ~6 blocks. Fragmentation from placement itself is untouched (e.g. best-fit, or keeping long-lived and short-lived textures apart). - `move_out` walks the whole texture table each pass, cheap so far. I haven't measured it at 100k+ textures. Builds alone on `cd811c1` (only `resource.rs` and `descriptor/host.rs` change). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The sweep already picks texture blocks to empty (block_fates, WaitedOut) and stops placing pieces in them, but it only lets go of idle copies, so a block that still holds textures in use never empties while the world streams (#21: 8 emptying, none returned). With VICTORY_POOL_MOVE=1 (off by default) the sweep, once a second, lets go of the host copies of textures the title fills that lie in such a block, up to VICTORY_POOL_MOVE_MB (128) a second, the way want_level replaces a copy (REPLACED, grown), and makes their slots due so the texture pass makes them anew in another block. After crbns/victory-tapin's drain_moves, reimplemented on this tree's sweep.

RX 9070 XT, 2560x1440, RT on, ~3 min driving each: blocks given back 1 -> 17, refilled for want of room 5 -> 0, 8,371 textures / 1,076 MB moved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DJe9WTewVmLUUPkT6dTccK
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 07:41:48 +00:00
Author
Owner

@⁠BlueCatsz on GitHub · 2026-12-01 16:03 UTC · original

Tested #31 (VICTORY_POOL_MOVE=1) on CachyOS + RX 9070 XT 16 GB.

  • Environment: Ryzen 7 5800X3D, 32 GB DDR4, RX 9070 XT (RADV GFX1201, Mesa 26.3.1 + #44/#43 mesa.patch), CachyOS (kernel 7.3.6), proton-cachyos-slr + RB-tree wineserver, Series X (1706x960 -> 2560x1440, HW RT on, FG off).
  • Stack note: Tested in a combined local stack (main 37bb30f + #44 + #47 + #67 + #43 + opt-in VICTORY_AMBIENT_RT), compared against a prior run on 37bb30f + #44 without #31.

Observed Result

  • Without #31 (37bb30f + #44, VICTORY_AMBIENT_RT=0): texture blocks: 80 alive, 8 being emptied, 0 given back to the card since the start, 2 taken into use again for want of room elsewhere.
  • With #31 (VICTORY_POOL_MOVE=1):
    • Final move summary: moved=15 mb=1 blocks=8 total=8368 total_mb=1066 given_back=37.
    • Final texture blocks: 72 alive, 6 being emptied, 37 given back to the card since the start, 5 taken into use again for want of room elsewhere.
  • Ran cleanly through the opening linear scenes into the open world (30–43 fps steady state, 0 crashes, 0 device loss, 0 dropped draws).
**@⁠BlueCatsz** on GitHub · 2026-12-01 16:03 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/31#issuecomment-7316965516) Tested #31 (`VICTORY_POOL_MOVE=1`) on CachyOS + RX 9070 XT 16 GB. - **Environment:** Ryzen 7 5800X3D, 32 GB DDR4, RX 9070 XT (RADV GFX1201, Mesa `26.3.1` + #44/#43 `mesa.patch`), CachyOS (kernel `7.3.6`), `proton-cachyos-slr` + RB-tree `wineserver`, Series X (`1706x960 -> 2560x1440`, HW RT on, FG off). - **Stack note:** Tested in a combined local stack (`main` `37bb30f` + #44 + #47 + #67 + #43 + opt-in `VICTORY_AMBIENT_RT`), compared against a prior run on `37bb30f + #44` without #31. ### Observed Result - **Without #31 (`37bb30f + #44`, `VICTORY_AMBIENT_RT=0`):** `texture blocks: 80 alive, 8 being emptied, 0 given back to the card since the start, 2 taken into use again for want of room elsewhere`. - **With #31 (`VICTORY_POOL_MOVE=1`):** - Final move summary: `moved=15 mb=1 blocks=8 total=8368 total_mb=1066 given_back=37`. - Final `texture blocks:` `72 alive, 6 being emptied, 37 given back to the card since the start, 5 taken into use again for want of room elsewhere`. - Ran cleanly through the opening linear scenes into the open world (`30–43 fps` steady state, `0` crashes, `0` device loss, `0` dropped draws).
github-bot closed this pull request 2026-12-03 17:37:47 +00:00
Author
Owner

@⁠LOCKhart07 on GitHub · 2026-12-03 17:33 UTC · original

Already cherrypicked to main

**@⁠LOCKhart07** on GitHub · 2026-12-03 17:33 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/31#issuecomment-7386699417) Already cherrypicked to main

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.