vkback: count views over physically shared target pages #147

Open
github-bot wants to merge 1 commit from github-bot/gh-147 into main AGit
Owner

@⁠TheRifai on GitHub · 2026-12-01 21:45 UTC · original
TheRifai:alias-cross-read → main · +44 −2 · 4 files · 1 commits · open

What

Follow-up from PR #130: six pairs of GPU-written textures with one description share physical title pages at different title addresses, but each gets its own arena image, so a write through one is not seen through the other. This adds a rule-32 counter for views placed over pages that two GPU-written targets share. A physical-page -> target map is refreshed at the stats line; alias_at counts a view when any of its pages is in the shared set. No behaviour change — the alias still resolves to the target at the exact address.

The reference

No console counterpart: the console shares the memory, so a view over those pages sees whichever target wrote them. The counter measures how often vkback's separate images could diverge.

Evidence

  • cargo check -p vkback --all-targets, 164 native tests, and the build all pass.
  • House start, 95 s, GE-Proton11-16: shared targets: same description 6 (61 MB), displaced 208, cross-reads 1319.
  • Boat start, 95 s: cross-reads 1321 with the same six pairs.
  • So the title does place views over physically shared target pages in both scenes. The counter does not decide whether a given read actually needs the other target's writes; that is the write-here/read-there check the task asks for next.
  • Runs: /tmp/opencode/capture/alias-cross-house/, /tmp/opencode/capture/alias-cross2/. Not performance measurements.

Checklist (docs/AGENTS.md)

  • One topic; docs/TASKS.md not edited (rule 29/31)
  • No fallback, constant, switch, queue, unsafe or translator output changed (rules 2/9b/33/35/36/27)
  • Comments say what is true now (rule 3)
  • Nothing from the title, no non-free data pointers (hard constraints)
**@⁠TheRifai** on GitHub · 2026-12-01 21:45 UTC · [original](https://github.com/vktory6/VKtory/pull/147) `TheRifai:alias-cross-read` → `main` · +44 −2 · 4 files · 1 commits · open ## What Follow-up from PR #130: six pairs of GPU-written textures with one description share physical title pages at different title addresses, but each gets its own arena image, so a write through one is not seen through the other. This adds a rule-32 counter for views placed over pages that two GPU-written targets share. A physical-page -> target map is refreshed at the stats line; `alias_at` counts a view when any of its pages is in the shared set. No behaviour change — the alias still resolves to the target at the exact address. ## The reference No console counterpart: the console shares the memory, so a view over those pages sees whichever target wrote them. The counter measures how often vkback's separate images could diverge. ## Evidence - `cargo check -p vkback --all-targets`, 164 native tests, and the build all pass. - House start, 95 s, GE-Proton11-16: `shared targets: same description 6 (61 MB), displaced 208, cross-reads 1319`. - Boat start, 95 s: `cross-reads 1321` with the same six pairs. - So the title does place views over physically shared target pages in both scenes. The counter does not decide whether a given read actually needs the other target's writes; that is the write-here/read-there check the task asks for next. - Runs: `/tmp/opencode/capture/alias-cross-house/`, `/tmp/opencode/capture/alias-cross2/`. Not performance measurements. ## Checklist (docs/AGENTS.md) - [x] One topic; `docs/TASKS.md` not edited (rule 29/31) - [x] No fallback, constant, switch, queue, `unsafe` or translator output changed (rules 2/9b/33/35/36/27) - [x] Comments say what is true now (rule 3) - [x] Nothing from the title, no non-free data pointers (hard constraints)
Follow-up from PR #130's "write-here/read-there probe": six pairs of GPU-written textures of one description share physical title pages at different title addresses, and each gets its own arena image. Refresh a physical-page -> target map at the stats line and count views placed over pages two targets share, regardless of which exact address the view names. House and boat runs each see ~1,320 such reads per 95 s, so the title does place views over these shared pages; the counter does not yet say whether a given read needs the other target's writes. No behaviour change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 21:46:13 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 16:03 UTC · original

Thanks, this is the write-here/read-there probe the TASKS item "Targets of one description over the same memory are separate images" asks for, and #194 waits on its numbers. One thing before merging: since #143, alias_at runs for every placed view, and the probe now calls tm.m.pieces into a fresh Vec on each of those calls, so it adds a lookup and an allocation to a hot path in every run. Please either put it behind a debug switch (registered in toggles.txt, removed once the question is answered) or reuse one buffer and check alias_shared_pages.is_empty() first, so it costs nothing when no pages are shared. Then please post the counts from one boat run: that decides #194.

**@⁠vktory6** on GitHub · 2026-12-02 16:03 UTC · [original](https://github.com/vktory6/VKtory/pull/147#issuecomment-7351362412) Thanks, this is the write-here/read-there probe the TASKS item "Targets of one description over the same memory are separate images" asks for, and #194 waits on its numbers. One thing before merging: since #143, `alias_at` runs for every placed view, and the probe now calls `tm.m.pieces` into a fresh `Vec` on each of those calls, so it adds a lookup and an allocation to a hot path in every run. Please either put it behind a debug switch (registered in `toggles.txt`, removed once the question is answered) or reuse one buffer and check `alias_shared_pages.is_empty()` first, so it costs nothing when no pages are shared. Then please post the counts from one boat run: that decides #194.
Author
Owner

@⁠TheRifai on GitHub · 2026-12-02 17:00 UTC · original

Maintenance note on this PR (no force-push, PR left open): main moved to 87ab180 and mergeable became false. I rebased the four-file change onto that base locally, resolved the one conflict with merged PR #152 in live/present.rs (both the mip-linear fields and the new cross-read field are kept), and verified it: cargo check -p vkback clean, tools/build.sh exit 0, and a 70 s house run reports cross-reads 987 then 1045 in two stats windows (/home/shlong/Documents/VKtory-capture/alias2-run/).

I could not push a corrected branch: POST /repos/TheRifai/VKtory/git/refs now returns HTTP 404 for a valid commit SHA via gh api and direct curl, GraphQL createRef says the token lacks permission, and a normal git push is rejected because this OAuth token lacks the workflow scope for the unchanged .github/workflows/ci.yml. This needs a credential/permission change from the account owner; the local work is ready at branch alias-cross-read-v2 in /home/shlong/Documents/VKtory-alias2.

**@⁠TheRifai** on GitHub · 2026-12-02 17:00 UTC · [original](https://github.com/vktory6/VKtory/pull/147#issuecomment-7352766810) Maintenance note on this PR (no force-push, PR left open): main moved to `87ab180` and `mergeable` became false. I rebased the four-file change onto that base locally, resolved the one conflict with merged PR #152 in `live/present.rs` (both the mip-linear fields and the new cross-read field are kept), and verified it: `cargo check -p vkback` clean, `tools/build.sh` exit 0, and a 70 s house run reports `cross-reads 987` then `1045` in two stats windows (`/home/shlong/Documents/VKtory-capture/alias2-run/`). I could not push a corrected branch: `POST /repos/TheRifai/VKtory/git/refs` now returns HTTP 404 for a valid commit SHA via `gh api` and direct curl, GraphQL `createRef` says the token lacks permission, and a normal `git push` is rejected because this OAuth token lacks the `workflow` scope for the unchanged `.github/workflows/ci.yml`. This needs a credential/permission change from the account owner; the local work is ready at branch `alias-cross-read-v2` in `/home/shlong/Documents/VKtory-alias2`.
This pull request has changes conflicting with the target branch.
  • greenfield/vkback/src/live/present.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/147/head:github-bot/gh-147'
git switch 'github-bot/gh-147'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-147'
git switch 'github-bot/gh-147'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-147'
git switch 'github-bot/gh-147'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-147'
git switch 'main'
git merge --squash 'github-bot/gh-147'
git switch 'main'
git merge --ff-only 'github-bot/gh-147'
git switch 'main'
git merge 'github-bot/gh-147'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.