perf(vk): RX_VK_TEX_AHEAD=2 prepares every block-compressed texture the game makes, not only those an earlier load drew #1813
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1813
Loading…
Reference in a new issue
No description provided.
Delete branch "GummiNaomi/Longshot:perf/tex-ahead-every"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
After a teleport or an area change, the first frames in the new place are slow because many textures are made and uploaded at their first draw. #1122's
RX_VK_TEX_AHEAD=1prepares textures during light frames, but only ones an earlier load drew at the same place in memory. An area change in play mostly draws textures the game made seconds before, at new places. This PR addsRX_VK_TEX_AHEAD=2, which prepares every block-compressed texture the game makes during light frames and keeps no list. It is off by default.Measured again at this head on a 12 GB card,
=2is not better than=1. It improves the Market and Hyrule Field entries, but the next area's entry (Kakariko after the Market) gets much worse: the budget fills with the Market's prepared textures, most of them never drawn, and evicts them again.=1has the best tails. See Measurements. The default stays off; whether=2stays as an option is for the Test Farm's 8 GB and Deck runs to settle.Changed in review (futondestroyer):
=2no longer readscache/longshot_textures_drawn.bin. The file is read throughtexture_ahead::load_list, which opens it only for a mode that uses the list, and only once a texture has been taken to look up in it (with=1it used to be read before the room check too).texture_ahead::room(cache, budget, cost)withahead_cost(texture_ahead::cost_bound, an upper bound from the descriptor: decoded ASTC at RGBA8 or BC's whole blocks, whichever is more). A texture that would take the 256 MB reserve is made at its first draw instead. Before, the cache was checked as it stood and the image charged afterwards, so the last texture prepared could go past the reserve by its own size. The allocator's rounding of that one image is still outside the bound.Read first:
gpu/vk/texture_ahead.h(mode,uses_list,load_list,room,cost_bound), thentexture_ahead_run,ahead_loadandahead_costingpu/vk/vk_texture.cpp, andtests/test_texture_ahead.cpp.See #1122. Related: #1810 changes the same loop (a move not yet registered is skipped); the two merge cleanly, with that skip kept.
Testing
Tested: Windows 11 Pro 26200, RTX 4070 SUPER 12 GB (NVIDIA 617.42), Ryzen 9 9950X3D with SMT off, 32 GB, at
3af1d156. One warm-up tour, then 12 measured teleport tours:=0,=1and=2interleaved 0,1,2,2,1,0, at 16 cores and again held to 4 cores (affinity 0xF00). All three areas reached in every run, no device-lost, out-of-memory or fatal lines in the logs. With=2the log has notextures drawn before are knownline (the list isn't read); with=1it has one.Checks at
3af1d156:tests/test_texture_ahead.pypasses on Windows (clang) and on Linux (WSL Ubuntu 24.04, g++).tests/test_switch_table.pypasses on Windows.!load_list(2, …)). With the cost ignored,!room(2000 MB, 2400 MB, 145 MB)fails. Withahead_loadcalled before the room check and for=2, the source check fails ("the list is asked for with RX_VK_TEX_AHEAD=2").gpu/vk/vk_texture.cppcompiles syntax-only with the builder's Windows flags.65488813(MSVC headers under-Werror, a missing Tooling checkout, markers other changes on main moved). None is this PR's.Still to test:
windows+vram8gb): the teleport walk withRX_VK_TEX_AHEAD0, 1 and 2, expecting=2to evict more than here and its second arrival to be slower than with 0 (Test Farm: running, @Beanstalk)windows+vram12gb): the same, expecting about what Measurements shows (Test Farm: running, @Beanstalk)steamdeck): the same, expecting=2no better than=1and no out-of-memory messages (Test Farm: running, @Beanstalk)=2, expecting no errors (by hand)Measurements
Verdict: on a 12 GB card at this head,
=2doesn't beat=1. Its slow-frame time after arrivals is no better than=0(825, 646 ms against 849, 683 at 16 cores). Its worst frame is worse (439-696 ms against 308-669 for=0and 235-385 for=1), all of it at the second arrival. It evicts ~2.5-3 times as many textures for the budget.=1has the fewest frames of 33 ms or more and the lowest p99 on both core counts. Off stays the default.Setup: the hardware in Testing; the build of this PR @
3af1d156(base main @65488813). Main's defaults (the control tool's--profile test, so nolongshot_env.txt) plusRX_VK_FRAME_TRACE=1andRX_VK_TEX_AHEAD=0/1/2. The tour:kokiri-startsave, then the debug teleport to the Market, Kakariko Village and Hyrule Field (child), ~35 s of walking in each. Runs interleaved 0,1,2,2,1,0, after one=1warm-up run that filled the list and the pipeline caches. Measured:vk: textures ahead:andtextures retiredlinesBaseline: this PR's own build with
RX_VK_TEX_AHEAD=0and=1. Those are main's two behaviours, unchanged by this PR except for the room check, and one build lets the three values run interleaved on the same binary. Each cell gives the two runs of that value.=0): this PR @3af1d156=1): this PR @3af1d156=2): this PR @3af1d156With
=2, the worst frame of each run is the Kakariko entry, the second arrival. That frame spent 202-525 ms on uploads: the cache was full of the Market's prepared textures, which the budget then evicted, and Kakariko's own textures had found no room ahead. GPU memory peaks about the same in all three because the budget holds it, so the cost shows as eviction churn rather than as a higher peak.The earlier numbers in this description (arrival slow time halved) came from
54a42715with uncapped play settings and the rule in a temporary form. They don't reproduce on current main with its defaults, so they have been replaced by the table above.Risks
=2, many images are made that are never drawn. The budget evicts them again, ~2.5-3 times main's budget evictions over this tour, and the next area's first frame can be slower than with the switch off (up to ~700 ms here, against ~200-300 ms). A smaller card should see this sooner. The light-frame time it uses is bounded byRX_VK_TEX_AHEAD_MS. The room check now keeps the 256 MB reserve after the image is made, so=1and=2prepare slightly less near the budget than before; a texture that doesn't fit is made at its first draw, as with the switch off.RX_VK_TEX_AHEADunset (the default), or use1.longshot_options.ini.cache/longshot_textures_drawn.binis read and grown with=1as before; with=2it is neither read nor written.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (The changed files' checks on Windows and Linux; every failure also fails on the base65488813.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Recommendation: Request changes. Mode 2 still loads the previous-draw list, and the proposed all-BC policy needs exact-head evidence for memory pressure and frame pacing.
Does it help: Unproven for this head. GummiNaomi's historical notes report combined arrival waits of 486–1086 ms falling to 200–601 ms, with 6.3–6.9 GB additional prepared image bytes and roughly 7,600–8,500 never-drawn preparations. Prepared bytes are not peak resident VRAM. The run was on older
54a42715with a temporary rule and two non-interleaved runs per arm.Other systems: Recheck low-VRAM GPUs and Deck, measuring peak residency, eviction churn and light-frame tails, as well as arrival waits.
Switches: RX_VK_TEX_AHEAD=2 is opt-in and widens the existing mode 1 policy.
Reviewed:
78143225against0de25c3e, with exact Graphify maps and source verification. Read texture-ahead loading, admission, allocation and source checks. Nothing run.Fixed in this review: Nothing.
Checked and fine: Mode 2 bypasses the membership filter; mode 1 retains it. The pre-allocation budget gate remains in place.
Blocking
gpu/vk/vk_texture.cpp:3011: the path still loads and populates the previous-draw set before mode and room checks. Mode 2 then ignores it, so even an empty or budget-blocked queue can pay the file read and startup cost. Skip loading in mode 2 and add a seeded-file test that confirms mode 1 still reads it.gpu/vk/vk_texture.cpp:3012,3023: the check sees current use plus reserve before creating the candidate; the allocation is charged afterward. Treat it as a soft preflight in the description or account for candidate cost if promising a hard reserve. Establish the real cost with matched exact-head A/B evidence before merge.Testing: The head has no gameplay or measurement receipt and the description and Guide screenshots checks are red. Record current-main comparisons and the actual scope of completed game-free checks after rebase.
Overlaps and merge order: #1810 changes the same texture-ahead loop. Preserve its pending-move skip if both land; measure independently first, then test both switches together.
@ -3000,3 +3015,3 @@}if (!ahead_queue.take(now, &t)) break;known = ahead_drawn.count(ahead_signature(t.d, t.L, t.gpu)) != 0;known = ahead_all() || ahead_drawn.count(ahead_signature(t.d, t.L, t.gpu)) != 0;This bypasses the learned-list lookup but the unconditional ahead_load above still opens and populates it. Guard the load and test mode 2 with a seeded list.
78143225a2e9d6b5ddb4Let's see if this is better for all and maybe replace the old one (-1)?
@Beanstalk
Beanstalk test farm · an earlier run: commit
e9d6b5d(the newer results are in a comment below)Commit
e9d6b5d· tier reviewed · approved by HumanBean · dashboardWhat will be tested · AI plan (
gpt-6.1-terra)On Windows 8 GB and 12 GB GPUs and Steam Deck, this plan compares texture-ahead modes 0, 1 and 2 on main and the PR during two teleport walks through Market, Kakariko Village and Hyrule Field. The mode axis checks the new policy against both off and the previous policy; each tester takes roughly 33 minutes. It measures whole-run hitches, frame times, peak VRAM and load times, and compares arrival screenshots. Crashes, out-of-memory or device-lost messages, visual differences, excessive regressions against main, or more PR-side hitches in mode 2 than in mode 0 fail the plan.
0or1or2.kokiri-start, then 2 times: teleport to Market, move the stick, teleport to Kakariko Village, teleport to Hyrule Field, take the picture field to compare with main, measure field for 20 s (after 0 s warm-up); 1 run on each side for each of 3 cells (3 game starts a run).Started at 07:49 UTC.
Estimate: done in about 4 h 30 min, from the queue and the testers online now; some jobs can't start yet.
RX_VK_TEX_AHEAD=0RX_VK_TEX_AHEAD=0RX_VK_TEX_AHEAD=0RX_VK_TEX_AHEAD=1RX_VK_TEX_AHEAD=1RX_VK_TEX_AHEAD=1RX_VK_TEX_AHEAD=2RX_VK_TEX_AHEAD=2RX_VK_TEX_AHEAD=2e9d6b5ddb4415777aa95Beanstalk test farm · ❌ failed on windows+vram8gb, windows+vram12gb, steamdeck
Commit
3af1d15· approved by GummiNaomi (reviewed) · dashboardStarted at 2026-11-20 13:14 UTC.
windows+vram8gb(8 GB VRAM)windows+vram12gb(12 GB VRAM)steamdeckteleport-tour· frame time p99 (ms), main → PR at each levelRX_VK_TEX_AHEAD=0(reference)RX_VK_TEX_AHEAD=1RX_VK_TEX_AHEAD=2windows+vram8gb(8 GB VRAM)windows+vram12gb(12 GB VRAM)steamdeckWhy it failed
windows+vram8gb:teleport-tour · RX_VK_TEX_AHEAD=0screenshot.max_diff:limit 0.1windows+vram8gb:teleport-tour · RX_VK_TEX_AHEAD=2crash:1 PR run crashedwindows+vram8gb:teleport-tour · RX_VK_TEX_AHEAD=2load_time_max_s.max_delta_pct:0.0 → 0.5 (+1075.0%); limit 30.0windows+vram8gb:teleport-tour · RX_VK_TEX_AHEAD=2log_forbidden_hits.max:1.0 → 1.0; limit 0.0windows+vram12gb:teleport-tour · RX_VK_TEX_AHEAD=0screenshot.max_diff:limit 0.1windows+vram12gb:teleport-tour · RX_VK_TEX_AHEAD=0kokiri-first.vram_peak_mb.max_delta_pct:5,553 → 9,133 (+64.5%); limit 15.0windows+vram12gb:teleport-tour · RX_VK_TEX_AHEAD=1kokiri-first.vram_peak_mb.max_delta_pct:6,097 → 7,269 (+19.2%); limit 15.0windows+vram12gb:teleport-tour · RX_VK_TEX_AHEAD=2kokiri-first.vram_peak_mb.max_delta_pct:7,587 → 8,749 (+15.3%); limit 15.0Couldn'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+vram12gb, report 1:the pull request's pack failed (exit 1): Failed to find real location of Z:\tools\python\python.exeWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)The plan runs the requested teleport tour from Kokiri Forest through Market, Kakariko and Hyrule Field and back on Windows 8 GB, Windows 12 GB and Steam Deck targets. It compares texture-ahead modes 0, 1 and 2 on main and the PR, measuring post-arrival frame tails, memory, load times and eviction counts if the available logs match the supplied pattern. The plan cannot set the requested frame-trace switch, so individual loading-frame maxima may require follow-up. Each target takes roughly 35 minutes; crashes, device loss, out-of-memory errors, visual mismatches or specified regressions fail the PR.
0or1or2.kokiri-start, then teleport to Kokiri Forest, measure kokiri-first for 5 s (after 0 s warm-up), move the stick, teleport to Market, measure market for 5 s (after 0 s warm-up), take the picture market to compare with main, teleport to Kakariko Village, measure kakariko for 5 s (after 0 s warm-up), take the picture kakariko to compare with main, teleport to Hyrule Field, measure field for 5 s (after 0 s warm-up), take the picture field to compare with main, measure kokiri-return for 5 s (after 0 s warm-up), take the picture kokiri-return to compare with main; 1 run on each side for each of 3 cells (3 game starts a run).Measurements on `windows+vram8gb`, for the PR description
Verdict: fail on windows+vram8gb (2 reports):
teleport-tour screenshot.max_diff;teleport-tour crash;teleport-tour load_time_max_s.max_delta_pct (+1075.0%)failed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 3070, 621.24.0AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 2080 SUPER, 621.24.0Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz, 16 GB RAMScene: 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: 1 game start a side, kokiri-first 5 s after 0 s warm-up, market 5 s after 0 s warm-up, kakariko 5 s after 0 s warm-up, field 5 s after 0 s warm-up, kokiri-return 5 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 (
@Beanstalkon this PR runs it again)65488813af1d15RX_VK_TEX_AHEAD=0· field · peak VRAM (MB)RX_VK_TEX_AHEAD=0· market · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kakariko · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kokiri-return · peak VRAM (MB)RX_VK_TEX_AHEAD=0· longest load (s)RX_VK_TEX_AHEAD=0· field · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· market · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kakariko · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kokiri-return · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· forbidden log linesRX_VK_TEX_AHEAD=1· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=1· longest load (s)RX_VK_TEX_AHEAD=1· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· forbidden log linesRX_VK_TEX_AHEAD=2· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=2· longest load (s)RX_VK_TEX_AHEAD=2· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=2· forbidden log linesFlags and settings
RX_VK_TEX_AHEAD0,1,2As Markdown for the PR description:
Measurements on `windows+vram12gb`, for the PR description
Verdict: fail on windows+vram12gb (2 reports):
teleport-tour screenshot.max_diff;teleport-tour kokiri-first.vram_peak_mb.max_delta_pct (+64.5%);teleport-tour kokiri-first.vram_peak_mb.max_delta_pct (+19.2%)failed.Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 4070 Ti, 621.14.0AMD Ryzen 9 5900X 12-Core Processor, 64 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpuNVIDIA GeForce RTX 3080 Ti, 621.24.0AMD Ryzen 9 5900X 12-Core Processor, 64 GB RAMScene: 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: 1 game start a side, kokiri-first 5 s after 0 s warm-up, market 5 s after 0 s warm-up, kakariko 5 s after 0 s warm-up, field 5 s after 0 s warm-up, kokiri-return 5 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 (
@Beanstalkon this PR runs it again)65488813af1d15RX_VK_TEX_AHEAD=0· field · peak VRAM (MB)RX_VK_TEX_AHEAD=0· market · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kakariko · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kokiri-return · peak VRAM (MB)RX_VK_TEX_AHEAD=0· longest load (s)RX_VK_TEX_AHEAD=0· field · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· market · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kakariko · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kokiri-return · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· forbidden log linesRX_VK_TEX_AHEAD=1· field · peak VRAM (MB)RX_VK_TEX_AHEAD=1· market · peak VRAM (MB)RX_VK_TEX_AHEAD=1· kakariko · peak VRAM (MB)RX_VK_TEX_AHEAD=1· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=1· kokiri-return · peak VRAM (MB)RX_VK_TEX_AHEAD=1· longest load (s)RX_VK_TEX_AHEAD=1· field · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· market · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· kakariko · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· kokiri-return · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· forbidden log linesRX_VK_TEX_AHEAD=2· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=2· longest load (s)RX_VK_TEX_AHEAD=2· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=2· forbidden log linesFlags and settings
RX_VK_TEX_AHEAD0,1,2As Markdown for the PR description:
Measurements on `steamdeck`, for the PR description
Verdict: fail on steamdeck (1 report):
teleport-tour screenshot.max_diff;teleport-tour load_time_max_s.max_delta_pct (+24200.0%)failed.Hardware: 1: linux+amd+radv+igpu+handheld
AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 12 GB RAMScene: 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: 1 game start a side, kokiri-first 5 s after 0 s warm-up, market 5 s after 0 s warm-up, kakariko 5 s after 0 s warm-up, field 5 s after 0 s warm-up, kokiri-return 5 s after 0 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)65488813af1d15RX_VK_TEX_AHEAD=0· market · peak VRAM (MB)RX_VK_TEX_AHEAD=0· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=0· longest load (s)RX_VK_TEX_AHEAD=0· market · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=0· forbidden log linesRX_VK_TEX_AHEAD=1· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=1· market · peak VRAM (MB)RX_VK_TEX_AHEAD=1· longest load (s)RX_VK_TEX_AHEAD=1· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· market · frame time (p99) (ms)RX_VK_TEX_AHEAD=1· forbidden log linesRX_VK_TEX_AHEAD=2· kokiri-first · peak VRAM (MB)RX_VK_TEX_AHEAD=2· longest load (s)RX_VK_TEX_AHEAD=2· kokiri-first · frame time (p99) (ms)RX_VK_TEX_AHEAD=2· forbidden log linesFlags and settings
RX_VK_TEX_AHEAD0,1,2As Markdown for the PR description:
The testers' hardware
windows+vram8gbNVIDIA GeForce RTX 3070, 621.24.0AMD Ryzen 5 5600X3D 6-Core Processor, 32 GB RAMwindows+vram8gbNVIDIA GeForce RTX 2080 SUPER, 621.24.0Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz, 16 GB RAMwindows+vram12gbNVIDIA GeForce RTX 4070 Ti, 621.14.0AMD Ryzen 9 5900X 12-Core Processor, 64 GB RAMwindows+vram12gbNVIDIA GeForce RTX 3080 Ti, 621.24.0AMD Ryzen 9 5900X 12-Core Processor, 64 GB RAMsteamdeckAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 12 GB RAMThanks @futondestroyer. Both blocking points are fixed in
3af1d156. That commit is also what I measured below.1. Mode 2 still read the list (
vk_texture.cpp~3011). Fixed at the root. The file is now read through a new function,texture_ahead::load_list(mode, path, set)intexture_ahead.h. It opens the file only for a mode that uses the list (uses_list: not 0, not 2).texture_ahead_runasks for the list only after it has taken a texture to look up, and never with=2, so a run blocked by the budget or with an empty queue doesn't read it either.RX_VK_TEX_AHEADis now parsed once, bytexture_ahead::mode.tests/test_texture_ahead.cppwrites a list to disk.load_list(1, …)must read it, andload_list(2, …)andload_list(0, …)must leave the set empty. With the old behaviour (the file read whatever the mode) the test fails at!load_list(2, …) && back.empty().tests/test_texture_ahead.pyalso checks the renderer:ahead_loadgoes throughload_list, andtexture_ahead_runcalls it once, aftertakeand behindif (!ahead_all()). With the old call put back (before the room check, for=2too), it fails with "the list is asked for with RX_VK_TEX_AHEAD=2".=2runs below log notextures drawn before are knownline. The=1runs log it once.2. The reserve check ran before the candidate was made (~3012/3023). I went for the hard reserve. The texture taken is now checked with its own cost:
texture_ahead::room(total_bytes, budget, ahead_cost(t)).ahead_costusestexture_ahead::cost_bound, an upper bound worked out from the descriptor. Decoded ASTC counts as RGBA8 or as BC's whole 4x4 blocks, whichever is more at each level; other block formats count as whole blocks × bytes per block. Layers, faces and depth are included. A texture that would take the 256 MB reserve is not prepared and gets made at its first draw, as with the switch off. The cache-only check beforetakeis still there, so a full cache still stops the loop without taking anything from the queue.padthatcreateadds). So "never within 256 MB" holds up to one image's rounding.room(2000 MB, 2400 MB, 144 MB)passes and145 MBfails, pluscost_boundcases for BC1 mips, a BC3 array, and ASTC 8x8 decoded (RGBA8, and BC's 16-byte floor at 1x1). With the cost ignored, the test fails at!room(2000 * MB, 2400 * MB, 145 * MB).git merge-treeof this head with #1810 (e841323c) is clean, and #1810'stexture_move_wantedskip stays right afterif (!known) continue;.Checks at
3af1d156:test_texture_ahead.pyandtest_switch_table.pypass on Windows (clang).test_texture_ahead.pypasses on Linux (WSL Ubuntu 24.04, g++).vk_texture.cppcompiles syntax-only with the builder's Windows flags. Of the checks that read the changed files, 19 fail on Windows and 15 on Linux, and every one of those fails the same way on this PR's base65488813. The Guide screenshots check passes locally. The description check was red because of the old template; the new description follows the current one.What my own runs say about 0 vs 1 vs 2 at this head (for @HumanBean's question; the default is unchanged in this push).
Setup: Windows 11, RTX 4070 SUPER 12 GB, 9950X3D (SMT off), main's defaults (the control tool's test profile) plus
RX_VK_FRAME_TRACE=1. The tour:kokiri-start, then teleport to Market, Kakariko and Hyrule Field, ~35 s walking in each. Runs were interleaved 0,1,2,2,1,0 at 16 cores, then again held to 4 cores (0xF00). Each value is one run.=0=1=2My reading: on this 12 GB card,
=2doesn't beat=1at this head, and on tails it is worse than both.=0and 235-385 ms with=1. The likely cause: the Market's prepared textures (most never drawn) fill the budget, the budget evicts them, and the runs have ~2.5-3 times the budget evictions, and the Kakariko entry frame spends 202-525 ms on uploads.=1has the best tails on both core counts.The halving in the old description, measured at
54a42715with uncapped play settings, doesn't reproduce on current main with its defaults. I've replaced those numbers in the description with these.So I wouldn't replace
=1with=2on this evidence. The farm's 8 GB and Deck cells are the ones to watch, since a smaller budget should make the crowding worse. If=2is kept as an option, a follow-up could stop preparing ahead once the cache passes some share of its budget, rather than only near the reserve. That isn't in this PR. Also not in this push: theahead_all()comment invk_texture.cppstill quotes the old54a42715numbers. I left it so the pushed head is exactly the build I measured; it gets rewritten or removed once the farm settles what=2becomes.Not measured: Linux, AMD, 8 GB cards, the Deck, adult areas, and the Market→Kakariko order reversed.
@Beanstalk windows+vram8gb, windows+vram12gb and steamdeck: the teleport walk from kokiri-start (Kokiri Forest, Castle Town market, Kakariko, Hyrule Field, back to Kokiri) with
RX_VK_TEX_AHEAD0, 1 and 2,RX_VK_FRAME_TRACE=1. Measure each arrival's longest frame and the eviction counts. Expecting on 8 GB and the Steam Deck=2to evict more and its second arrivals no better than=1(that is the question for the default); on 12 GB about what the description's Measurements shows.(Earlier runs on #1846 and #1847 today ended in
errorbefore building: the farm's checkout of main failedgit rev-parse --verify HEAD^{commit}in packs.py's cmd_base, so nothing was measured there.)GummiNaomi referenced this pull request2026-11-20 13:15:09 +00:00
The farm run on
3af1d156is complete (8 GB and 12 GB Windows, and the Steam Deck). A summary, since the sticky marks every target failed:Slowest frames (p99) on the teleport tour, main → this PR:
=1(the current list)=2(every texture)So on all three,
=2gives the lower tails and=1is the weaker of the two. @HumanBean, on replacing=1: these numbers support it. My own 12 GB runs (in the description) had=1slightly ahead of=2on the arrivals' slow-frame time, so the two measures disagree there; on the 8 GB card and the Deck the farm's gap is large. I'm happy to make=1take this PR's policy (every texture) and drop the old list, if you'd like that in this PR.What the failures are:
=2run, inside NVIDIA's shader compilernvgpucomp64.dll, with ~3.6 GB of textures made) is the open one: a main run on that same PC also crashed (stack overflow) in another cell, so it isn't attributable yet. Another 8 GB run would settle it.kokiri-firstVRAM peak is +64 % at=0, where this PR changes nothing; and the Deck's=0row is −49 %, also a cell this PR doesn't touch. These cells show the run-to-run spread, which is why I'd read only the=1/=2columns above.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.