One texture entry: ~20 maps and four let-go paths behind the long-session drift #252

Open
opened 2026-12-02 17:11:59 +00:00 by github-bot · 1 comment
Owner

@⁠TheRifai on GitHub · 2026-12-02 16:27 UTC · original

Finding (TASKS "One texture entry", line 865)

Seen on: main 9d4e2f1 (code read; run evidence from main 963df8e in /home/shlong/Documents/VKtory-capture/longsession-30m/20261202-155659/).

Texture state is spread across ~20 HashMaps in VulkanBackend (greenfield/vkback/src/lib.rs): images, arena_of, placed_ids, placed_keys, attach_of, attach_cache, views, views_of, img_slots, kept_shown, lazy, naming, twins, twin_slots, fill_info, shown, etc., with further state in residency.rs, srclife.rs, placed.rs and arena.rs. The 30-minute house run grew images 1,060 -> 38,869 and the arena 1.3 -> 6.6 GB while fps crept from 27.7 to 24.7 (issue #241). That is exactly the class of slow drift this refactor is meant to make inspectable.

I did not attempt the refactor: TASKS estimates 1.5-2 days at medium risk and requires a picture check, and several of these maps are also used by the D3D12 path, so a partial consolidation would add a second source of truth rather than remove one. No code change from me.

Next

After deciding to take the 1.5-2 day slot, start from one TexEntry holding Img, its arena piece, let_go state and retry state; move the four let-go paths and three slot-retry queues onto it one at a time, with the picture gate and the 30-minute run as checks.

**@⁠TheRifai** on GitHub · 2026-12-02 16:27 UTC · [original](https://github.com/vktory6/VKtory/issues/252) ## Finding (TASKS "One texture entry", line 865) **Seen on:** main `9d4e2f1` (code read; run evidence from main `963df8e` in `/home/shlong/Documents/VKtory-capture/longsession-30m/20261202-155659/`). Texture state is spread across ~20 `HashMap`s in `VulkanBackend` (`greenfield/vkback/src/lib.rs`): `images`, `arena_of`, `placed_ids`, `placed_keys`, `attach_of`, `attach_cache`, `views`, `views_of`, `img_slots`, `kept_shown`, `lazy`, `naming`, `twins`, `twin_slots`, `fill_info`, `shown`, etc., with further state in `residency.rs`, `srclife.rs`, `placed.rs` and `arena.rs`. The 30-minute house run grew `images` 1,060 -> 38,869 and the arena 1.3 -> 6.6 GB while fps crept from 27.7 to 24.7 (issue #241). That is exactly the class of slow drift this refactor is meant to make inspectable. I did not attempt the refactor: TASKS estimates 1.5-2 days at medium risk and requires a picture check, and several of these maps are also used by the D3D12 path, so a partial consolidation would add a second source of truth rather than remove one. No code change from me. ## Next After deciding to take the 1.5-2 day slot, start from one `TexEntry` holding `Img`, its arena piece, `let_go` state and retry state; move the four let-go paths and three slot-retry queues onto it one at a time, with the picture gate and the 30-minute run as checks.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 17:11:59 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 18:38 UTC · original

Thanks. The count is right and the task had it wrong: there are ~20 texture maps in VulkanBackend, not ~11. "One texture entry" now lists them: github.com/vktory6/VKtory@a58cd901dd

One correction on the reasoning: the D3D12 path is gone, so all of these maps are vkback's. Merging them into one TexEntry doesn't create a second source of truth outside vkback. The 1.5-2 days and the picture check still stand. Your "Next" order (one entry first, then the let-go paths and slot retries one at a time) is the right shape.

On the growth in #241: from reading the code, a placed texture copy is only freed when a new texture's head meets it at a different length, when its first page has been unmapped for 6 s, or by the idle sweep near the VRAM line. A copy whose pool memory the title reuses for another texture (at a different start, or at the same length) keeps a mapped first page and no slot names it again. So it stays until the card reaches its line, and after that new textures spill to GTT. That fits 279,881 spills while the title's own memory never spilled. It's written down as a lead (not measured yet) in "Long sessions and VRAM headroom", with the count to take first.

Closing here. The tasks track it.

**@⁠vktory6** on GitHub · 2026-12-02 18:38 UTC · [original](https://github.com/vktory6/VKtory/issues/252#issuecomment-7354926297) Thanks. The count is right and the task had it wrong: there are ~20 texture maps in `VulkanBackend`, not ~11. "One texture entry" now lists them: https://github.com/vktory6/VKtory/commit/a58cd901ddf9004fdcbc8a1a936f868cca0e0e5d One correction on the reasoning: the D3D12 path is gone, so all of these maps are vkback's. Merging them into one `TexEntry` doesn't create a second source of truth outside vkback. The 1.5-2 days and the picture check still stand. Your "Next" order (one entry first, then the let-go paths and slot retries one at a time) is the right shape. On the growth in #241: from reading the code, a placed texture copy is only freed when a new texture's head meets it at a different length, when its first page has been unmapped for 6 s, or by the idle sweep near the VRAM line. A copy whose pool memory the title reuses for another texture (at a different start, or at the same length) keeps a mapped first page and no slot names it again. So it stays until the card reaches its line, and after that new textures spill to GTT. That fits 279,881 spills while the title's own memory never spilled. It's written down as a lead (not measured yet) in "Long sessions and VRAM headroom", with the count to take first. Closing here. The tasks track it.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/vktory6--VKtory#252
No description provided.