WIP: perf(vk): a draw's program checks its textures with each handle read once, a plain one in place #3303

Draft
dyst wants to merge 1 commit from dyst/Longshot:perf/vk-pick-handles-once into main
Member

Summary

Each draw asks program_for for its program. It keeps the variant it picked last for the same inputs, and the handles of
the textures that variant was picked for (each texture's slot and the slot's version); a draw checks those against the
textures bound now. That check read every handle through answer_handle (descriptor_handle, stage_cbuf_word,
driver_bank_word: a chain of calls and range tests for each), and when any handle differed it read them all again to
check their types (still_valid). It runs on the render thread at nearly every draw: over a million rechecks in 45 s of
Market.

This reads each handle once. A handle that is a plain driver bank 2 word (no handle program, no second word, no shift:
handle_bank2_offset, the conditions under which descriptor_handle returns that word as it is) is read in place, at the
word's offset in the NvnState, found once when the program is picked (pick_places); any other through answer_handle
as before. On a difference every answer is checked over the handles just read, by still_valid's own rule, so the answer
(the same handles / other textures of the same types / other types) and the handles kept are the same as before.
driver_bank2_slot (vk_bank.cpp) is driver_bank_word's map of bank 2, which driver_bank_word now reads through, so
the two cannot disagree about where a handle lives.

On the render thread's replay of one Market frame (2,226 draws, 8.74 ms) it takes 0.229 ms off (95 % interval
0.155-0.260 ms, about 2.6 %). In play at Market, an A/B with the switch flipped within each run: program_for's time
on the render thread is 0.36 ms a frame less (−20 %) and the whole draw translation's 0.34 ms less, in both runs; fps
+1.6 %, inside the series' spread (Measurements).

RX_VK_PICK_ONCE (a kill switch, read at each recording's start, so HOS_AB flips it within a run): =0 reads as before;
=check runs both ways at every recheck, takes the old one's answer, logs any difference and says it is checking at its
first recheck.

Overlaps siantm's #2954 (an 8-way prog_fast cache and inline c2
fast_answers in program_for), which reads c2-resident handles against the NvnState too, as part of a larger change.
This one is the recheck alone, held to the old way's answers by a check mode and a test; whichever lands second rebases
over the other. My older WIP #795 (the fast path kept across
texture registrations, so fewer draws take the full pick) touches program_for too; it has not moved since 2026-11-15
and would rebase over this.

Read first: gpu/vk/vk_shader.cpp (handle_bank2_offset, pick_places, pick_recheck_once, pick_recheck,
program_for), gpu/vk/vk_bank.cpp (driver_bank2_slot, driver_bank_word).

Testing

Tested: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47). This commit over main de091ae29, packed over the
3b3ea2cb3 base, with RX_VK_PICK_ONCE=check: Continue, then a teleport to Market, Hyrule Field and Kakariko, 45 s of play
in each, threaded rendering on. Every run compared both ways at every recheck: Market 1,048,576+, Hyrule Field
2,097,152+, Kakariko 2,097,152+ (twice), 0 differ. One launch (the first Kakariko one) lost the GPU during start-up
(Windows: nvlddmkm 153, then "stopped responding and has successfully recovered"), before the first frame and before any
recheck had run (the check logs its first, and had not); its two reruns played through, and it is the only device loss in
the PC's last 142 game runs. The A/B in Measurements ran 2 more runs of play.

  • tests/test_pick_once.py (new): vk_shader.cpp's and vk_bank.cpp's own code, cut out of the sources and built over
    the real Program, Stage and descriptor types: driver_bank2_slot is the old bank 2 map at every stage and byte
    offset; over random programs (every descriptor kind: plain bank 2 words, other banks, word pairs, shifted words, handle
    programs, misaligned and out-of-range offsets, stages out of range) and random changes of the bound state, the pool's
    slots and their types, the new, old and =check ways give the same answers and keep the same handles (116,700
    rechecks), also against a copy of the state with the first scrambled; a slot unbound then bound to slot 0; =check
    where the two ways differ (it logs, and answers as before); a thread with no recording begun; the switch's values and
    HOS_AB. Thirteen broken versions of the change make it fail (each checked).
  • tests/test_tex_desc_memo.py cuts driver_bank2_slot with driver_bank_word; tests/test_hos_ab.py lists the switch;
    the three fixtures that cut draw_begin_recording (tests/draw_stream_visibility_test.cpp,
    fsr_uniform_ownership_test.cpp, recording_admission_test.cpp) stub pick_begin_recording beside its neighbours.
  • A second agent reviewed the change cold; its points (a comment, HOS_AB values past 2, the check's first log line, five
    more broken versions for the test) are in.
  • tests/run_all.py --strict (Windows, llvm-mingw) on this head, f513f7e75: 887 passed, 15 failed, 55 skipped. The
    same 15 fail on main 0b284cc76 run the same way on this PC (884 passed, 17 failed there: these 15, and
    test_run_all_output and test_seed_reader, which pass here). Ten lack a tool this PC doesn't have under --strict
    (glslang, spirv-val, llvm-mc, zstandard: test_fixed_share_upscale_shader, test_framegen_hdr,
    test_fsr3fi_hud_layer, test_fsr3fi_hudless_colour, test_fsr4_tune, test_gfx_effects, test_lifter,
    test_native_zstd, test_rt_refl_lamps, test_temporal_present_bandwidth); five fail on main here for reasons of
    their own (test_dev_update, test_float_add_subgroup, test_helpers_extract, test_longshot_ctl,
    test_rt_light_grid). The branch's first full run failed three more: the fixtures that cut draw_begin_recording
    lacked a stub for its new call; they have one in this commit and pass.

Still to test:

  • Linux (Steam Deck): play Market a minute with RX_VK_PICK_ONCE=check, expecting vk: pick: RX_VK_PICK_ONCE=check: N rechecks compared, 0 differ lines in the log and no difference in the picture (@Beanstalk play Market for a minute on
    the Steam Deck with RX_VK_PICK_ONCE=check and report the "rechecks compared" lines)

Measurements

Setup: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47); Market, child (crowded): Continue, then a
teleport; window 1720x720, output 3440x1440, render resolution 67 %, quality Custom, frame generation off, V-Sync off,
uncapped (HOS_FPS_MAX=1000), threaded rendering on; the frame trace (RX_VK_FRAME_TRACE=1), 40 s in each run after a
warm-up until no frame waits for a pipeline. dev.py ab --scene market --runs 2 --env RX_VK_PICK_ONCE=0, each run a
timing job of the PC's queue, the switch flipped every 3 s within each run (HOS_AB), so both sides share each run's
scene, heat and background.

Baseline: one build, this change over main de091ae29 (a4d4e380a, before its rebase): RX_VK_PICK_ONCE=0 (the
old way, as on main) against unset (this change). The head is the same renderer code rebased onto a2b7abf9e; the six
commits between touch no file under gpu/.

The render thread's phases are the frame trace's columns, the mean a frame over each side's frames (transitions left
out); fps and frame times are dev.py ab's.

Before, RX_VK_PICK_ONCE=0: this PR @ a4d4e380a After: this PR @ a4d4e380a Δ
programs_ms (program_for, the pick) 1.763 ms 1.406 ms −0.357 ms (−20 %); per run −0.359, −0.355
draw_ms (the draw translation, all of it) 9.553 ms 9.215 ms −0.338 ms (−3.5 %); per run −0.402, −0.275
desc_ms (descriptors) 3.209 ms 3.213 ms +0.004 ms
cmds_ms (commands, the push) 3.249 ms 3.241 ms −0.008 ms
game_ms (the game thread) 16.586 ms 16.694 ms +0.108 ms
fps 55.2 56.1 +1.6 %; per run +2.2 %, +0.7 %
mean frame time 18.11 ms 17.83 ms −0.28 ms (95 % interval −5.16 % to +1.87 %)
median frame time 17.52 ms 17.33 ms −0.19 ms
p99 frame time 27.33 ms 26.75 ms −0.59 ms
frames of 50 ms or more a minute 0.00 0.00 0

Verdict: the pick's own time on the render thread is 0.36 ms a frame less, the same in both runs, and the draw
translation's 0.34 ms less; nothing else on the render thread moves. fps is up 1.6 % and the frame time's interval holds
0: at this setting the frame follows the game's own time (game_ms 16.6 ms of a 17.8 ms frame), and the present waits
for the render thread 0.02 ms a frame (wait_render_ms), so the render thread's saving shows in fps only where the render
thread sets the pace (a slower CPU, more draws; not measured here).

Risks

  • vk_shader.cpp, vk_bank.cpp and vk_state.h are in the shader stamp: players' programs are translated again once,
    at the launcher's shader preparation (as for any change to those files).
  • A draw whose handle is read in place where the old way would not read that word: handle_bank2_offset mirrors
    descriptor_handle's conditions, the test holds the two to each other over every descriptor kind, and =check found
    no difference in play. RX_VK_PICK_ONCE=0 restores the old way; =check shows a difference in the log.
  • Nothing changes in saves, settings.toml or the caches beyond the re-translation; a revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened: tests/test_tex_desc_memo.py cuts
    driver_bank_word with the driver_bank2_slot it now reads through; the three fixtures that cut draw_begin_recording
    stub its new pick_begin_recording() call.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run. Linux: CI's build)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Each draw asks `program_for` for its program. It keeps the variant it picked last for the same inputs, and the handles of the textures that variant was picked for (each texture's slot and the slot's version); a draw checks those against the textures bound now. That check read every handle through `answer_handle` (`descriptor_handle`, `stage_cbuf_word`, `driver_bank_word`: a chain of calls and range tests for each), and when any handle differed it read them all again to check their types (`still_valid`). It runs on the render thread at nearly every draw: over a million rechecks in 45 s of Market. This reads each handle once. A handle that is a plain driver bank 2 word (no handle program, no second word, no shift: `handle_bank2_offset`, the conditions under which `descriptor_handle` returns that word as it is) is read in place, at the word's offset in the `NvnState`, found once when the program is picked (`pick_places`); any other through `answer_handle` as before. On a difference every answer is checked over the handles just read, by `still_valid`'s own rule, so the answer (the same handles / other textures of the same types / other types) and the handles kept are the same as before. `driver_bank2_slot` (`vk_bank.cpp`) is `driver_bank_word`'s map of bank 2, which `driver_bank_word` now reads through, so the two cannot disagree about where a handle lives. On the render thread's replay of one Market frame (2,226 draws, 8.74 ms) it takes 0.229 ms off (95 % interval 0.155-0.260 ms, about 2.6 %). In play at Market, an A/B with the switch flipped within each run: `program_for`'s time on the render thread is 0.36 ms a frame less (−20 %) and the whole draw translation's 0.34 ms less, in both runs; fps +1.6 %, inside the series' spread (Measurements). `RX_VK_PICK_ONCE` (a kill switch, read at each recording's start, so HOS_AB flips it within a run): `=0` reads as before; `=check` runs both ways at every recheck, takes the old one's answer, logs any difference and says it is checking at its first recheck. Overlaps siantm's https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2954 (an 8-way `prog_fast` cache and inline c2 `fast_answers` in `program_for`), which reads c2-resident handles against the `NvnState` too, as part of a larger change. This one is the recheck alone, held to the old way's answers by a check mode and a test; whichever lands second rebases over the other. My older WIP https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/795 (the fast path kept across texture registrations, so fewer draws take the full pick) touches `program_for` too; it has not moved since 2026-11-15 and would rebase over this. Read first: `gpu/vk/vk_shader.cpp` (`handle_bank2_offset`, `pick_places`, `pick_recheck_once`, `pick_recheck`, `program_for`), `gpu/vk/vk_bank.cpp` (`driver_bank2_slot`, `driver_bank_word`). ## Testing **Tested:** Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47). This commit over main de091ae29, packed over the 3b3ea2cb3 base, with `RX_VK_PICK_ONCE=check`: Continue, then a teleport to Market, Hyrule Field and Kakariko, 45 s of play in each, threaded rendering on. Every run compared both ways at every recheck: Market 1,048,576+, Hyrule Field 2,097,152+, Kakariko 2,097,152+ (twice), **0 differ**. One launch (the first Kakariko one) lost the GPU during start-up (Windows: nvlddmkm 153, then "stopped responding and has successfully recovered"), before the first frame and before any recheck had run (the check logs its first, and had not); its two reruns played through, and it is the only device loss in the PC's last 142 game runs. The A/B in Measurements ran 2 more runs of play. - `tests/test_pick_once.py` (new): `vk_shader.cpp`'s and `vk_bank.cpp`'s own code, cut out of the sources and built over the real `Program`, `Stage` and descriptor types: `driver_bank2_slot` is the old bank 2 map at every stage and byte offset; over random programs (every descriptor kind: plain bank 2 words, other banks, word pairs, shifted words, handle programs, misaligned and out-of-range offsets, stages out of range) and random changes of the bound state, the pool's slots and their types, the new, old and `=check` ways give the same answers and keep the same handles (116,700 rechecks), also against a copy of the state with the first scrambled; a slot unbound then bound to slot 0; `=check` where the two ways differ (it logs, and answers as before); a thread with no recording begun; the switch's values and HOS_AB. Thirteen broken versions of the change make it fail (each checked). - `tests/test_tex_desc_memo.py` cuts `driver_bank2_slot` with `driver_bank_word`; `tests/test_hos_ab.py` lists the switch; the three fixtures that cut `draw_begin_recording` (`tests/draw_stream_visibility_test.cpp`, `fsr_uniform_ownership_test.cpp`, `recording_admission_test.cpp`) stub `pick_begin_recording` beside its neighbours. - A second agent reviewed the change cold; its points (a comment, HOS_AB values past 2, the check's first log line, five more broken versions for the test) are in. - `tests/run_all.py --strict` (Windows, llvm-mingw) on this head, f513f7e75: 887 passed, 15 failed, 55 skipped. The same 15 fail on main 0b284cc76 run the same way on this PC (884 passed, 17 failed there: these 15, and `test_run_all_output` and `test_seed_reader`, which pass here). Ten lack a tool this PC doesn't have under `--strict` (glslang, spirv-val, llvm-mc, zstandard: `test_fixed_share_upscale_shader`, `test_framegen_hdr`, `test_fsr3fi_hud_layer`, `test_fsr3fi_hudless_colour`, `test_fsr4_tune`, `test_gfx_effects`, `test_lifter`, `test_native_zstd`, `test_rt_refl_lamps`, `test_temporal_present_bandwidth`); five fail on main here for reasons of their own (`test_dev_update`, `test_float_add_subgroup`, `test_helpers_extract`, `test_longshot_ctl`, `test_rt_light_grid`). The branch's first full run failed three more: the fixtures that cut `draw_begin_recording` lacked a stub for its new call; they have one in this commit and pass. **Still to test:** - Linux (Steam Deck): play Market a minute with `RX_VK_PICK_ONCE=check`, expecting `vk: pick: RX_VK_PICK_ONCE=check: N rechecks compared, 0 differ` lines in the log and no difference in the picture (@Beanstalk play Market for a minute on the Steam Deck with RX_VK_PICK_ONCE=check and report the "rechecks compared" lines) ## Measurements **Setup:** Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47); Market, child (crowded): Continue, then a teleport; window 1720x720, output 3440x1440, render resolution 67 %, quality Custom, frame generation off, V-Sync off, uncapped (`HOS_FPS_MAX=1000`), threaded rendering on; the frame trace (`RX_VK_FRAME_TRACE=1`), 40 s in each run after a warm-up until no frame waits for a pipeline. `dev.py ab --scene market --runs 2 --env RX_VK_PICK_ONCE=0`, each run a timing job of the PC's queue, the switch flipped every 3 s within each run (HOS_AB), so both sides share each run's scene, heat and background. **Baseline:** one build, this change over main de091ae29 (a4d4e380a, before its rebase): `RX_VK_PICK_ONCE=0` (the old way, as on main) against unset (this change). The head is the same renderer code rebased onto a2b7abf9e; the six commits between touch no file under `gpu/`. The render thread's phases are the frame trace's columns, the mean a frame over each side's frames (transitions left out); fps and frame times are `dev.py ab`'s. | | Before, `RX_VK_PICK_ONCE=0`: this PR @ a4d4e380a | After: this PR @ a4d4e380a | Δ | |---|---|---|---| | `programs_ms` (`program_for`, the pick) | 1.763 ms | 1.406 ms | **−0.357 ms (−20 %)**; per run −0.359, −0.355 | | `draw_ms` (the draw translation, all of it) | 9.553 ms | 9.215 ms | **−0.338 ms (−3.5 %)**; per run −0.402, −0.275 | | `desc_ms` (descriptors) | 3.209 ms | 3.213 ms | +0.004 ms | | `cmds_ms` (commands, the push) | 3.249 ms | 3.241 ms | −0.008 ms | | `game_ms` (the game thread) | 16.586 ms | 16.694 ms | +0.108 ms | | fps | 55.2 | 56.1 | +1.6 %; per run +2.2 %, +0.7 % | | mean frame time | 18.11 ms | 17.83 ms | −0.28 ms (95 % interval −5.16 % to +1.87 %) | | median frame time | 17.52 ms | 17.33 ms | −0.19 ms | | p99 frame time | 27.33 ms | 26.75 ms | −0.59 ms | | frames of 50 ms or more a minute | 0.00 | 0.00 | 0 | **Verdict:** the pick's own time on the render thread is 0.36 ms a frame less, the same in both runs, and the draw translation's 0.34 ms less; nothing else on the render thread moves. fps is up 1.6 % and the frame time's interval holds 0: at this setting the frame follows the game's own time (`game_ms` 16.6 ms of a 17.8 ms frame), and the present waits for the render thread 0.02 ms a frame (`wait_render_ms`), so the render thread's saving shows in fps only where the render thread sets the pace (a slower CPU, more draws; not measured here). ## Risks - `vk_shader.cpp`, `vk_bank.cpp` and `vk_state.h` are in the shader stamp: players' programs are translated again once, at the launcher's shader preparation (as for any change to those files). - A draw whose handle is read in place where the old way would not read that word: `handle_bank2_offset` mirrors `descriptor_handle`'s conditions, the test holds the two to each other over every descriptor kind, and `=check` found no difference in play. `RX_VK_PICK_ONCE=0` restores the old way; `=check` shows a difference in the log. - Nothing changes in saves, `settings.toml` or the caches beyond the re-translation; a revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened: `tests/test_tex_desc_memo.py` cuts `driver_bank_word` with the `driver_bank2_slot` it now reads through; the three fixtures that cut `draw_begin_recording` stub its new `pick_begin_recording()` call. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: built and run. Linux: CI's build) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
perf(vk): a draw's program checks its textures with each handle read once, a plain one in place
Some checks reported errors
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Waiting to run
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
beanstalk/approval approved by dyst (reviewed)
beanstalk/steamdeck 0/1 pass, 2 error
f513f7e757
program_for keeps, for each program and inputs, the variant it picked and the handles at the variant's answers (each texture's
slot and the slot's version). At each draw it read every handle (answer_handles) and, when any differed, read them all again to
check their types (still_valid). It now reads each once: a handle that is a plain driver bank 2 word (no handle program, no second
word, no shift: handle_bank2_offset, beside descriptor_handle) is read in place, at the word's offset in the NvnState found when
the program is picked; any other through answer_handle as before. On a difference every answer is checked over the handles read,
as still_valid checks them, so the answer and the handles kept are the same as before. driver_bank2_slot (vk_bank.cpp) is
driver_bank_word's map of bank 2, which it now reads through.

On the render thread's replay of a Market frame (2,226 draws, 8.74 ms) it took 0.229 ms off (95 % interval 0.155-0.260 ms),
about 2.6 %. vk_shader.cpp, vk_bank.cpp and vk_state.h are in the shader stamp: programs are translated again once.

RX_VK_PICK_ONCE, a kill switch read at each recording's start (HOS_AB; a value other than 0 and 2 reads as on, as the variable
does): =0 reads as before; =check runs both, takes the old one's answer, logs a difference and says it checked at its first
check. tests/test_pick_once.py runs the cut code over random programs and states (and copies of them) against the old way,
=check where the two differ, a thread with no recording begun, and catches thirteen broken versions; test_tex_desc_memo cuts
driver_bank2_slot with driver_bank_word.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47), threaded rendering on. This change over main de091ae29 with RX_VK_PICK_ONCE=check: Continue, then a teleport to Market, Hyrule Field and Kakariko, 45 s of play in each, each run played to its end; every recheck compared both ways (Market 1,048,576+, Hyrule Field 2,097,152+, Kakariko 2,097,152+ twice), 0 differ. Then 2 runs of 40 s at Market with the switch flipped within each run (Measurements): program_for 0.36 ms a frame less on the render thread. One Kakariko launch lost the GPU during start-up, before any recheck had run (nvlddmkm 153); its two reruns played through.

Tested in game: Windows 11 (22631), Ryzen 9 3900X, RTX 3080 (NVIDIA 621.47), threaded rendering on. This change over main de091ae29 with RX_VK_PICK_ONCE=check: Continue, then a teleport to Market, Hyrule Field and Kakariko, 45 s of play in each, each run played to its end; every recheck compared both ways (Market 1,048,576+, Hyrule Field 2,097,152+, Kakariko 2,097,152+ twice), 0 differ. Then 2 runs of 40 s at Market with the switch flipped within each run (Measurements): program_for 0.36 ms a frame less on the render thread. One Kakariko launch lost the GPU during start-up, before any recheck had run (nvlddmkm 153); its two reruns played through.
Member

Possibly related, for context:

  • PR #2954 perf(vk): expand prog_fast cache, inline c2 fast_answers, and route mesh programs — Overlapping program_for fast cache and texture-handle validation work
  • PR #795 WIP: perf(vk): a draw keeps its program across texture registrations and uniform updates that do not touch its answers — Same author's open program-pick optimization in vk_shader.cpp
Possibly related, for context: - PR #2954 perf(vk): expand prog_fast cache, inline c2 fast_answers, and route mesh programs — Overlapping program_for fast cache and texture-handle validation work - PR #795 WIP: perf(vk): a draw keeps its program across texture registrations and uniform updates that do not touch its answers — Same author's open program-pick optimization in vk_shader.cpp
Author
Member

@Beanstalk play Market for a minute on the Steam Deck with RX_VK_PICK_ONCE=check and report the "rechecks compared" lines (expected: vk: pick: RX_VK_PICK_ONCE=check: N rechecks compared, 0 differ), and whether the picture looks as on main.

@Beanstalk play Market for a minute on the Steam Deck with RX_VK_PICK_ONCE=check and report the "rechecks compared" lines (expected: `vk: pick: RX_VK_PICK_ONCE=check: N rechecks compared, 0 differ`), and whether the picture looks as on main.
Member

Beanstalk test farm · ⚠️ couldn't be judged on steamdeck

Commit f513f7e · approved by dyst (reviewed) · dashboard

⚠️ Note: Check mode runs both implementations and returns the old answer, so this plan cannot measure the claimed speed-up or independently verify the default fast path's picture.

Summary, written by AI (gpt-6.1-terra) from the numbers below:

The change could not be judged on Steam Deck because both reports failed while preparing the baseline, before the game ran. The baseline build exited with code 1 and reported 11 shader cache files; no picture comparisons or in-game checks were completed.

Done (started 03:26 UTC, last report 08:40 UTC). Comment @Beanstalk to run it again.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
steamdeck ⚠️ couldn't be judged 2 1 2 — — none

Couldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.

  • steamdeck, report 1: the main base failed (exit 1): 11 shader cache files from <data>/builder/bases/main-seed
  • steamdeck, report 2: the main base failed (exit 1): 11 shader cache files from <data>/builder/bases/main-seed
What was tested

What will be tested · AI plan (gpt-6.1-terra)

On Steam Deck, the plan starts at the daytime Market entrance, compares a stationary picture with main, and runs a minute in Market with RX_VK_PICK_ONCE=check on the PR. Three starts per side provide repeated picture comparisons, while the logs report the recheck counts and differences. A crash, a missing check line, a reported mismatch, or a picture difference above the threshold fails the PR.

  • Where: steamdeck (1-2 reports).
  • Matrix: 1 cell, each on main and the PR: RX_VK_PICK_ONCE check (PR only).
  • market-check: from the repository's save market-entrance (settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0; switches HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0), then take the picture market-entrance to compare with main, move the stick; 3 runs on each side.
  • Measured: crashes, the game's log, numbers from the game's log.
  • The PR fails if: it crashes; or a picture differs from main by more than 20%; or value_rechecks is below 1; or value_differences is above 0; or forbidden log lines is above 0; or expected log lines missing is above 0.
  • Time: about 37 min of game runs per tester (6 game starts), plus the two builds.
Measurements on `steamdeck`, for the PR description

Verdict: could not be judged on steamdeck (2 reports).

Hardware: 1: linux+amd+radv+igpu+handheld AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99 AMD Custom APU 0405, 12 GB RAM; 2: linux+amd+radv+igpu+handheld AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99 AMD Custom APU 0405, 12 GB RAM
Scene: market-check, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-check: 3 game starts a side; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame time (p99)) Helps / doesn't help / untested
RX_VK_PICK_ONCE switch the PR adds (set on the PR side only) check not in main the PR's default market-check, main without it → the PR with check: not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** could not be judged on steamdeck (2 reports).

Hardware: 1: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM`; 2: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM`  
Scene: market-check, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them  
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-check: 3 game starts a side; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `RX_VK_PICK_ONCE` | switch the PR adds (set on the PR side only) | `check` | not in main | the PR's default | market-check, main without it → the PR with check: not measured | untested |
The testers' hardware
Target Report Ran on
steamdeck 1 linux+amd+radv+igpu+handheld AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99 AMD Custom APU 0405, 12 GB RAM
steamdeck 2 linux+amd+radv+igpu+handheld AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99 AMD Custom APU 0405, 12 GB RAM
<!-- beanstalk:sticky --> ### Beanstalk test farm · ⚠️ couldn't be judged on steamdeck Commit `f513f7e` · approved by dyst (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/3303) ⚠️ **Note:** Check mode runs both implementations and returns the old answer, so this plan cannot measure the claimed speed-up or independently verify the default fast path's picture. > **Summary**, written by AI (`gpt-6.1-terra`) from the numbers below: > > The change could not be judged on Steam Deck because both reports failed while preparing the baseline, before the game ran. The baseline build exited with code 1 and reported 11 shader cache files; no picture comparisons or in-game checks were completed. Done (started 03:26 UTC, last report 08:40 UTC). Comment `@Beanstalk` to run it again. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `steamdeck` | ⚠️ couldn't be judged | 2 [1](https://beanstalk.magicbean.dev/reports/rp_ca1efa27e544c066) [2](https://beanstalk.magicbean.dev/reports/rp_0e497ef443727539) | — | — | none | **Couldn't be judged**: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own. - `steamdeck`, [report 1](https://beanstalk.magicbean.dev/reports/rp_ca1efa27e544c066): `the main base failed (exit 1): 11 shader cache files from <data>/builder/bases/main-seed` - `steamdeck`, [report 2](https://beanstalk.magicbean.dev/reports/rp_0e497ef443727539): `the main base failed (exit 1): 11 shader cache files from <data>/builder/bases/main-seed` <details><summary>What was tested</summary> **What will be tested** · AI plan (`gpt-6.1-terra`) On Steam Deck, the plan starts at the daytime Market entrance, compares a stationary picture with main, and runs a minute in Market with RX_VK_PICK_ONCE=check on the PR. Three starts per side provide repeated picture comparisons, while the logs report the recheck counts and differences. A crash, a missing check line, a reported mismatch, or a picture difference above the threshold fails the PR. - **Where:** steamdeck (1-2 reports). - **Matrix:** 1 cell, each on main and the PR: RX_VK_PICK_ONCE `check` (PR only). - **market-check:** from the repository's save `market-entrance` (settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0; switches `HOS_OUTPUT_RES=1280x720`, `RX_VK_AUTO_TUNE=0`), then take the picture market-entrance to compare with main, move the stick; 3 runs on each side. - **Measured:** crashes, the game's log, numbers from the game's log. - **The PR fails if:** it crashes; or a picture differs from main by more than 20%; or value_rechecks is below 1; or value_differences is above 0; or forbidden log lines is above 0; or expected log lines missing is above 0. - **Time:** about 37 min of game runs per tester (6 game starts), plus the two builds. </details> <details><summary>Measurements on `steamdeck`, for the PR description</summary> **Verdict:** could not be judged on steamdeck (2 reports). Hardware: 1: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM`; 2: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` Scene: market-check, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-check: 3 game starts a side; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_PICK_ONCE` | switch the PR adds (set on the PR side only) | `check` | not in main | the PR's default | market-check, main without it → the PR with check: not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** could not be judged on steamdeck (2 reports). Hardware: 1: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM`; 2: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` Scene: market-check, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); market-check: 3 game starts a side; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame time (p99)) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_PICK_ONCE` | switch the PR adds (set on the PR side only) | `check` | not in main | the PR's default | market-check, main without it → the PR with check: not measured | untested | ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `steamdeck` | [1](https://beanstalk.magicbean.dev/reports/rp_ca1efa27e544c066) | linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` | | `steamdeck` | [2](https://beanstalk.magicbean.dev/reports/rp_0e497ef443727539) | linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` | </details>
Some checks reported errors
PR description / Title and description (pull_request_target) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / What the change needs (pull_request) Waiting to run
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
beanstalk/approval approved by dyst (reviewed)
beanstalk/steamdeck 0/1 pass, 2 error
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/vk-pick-handles-once:dyst-perf/vk-pick-handles-once'
git switch 'dyst-perf/vk-pick-handles-once'
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!3303
No description provided.