perf(vk): textures prepared on worker threads as the game makes them (RX_VK_TEX_PREP, off by default) #1847

Closed
GummiNaomi wants to merge 2 commits from GummiNaomi/Longshot:perf/tex-prep-workers into main
Member

Summary

Arriving in an area, the replay thread copies, hashes and lays out the storage of every new texture at its first draw, inside the frames that draw the new area. This moves that work to worker threads as the game makes each texture (RX_VK_TEX_PREP): the upload then takes the worker's buffer when the storage still hashes the same, and does as before otherwise. It is an attempt, off by default on every PC: =1 turns it on, =2 also checks each upload.

Measured at this head on main, it does not help: in two teleport tours a side on 4 cores (where it is on by default), against main @ 65488813, an arrival's time over 16.7 ms a frame went 350 -> 396 ms (median), its longest frame 104 -> 133 ms (median) and 244 -> 211 ms at most, and the game's most private memory went up by 1.3-1.4 GB (22.9-23.0 -> 24.2-24.4 GB). The earlier gain (an arrival's excess 496 -> 370 ms) was measured on a build with #1810's moves and a carry-over of the prepared buffers across them, which this PR leaves out; main without those arrives smoother than that build did, and this head adds nothing to it. So it now ships off on every PC (ebd6c08a); before, it was on with 8 usable CPUs or fewer. It stays as an opt-in until a PC where it helps is found (Still to test).

Why: a texture's first draw makes its image and fills it from the game's memory (upload_inner, gpu/vk/vk_texture.cpp): the storage is read, hashed for the ASTC decoder's reuse, and staged (ASTC) or unswizzled (native BC and uncompressed) on the replay thread. An arrival makes hundreds of textures in its first frames, so this lands in them. The game announces each texture well before it draws it (nvnTextureInitialize), and its storage is mostly written by then.

What changes: texture_prep_made (called from texture_created_of, gpu/vk/vk_replay.cpp) queues each texture tex_prep.h takes: 2D, 2D array, cube and cube array textures, ASTC up to 256 MB (whole layers, laid out as the GPU decoder reads them) and native BC or uncompressed ones under 8 MB (unswizzled level by level as the CPU route does), not render targets, depth, multisampled or non-contiguous ones. One worker (two from 8 usable CPUs, RX_VK_TEX_PREP_THREADS), at below-normal priority and only once the renderer has presented, copies the storage once, hashes the copy (the same chained XXH64 in 64 MB pieces as reuse_upload) and fills a cached host buffer. A whole upload (upload_inner, no dirty ranges) takes the buffer of its texture's newest serial: for ASTC it compares the hash reuse_upload makes anyway and decodes from the worker's buffer; for the CPU route it hashes the storage as the upload reads it (guest_bytes), checks every level's geometry, and leaves out a level that runs past the storage while a kept capture page lies there; then one copy from the worker's buffer. Any mismatch, or a buffer not ready in time, uploads as before. Buffers the GPU used are freed once their recording completes; at most RX_VK_TEX_PREP_MB (1024) are held, the oldest let go first, and a texture finalized drops its own. RX_VK_TEX_PREP=2 also does each such upload the old way and compares. The log has a "textures prepared" line every 600 presents and the two routes in "a frame's uploads took". Unchanged: partial uploads, reuse_upload and its ASTC cache, what is drawn.

This was written and first measured on top of #1810 (open), where a texture the game's compaction moves keeps its image; there a move also carried its prepared buffer over. Main has no such moves (a moved texture is a new one, prepared on its own), so this PR leaves that part out; it goes in with whichever of the two lands second.

Read first: gpu/vk/tex_prep.h, then prep_worker, prep_take and their use in upload_inner in gpu/vk/vk_texture.cpp, and tests/test_tex_prep.py.

Testing

Tested: Windows 11 Pro 26200, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D with SMT off, 32 GB.
At a35e5edd (on main @ 65488813), the code of this head before it was rebased and its default turned off (with the old default, unset meant on with 4 usable CPUs, as =1 does now): the builder's Windows (llvm-mingw) builds of this head and of main @ 65488813, and four teleport tours on 4 cores, main, this PR, this PR, main (Measurements). No crash, FATAL or device loss in any; every teleport arrived (in one tour a side one was refused at the first try, "an event is playing"). With it unset on 4 cores the log says 1 worker; in a tour 34,000-43,600 textures announced and prepared (16.7-18.4 GB, 13-15 s of the worker), of which 4,278-5,286 CPU-route and 3,118-3,821 ASTC first uploads took the worker's buffer; 4-10 were not ready in time and none written since; 1,017-1,019 MB of prepared buffers held at the tour's end (the 1024 MB limit). The pictures were not compared at this head.
Earlier, on builds of main @ f505340b with #1810-#1813's changes and this one (with the move carry-over above): teleport tours on 4 and 16 cores, two a side; no crash in the six tours with it on of the last two builds; the arrivals' pictures alike both ways (mean pixel difference 2.8-6.6 of 255: Navi and particles); a check run with RX_VK_TEX_PREP=2 on 16 cores, 15 teleports: 10,298 unswizzled and 10,736 ASTC uploads from the workers' buffers, every one the same as the old path's ("check: all the same", no DIFFER line).
Checks: tests/test_tex_prep.py (tex_prep.h's rules compiled and run: which textures, their layers and levels, the hash, the ASTC layout, the ready list's room and age, the workers' count and the CPU rule; the wiring in the source, and no call that both moves a prepared texture and reads it, the start-up crash an earlier version had) passes on this head on Windows (clang) and Linux (g++ 13.3, WSL Ubuntu 24.04) and fails on main; tests/test_switch_table.py, tests/test_astc_reuse.py, tests/test_bc_upload_retry.py, tests/test_astc_upload_chunking.py (stand-ins for the prep's names), tests/test_texture_staging_publication.py and the BC scratch checks pass on Windows and in WSL.
Suite at this head, tests/run_all.py --changed 65488813 in WSL Ubuntu 24.04: 156 pass, 30 fail, 5 skipped. 29 of the 30 fail on main @ 65488813 there too: test_capture_readback_visibility, test_crash_dialog, test_dev_ab, test_dev_packs, test_draw_stream_visibility, test_early_split_before_draw, test_frame_overlap, test_fsr_image_retirement, test_fsr_uniform_ownership, test_hold_gpu, test_hud_layout_row, test_image_view_retry, test_linux_pressure, test_pass_barrier, test_present_queue_default, test_present_source_crop, test_profiling_mode, test_readback_early, test_readback_late, test_readback_timeout_source, test_replay_write_order, test_slow_frames, test_split_before_draw, test_staging_burst, test_texel_buffer_ownership, test_ub_update_batch, test_upscaler_rows, test_vk_occlusion_queries, test_walk_key. The 30th, test_low_vram_texture_mips, fails in WSL on the text of vk_menu.cpp, a file this PR leaves alone; run on Windows it fails on main @ 65488813 with the same error as on this head (its marker is in vk_texture.cpp twice). (The full suite with every check on main @ 068fb8eb in WSL, and this head's --changed checks on Windows as it was on 068fb8eb, are in this PR's earlier description: every failure there also failed on main.)
No Linux build was done: on Linux only the checks above ran, in WSL.

Still to test:

  • steamdeck: a teleport tour twice unset and twice with RX_VK_TEX_PREP=1, ABBA, to see whether the arrivals are any smoother there, expecting the private memory about 1 GB higher with =1 (@Beanstalk steamdeck, teleport tour 4 minutes x 4, RX_VK_TEX_PREP=1 against unset, ABBA, with the frame trace and the private memory)
  • A PC of 6 to 8 cores: the same tours, to see whether it helps anywhere; nothing between 4 and 16 cores is measured, expecting an answer either way (@Beanstalk windows with 6 to 8 cores, teleport tour 4 minutes x 4, RX_VK_TEX_PREP=1 against unset, ABBA)
  • AMD and Intel GPUs: a check run with RX_VK_TEX_PREP=2, expecting "check: all the same" (@Beanstalk amd and intel GPUs, a teleport tour with RX_VK_TEX_PREP=2, the log's check line)

Measurements

Rebased and turned off: this head, ebd6c08a, is a35e5edd rebased onto main 89c3d21e with no conflicts (1fb19086), then one commit that makes RX_VK_TEX_PREP off by default on every PC and an attempt in its row. The numbers below are from a35e5edd on 65488813, where unset was on with 4 usable CPUs, the same as =1 now. At ebd6c08a, tests/test_tex_prep.py and tests/test_switch_table.py pass on Windows (clang), and vk_texture.cpp and vk_replay.cpp compile syntax-only with the builder's flags; tests/test_astc_upload_chunking.py fails to compile the same way on main 89c3d21e.

Verdict: no gain at this head, and a memory cost. On 4 cores, with it on (the old default there), against main @ 65488813: an arrival's excess 350 -> 396 ms (median) and 422 -> 433 ms (mean), its longest frame 104 -> 133 ms (median) and 244 -> 211 ms at most, its uploads and lookups about the same; the tours' medians of the excess (361 / 333 against 396 / 396) and of the longest frame (108 / 101 against 130 / 136) do not overlap, so on those it is slightly worse, better only on the single longest frame. The most private memory in a tour is 1.3-1.4 GB higher.

Setup: Windows 11 Pro 26200, RTX 4070 SUPER 12 GB (NVIDIA 617.42), Ryzen 9 9950X3D with SMT off, 32 GB; the game held to 4 cores (process affinity 0xF00). Teleport tours from kokiri-start, 4 minutes each (14-15 arrivals: Castle Town's market, Hyrule Field, Kakariko, Kokiri Forest, the Lost Woods, Zora's River, round again); the control tool's test profile (window 1920x1080, headless), uncapped (HOS_FPS_MAX=1000); both sides RX_VK_LATE_FIX=1 RX_VK_TEX_AHEAD=2 RX_VK_ASTC_BC_ALL=1 RX_VK_IMAGE_BLOCK_MB=32 RX_VK_LOAD=create RX_VK_BC_LAYERS=8 RX_VK_FRAME_TRACE=1, this PR at a35e5edd with RX_VK_TEX_PREP unset, which with that head's default was on (4 usable CPUs), as =1 is now. Order main, PR, PR, main, 20 Nov 13:12-13:32, one build a side. Each arrival's first 3 s from the frame trace: its excess (the time over 16.7 ms a frame), its longest frame, and the uploads' and lookups' columns (means over the arrivals); the save's load-in left out (27 and 28 teleports). The private bytes sampled every 2 s, the most in each tour.

Before: main @ 65488813 After: this PR @ a35e5edd
excess an arrival, median / mean (ms) 350 / 422 396 / 433
excess an arrival, median, each tour (ms) 361 / 333 396 / 396
longest frame of an arrival, median / max (ms) 104 / 244 133 / 211
longest frame of an arrival, median, each tour (ms) 108 / 101 130 / 136
an arrival's uploads / lookups, mean (ms) 187 / 245 195 / 247
frames of 33 ms or more, a tour 131 / 111 128 / 145
p99 frame time, a tour (ms) 19.0 / 19.0 19.6 / 21.0
the most private memory in a tour (MB) 22,895 / 22,992 24,241 / 24,409
prepared buffers held at a tour's end (MB) none 1,019 / 1,017

A tour's average fps and median frame time mix the title, the loads and play, which take different shares in each tour, so they are not compared. Not measured: 16 cores, anything between 4 and 16 cores, the pictures.

Baseline (the earlier table): builds of main @ f505340b with #1810-#1813's changes and this one, with the move carry-over this PR leaves out: RX_VK_TEX_PREP=0 against on, two tours a side on each core count, in the order off, on, off, on; the same tour and method, and RX_VK_TEX_MOVE=1 HOS_NVN_FRAME_OVERLAP=1, switches main does not have. The off tours ran on an earlier and the final build of that change, the on tours on the last two.

RX_VK_TEX_PREP=0 @ f505340b + #1810-#1813 on @ f505340b + #1810-#1813
4 cores (27 / 29 teleports): excess an arrival, median / mean 496 / 580 ms 370 / 367 ms
4 cores: longest frame of an arrival, median / max 134 / 349 ms 94 / 154 ms
4 cores: an arrival's uploads / lookups 74 / 156 ms 55 / 103 ms
4 cores: frames of 33 ms or more, a tour 218 / 149 143 / 137
4 cores: p99 frame time, a tour 29.3 / 20.1 ms 21.7 / 20.7 ms
16 cores (28 / 30 teleports): excess an arrival, median / mean 387 / 416 ms 402 / 432 ms
16 cores: longest frame of an arrival, median 125 ms 117 ms
16 cores: p99 frame time, a tour 19.0 / 18.9 ms 17.9 / 18.0 ms
the most private memory in a tour, 4 cores 23,356 / 24,342 MB 24,953 / 24,662 MB
the most private memory in a tour, 16 cores 24,003 / 24,275 MB 24,992 / 25,685 MB
prepared buffers held at a tour's end none 556-807 MB

(Those tours ran in the same 1920x1080 window as above; the earlier description's 2560x1440 was a mistake.)

RX_VK_TEX_PREP (new, an attempt) ships off on every PC; =1 turns it on and =2 also checks. The earlier default, on with 8 usable CPUs or fewer, was chosen by the earlier table, on a build with #1810's moves; at a35e5edd on main the 4-core tours above showed no gain and 1.3-1.4 GB more memory, so it is off by default now (ebd6c08a).

Risks

What could break: the prepared buffers hold up to 1 GB of host memory (RX_VK_TEX_PREP_MB; 1.3-1.4 GB more private memory in the tours at this head), for a player who turns it on (RX_VK_TEX_PREP_MB lowers it). Off by default, nothing a frame runs changes apart from one check of the switch, read once. On main it did not make arrivals smoother on 4 cores (Measurements). An upload uses a worker's buffer only when the storage hashes the same as it reads it, and the check run found every one the same, but a texture written between the hash and the GPU's read would be as stale as on today's path, no more. The workers take CPU time at below-normal priority (13-15 s of one worker in a 4-core tour of about 4 minutes at this head). After updating, nothing changes unless RX_VK_TEX_PREP is set; nothing changes either way for saves, longshot_options.ini or the caches. A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit. (Rebased onto main 89c3d21e, no conflicts; then ebd6c08a turns the default off.)
  • 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. (Two tours a side on 4 cores at this head against main @ 65488813, ABBA.)
  • 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. (Off: on main the 4-core tours showed no gain and 1.3-1.4 GB more memory. Its row is an attempt.)
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built on Windows: the builder's llvm-mingw build of a35e5edd, run in the tours above. On Linux only checks: tests/test_tex_prep.py (tex_prep.h with g++ 13.3) and the --changed suite in WSL Ubuntu 24.04. No Linux build was done.)
  • 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 Arriving in an area, the replay thread copies, hashes and lays out the storage of every new texture at its first draw, inside the frames that draw the new area. This moves that work to worker threads as the game makes each texture (`RX_VK_TEX_PREP`): the upload then takes the worker's buffer when the storage still hashes the same, and does as before otherwise. It is an attempt, off by default on every PC: `=1` turns it on, `=2` also checks each upload. Measured at this head on main, it does not help: in two teleport tours a side on 4 cores (where it is on by default), against main @ 65488813, an arrival's time over 16.7 ms a frame went 350 -> 396 ms (median), its longest frame 104 -> 133 ms (median) and 244 -> 211 ms at most, and the game's most private memory went up by 1.3-1.4 GB (22.9-23.0 -> 24.2-24.4 GB). The earlier gain (an arrival's excess 496 -> 370 ms) was measured on a build with #1810's moves and a carry-over of the prepared buffers across them, which this PR leaves out; main without those arrives smoother than that build did, and this head adds nothing to it. So it now ships off on every PC (ebd6c08a); before, it was on with 8 usable CPUs or fewer. It stays as an opt-in until a PC where it helps is found (Still to test). Why: a texture's first draw makes its image and fills it from the game's memory (`upload_inner`, `gpu/vk/vk_texture.cpp`): the storage is read, hashed for the ASTC decoder's reuse, and staged (ASTC) or unswizzled (native BC and uncompressed) on the replay thread. An arrival makes hundreds of textures in its first frames, so this lands in them. The game announces each texture well before it draws it (`nvnTextureInitialize`), and its storage is mostly written by then. What changes: `texture_prep_made` (called from `texture_created_of`, `gpu/vk/vk_replay.cpp`) queues each texture `tex_prep.h` takes: 2D, 2D array, cube and cube array textures, ASTC up to 256 MB (whole layers, laid out as the GPU decoder reads them) and native BC or uncompressed ones under 8 MB (unswizzled level by level as the CPU route does), not render targets, depth, multisampled or non-contiguous ones. One worker (two from 8 usable CPUs, `RX_VK_TEX_PREP_THREADS`), at below-normal priority and only once the renderer has presented, copies the storage once, hashes the copy (the same chained XXH64 in 64 MB pieces as `reuse_upload`) and fills a cached host buffer. A whole upload (`upload_inner`, no dirty ranges) takes the buffer of its texture's newest serial: for ASTC it compares the hash `reuse_upload` makes anyway and decodes from the worker's buffer; for the CPU route it hashes the storage as the upload reads it (`guest_bytes`), checks every level's geometry, and leaves out a level that runs past the storage while a kept capture page lies there; then one copy from the worker's buffer. Any mismatch, or a buffer not ready in time, uploads as before. Buffers the GPU used are freed once their recording completes; at most `RX_VK_TEX_PREP_MB` (1024) are held, the oldest let go first, and a texture finalized drops its own. `RX_VK_TEX_PREP=2` also does each such upload the old way and compares. The log has a "textures prepared" line every 600 presents and the two routes in "a frame's uploads took". Unchanged: partial uploads, `reuse_upload` and its ASTC cache, what is drawn. This was written and first measured on top of #1810 (open), where a texture the game's compaction moves keeps its image; there a move also carried its prepared buffer over. Main has no such moves (a moved texture is a new one, prepared on its own), so this PR leaves that part out; it goes in with whichever of the two lands second. Read first: `gpu/vk/tex_prep.h`, then `prep_worker`, `prep_take` and their use in `upload_inner` in `gpu/vk/vk_texture.cpp`, and `tests/test_tex_prep.py`. ## Testing **Tested:** Windows 11 Pro 26200, RTX 4070 SUPER (NVIDIA 617.42), Ryzen 9 9950X3D with SMT off, 32 GB. At a35e5edd (on main @ 65488813), the code of this head before it was rebased and its default turned off (with the old default, unset meant on with 4 usable CPUs, as `=1` does now): the builder's Windows (llvm-mingw) builds of this head and of main @ 65488813, and four teleport tours on 4 cores, main, this PR, this PR, main (Measurements). No crash, FATAL or device loss in any; every teleport arrived (in one tour a side one was refused at the first try, "an event is playing"). With it unset on 4 cores the log says 1 worker; in a tour 34,000-43,600 textures announced and prepared (16.7-18.4 GB, 13-15 s of the worker), of which 4,278-5,286 CPU-route and 3,118-3,821 ASTC first uploads took the worker's buffer; 4-10 were not ready in time and none written since; 1,017-1,019 MB of prepared buffers held at the tour's end (the 1024 MB limit). The pictures were not compared at this head. Earlier, on builds of main @ f505340b with #1810-#1813's changes and this one (with the move carry-over above): teleport tours on 4 and 16 cores, two a side; no crash in the six tours with it on of the last two builds; the arrivals' pictures alike both ways (mean pixel difference 2.8-6.6 of 255: Navi and particles); a check run with `RX_VK_TEX_PREP=2` on 16 cores, 15 teleports: 10,298 unswizzled and 10,736 ASTC uploads from the workers' buffers, every one the same as the old path's ("check: all the same", no DIFFER line). Checks: `tests/test_tex_prep.py` (`tex_prep.h`'s rules compiled and run: which textures, their layers and levels, the hash, the ASTC layout, the ready list's room and age, the workers' count and the CPU rule; the wiring in the source, and no call that both moves a prepared texture and reads it, the start-up crash an earlier version had) passes on this head on Windows (clang) and Linux (g++ 13.3, WSL Ubuntu 24.04) and fails on main; `tests/test_switch_table.py`, `tests/test_astc_reuse.py`, `tests/test_bc_upload_retry.py`, `tests/test_astc_upload_chunking.py` (stand-ins for the prep's names), `tests/test_texture_staging_publication.py` and the BC scratch checks pass on Windows and in WSL. Suite at this head, `tests/run_all.py --changed 65488813` in WSL Ubuntu 24.04: 156 pass, 30 fail, 5 skipped. 29 of the 30 fail on main @ 65488813 there too: `test_capture_readback_visibility`, `test_crash_dialog`, `test_dev_ab`, `test_dev_packs`, `test_draw_stream_visibility`, `test_early_split_before_draw`, `test_frame_overlap`, `test_fsr_image_retirement`, `test_fsr_uniform_ownership`, `test_hold_gpu`, `test_hud_layout_row`, `test_image_view_retry`, `test_linux_pressure`, `test_pass_barrier`, `test_present_queue_default`, `test_present_source_crop`, `test_profiling_mode`, `test_readback_early`, `test_readback_late`, `test_readback_timeout_source`, `test_replay_write_order`, `test_slow_frames`, `test_split_before_draw`, `test_staging_burst`, `test_texel_buffer_ownership`, `test_ub_update_batch`, `test_upscaler_rows`, `test_vk_occlusion_queries`, `test_walk_key`. The 30th, `test_low_vram_texture_mips`, fails in WSL on the text of `vk_menu.cpp`, a file this PR leaves alone; run on Windows it fails on main @ 65488813 with the same error as on this head (its marker is in `vk_texture.cpp` twice). (The full suite with every check on main @ 068fb8eb in WSL, and this head's `--changed` checks on Windows as it was on 068fb8eb, are in this PR's earlier description: every failure there also failed on main.) No Linux build was done: on Linux only the checks above ran, in WSL. **Still to test:** - steamdeck: a teleport tour twice unset and twice with `RX_VK_TEX_PREP=1`, ABBA, to see whether the arrivals are any smoother there, expecting the private memory about 1 GB higher with `=1` (@Beanstalk steamdeck, teleport tour 4 minutes x 4, RX_VK_TEX_PREP=1 against unset, ABBA, with the frame trace and the private memory) - A PC of 6 to 8 cores: the same tours, to see whether it helps anywhere; nothing between 4 and 16 cores is measured, expecting an answer either way (@Beanstalk windows with 6 to 8 cores, teleport tour 4 minutes x 4, RX_VK_TEX_PREP=1 against unset, ABBA) - AMD and Intel GPUs: a check run with `RX_VK_TEX_PREP=2`, expecting "check: all the same" (@Beanstalk amd and intel GPUs, a teleport tour with RX_VK_TEX_PREP=2, the log's check line) ## Measurements **Rebased and turned off:** this head, ebd6c08a, is a35e5edd rebased onto main 89c3d21e with no conflicts (1fb19086), then one commit that makes `RX_VK_TEX_PREP` off by default on every PC and an attempt in its row. The numbers below are from a35e5edd on 65488813, where unset was on with 4 usable CPUs, the same as `=1` now. At ebd6c08a, `tests/test_tex_prep.py` and `tests/test_switch_table.py` pass on Windows (clang), and `vk_texture.cpp` and `vk_replay.cpp` compile syntax-only with the builder's flags; `tests/test_astc_upload_chunking.py` fails to compile the same way on main 89c3d21e. **Verdict:** no gain at this head, and a memory cost. On 4 cores, with it on (the old default there), against main @ 65488813: an arrival's excess 350 -> 396 ms (median) and 422 -> 433 ms (mean), its longest frame 104 -> 133 ms (median) and 244 -> 211 ms at most, its uploads and lookups about the same; the tours' medians of the excess (361 / 333 against 396 / 396) and of the longest frame (108 / 101 against 130 / 136) do not overlap, so on those it is slightly worse, better only on the single longest frame. The most private memory in a tour is 1.3-1.4 GB higher. Setup: Windows 11 Pro 26200, RTX 4070 SUPER 12 GB (NVIDIA 617.42), Ryzen 9 9950X3D with SMT off, 32 GB; the game held to 4 cores (process affinity 0xF00). Teleport tours from `kokiri-start`, 4 minutes each (14-15 arrivals: Castle Town's market, Hyrule Field, Kakariko, Kokiri Forest, the Lost Woods, Zora's River, round again); the control tool's `test` profile (window 1920x1080, headless), uncapped (`HOS_FPS_MAX=1000`); both sides `RX_VK_LATE_FIX=1 RX_VK_TEX_AHEAD=2 RX_VK_ASTC_BC_ALL=1 RX_VK_IMAGE_BLOCK_MB=32 RX_VK_LOAD=create RX_VK_BC_LAYERS=8 RX_VK_FRAME_TRACE=1`, this PR at a35e5edd with `RX_VK_TEX_PREP` unset, which with that head's default was on (4 usable CPUs), as `=1` is now. Order main, PR, PR, main, 20 Nov 13:12-13:32, one build a side. Each arrival's first 3 s from the frame trace: its excess (the time over 16.7 ms a frame), its longest frame, and the uploads' and lookups' columns (means over the arrivals); the save's load-in left out (27 and 28 teleports). The private bytes sampled every 2 s, the most in each tour. | | Before: main @ 65488813 | After: this PR @ a35e5edd | |---|---|---| | excess an arrival, median / mean (ms) | 350 / 422 | 396 / 433 | | excess an arrival, median, each tour (ms) | 361 / 333 | 396 / 396 | | longest frame of an arrival, median / max (ms) | 104 / 244 | 133 / 211 | | longest frame of an arrival, median, each tour (ms) | 108 / 101 | 130 / 136 | | an arrival's uploads / lookups, mean (ms) | 187 / 245 | 195 / 247 | | frames of 33 ms or more, a tour | 131 / 111 | 128 / 145 | | p99 frame time, a tour (ms) | 19.0 / 19.0 | 19.6 / 21.0 | | the most private memory in a tour (MB) | 22,895 / 22,992 | 24,241 / 24,409 | | prepared buffers held at a tour's end (MB) | none | 1,019 / 1,017 | A tour's average fps and median frame time mix the title, the loads and play, which take different shares in each tour, so they are not compared. Not measured: 16 cores, anything between 4 and 16 cores, the pictures. Baseline (the earlier table): builds of main @ f505340b with #1810-#1813's changes and this one, with the move carry-over this PR leaves out: `RX_VK_TEX_PREP=0` against on, two tours a side on each core count, in the order off, on, off, on; the same tour and method, and `RX_VK_TEX_MOVE=1 HOS_NVN_FRAME_OVERLAP=1`, switches main does not have. The off tours ran on an earlier and the final build of that change, the on tours on the last two. | | `RX_VK_TEX_PREP=0` @ f505340b + #1810-#1813 | on @ f505340b + #1810-#1813 | |---|---|---| | 4 cores (27 / 29 teleports): excess an arrival, median / mean | 496 / 580 ms | 370 / 367 ms | | 4 cores: longest frame of an arrival, median / max | 134 / 349 ms | 94 / 154 ms | | 4 cores: an arrival's uploads / lookups | 74 / 156 ms | 55 / 103 ms | | 4 cores: frames of 33 ms or more, a tour | 218 / 149 | 143 / 137 | | 4 cores: p99 frame time, a tour | 29.3 / 20.1 ms | 21.7 / 20.7 ms | | 16 cores (28 / 30 teleports): excess an arrival, median / mean | 387 / 416 ms | 402 / 432 ms | | 16 cores: longest frame of an arrival, median | 125 ms | 117 ms | | 16 cores: p99 frame time, a tour | 19.0 / 18.9 ms | 17.9 / 18.0 ms | | the most private memory in a tour, 4 cores | 23,356 / 24,342 MB | 24,953 / 24,662 MB | | the most private memory in a tour, 16 cores | 24,003 / 24,275 MB | 24,992 / 25,685 MB | | prepared buffers held at a tour's end | none | 556-807 MB | (Those tours ran in the same 1920x1080 window as above; the earlier description's 2560x1440 was a mistake.) `RX_VK_TEX_PREP` (new, an attempt) ships off on every PC; `=1` turns it on and `=2` also checks. The earlier default, on with 8 usable CPUs or fewer, was chosen by the earlier table, on a build with #1810's moves; at a35e5edd on main the 4-core tours above showed no gain and 1.3-1.4 GB more memory, so it is off by default now (ebd6c08a). ## Risks What could break: the prepared buffers hold up to 1 GB of host memory (`RX_VK_TEX_PREP_MB`; 1.3-1.4 GB more private memory in the tours at this head), for a player who turns it on (`RX_VK_TEX_PREP_MB` lowers it). Off by default, nothing a frame runs changes apart from one check of the switch, read once. On main it did not make arrivals smoother on 4 cores (Measurements). An upload uses a worker's buffer only when the storage hashes the same as it reads it, and the check run found every one the same, but a texture written between the hash and the GPU's read would be as stale as on today's path, no more. The workers take CPU time at below-normal priority (13-15 s of one worker in a 4-core tour of about 4 minutes at this head). After updating, nothing changes unless `RX_VK_TEX_PREP` is set; nothing changes either way for saves, `longshot_options.ini` or the caches. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. (Rebased onto main 89c3d21e, no conflicts; then ebd6c08a turns the default off.) - [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. (Two tours a side on 4 cores at this head against main @ 65488813, ABBA.) - [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`. (Off: on main the 4-core tours showed no gain and 1.3-1.4 GB more memory. Its row is an attempt.) - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Built on Windows: the builder's llvm-mingw build of a35e5edd, run in the tours above. On Linux only checks: `tests/test_tex_prep.py` (`tex_prep.h` with g++ 13.3) and the `--changed` suite in WSL Ubuntu 24.04. No Linux build was done.) - [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): textures prepared on worker threads as the game makes them, on PCs of 8 usable CPUs or fewer (RX_VK_TEX_PREP)
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 16s
PR description / Description follows the template (pull_request_target) Successful in 18s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 24s
CI / Workflow lint (actionlint) (pull_request) Successful in 27s
Third-party parts / As their notes say (pull_request) Successful in 31s
CI / Website build and checks (pull_request) Has been cancelled
429766c8d0
Arriving in an area, the replay thread copied, hashed and laid out every new texture's storage at its first draw: on 4
cores the uploads and lookups of an arrival's first 3 s took 74 and 156 ms, and its longest frame was 134 ms (median).

As the game announces a texture (nvnTextureInitialize), worker threads at below-normal priority copy its storage, hash
the copy and lay it out in a buffer of their own: ASTC as whole layers for the GPU decoder, native BC and uncompressed
textures under 8 MB unswizzled (tex_prep.h's rules). A whole upload takes the worker's buffer only when the storage, read
as the upload reads it, hashes the same; anything else, or a texture not prepared in time, uploads as before. The
buffers the GPU is done with are freed at the frame's end; RX_VK_TEX_PREP_MB (1024) bounds what is held, the oldest let
go first. RX_VK_TEX_PREP=2 also uploads each the old way and compares.

An hw switch: unset, on with 8 usable CPUs or fewer, off above; =1 or =0 either way. Teleport tours on 4 cores
(2 off, 1 on): an arrival's excess frame time median 496 -> 399 ms, its longest frame median 134 -> 94 ms and max
349 -> 148 ms, uploads 74 -> 54 ms and lookups 156 -> 99 ms; 16 cores (2 a side): no change; about 1 GB more private
memory on both. A 16-core check run (=2): 10,298 unswizzled and 10,736 ASTC uploads, all the same. tests/test_tex_prep.py
runs tex_prep.h's rules and checks the wiring in the source;
tests/texture_staging_publication_test.cpp's fixture gets stand-ins for the prep's names upload_astc_gpu now reads.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean added this to the WIP project 2026-11-20 06:43:24 +00:00
GummiNaomi force-pushed perf/tex-prep-workers from 429766c8d0
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 16s
PR description / Description follows the template (pull_request_target) Successful in 18s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 24s
CI / Workflow lint (actionlint) (pull_request) Successful in 27s
Third-party parts / As their notes say (pull_request) Successful in 31s
CI / Website build and checks (pull_request) Has been cancelled
to abb0cb0e43
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
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 22s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
Third-party parts / As their notes say (pull_request) Successful in 32s
CI / Website build and checks (pull_request) Has been cancelled
2026-11-20 07:46:21 +00:00
Compare
GummiNaomi force-pushed perf/tex-prep-workers from abb0cb0e43
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
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 22s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 20s
Third-party parts / As their notes say (pull_request) Successful in 32s
CI / Website build and checks (pull_request) Has been cancelled
to a35e5eddd9
Some checks reported errors
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
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 17s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Third-party parts / As their notes say (pull_request) Successful in 23s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 6s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/any 0/1 pass, 2 error
CI / Website build and checks (pull_request) Has been cancelled
2026-11-20 07:51:07 +00:00
Compare
Owner

1GB more memory is big

@Beanstalk

1GB more memory is big @Beanstalk
Member
Beanstalk test farm · an earlier run: commit a35e5ed (the newer results are in a comment below)

Commit a35e5ed · tier reviewed · approved by HumanBean · dashboard

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

A short teleport tour compares main and the PR at default settings, then repeats with texture-preparation byte checking forced on. It covers Kokiri Forest, Hyrule Field and Kakariko Village, including a return visit, in about 20 minutes per tester. The plan measures arrival hitches and peak process memory, and compares arrival pictures. Crashes, texture-check mismatches, materially worse hitches or memory, and large visual differences fail the plan; the memory limit allows for the reported extra allocation.

  • Where: any (any PC, 1-2 reports).
  • Matrix: 1 cell, each on main and the PR: RX_VK_TEX_PREP 2 (PR only).
  • default-tour: from the repository's save kokiri-start, then teleport to Hyrule Field, take the picture field to compare with main, teleport to Kakariko Village, take the picture village to compare with main, teleport to Kokiri Forest, measure forest for 20 s (after 2 s warm-up), take the picture forest to compare with main; 1 run on each side.
  • checked-tour: from the repository's save kokiri-start, then teleport to Kokiri Forest, teleport to Hyrule Field, take the picture field-check to compare with main, teleport to Kakariko Village, measure checked-forest for 20 s (after 2 s warm-up), take the picture forest-check to compare with main; 1 run on each side.
  • Measured: crashes, frame times, stutters and hitches, memory and CPU time, load times, the game's log.
  • The PR fails if: it crashes; or a picture differs from main by more than 10%; or peak memory is more than 60% above main; or longest load is more than 50% above main; or hitches over 50 ms in the whole run is more than 50% above main; or forbidden log lines is above 0; or worst frame time in the whole run is more than 50% above main.
  • Time: about 22 min of game runs per tester (4 game starts), plus the two builds.

Done (started 08:00 UTC, last report 08:38 UTC). Comment @Beanstalk to run it again.

Target Reports Crash Frame p99 (ms) vs main VRAM peak (MB) vs main Result
any · 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4080, 621.1.0 2/1 1 2 none — — error

Measurements · any

Verdict: could not be judged on any (2/1 report).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0 AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4080, 621.1.0 AMD Ryzen 7 9800X3D 8-Core Processor, 32 GB RAM
Scene: default-tour, from the repository's save kokiri-start; checked-tour, from the repository's save kokiri-start; 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); default-tour: 1 game start a side, forest 20 s after 2 s warm-up; checked-tour: 1 game start a side, checked-forest 20 s after 2 s warm-up; 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 (peak memory) Helps / doesn't help / untested
RX_VK_TEX_PREP switch the PR adds (set on the PR side only) 2 not in main the PR's default checked-tour, main without it → the PR with 2: not measured untested
Markdown for the PR description
## Measurements

**Verdict:** could not be judged on any (2/1 report).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4080, 621.1.0` `AMD Ryzen 7 9800X3D 8-Core Processor, 32 GB RAM`  
Scene: default-tour, from the repository's save kokiri-start; checked-tour, from the repository's save kokiri-start; 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); default-tour: 1 game start a side, forest 20 s after 2 s warm-up; checked-tour: 1 game start a side, checked-forest 20 s after 2 s warm-up; 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 (peak memory) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `RX_VK_TEX_PREP` | switch the PR adds (set on the PR side only) | `2` | not in main | the PR's default | checked-tour, main without it → the PR with 2: not measured | untested |
<!-- beanstalk:previous --> <details><summary>Beanstalk test farm · an earlier run: commit <code>a35e5ed</code> (the newer results are in a comment below)</summary> Commit `a35e5ed` · tier **reviewed** · approved by HumanBean · [dashboard](https://beanstalk.magicbean.dev/prs/1847) **What will be tested** · AI plan (`gpt-6.1-terra`) A short teleport tour compares main and the PR at default settings, then repeats with texture-preparation byte checking forced on. It covers Kokiri Forest, Hyrule Field and Kakariko Village, including a return visit, in about 20 minutes per tester. The plan measures arrival hitches and peak process memory, and compares arrival pictures. Crashes, texture-check mismatches, materially worse hitches or memory, and large visual differences fail the plan; the memory limit allows for the reported extra allocation. - **Where:** any (any PC, 1-2 reports). - **Matrix:** 1 cell, each on main and the PR: RX_VK_TEX_PREP `2` (PR only). - **default-tour:** from the repository's save `kokiri-start`, then teleport to Hyrule Field, take the picture field to compare with main, teleport to Kakariko Village, take the picture village to compare with main, teleport to Kokiri Forest, measure forest for 20 s (after 2 s warm-up), take the picture forest to compare with main; 1 run on each side. - **checked-tour:** from the repository's save `kokiri-start`, then teleport to Kokiri Forest, teleport to Hyrule Field, take the picture field-check to compare with main, teleport to Kakariko Village, measure checked-forest for 20 s (after 2 s warm-up), take the picture forest-check to compare with main; 1 run on each side. - **Measured:** crashes, frame times, stutters and hitches, memory and CPU time, load times, the game's log. - **The PR fails if:** it crashes; or a picture differs from main by more than 10%; or peak memory is more than 60% above main; or longest load is more than 50% above main; or hitches over 50 ms in the whole run is more than 50% above main; or forbidden log lines is above 0; or worst frame time in the whole run is more than 50% above main. - **Time:** about 22 min of game runs per tester (4 game starts), plus the two builds. Done (started 08:00 UTC, last report 08:38 UTC). Comment `@Beanstalk` to run it again. | Target | Reports | Crash | Frame p99 (ms) vs main | VRAM peak (MB) vs main | Result | | --- | --- | --- | --- | --- | --- | | any · 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4080, 621.1.0` | 2/1 [1](https://beanstalk.magicbean.dev/reports/rp_d5c7a3a00cdc8cf9) [2](https://beanstalk.magicbean.dev/reports/rp_91e1da1b838809ef) | none | — | — | error | #### Measurements · any **Verdict:** could not be judged on any (2/1 report). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4080, 621.1.0` `AMD Ryzen 7 9800X3D 8-Core Processor, 32 GB RAM` Scene: default-tour, from the repository's save kokiri-start; checked-tour, from the repository's save kokiri-start; 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); default-tour: 1 game start a side, forest 20 s after 2 s warm-up; checked-tour: 1 game start a side, checked-forest 20 s after 2 s warm-up; 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 (peak memory) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_TEX_PREP` | switch the PR adds (set on the PR side only) | `2` | not in main | the PR's default | checked-tour, main without it → the PR with 2: not measured | untested | <details><summary>Markdown for the PR description</summary> ```markdown ## Measurements **Verdict:** could not be judged on any (2/1 report). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4080, 621.1.0` `AMD Ryzen 7 9800X3D 8-Core Processor, 32 GB RAM` Scene: default-tour, from the repository's save kokiri-start; checked-tour, from the repository's save kokiri-start; 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); default-tour: 1 game start a side, forest 20 s after 2 s warm-up; checked-tour: 1 game start a side, checked-forest 20 s after 2 s warm-up; 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 (peak memory) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `RX_VK_TEX_PREP` | switch the PR adds (set on the PR side only) | `2` | not in main | the PR's default | checked-tour, main without it → the PR with 2: not measured | untested | ``` </details> </details>
GummiNaomi changed title from WIP: perf(vk): textures prepared on worker threads as the game makes them, on PCs of 8 usable CPUs or fewer (RX_VK_TEX_PREP) to perf(vk): textures prepared on worker threads as the game makes them, on PCs of 8 usable CPUs or fewer (RX_VK_TEX_PREP) 2026-11-20 08:04:45 +00:00
GummiNaomi force-pushed perf/tex-prep-workers from a35e5eddd9
Some checks reported errors
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
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 17s
CI / Workflow lint (actionlint) (pull_request) Successful in 18s
Third-party parts / As their notes say (pull_request) Successful in 23s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 6s
beanstalk/approval approved by HumanBean (reviewed)
beanstalk/any 0/1 pass, 2 error
CI / Website build and checks (pull_request) Has been cancelled
to ebd6c08acc
Some checks reported errors
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
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Failing after 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval approved by GummiNaomi (reviewed)
beanstalk/steamdeck 0/1 pass, 0 running, 0 queued
beanstalk/windows 0/1 pass, 2 error
CI / Website build and checks (pull_request) Failing after 4m25s
2026-11-20 14:51:42 +00:00
Compare
Member

Beanstalk test farm · 🔄 testing (2 of 2 reports so far)

Commit ebd6c08 · approved by GummiNaomi (reviewed) · dashboard

Done (started 14:53 UTC, last report 15:10 UTC). Comment @Beanstalk to run it again.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
steamdeck ⏳ queued 0 of 1 — — —
windows ⚠️ 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.

  • windows, report 1: the main base failed (exit 1): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  • windows, report 2: no scenario could be judged: a step ran out of time: timeout: not met in time
What was tested

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

On Steam Deck and Windows, two runs per side will tour six destinations from Kokiri Forest, spending 3.5 minutes in measured segments per tour. The PR with texture preparation enabled is compared with main unset; arrival-segment longest frames, whole-run hitches, peak resident memory and screenshots are recorded. Crashes or material screenshot differences fail the plan, while smoothness and memory are reported without requiring a gain. The farm cannot select Windows PCs by core count, enable the requested frame trace, or measure peak private memory; resident memory is a proxy and arrival-segment maxima exclude the preceding load.

  • Where: steamdeck (1-2 reports), windows (1-2 reports).
  • Matrix: 1 cell, each on main and the PR: RX_VK_TEX_PREP 1 (PR only).
  • teleport-tour: from the repository's save kokiri-start, then teleport to Market, take the picture market to compare with main, measure market for 35 s (after 0 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 35 s (after 0 s warm-up), teleport to Kakariko Village, take the picture kakariko to compare with main, measure kakariko for 35 s (after 0 s warm-up), teleport to Kokiri Forest, take the picture kokiri to compare with main, measure kokiri for 35 s (after 0 s warm-up), teleport to Lost Woods, take the picture woods to compare with main, measure woods for 35 s (after 0 s warm-up), teleport to Zora's River, take the picture river to compare with main, measure river for 35 s (after 0 s warm-up); 2 runs on each side.
  • Measured: crashes, frame times, stutters and hitches, memory and CPU time, the game's log.
  • The PR fails if: it crashes; or a picture differs from main by more than 5%; or forbidden log lines is above 0.
  • Time: about 34 min of game runs per tester (4 game starts), plus the two builds.
Measurements on `windows`, for the PR description

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

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0 AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3090, 621.1.0 AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM
Scene: teleport-tour, from the repository's save kokiri-start; 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); teleport-tour: 2 game starts a side, market 35 s after 0 s warm-up, field 35 s after 0 s warm-up, kakariko 35 s after 0 s warm-up, kokiri 35 s after 0 s warm-up, woods 35 s after 0 s warm-up, river 35 s after 0 s warm-up; 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)

Before: main @ 89c3d21 After: this PR @ ebd6c08
teleport-tour · RX_VK_TEX_PREP=1 (PR only) · forbidden log lines 0.0 0.0

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_TEX_PREP switch the PR adds (set on the PR side only) 1 not in main the PR's default teleport-tour, main without it → the PR with 1: not measured untested

As Markdown for the PR description:

## Measurements

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

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3090, 621.1.0` `AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM`  
Scene: teleport-tour, from the repository's save kokiri-start; 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); teleport-tour: 2 game starts a side, market 35 s after 0 s warm-up, field 35 s after 0 s warm-up, kakariko 35 s after 0 s warm-up, kokiri 35 s after 0 s warm-up, woods 35 s after 0 s warm-up, river 35 s after 0 s warm-up; 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)

| | Before: main @ 89c3d21 | After: this PR @ ebd6c08 |
|---|---|---|
| teleport-tour · `RX_VK_TEX_PREP=1 (PR only)` · forbidden log lines | 0.0 | 0.0 |

**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_TEX_PREP` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | teleport-tour, main without it → the PR with 1: not measured | untested |
The testers' hardware
Target Report Ran on
windows 1 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0 AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM
windows 2 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 3090, 621.1.0 AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM
<!-- beanstalk:sticky --> ### Beanstalk test farm · 🔄 testing (2 of 2 reports so far) Commit `ebd6c08` · approved by GummiNaomi (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/1847) Done (started 14:53 UTC, last report 15:10 UTC). Comment `@Beanstalk` to run it again. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `steamdeck` | ⏳ queued | 0 of 1 | — | — | — | | `windows` | ⚠️ couldn't be judged | 2 [1](https://beanstalk.magicbean.dev/reports/rp_f9718d2bb0553cad) [2](https://beanstalk.magicbean.dev/reports/rp_49c4339386c908cc) | — | — | 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. - `windows`, [report 1](https://beanstalk.magicbean.dev/reports/rp_f9718d2bb0553cad): `the main base failed (exit 1): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^` - `windows`, [report 2](https://beanstalk.magicbean.dev/reports/rp_49c4339386c908cc): `no scenario could be judged: a step ran out of time: timeout: not met in time` <details><summary>What was tested</summary> **What will be tested** · AI plan (`gpt-6.1-terra`) On Steam Deck and Windows, two runs per side will tour six destinations from Kokiri Forest, spending 3.5 minutes in measured segments per tour. The PR with texture preparation enabled is compared with main unset; arrival-segment longest frames, whole-run hitches, peak resident memory and screenshots are recorded. Crashes or material screenshot differences fail the plan, while smoothness and memory are reported without requiring a gain. The farm cannot select Windows PCs by core count, enable the requested frame trace, or measure peak private memory; resident memory is a proxy and arrival-segment maxima exclude the preceding load. - **Where:** steamdeck (1-2 reports), windows (1-2 reports). - **Matrix:** 1 cell, each on main and the PR: RX_VK_TEX_PREP `1` (PR only). - **teleport-tour:** from the repository's save `kokiri-start`, then teleport to Market, take the picture market to compare with main, measure market for 35 s (after 0 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 35 s (after 0 s warm-up), teleport to Kakariko Village, take the picture kakariko to compare with main, measure kakariko for 35 s (after 0 s warm-up), teleport to Kokiri Forest, take the picture kokiri to compare with main, measure kokiri for 35 s (after 0 s warm-up), teleport to Lost Woods, take the picture woods to compare with main, measure woods for 35 s (after 0 s warm-up), teleport to Zora's River, take the picture river to compare with main, measure river for 35 s (after 0 s warm-up); 2 runs on each side. - **Measured:** crashes, frame times, stutters and hitches, memory and CPU time, the game's log. - **The PR fails if:** it crashes; or a picture differs from main by more than 5%; or forbidden log lines is above 0. - **Time:** about 34 min of game runs per tester (4 game starts), plus the two builds. </details> <details><summary>Measurements on `windows`, for the PR description</summary> **Verdict:** could not be judged on windows (2 reports). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3090, 621.1.0` `AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM` Scene: teleport-tour, from the repository's save kokiri-start; 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); teleport-tour: 2 game starts a side, market 35 s after 0 s warm-up, field 35 s after 0 s warm-up, kakariko 35 s after 0 s warm-up, kokiri 35 s after 0 s warm-up, woods 35 s after 0 s warm-up, river 35 s after 0 s warm-up; 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) | | Before: main @ 89c3d21 | After: this PR @ ebd6c08 | |---|---|---| | teleport-tour · `RX_VK_TEX_PREP=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | **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_TEX_PREP` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | teleport-tour, main without it → the PR with 1: not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** could not be judged on windows (2 reports). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3090, 621.1.0` `AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM` Scene: teleport-tour, from the repository's save kokiri-start; 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); teleport-tour: 2 game starts a side, market 35 s after 0 s warm-up, field 35 s after 0 s warm-up, kakariko 35 s after 0 s warm-up, kokiri 35 s after 0 s warm-up, woods 35 s after 0 s warm-up, river 35 s after 0 s warm-up; 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) | | Before: main @ 89c3d21 | After: this PR @ ebd6c08 | |---|---|---| | teleport-tour · `RX_VK_TEX_PREP=1 (PR only)` · forbidden log lines | 0.0 | 0.0 | **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_TEX_PREP` | switch the PR adds (set on the PR side only) | `1` | not in main | the PR's default | teleport-tour, main without it → the PR with 1: not measured | untested | ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `windows` | [1](https://beanstalk.magicbean.dev/reports/rp_f9718d2bb0553cad) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3050 Ti Laptop GPU, 621.24.0` `AMD Ryzen 7 5800H with Radeon Graphics, 16 GB RAM` | | `windows` | [2](https://beanstalk.magicbean.dev/reports/rp_49c4339386c908cc) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 3090, 621.1.0` `AMD Ryzen 9 5900X 12-Core Processor, 128 GB RAM` | </details>
GummiNaomi changed title from perf(vk): textures prepared on worker threads as the game makes them, on PCs of 8 usable CPUs or fewer (RX_VK_TEX_PREP) to perf(vk): textures prepared on worker threads as the game makes them (RX_VK_TEX_PREP, off by default) 2026-11-20 14:52:17 +00:00
Author
Member

@HumanBean you were right about the memory. Measured at this PR's code on main (65488813, before the rebase), 4 cores, two teleport tours a side, ABBA: no smoother arrivals (median excess 350 → 396 ms, longest frame 104 → 133 ms median) and 1.3–1.4 GB more peak private memory. The earlier gain came from a build that also had #1810's moves. So RX_VK_TEX_PREP is now off by default on every PC (ebd6c08a, rebased onto 89c3d21e), an opt-in attempt; the description has the numbers.

@Beanstalk steamdeck, and windows with 6 to 8 cores: a 4-minute teleport tour from kokiri-start (Castle Town's market, Hyrule Field, Kakariko, Kokiri Forest, the Lost Woods, Zora's River), RX_VK_TEX_PREP=1 against unset, ABBA, RX_VK_FRAME_TRACE=1, with each arrival's longest frame and the peak private memory. The question is whether =1 makes arrivals smoother anywhere; expecting about 1 GB more memory with it.

(This replaces today's run, which ended in error before building: the farm's checkout of main failed git rev-parse --verify HEAD^{commit} in packs.py's cmd_base.)

@HumanBean you were right about the memory. Measured at this PR's code on main (65488813, before the rebase), 4 cores, two teleport tours a side, ABBA: no smoother arrivals (median excess 350 → 396 ms, longest frame 104 → 133 ms median) and 1.3–1.4 GB more peak private memory. The earlier gain came from a build that also had #1810's moves. So `RX_VK_TEX_PREP` is now off by default on every PC (ebd6c08a, rebased onto 89c3d21e), an opt-in `attempt`; the description has the numbers. @Beanstalk steamdeck, and windows with 6 to 8 cores: a 4-minute teleport tour from kokiri-start (Castle Town's market, Hyrule Field, Kakariko, Kokiri Forest, the Lost Woods, Zora's River), `RX_VK_TEX_PREP=1` against unset, ABBA, `RX_VK_FRAME_TRACE=1`, with each arrival's longest frame and the peak private memory. The question is whether `=1` makes arrivals smoother anywhere; expecting about 1 GB more memory with it. (This replaces today's run, which ended in `error` before building: the farm's checkout of main failed `git rev-parse --verify HEAD^{commit}` in packs.py's cmd_base.)
Author
Member

Closing: no gain at this head, and 1.3-1.4 GB more peak private memory, as @HumanBean said. On 4 cores arrivals were slightly worse with it on (median excess 350 -> 396 ms, longest frame 104 -> 133 ms), and the farm couldn't judge it. The earlier gain came from a build that also had #1810's moves.

Closing: no gain at this head, and 1.3-1.4 GB more peak private memory, as @HumanBean said. On 4 cores arrivals were slightly worse with it on (median excess 350 -> 396 ms, longest frame 104 -> 133 ms), and the farm couldn't judge it. The earlier gain came from a build that also had #1810's moves.
GummiNaomi closed this pull request 2026-11-20 21:02:02 +00:00
Some checks reported errors
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
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Failing after 5s
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval approved by GummiNaomi (reviewed)
beanstalk/steamdeck 0/1 pass, 0 running, 0 queued
beanstalk/windows 0/1 pass, 2 error
CI / Website build and checks (pull_request) Failing after 4m25s

Pull request closed

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!1847
No description provided.