vkback live: cache slot reads whose words are no view #48

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

@⁠Mhyster on GitHub · 2026-12-01 03:59 UTC · original
Mhyster:slot-cache-no-view → main · +28 −3 · 4 files · 1 commits · merged 2026-12-01 08:13 UTC

What

live/slots.rs caches slot reads whose words are no view (Resolved::NotAView) as it caches resolved views. Answers that depend on the view table (stale generation, beyond the table, bad shape) are still tried again at every read.

Why

Only resolved slots were cached, so each read of a slot whose tag is not vVIE (a render-target record, an empty slot in a page the cache had not seen) was resolved, noted and nulled again: ~11.5k index slots a present (prison30.md). NotAView comes from the words alone (ViewTable::resolve checks the tag before the table) and its write is the same null each time. The backend's own writes to a slot uncache it as before (forget_slots). The slot cache's doc on all-zero words is corrected: they are the default, and an empty slot is no view, so a hit is right.

Verification (rule 27)

Added 2026-12-01: the pairs below are bb34500 (2dd59da with the open PRs #22 and #29 merged, just-another-dude84/VKtory@324542c cherry-picked and a local translator version bump) against bb34500 with this change (2181d35). This change also ran in #47's validation run as part of 1da3463, with no new error against bb34500.

cargo test -p vkback --lib. RX 9070 XT, Ryzen 5 9600X, Mesa 26.3.1, own save left standing, 180 s after a 120 s load, two interleaved pairs: recording and submitting 13.7/13.7 -> 12.3/13.2 ms a frame, renderer thread 77.8/77.2 -> 73.6/76.1 % of a core; fps within the spread. A small renderer saving, not a frame-rate change by itself.

Validation run (rule 30): the Vulkan calls stay the same (a cached slot already holds the null the write would make again); none run.

Learning: docs/learnings/vkback-live-cpu.md, "Slots that are no view, cached".

What is left: ~2.2M slot reads per 5 s still resolve to no view; a counter put all of them inside the view heaps, and they miss although cached (their words differ from the last read, or the address is new), so no cache holds them. Only fewer reads would (the descriptor heap as one array). In the learning.

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/48) `Mhyster:slot-cache-no-view` → `main` · +28 −3 · 4 files · 1 commits · merged 2026-12-01 08:13 UTC ## What live/slots.rs caches slot reads whose words are no view (`Resolved::NotAView`) as it caches resolved views. Answers that depend on the view table (stale generation, beyond the table, bad shape) are still tried again at every read. ## Why Only resolved slots were cached, so each read of a slot whose tag is not `vVIE` (a render-target record, an empty slot in a page the cache had not seen) was resolved, noted and nulled again: ~11.5k index slots a present (prison30.md). `NotAView` comes from the words alone (`ViewTable::resolve` checks the tag before the table) and its write is the same null each time. The backend's own writes to a slot uncache it as before (`forget_slots`). The slot cache's doc on all-zero words is corrected: they are the default, and an empty slot is no view, so a hit is right. ## Verification (rule 27) *Added 2026-12-01: the pairs below are bb34500 (2dd59da with the open PRs #22 and #29 merged, just-another-dude84/VKtory@324542c cherry-picked and a local translator version bump) against bb34500 with this change (2181d35). This change also ran in #47's validation run as part of 1da3463, with no new error against bb34500.* `cargo test -p vkback --lib`. RX 9070 XT, Ryzen 5 9600X, Mesa 26.3.1, own save left standing, 180 s after a 120 s load, two interleaved pairs: recording and submitting 13.7/13.7 -> 12.3/13.2 ms a frame, renderer thread 77.8/77.2 -> 73.6/76.1 % of a core; fps within the spread. A small renderer saving, not a frame-rate change by itself. Validation run (rule 30): the Vulkan calls stay the same (a cached slot already holds the null the write would make again); none run. Learning: `docs/learnings/vkback-live-cpu.md`, "Slots that are no view, cached". What is left: ~2.2M slot reads per 5 s still resolve to no view; a counter put all of them inside the view heaps, and they miss although cached (their words differ from the last read, or the address is new), so no cache holds them. Only fewer reads would (the descriptor heap as one array). In the learning. 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)
Only slots that resolved to a view were cached, so a slot whose words are no
view (NotAView: the tag alone says so) was resolved, noted and nulled again at
every read, ~11.5k index slots a present. NotAView does not depend on the view
table and its write is the same null each time, so it is cached like a view;
table-dependent answers (stale, beyond the table, bad shape) are still tried
again. The backend's own writes uncache a slot as before.

Measured (RX 9070 XT, player save standing, 180 s, two pairs): recording and
submitting 13.7/13.7 -> 12.3/13.2 ms a frame, renderer thread 77.5 -> 75 % of
a core; fps within the run-to-run spread. Learning:
docs/learnings/vkback-live-cpu.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:28 +00:00
github-bot changed target branch from main to gh-pr/48/base 2026-12-01 08:16:26 +00:00
github manually merged commit 41c8237053 into gh-pr/48/base 2026-12-01 08:16:33 +00:00
Author
Owner

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

Merged, thanks! Caching NotAView is safe: the decision depends only on the words, and the cache entry is keyed on them, so changed words resolve again. 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:13 UTC · [original](https://github.com/vktory6/VKtory/pull/48#issuecomment-7305030221) Merged, thanks! Caching `NotAView` is safe: the decision depends only on the words, and the cache entry is keyed on them, so changed words resolve again. 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.