GPU: count is_view calls and time in live guards #219

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

@⁠TheRifai on GitHub · 2026-12-02 14:39 UTC · original
TheRifai:isview-counter → main · +16 −1 · 2 files · 1 commits · closed without merging

What

Answers the counter request on #208: count the is_view calls live_title_block makes and the time in them, with a stats line showing calls/s, ms/s and µs per call. No rendering or guard behaviour changes — two atomics and one log line.

Evidence

100 s warm-store house run on main 963df8e, RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X 3840x2160, scripted camera walk, patched build:

Metric (1 s windows, n=92) mean median max
is_view calls/s 1,339 830 8,884
time in is_view, ms/s 128.8 80.6 782.0
sending waits, ms/s 74.4 28.3 629.3

So the time is in the query path, not just in the wait that follows it: ~80 ms/s in is_view at the median against ~28 ms/s of sending waits, and ~100 µs per call — far more than one VirtualQuery. That points at the hole walk inside is_view or contention on the umem lock rather than the single syscall. This keeps the #141 crash fix and gives the next patch a target.

cargo check -p victory-gpu --features diagnostics and tools/build.sh exit 0. Evidence: /home/shlong/Documents/VKtory-capture/isview-run/.

Checklist (docs/AGENTS.md)

  • One topic; docs/TASKS.md not edited (rules 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)
  • No game content as evidence; only counters
**@⁠TheRifai** on GitHub · 2026-12-02 14:39 UTC · [original](https://github.com/vktory6/VKtory/pull/219) `TheRifai:isview-counter` → `main` · +16 −1 · 2 files · 1 commits · closed without merging ## What Answers the counter request on #208: count the `is_view` calls `live_title_block` makes and the time in them, with a stats line showing calls/s, ms/s and µs per call. No rendering or guard behaviour changes — two atomics and one log line. ## Evidence 100 s warm-store house run on main `963df8e`, RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X 3840x2160, scripted camera walk, patched build: | Metric (1 s windows, n=92) | mean | median | max | |---|---:|---:|---:| | `is_view` calls/s | 1,339 | 830 | 8,884 | | time in `is_view`, ms/s | 128.8 | 80.6 | 782.0 | | sending waits, ms/s | 74.4 | 28.3 | 629.3 | So the time is in the query path, not just in the wait that follows it: ~80 ms/s in `is_view` at the median against ~28 ms/s of sending waits, and ~100 µs per call — far more than one `VirtualQuery`. That points at the hole walk inside `is_view` or contention on the umem lock rather than the single syscall. This keeps the #141 crash fix and gives the next patch a target. `cargo check -p victory-gpu --features diagnostics` and `tools/build.sh` exit 0. Evidence: `/home/shlong/Documents/VKtory-capture/isview-run/`. ## Checklist (docs/AGENTS.md) - [x] One topic; `docs/TASKS.md` not edited (rules 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] No game content as evidence; only counters
Asked on PR #208: tell a query-heavy path from one whose time is elsewhere.
Adds two atomics (count, ns) around the is_view call in live_title_block and a
stats line with calls/s, ms/s and us per call. No behaviour change.

One 100 s house run on main 963df8e, RX 9070 XT / RADV 26.3.1, GE-Proton11-16:
is_view 830 calls/s median (128.8 ms/s mean, 80.6 p50), ~100 us per call;
sending waits 74.4 ms/s mean, 28.3 p50. So the query itself is larger than the
wait it was blamed for, and ~100 us per block is far more than one VirtualQuery
-- the fallback is walking holes or contending on the umem lock. Evidence:
/home/shlong/Documents/VKtory-capture/isview-run/.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 14:40:35 +00:00
Author
Owner

@⁠TheRifai on GitHub · 2026-12-02 15:32 UTC · original

Correction to my earlier pointer: the corrected branch is isview-counter-v2 (c3b1668), not the uncorrected liveguard-known-view-v2. This PR stays open; no force-push.

Per the request on #208, the counter now also buckets each VirtualQuery by RegionSize (thread-local flag so only live_title_block calls count). 100 s house run on main b447925, RX 9070 XT / GE-Proton11-16, Series X 3840x2160:

RegionSize queries share
<64 KiB 977 0.9%
<1 MiB 0 0%
<16 MiB 360 0.3%
<1 GiB 12,331 10.9%
<8 GiB 63,943 56.6%
>=8 GiB 35,348 31.3%

is_view 1,286 calls/s mean, 111.7 ms/s, ~87 µs/call. ~88% of queries land in multi-GiB regions, which fits your get_vprot_range_size walk on the 24 GiB placeholder and explains the ~100 µs/call. Evidence: /home/shlong/Documents/VKtory-capture/isview-regions/.

**@⁠TheRifai** on GitHub · 2026-12-02 15:32 UTC · [original](https://github.com/vktory6/VKtory/pull/219#issuecomment-7350490506) Correction to my earlier pointer: the corrected branch is `isview-counter-v2` (`c3b1668`), not the uncorrected `liveguard-known-view-v2`. This PR stays open; no force-push. Per the request on #208, the counter now also buckets each `VirtualQuery` by `RegionSize` (thread-local flag so only `live_title_block` calls count). 100 s house run on main `b447925`, RX 9070 XT / GE-Proton11-16, Series X 3840x2160: | RegionSize | queries | share | |---|---:|---:| | <64 KiB | 977 | 0.9% | | <1 MiB | 0 | 0% | | <16 MiB | 360 | 0.3% | | <1 GiB | 12,331 | 10.9% | | <8 GiB | 63,943 | 56.6% | | >=8 GiB | 35,348 | 31.3% | `is_view` 1,286 calls/s mean, 111.7 ms/s, ~87 µs/call. ~88% of queries land in multi-GiB regions, which fits your `get_vprot_range_size` walk on the 24 GiB placeholder and explains the ~100 µs/call. Evidence: `/home/shlong/Documents/VKtory-capture/isview-regions/`.
github-bot closed this pull request 2026-12-02 15:45:47 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 15:41 UTC · original

Thanks, this counter is what made the cause visible (~100 µs per is_view). The fix (github.com/vktory6/VKtory@3aea0e4, see #208) takes is_view off the hot path, so the call it counts now only runs once per block that is neither title memory nor umem's. Closing as superseded, credited in the fix's commit message.

**@⁠vktory6** on GitHub · 2026-12-02 15:41 UTC · [original](https://github.com/vktory6/VKtory/pull/219#issuecomment-7350764858) Thanks, this counter is what made the cause visible (~100 µs per `is_view`). The fix (https://github.com/vktory6/VKtory/commit/3aea0e4, see #208) takes `is_view` off the hot path, so the call it counts now only runs once per block that is neither title memory nor umem's. Closing as superseded, credited in the fix's commit message.
Author
Owner

@⁠TheRifai on GitHub · 2026-12-02 15:47 UTC · original

Third (and final) branch pointer: isview-counter-v3 (7e6297f), rebased on main 3aea0e4, which carries the title-memory record fix for #171. Earlier pushed branches could not fast-forward, so no force-push; this PR stays open.

The counter now validates that fix on current main: 100 s house run rt3, RX 9070 XT / GE-Proton11-16, 3840x2160: is_view 0 calls/s (0.11 ms/s residual) against 1,286 calls/s and 111.7 ms/s before the fix, sending waits 5.5 ms/s against 48-59 ms/s, LIVE_NOT_TITLE still 16, fps 28.04. Evidence: /home/shlong/Documents/VKtory-capture/isview-after-main-fix/ (and isview-regions/ for the pre-fix bucket table). The counter is diagnostic only; with the fix in place there is nothing left for it to catch, so please close this PR if you agree it has served its purpose.

**@⁠TheRifai** on GitHub · 2026-12-02 15:47 UTC · [original](https://github.com/vktory6/VKtory/pull/219#issuecomment-7350924560) Third (and final) branch pointer: `isview-counter-v3` (`7e6297f`), rebased on main `3aea0e4`, which carries the title-memory record fix for #171. Earlier pushed branches could not fast-forward, so no force-push; this PR stays open. The counter now validates that fix on current main: 100 s house run `rt3`, RX 9070 XT / GE-Proton11-16, 3840x2160: `is_view` **0 calls/s** (0.11 ms/s residual) against 1,286 calls/s and 111.7 ms/s before the fix, sending waits 5.5 ms/s against 48-59 ms/s, `LIVE_NOT_TITLE` still 16, fps 28.04. Evidence: `/home/shlong/Documents/VKtory-capture/isview-after-main-fix/` (and `isview-regions/` for the pre-fix bucket table). The counter is diagnostic only; with the fix in place there is nothing left for it to catch, so please close this PR if you agree it has served its purpose.

Pull request closed

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