perf(vk): exact handle staleness, blocks-hash memo, zero depth clears (three from #2273) #2343

Merged
HumanBean merged 4 commits from omgitsgela/Longshot:vk-switches-veix into main 2026-11-23 16:20:08 +00:00
Member

Summary

Three fixes from Veix's #2273 handover, which asks for its parts to be taken separately, ported to current main on their own. The pull request's disk-cache half is what #2292 is doing more completely; its RAM-cache half waits behind that. These three changes are what #2273's own Deck measurements (its comments) found to be the whole win: against all three forced off under forced VRAM churn, frames over 60 ms 263 to 146 and staged texture MB 3,067 to 1,617.

Exact staleness (RX_VK_EXACT_STALE). The renderer keeps one destroy generation for all textures, so every resolved texture handle goes stale and every draw of the next frame looks its textures up again and rebuilds its descriptors whenever ANY texture went. Veix's note: closing the pause menu costs 11 ms of lookups and 12 ms of descriptor building in the frame after its own targets went, with the render thread 30-40 ms behind for the frames after it. Each destroyed or moved texture is now logged by its creation number (gone_note); a handle whose own texture did not go stands (texture_still_resolved). Placeholder retirement still invalidates every resolved view. The compaction pass names each moved texture instead of invalidating every handle. RX_VK_EXACT_STALE=0: as before.

Blocks hash memo (RX_VK_HASH_MEMO). Every first whole upload of a decoded ASTC texture hashes its blocks, for #1222's reuse: a turn in Kokiri hashed ~1.8 ms of storage a frame, much of it the same texture made again over storage no page of which was written since. The hash is remembered by the storage and the shape with the memory generation it was taken at, and taken without rereading the storage while memory_written_since says the bytes stand — the same guard the capture paths use. The generation is read before the hash, so a write during it makes the memo older than the bytes, never newer. The reuse census line grows the memo's hits and misses. RX_VK_HASH_MEMO=0: as before.

Zero depth clears (RX_VK_DEPTH_ZERO). The game draws its shadow maps at one size (816 x 816) and samples them at another (812, 813) over the same memory, so the whole depth texture is read before the GPU ever drew into it, and the CPU route unswizzles 1-9 MB per read (upload_all_zero takes only storage 32 MB and more). Where such a storage reads all zero — 15 of 25 such reads in Veix's Kokiri sample, 469 of them in a Castle Town arm on a Steam Deck — the image is cleared on the GPU instead. The bytes checked are guest_bytes', exactly what the CPU route would read, and a depth image cleared to 0 is what unswizzling zero storage makes. If upload_all_zero already checked the storage, this path does not scan it again. RX_VK_DEPTH_ZERO=0: as before.

Read first: vk_texture.cpp gone_note / texture_still_resolved and the three going sites; then the texture_view_of caller's staleness check in vk_draw.cpp; then blocks_hash_memoized; then the zero-depth block at the top of upload_inner.

See #2273 (the handover), #2292 (the disk cache these deliberately do not touch).

Testing

Tested: Steam Deck LCD (Vangogh, Mesa/RADV), desktop mode, Castle Town walk-and-turn arms over the saved Castle Town center file, with the frame log and trace on. The three changes as they stand here were carried by #2273's head c8430046 in that branch's Deck arms (its comment with the arm table): under forced churn (RX_VK_COMPACT_PCT=60) the three on gave frames over 60 ms 146 against 263 with all three forced off, and staged texture MB 1,617 against 3,067; screenshots of the churn arms showed no texture corruption. The paired boots at THIS branch's head against main are running now; the numbers land in Measurements before this goes ready.

Still to test:

  • Windows (any d3d-free Vulkan GPU): normal play, pause-menu open/close, expecting no wrong-texture frames and no descriptor staleness (the switch defaults on; RX_VK_EXACT_STALE=0 reverts) (@Beanstalk or by hand)
  • Strong discrete GPU: a Castle Town turn, expecting the three switches to be neutral-to-positive where decode and uploads are not the cost (@Beanstalk)

Measurements

Paired interleaved boots (Steam Deck LCD, Castle Town walk-and-turn, CASTLE_CYCLES=20, frame log): main against this branch, natural play and forced churn (RX_VK_COMPACT_PCT=60), two boots each per condition, medians. Running at branch head; the table lands before ready.

Verdict: to fill: the #2273-head Deck numbers above say the three together are the win; this branch isolates exactly those three.

Risks

Each change ships behind a switch that reverts to the previous behavior at =0 (all three are kill rows in switches.def). Staleness too lax would show as a stale texture surviving a going: destroy_later and the compaction move loop log the texture's creation number, placeholder retirement invalidates all resolved views, and the log is sized past any sweep. A wrong hash memo would need memory_written_since to miss a write — the guard the capture paths already trust. A zero-check false positive cannot happen (the bytes are the CPU route's own), and a false negative only costs the CPU path as before. Player-visible: nothing on update; no saves or options change.

Cost: a 16,384-entry going log (uint32), and the hash memo (a bound: cleared past 200,000 entries).

## Summary Three fixes from Veix's #2273 handover, which asks for its parts to be taken separately, ported to current main on their own. The pull request's disk-cache half is what #2292 is doing more completely; its RAM-cache half waits behind that. These three changes are what #2273's own Deck measurements (its comments) found to be the whole win: against all three forced off under forced VRAM churn, frames over 60 ms 263 to 146 and staged texture MB 3,067 to 1,617. **Exact staleness (RX_VK_EXACT_STALE).** The renderer keeps one destroy generation for all textures, so every resolved texture handle goes stale and every draw of the next frame looks its textures up again and rebuilds its descriptors whenever ANY texture went. Veix's note: closing the pause menu costs 11 ms of lookups and 12 ms of descriptor building in the frame after its own targets went, with the render thread 30-40 ms behind for the frames after it. Each destroyed or moved texture is now logged by its creation number (gone_note); a handle whose own texture did not go stands (texture_still_resolved). Placeholder retirement still invalidates every resolved view. The compaction pass names each moved texture instead of invalidating every handle. `RX_VK_EXACT_STALE=0`: as before. **Blocks hash memo (RX_VK_HASH_MEMO).** Every first whole upload of a decoded ASTC texture hashes its blocks, for #1222's reuse: a turn in Kokiri hashed ~1.8 ms of storage a frame, much of it the same texture made again over storage no page of which was written since. The hash is remembered by the storage and the shape with the memory generation it was taken at, and taken without rereading the storage while `memory_written_since` says the bytes stand — the same guard the capture paths use. The generation is read before the hash, so a write during it makes the memo older than the bytes, never newer. The reuse census line grows the memo's hits and misses. `RX_VK_HASH_MEMO=0`: as before. **Zero depth clears (RX_VK_DEPTH_ZERO).** The game draws its shadow maps at one size (816 x 816) and samples them at another (812, 813) over the same memory, so the whole depth texture is read before the GPU ever drew into it, and the CPU route unswizzles 1-9 MB per read (upload_all_zero takes only storage 32 MB and more). Where such a storage reads all zero — 15 of 25 such reads in Veix's Kokiri sample, 469 of them in a Castle Town arm on a Steam Deck — the image is cleared on the GPU instead. The bytes checked are `guest_bytes`', exactly what the CPU route would read, and a depth image cleared to 0 is what unswizzling zero storage makes. If `upload_all_zero` already checked the storage, this path does not scan it again. `RX_VK_DEPTH_ZERO=0`: as before. Read first: `vk_texture.cpp` `gone_note` / `texture_still_resolved` and the three going sites; then the `texture_view_of` caller's staleness check in `vk_draw.cpp`; then `blocks_hash_memoized`; then the zero-depth block at the top of `upload_inner`. See #2273 (the handover), #2292 (the disk cache these deliberately do not touch). ## Testing **Tested:** Steam Deck LCD (Vangogh, Mesa/RADV), desktop mode, Castle Town walk-and-turn arms over the saved Castle Town center file, with the frame log and trace on. The three changes as they stand here were carried by #2273's head c8430046 in that branch's Deck arms (its comment with the arm table): under forced churn (RX_VK_COMPACT_PCT=60) the three on gave frames over 60 ms 146 against 263 with all three forced off, and staged texture MB 1,617 against 3,067; screenshots of the churn arms showed no texture corruption. The paired boots at THIS branch's head against main are running now; the numbers land in Measurements before this goes ready. **Still to test:** - Windows (any d3d-free Vulkan GPU): normal play, pause-menu open/close, expecting no wrong-texture frames and no descriptor staleness (the switch defaults on; RX_VK_EXACT_STALE=0 reverts) (@Beanstalk or by hand) - Strong discrete GPU: a Castle Town turn, expecting the three switches to be neutral-to-positive where decode and uploads are not the cost (@Beanstalk) ## Measurements Paired interleaved boots (Steam Deck LCD, Castle Town walk-and-turn, CASTLE_CYCLES=20, frame log): main against this branch, natural play and forced churn (RX_VK_COMPACT_PCT=60), two boots each per condition, medians. Running at branch head; the table lands before ready. **Verdict:** to fill: the #2273-head Deck numbers above say the three together are the win; this branch isolates exactly those three. ## Risks Each change ships behind a switch that reverts to the previous behavior at `=0` (all three are `kill` rows in switches.def). Staleness too lax would show as a stale texture surviving a going: destroy_later and the compaction move loop log the texture's creation number, placeholder retirement invalidates all resolved views, and the log is sized past any sweep. A wrong hash memo would need memory_written_since to miss a write — the guard the capture paths already trust. A zero-check false positive cannot happen (the bytes are the CPU route's own), and a false negative only costs the CPU path as before. Player-visible: nothing on update; no saves or options change. Cost: a 16,384-entry going log (uint32), and the hash memo (a bound: cleared past 200,000 entries).
One destroy generation for all textures made every draw of the next frame look its
textures up again and build its descriptors again whenever ANY texture went: 11 ms of
lookups and 12 ms of descriptors in the frame after the pause menu's own targets went,
with the render thread 30-40 ms behind for the frames after it. The going of each
texture is now logged by its creation number (gone_note), and a handle whose own
texture did not go keeps its resolved view (texture_still_resolved). The going of a
texture and the compaction moving a texture's image both name it; a compaction pass
no longer invalidates every resolved handle.

Measured on a Steam Deck LCD (Vangogh), Castle Town walk-and-turn with VRAM churn
forced (RX_VK_COMPACT_PCT=60): frames over 60 ms 263 to 146, staged texture MB 3,067
to 1,617 (this change measured together with the hash memo and depth-zero commits;
the three were not isolated individually).

From Veix's #2273 handover (c8430046), converted to current main; the Deck arms and
measurements are in that pull request's comments.

Co-authored-by: Veix <[email protected]>
Every first whole upload of a decoded ASTC texture hashes its blocks (for the freed-
image reuse of #1222); a turn in Kokiri hashed about 1.8 ms of storage a frame under
the helpers' lock, much of it the same texture made again over storage no page of
which was written since. The hash is now remembered by the storage address, the shape
and the memory generation it was taken at: made again over unwritten storage, it is
taken without reading the storage again. memory_written_since is the same guard the
descriptor and capture paths use; the generation is read before the hash so a write
during it makes the memo older than the bytes, never newer. The reuse census line
grows the memo's hits and misses.

From Veix's #2273 handover (c8430046), converted to current main; measured there with
the EXACT_STALE and DEPTH_ZERO commits as a set on a Steam Deck LCD (see #2273's Deck
comments: staged MB 3,067 to 1,617 together).

Co-authored-by: Veix <[email protected]>
vk: a depth buffer read before the GPU drew it, all zero, cleared on the GPU (RX_VK_DEPTH_ZERO)
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 28s
CI / Website build and checks (pull_request) Successful in 4m39s
80670412ee
The game draws its shadow maps at one size (816 x 816) and samples them at another
(812, 813) over the same memory, so a whole depth texture is read before the GPU ever
drew into it; unswizzled on the CPU, it costs 1-9 MB per read (upload_all_zero takes
only 32 MB and more of live memory). Where such a storage reads all zero (15 of 25
Kokiri samples in Veix's run; 469 of the Deck churn arms), the image is cleared on the
GPU instead: the guest bytes the CPU route reads are zeros, so what the image gets is
the same. Checked in 16 MB pieces against guest_bytes, before upload_all_zero and the
CPU unswizzle; RX_VK_DEPTH_ZERO=0 reverts.

From Veix's #2273 handover (c8430046), converted to current main; measured there with
the EXACT_STALE and HASH_MEMO commits as a set on a Steam Deck LCD (see #2273's Deck
comments).

Co-authored-by: Veix <[email protected]>
Author
Member

Tested in game: Steam Deck LCD (Vangogh, Mesa/RADV), desktop mode, Castle Town over the saved Castle Town center file, branch head 80670412 (its .so built on the Deck): the game boots, walks the turn route and quits clean; the run log carries the new census line with the hash-memo counters and the depth-zero milestone lines (clears fired during the smoke). Paired interleaved arms against a main control build are running on the same Deck now; their table lands in Measurements before this is marked ready.

Tested in game: Steam Deck LCD (Vangogh, Mesa/RADV), desktop mode, Castle Town over the saved Castle Town center file, branch head 80670412 (its .so built on the Deck): the game boots, walks the turn route and quits clean; the run log carries the new census line with the hash-memo counters and the depth-zero milestone lines (clears fired during the smoke). Paired interleaved arms against a main control build are running on the same Deck now; their table lands in Measurements before this is marked ready.
Member

Possibly related, for context:

  • PR #2003 WIP: perf(vk): resolved texture handles in a flat table by era (RX_VK_TEX_HIT_FLAT) — Resolved-handle table also changes vk_draw.cpp
  • PR #2054 WIP: perf(vk): dead render targets are let go as they die, and a texture's end invalidates handles only when it must (RX_VK_RETIRE_LAZY=0 to disable) — Texture retirement work also changes handle invalidation
  • PR #1281 WIP: perf(vk): a new ASTC texture's blocks are hashed at upload only when a finalized one has its shape — Open ASTC block-hashing/reuse implementation
  • issue #1606 The upscalers give up a frame whenever any texture is destroyed anywhere, though their own depth and colour were not touched — Tracks global-generation invalidation addressed here
Possibly related, for context: - PR #2003 WIP: perf(vk): resolved texture handles in a flat table by era (RX_VK_TEX_HIT_FLAT) — Resolved-handle table also changes vk_draw.cpp - PR #2054 WIP: perf(vk): dead render targets are let go as they die, and a texture's end invalidates handles only when it must (RX_VK_RETIRE_LAZY=0 to disable) — Texture retirement work also changes handle invalidation - PR #1281 WIP: perf(vk): a new ASTC texture's blocks are hashed at upload only when a finalized one has its shape — Open ASTC block-hashing/reuse implementation - issue #1606 The upscalers give up a frame whenever any texture is destroyed anywhere, though their own depth and colour were not touched — Tracks global-generation invalidation addressed here
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The new depth-zero path bypasses an existing sparse-memory optimization and can turn a known large shadow-map upload into hundreds of milliseconds of work and substantial extra resident memory. The three independent optimizations also need to be separated under the repository’s one-topic rule.

The change keeps unaffected texture handles, memoizes ASTC block hashes, and clears zero depth textures on the GPU. It may reduce texture work, but its gain at this head is unmeasured and the new zero scan regresses large sparse storage.

Blocking (1): must change before merging.

  1. L1 gpu/vk/vk_texture.cpp:2279: The new scan runs before the existing large-zero path and reads every byte, including uncommitted guest-memory holes. (more on the line) Do: Route large eligible storage through the existing hole-aware zero check first, or make this scan skip holes without faulting them in.

Should fix (1): not blocking, but worth doing before merging.

  • L2: This pull request combines three independent renderer optimizations, contrary to the repository’s one-topic rule. When: Handle staleness, ASTC hash memoization, and zero-depth uploads have separate code paths and switches; each can be reviewed, measured, or reverted independently. Do: Split the three optimizations into separate pull requests, with each change’s own measurements.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The claimed performance gain has not been measured against the base at this head. When: The supplied comparison is from another branch with all three changes toggled together under forced churn, so it does not show the effect of this head during normal play or whether frame pacing improved. Do: Run interleaved base and head measurements on the same Deck in normal play and forced churn, including average and 1% low FPS, median and p99 frame times, and memory use.
  • L4: The default-on renderer paths have not been checked on the other affected Tier 1 systems. When: The head has only a Deck smoke run; texture lifetime, Vulkan clears, and upload costs also affect Windows and discrete NVIDIA and AMD drivers. Do: Run normal play and pause-menu open/close on the affected Tier 1 Windows and Linux GPUs, checking texture output and frame pacing against the base.

@fix can do L1 and L2.

Checks: Failing on this head, which is behind its base, where it passes: Guide screenshots / Guide images and local UI source review (pull_request). @rebase (or @fix) brings it up to date and runs it again; not held against it.

More: does it help, other systems, switches, what was read

Does it help: Unproven. The cited Deck result, 263 to 146 frames over 60 ms and 3,067 to 1,617 MB staged, compares switches on another branch under forced churn; paired measurements against the base at this head are still running.

Other systems: The code affects Vulkan texture uploads and handles across Windows and Linux, GPU vendors, and the Steam Deck. The reported head smoke run covers a Deck; Windows and discrete GPUs remain untested. Texture capture, compaction, descriptor reuse, and sparse guest storage share these paths.

Switches: RX_VK_EXACT_STALE, RX_VK_HASH_MEMO, and RX_VK_DEPTH_ZERO are added as kill switches, all on by default and all listed in switches.def. Their defaults need measurements on the affected systems; RX_VK_DEPTH_ZERO currently exposes the large-storage regression.

Reviewed: 80670412ee against 0e32bc100d: Read the diff and commit messages, AGENTS.md, CONTRIBUTING.md, the pull request template, and the relevant standards. Read the changed functions and surrounding texture upload, capture, image creation, handle lookup, and generation code; skimmed the rest of the large changed code files and switch table. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No recorded runs, translations, or generated files were changed.; nothing run (a code review).

Checked and fine:

  • The three new switches have entries in switches.def and their documented off values restore the prior paths.
  • The changed files contain no committed game-derived artifacts or generated shader headers.
  • The renderer API structures and API version are unchanged.
  • The supplied CI data reports no failure unique to this head.

Testing: Read-only review; no builds, tests, or project scripts were run. The author reports a successful Deck smoke run at head, with paired measurements still in progress.

Overlaps and merge order: The description identifies #2273 as the handover and #2292 as the disk-cache work; no merge dependency for these three changes is established.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The new depth-zero path bypasses an existing sparse-memory optimization and can turn a known large shadow-map upload into hundreds of milliseconds of work and substantial extra resident memory. The three independent optimizations also need to be separated under the repository’s one-topic rule. The change keeps unaffected texture handles, memoizes ASTC block hashes, and clears zero depth textures on the GPU. It may reduce texture work, but its gain at this head is unmeasured and the new zero scan regresses large sparse storage. **Blocking (1)**: must change before merging. 1. **L1** `gpu/vk/vk_texture.cpp:2279`: The new scan runs before the existing large-zero path and reads every byte, including uncommitted guest-memory holes. (more on the line) **Do:** Route large eligible storage through the existing hole-aware zero check first, or make this scan skip holes without faulting them in. **Should fix (1)**: not blocking, but worth doing before merging. - **L2**: This pull request combines three independent renderer optimizations, contrary to the repository’s one-topic rule. *When:* Handle staleness, ASTC hash memoization, and zero-depth uploads have separate code paths and switches; each can be reviewed, measured, or reverted independently. **Do:** Split the three optimizations into separate pull requests, with each change’s own measurements. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The claimed performance gain has not been measured against the base at this head. *When:* The supplied comparison is from another branch with all three changes toggled together under forced churn, so it does not show the effect of this head during normal play or whether frame pacing improved. **Do:** Run interleaved base and head measurements on the same Deck in normal play and forced churn, including average and 1% low FPS, median and p99 frame times, and memory use. - **L4**: The default-on renderer paths have not been checked on the other affected Tier 1 systems. *When:* The head has only a Deck smoke run; texture lifetime, Vulkan clears, and upload costs also affect Windows and discrete NVIDIA and AMD drivers. **Do:** Run normal play and pause-menu open/close on the affected Tier 1 Windows and Linux GPUs, checking texture output and frame pacing against the base. `@fix` can do L1 and L2. **Checks:** Failing on this head, which is behind its base, where it passes: `Guide screenshots / Guide images and local UI source review (pull_request)`. `@rebase` (or `@fix`) brings it up to date and runs it again; not held against it. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The cited Deck result, 263 to 146 frames over 60 ms and 3,067 to 1,617 MB staged, compares switches on another branch under forced churn; paired measurements against the base at this head are still running. **Other systems:** The code affects Vulkan texture uploads and handles across Windows and Linux, GPU vendors, and the Steam Deck. The reported head smoke run covers a Deck; Windows and discrete GPUs remain untested. Texture capture, compaction, descriptor reuse, and sparse guest storage share these paths. **Switches:** RX_VK_EXACT_STALE, RX_VK_HASH_MEMO, and RX_VK_DEPTH_ZERO are added as kill switches, all on by default and all listed in switches.def. Their defaults need measurements on the affected systems; RX_VK_DEPTH_ZERO currently exposes the large-storage regression. **Reviewed:** 80670412ee0b against 0e32bc100dbe: Read the diff and commit messages, AGENTS.md, CONTRIBUTING.md, the pull request template, and the relevant standards. Read the changed functions and surrounding texture upload, capture, image creation, handle lookup, and generation code; skimmed the rest of the large changed code files and switch table. docs/review-checklist.md and ../Tooling/AGENTS.md were absent. No recorded runs, translations, or generated files were changed.; nothing run (a code review). **Checked and fine:** - The three new switches have entries in switches.def and their documented off values restore the prior paths. - The changed files contain no committed game-derived artifacts or generated shader headers. - The renderer API structures and API version are unchanged. - The supplied CI data reports no failure unique to this head. **Testing:** Read-only review; no builds, tests, or project scripts were run. The author reports a successful Deck smoke run at head, with paired measurements still in progress. **Overlaps and merge order:** The description identifies #2273 as the handover and #2292 as the disk-cache work; no merge dependency for these three changes is established. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -2240,0 +2276,4 @@
// samples at another (812, 813) over the same memory. The bytes checked are guest_bytes', as the CPU route reads
// them; a depth image cleared to 0 is what unswizzling zero storage makes. RX_VK_DEPTH_ZERO=0: off
static const bool dz_on = [] { const char* e = getenv("RX_VK_DEPTH_ZERO"); return !(e && env_value_off(e)); }();
static std::atomic<int64_t> dz_n{0}, dz_bytes{0}, dz_not{0};
Member

L1 (blocking): The new scan runs before the existing large-zero path and reads every byte, including uncommitted guest-memory holes.

When: For the documented 288 MB D16 shadow map at Hyrule Field load, the scan touches the mostly empty storage before upload_all_zero can use its hole-aware scan. The existing code records that reading those holes made guest pages resident and took 203–353 ms on a Deck, instead of skipping them.

Do: Route large eligible storage through the existing hole-aware zero check first, or make this scan skip holes without faulting them in.

**L1** (blocking): The new scan runs before the existing large-zero path and reads every byte, including uncommitted guest-memory holes. *When:* For the documented 288 MB D16 shadow map at Hyrule Field load, the scan touches the mostly empty storage before upload_all_zero can use its hole-aware scan. The existing code records that reading those holes made guest pages resident and took 203–353 ms on a Deck, instead of skipping them. **Do:** Route large eligible storage through the existing hole-aware zero check first, or make this scan skip holes without faulting them in.
Owner
@fix
BeanBot force-pushed vk-switches-veix from 80670412ee
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 28s
CI / Website build and checks (pull_request) Successful in 4m39s
to db61ebaa76
Some checks failed
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 25s
CI / Workflow lint (actionlint) (pull_request) Successful in 46s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 40s
Third-party parts / As their notes say (pull_request) Successful in 53s
PR description / Description follows the template (pull_request_target) Failing after 22s
CI / Website build and checks (pull_request) Successful in 8m58s
2026-11-23 16:16:58 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The pull request still combines three independent renderer optimizations, contrary to the one-topic rule. Its performance gain and behavior across the affected Tier 1 systems also remain unmeasured at this head. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is db61ebaa76. I rebased it onto main (1b0a17a827). I edited its description to match the change.

Changed

  • Large depth zero scan, gpu/vk/vk_texture.cpp:2330: Run the existing hole-aware check first for eligible large textures and skip the redundant depth scan when it finds nonzero data. Tests were not run as requested.

Nothing was built or run: the checks run again on the new head.

The change aims to reduce texture lookup, hashing and depth-upload work. It adds a destruction log, a bounded hash memo and three default-on switches; the reported fix avoids a redundant scan of eligible large textures.

Should fix (1): not blocking, but worth doing before merging.

  • L2: This pull request combines three independent renderer optimizations, contrary to the repository’s one-topic rule. When: Handle staleness, ASTC hash memoization, and zero-depth uploads have separate code paths and switches; each can be reviewed, measured, or reverted independently. Do: Split the three optimizations into separate pull requests, with each change’s own measurements.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3: The claimed performance gain has not been measured against the base at this head. When: The supplied comparison is from another branch with all three changes toggled together under forced churn, so it does not show the effect of this head during normal play or whether frame pacing improved. Do: Run interleaved base and head measurements on the same Deck in normal play and forced churn, including average and 1% low FPS, median and p99 frame times, and memory use.
  • L4: The default-on renderer paths have not been checked on the other affected Tier 1 systems. When: The head has only a Deck smoke run; texture lifetime, Vulkan clears, and upload costs also affect Windows and discrete NVIDIA and AMD drivers. Do: Run normal play and pause-menu open/close on the affected Tier 1 Windows and Linux GPUs, checking texture output and frame pacing against the base.

@fix can do L2.

Checks: they run again on this head (Guide screenshots / Guide images and local UI source review (pull_request) failed on the last one); a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • Large depth uploads excluded from upload_all_zero, including captured shadow storage, can still take the serial depth scan.
More: does it help, other systems, switches, what was read

Does it help: Unproven. The earlier #2273 run reported 263 to 146 frames over 60 ms and 3,067 to 1,617 MB staged under forced churn, but paired runs of this head against its base have not been reported.

Other systems: The texture paths can affect Vulkan drivers on Windows and Linux, including NVIDIA and AMD GPUs and Steam Deck. The reported head smoke run covers Steam Deck; the other affected Tier 1 systems remain untested.

Switches: RX_VK_EXACT_STALE, RX_VK_HASH_MEMO and RX_VK_DEPTH_ZERO are added as default-on kill switches. Their defaults have not yet been supported by measurements across the affected systems.

Reviewed: db61ebaa76 against 1b0a17a827: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the fix diff and the large-zero upload path. The full base diff includes 93 files and was only skimmed; the remaining changed code was not read in full. No docs/review-checklist.md was present.; nothing run (a code review).

Checked and fine:

  • The reported fix runs the existing large-texture zero check first and skips the depth scan when that check has already examined eligible storage.
  • The fix retains the depth-zero path for smaller textures and for textures the large-texture check cannot examine.

Testing: No commands that build or run the project were executed. The author reports a Steam Deck game smoke run; paired performance runs and other Tier 1 checks are outstanding.

Overlaps and merge order: The description identifies #2273 as the handover and #2292 as overlapping disk-cache work; merge order is not established.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The pull request still combines three independent renderer optimizations, contrary to the one-topic rule. Its performance gain and behavior across the affected Tier 1 systems also remain unmeasured at this head. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is db61ebaa763b. I rebased it onto `main` (1b0a17a82705). I edited its description to match the change. **Changed** - **Large depth zero scan, gpu/vk/vk_texture.cpp:2330**: Run the existing hole-aware check first for eligible large textures and skip the redundant depth scan when it finds nonzero data. Tests were not run as requested. Nothing was built or run: the checks run again on the new head. The change aims to reduce texture lookup, hashing and depth-upload work. It adds a destruction log, a bounded hash memo and three default-on switches; the reported fix avoids a redundant scan of eligible large textures. **Should fix (1)**: not blocking, but worth doing before merging. - **L2**: This pull request combines three independent renderer optimizations, contrary to the repository’s one-topic rule. *When:* Handle staleness, ASTC hash memoization, and zero-depth uploads have separate code paths and switches; each can be reviewed, measured, or reverted independently. **Do:** Split the three optimizations into separate pull requests, with each change’s own measurements. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3**: The claimed performance gain has not been measured against the base at this head. *When:* The supplied comparison is from another branch with all three changes toggled together under forced churn, so it does not show the effect of this head during normal play or whether frame pacing improved. **Do:** Run interleaved base and head measurements on the same Deck in normal play and forced churn, including average and 1% low FPS, median and p99 frame times, and memory use. - **L4**: The default-on renderer paths have not been checked on the other affected Tier 1 systems. *When:* The head has only a Deck smoke run; texture lifetime, Vulkan clears, and upload costs also affect Windows and discrete NVIDIA and AMD drivers. **Do:** Run normal play and pause-menu open/close on the affected Tier 1 Windows and Linux GPUs, checking texture output and frame pacing against the base. `@fix` can do L2. **Checks:** they run again on this head (`Guide screenshots / Guide images and local UI source review (pull_request)` failed on the last one); a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - Large depth uploads excluded from upload_all_zero, including captured shadow storage, can still take the serial depth scan. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. The earlier #2273 run reported 263 to 146 frames over 60 ms and 3,067 to 1,617 MB staged under forced churn, but paired runs of this head against its base have not been reported. **Other systems:** The texture paths can affect Vulkan drivers on Windows and Linux, including NVIDIA and AMD GPUs and Steam Deck. The reported head smoke run covers Steam Deck; the other affected Tier 1 systems remain untested. **Switches:** RX_VK_EXACT_STALE, RX_VK_HASH_MEMO and RX_VK_DEPTH_ZERO are added as default-on kill switches. Their defaults have not yet been supported by measurements across the affected systems. **Reviewed:** db61ebaa763b against 1b0a17a82705: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the fix diff and the large-zero upload path. The full base diff includes 93 files and was only skimmed; the remaining changed code was not read in full. No docs/review-checklist.md was present.; nothing run (a code review). **Checked and fine:** - The reported fix runs the existing large-texture zero check first and skips the depth scan when that check has already examined eligible storage. - The fix retains the depth-zero path for smaller textures and for textures the large-texture check cannot examine. **Testing:** No commands that build or run the project were executed. The author reports a Steam Deck game smoke run; paired performance runs and other Tier 1 checks are outstanding. **Overlaps and merge order:** The description identifies #2273 as the handover and #2292 as overlapping disk-cache work; merge order is not established. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean changed title from WIP: perf(vk): exact handle staleness, blocks-hash memo, zero depth clears (three from #2273) to perf(vk): exact handle staleness, blocks-hash memo, zero depth clears (three from #2273) 2026-11-23 16:19:34 +00:00
HumanBean deleted branch vk-switches-veix 2026-11-23 16:20:14 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!2343
No description provided.