vkback residency: each memory line places and lets go its own textures #47

Manually merged
github merged 1 commit from github-bot/gh-47 into gh-pr/47/base 2026-12-01 08:16:23 +00:00 AGit
Owner

@⁠Mhyster on GitHub · 2026-12-01 03:59 UTC · original
Mhyster:residency-own-lines → main · +67 −11 · 3 files · 1 commits · merged 2026-12-01 08:12 UTC

What

The VRAM decision for a texture (room_for_textures, which texture_place uses for the card's line) now reads the card's line only, and let_go_idle runs once per line over the textures in that line's memory (let_go_from; Life::gtt tells them apart). Textures spilled to GTT come back to VRAM when the card is more than 7 % under its line (back_to_vram: idle ones let go, 64 MB every 30th present, made again in VRAM at their next use).

Why

  • room_for_textures asked v < 0 && g < 0. GTT is mostly title memory, so whenever GTT stood over its line, every texture was refused, including the ones that would have gone into VRAM while the card was under its line. In a player session on a 16 GB card: GTT 13.3 of 15.4 GB with only 0.5 GB of it textures, 194k textures "refused past both lines", and the image arena holding 4.8 GB free in its blocks. A refused texture reads null: black or missing surfaces until there is room.
  • let_go_idle took ov.max(og) and let go VRAM textures for GTT's line. Freeing a VRAM texture gives no GTT back, so the sweep churned: 381,786 let go and 1,175,026 refills refused in that session.

texture_place's doc already says room_for_textures "decides the VRAM line".

Verification (rule 27)

Corrected 2026-12-01: "main" in this section is bb34500, not main: 2dd59da with the open PRs #22 and #29 merged, just-another-dude84/VKtory@324542c cherry-picked and a local translator version bump. "This branch" in the table is bb34500 with this PR's first commit (9894da3). The back_to_vram pair and the validation run compare bb34500 with 1da3463, which also has #48: their VRAM, spill and refusal numbers are this PR's, their fps may include #48's.

RX 9070 XT 16 GB, Ryzen 5 9600X, Mesa 26.3.1. Own save loaded and left standing; 180 s sampled after a 120 s load, interleaved with main.

refused (VRAM budget) VRAM in use fps
GTT capped at 10 GB (VKB_GTT_BUDGET_GB=10), main 22,000,460 9.7 GB 28.8
same, this branch 289,311 11.9 GB 28.6
no cap, main (2 runs) 38 / 30 12.1 GB 27.1 / 28.2
no cap, this branch (2 runs) 25 / 43 12.1 GB 27.2 / 29.1

The first version without back_to_vram left spilled textures in GTT (spilled 45k/39k -> 148k/139k): the old sweep had brought them back by accident. With it, another standing spot of the same save, two interleaved pairs, no GTT pressure: fps 24.6/24.5 -> 25.0/24.9, VRAM 12.0/11.7 -> 11.7/11.8 GB, no refusals or spills on either side.

Validation run (rule 30), house scene, 60 world s, errors only, two runs a side (layer 1.4.363): no new error. The union of distinct VUIDs is the same on both sides except VkRenderingInfo-pNext-06079/06080, seen in one main run only. VUID-VkSparseMemoryBind-memory-02730 shows on both sides and is not on the TASKS.md list: reported separately (#42).

Learning: docs/learnings/tex-letgo.md, "Each line its own memory".

The fps numbers are from the house scene, which docs/tools.md now calls a smoke check only (its view switches on its own); the refusal counts and recording times are the measurement, the fps only shows nothing got worse.

🤖 Generated with Claude Code

**@⁠Mhyster** on GitHub · 2026-12-01 03:59 UTC · [original](https://github.com/vktory6/VKtory/pull/47) `Mhyster:residency-own-lines` → `main` · +67 −11 · 3 files · 1 commits · merged 2026-12-01 08:12 UTC ## What The VRAM decision for a texture (`room_for_textures`, which `texture_place` uses for the card's line) now reads the card's line only, and `let_go_idle` runs once per line over the textures in that line's memory (`let_go_from`; `Life::gtt` tells them apart). Textures spilled to GTT come back to VRAM when the card is more than 7 % under its line (`back_to_vram`: idle ones let go, 64 MB every 30th present, made again in VRAM at their next use). ## Why - `room_for_textures` asked `v < 0 && g < 0`. GTT is mostly title memory, so whenever GTT stood over its line, every texture was refused, including the ones that would have gone into VRAM while the card was under its line. In a player session on a 16 GB card: GTT 13.3 of 15.4 GB with only 0.5 GB of it textures, 194k textures "refused past both lines", and the image arena holding 4.8 GB free in its blocks. A refused texture reads null: black or missing surfaces until there is room. - `let_go_idle` took `ov.max(og)` and let go VRAM textures for GTT's line. Freeing a VRAM texture gives no GTT back, so the sweep churned: 381,786 let go and 1,175,026 refills refused in that session. `texture_place`'s doc already says `room_for_textures` "decides the VRAM line". ## Verification (rule 27) *Corrected 2026-12-01: "main" in this section is bb34500, not main: 2dd59da with the open PRs #22 and #29 merged, just-another-dude84/VKtory@324542c cherry-picked and a local translator version bump. "This branch" in the table is bb34500 with this PR's first commit (9894da3). The `back_to_vram` pair and the validation run compare bb34500 with 1da3463, which also has #48: their VRAM, spill and refusal numbers are this PR's, their fps may include #48's.* RX 9070 XT 16 GB, Ryzen 5 9600X, Mesa 26.3.1. Own save loaded and left standing; 180 s sampled after a 120 s load, interleaved with main. | | refused (VRAM budget) | VRAM in use | fps | |---|---|---|---| | GTT capped at 10 GB (`VKB_GTT_BUDGET_GB=10`), main | 22,000,460 | 9.7 GB | 28.8 | | same, this branch | 289,311 | 11.9 GB | 28.6 | | no cap, main (2 runs) | 38 / 30 | 12.1 GB | 27.1 / 28.2 | | no cap, this branch (2 runs) | 25 / 43 | 12.1 GB | 27.2 / 29.1 | The first version without `back_to_vram` left spilled textures in GTT (spilled 45k/39k -> 148k/139k): the old sweep had brought them back by accident. With it, another standing spot of the same save, two interleaved pairs, no GTT pressure: fps 24.6/24.5 -> 25.0/24.9, VRAM 12.0/11.7 -> 11.7/11.8 GB, no refusals or spills on either side. Validation run (rule 30), house scene, 60 world s, errors only, two runs a side (layer 1.4.363): no new error. The union of distinct VUIDs is the same on both sides except `VkRenderingInfo-pNext-06079/06080`, seen in one main run only. `VUID-VkSparseMemoryBind-memory-02730` shows on both sides and is not on the TASKS.md list: reported separately (#42). Learning: `docs/learnings/tex-letgo.md`, "Each line its own memory". The fps numbers are from the house scene, which docs/tools.md now calls a smoke check only (its view switches on its own); the refusal counts and recording times are the measurement, the fps only shows nothing got worse. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
room_for_textures, the VRAM decision of texture_place, asked for room under
both lines, so a full GTT (mostly title memory) refused VRAM textures while the
card was under its line and the image arena had gigabytes free in its blocks.
let_go_idle took the larger of the two overruns and let go VRAM textures for
GTT's line, which gives no GTT back.

Now the VRAM decision reads the card's line only, and the sweep runs once per
line over the textures in that line's memory (let_go_from; Life::gtt tells
them apart). Textures spilled to GTT come back to VRAM when the card is well
under its line (back_to_vram), which the old sweep did by accident.

Measured (RX 9070 XT, player save standing, 180 s): with GTT capped at 10 GB
(VKB_GTT_BUDGET_GB), textures refused 22,000,460 -> 289,311 and VRAM in use
9.7 -> 11.9 GB at the same fps; without pressure, fps 24.6/24.5 -> 25.0/24.9
in two interleaved pairs. Learning: docs/learnings/tex-letgo.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 04:00:27 +00:00
github-bot changed target branch from main to gh-pr/47/base 2026-12-01 08:16:21 +00:00
github manually merged commit 8da794a86c into gh-pr/47/base 2026-12-01 08:16:23 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 08:12 UTC · original

Merged, thanks! Asking for GTT room in the VRAM decision was a real bug, and your refusal counts show it clearly. back_to_vram puts back on purpose what the old sweep did by accident. Check on the reference system (RX 9070 XT): tests pass, and the house-scene validation run shows no new error.

**@⁠vktory6** on GitHub · 2026-12-01 08:12 UTC · [original](https://github.com/vktory6/VKtory/pull/47#issuecomment-7305007318) Merged, thanks! Asking for GTT room in the VRAM decision was a real bug, and your refusal counts show it clearly. `back_to_vram` puts back on purpose what the old sweep did by accident. Check on the reference system (RX 9070 XT): tests pass, and the house-scene validation run shows no new error.
This discussion has been locked. Commenting is limited to contributors.
No description provided.