vkback: count reads of a slot held null for a new image's memory #236

Manually merged
github merged 1 commit from github-bot/gh-236 into gh-pr/236/base 2026-12-02 18:32:51 +00:00 AGit
Owner

@⁠lordra9-svg on GitHub · 2026-12-02 15:18 UTC · original
lordra9-svg:fix/held-new-sampled → main · +132 −6 · 5 files · 1 commits · merged 2026-12-02 17:36 UTC

What

docs/TASKS.md:626 "Newly made images show empty for a frame": measure whether the 100k slot holds are actually seen by draws. arena::hold_new nulls a slot that would show an image made while earlier batches may still run (direct-descriptor device-loss guard); the TASKS note says the visual impact is a candidate, not proven.

Change (instrumentation only)

  • Arena owns held_new (the same addresses as later) and held_read_now; hold_new/take_retry_slots use hold/release, which keep a slot held while a later entry for it is pending.
  • slot_read_at/slot_read_at_index ask arena.held_read(addr): one HashSet::contains on the read path, no lock; a hit counts reads and marks the slot for the present.
  • heldread counters and a stats part: reads of a slot held null for a new image's memory {reads} ({distinct} distinct slots so far). Distinct is summed per present.

Measured (b7fixed, clean run)

  • slots retried after a refusal 102728, all hold_new (the Exit::Retry causes are ~2).
  • reads of a slot held null ... 5958 (5718 distinct slots) — ~2.7 slot reads/present actually sample the null before the retry, so the one-frame pop is real but small, not the 100k the retry count suggests.
  • 26.6-27.6 fps (same as before the counter), no device loss.

Verified

  • cargo test -p vkback --lib: 169 passed (new a_held_slot_counts_reads_until_its_serial_passed); policy 6; clippy -D warnings clean; tools/build.sh exit 0.

Next (not in this PR)

Decide whether the ~6k sampled-null reads justify the device-loss-sensitive fix: keep the old descriptor (and hold its view/image alive) while the new image's memory is fresh, as victory-gpu's keep/kin, instead of nulling. That needs a validation + device-loss A/B, so it should be its own change.

**@⁠lordra9-svg** on GitHub · 2026-12-02 15:18 UTC · [original](https://github.com/vktory6/VKtory/pull/236) `lordra9-svg:fix/held-new-sampled` → `main` · +132 −6 · 5 files · 1 commits · merged 2026-12-02 17:36 UTC ## What `docs/TASKS.md:626` "Newly made images show empty for a frame": measure whether the 100k slot holds are actually seen by draws. `arena::hold_new` nulls a slot that would show an image made while earlier batches may still run (direct-descriptor device-loss guard); the TASKS note says the visual impact is a candidate, not proven. ## Change (instrumentation only) - `Arena` owns `held_new` (the same addresses as `later`) and `held_read_now`; `hold_new`/`take_retry_slots` use `hold`/`release`, which keep a slot held while a later entry for it is pending. - `slot_read_at`/`slot_read_at_index` ask `arena.held_read(addr)`: one `HashSet::contains` on the read path, no lock; a hit counts reads and marks the slot for the present. - `heldread` counters and a stats part: `reads of a slot held null for a new image's memory {reads} ({distinct} distinct slots so far)`. Distinct is summed per present. ## Measured (b7fixed, clean run) - `slots retried after a refusal 102728`, all `hold_new` (the `Exit::Retry` causes are ~2). - **`reads of a slot held null ... 5958 (5718 distinct slots)`** — ~2.7 slot reads/present actually sample the null before the retry, so the one-frame pop is real but small, not the 100k the retry count suggests. - 26.6-27.6 fps (same as before the counter), no device loss. ## Verified - `cargo test -p vkback --lib`: 169 passed (new `a_held_slot_counts_reads_until_its_serial_passed`); policy 6; clippy `-D warnings` clean; `tools/build.sh` exit 0. ## Next (not in this PR) Decide whether the ~6k sampled-null reads justify the device-loss-sensitive fix: keep the old descriptor (and hold its view/image alive) while the new image's memory is fresh, as victory-gpu's `keep`/`kin`, instead of nulling. That needs a validation + device-loss A/B, so it should be its own change.
Instruments hold_new/take_retry_slots (arena.rs) without changing the
ordering: Arena keeps the held addresses beside `later`, slot_read_at and
slot_read_at_index count a read that lands on one (heldread.rs), and the
present boundary adds the frame's distinct held slots before clearing them.
The stats line gains the read count and the distinct-slots-so-far total
next to the slot-retry counters.

Unit test: hold/release/read/distinct on Arena, no GPU.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 15:24:11 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-02 17:37 UTC · original

Merged, thanks: the count tells whether draws actually read the slots held null for new images (TASKS "Newly made images show empty for a frame").

**@⁠vktory6** on GitHub · 2026-12-02 17:37 UTC · [original](https://github.com/vktory6/VKtory/pull/236#issuecomment-7353481261) Merged, thanks: the count tells whether draws actually read the slots held null for new images (TASKS "Newly made images show empty for a frame").
github-bot changed target branch from main to gh-pr/236/base 2026-12-02 18:32:49 +00:00
github manually merged commit f98deb3dd3 into gh-pr/236/base 2026-12-02 18:32:51 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.