fix(vk): simulated-turf lists keep the game's size in areas without turf, so Hyrule Field no longer stalls 250 ms at a time on the way in #2174
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2174
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/sim-turf-stock-floor"
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
Walking from Market back into Hyrule Field drops the game to about 1 fps for 10 to 15 seconds when
RX_VK_SIM_TURF_ADAPTIVEis on, as it is by default. A player's log, Windows on an RTX 4070 SUPER (NVIDIA 621.24) atmain@9e10f6f7, shows fourvk: a capture's wait for write-back N timed outlines, each followed byslow submit: 250 ms: dispatch 250. It also showsGPU time 140.3 ms a frame (the longest submission 4062.9 ms)and1.5 fps, then0.3 fps. WithRX_VK_SIM_TURF_ADAPTIVE=0none of this happens.Cause. #2093 made the six simulated-turf lists' private buffers adaptive, with a floor of 0 records (
SimTurfPrivate's policy,gpu/vk/vk_draw.cpp). Market has no simulated turf. After 600 quiet frames every list there is released to 0 records (the log'sresized 143360 -> 0). Back in Hyrule Field:sim_turf_sample_demandcopies nothing into the game's own records (mirror_spanis 0);resized 0 -> 21312,0 -> 32,0 -> 4864, ...). Each growth's first copy into the game's records is a new write-back. A capture then waits on it with no stamps to fix the page from: the log's late-pages line counts exactly4 no stamps or shadow yet, one per 250 ms timeout.With the switch off, the lists stay at the game's size, the copy runs on every producer dispatch, and nothing comes back from empty.
This change. The floor is the game's own size: 143360 blade records and 138240 pool records. A list still grows above that with 25 % headroom for dense settings, which is #2093's gain, and still shrinks back after the quiet window, but no further than stock. The memory given up is the space below stock, about 28 MB for all six lists. This also means a list is never 0 records, so the blade producer's
max(cap, 1) - 1guard can no longer let record 0 through on an empty list. Today that write is out of bounds wherever robust buffer access is off.Read first:
SimTurfPrivateingpu/vk/vk_draw.cpp, thenPolicy::observeingpu/vk/sim_turf_capacity.h(unchanged).See #2093.
This pull request was written with AI assistance (Claude Code).
Testing
Tested: Linux (CachyOS, kernel 7.3), RTX 3090, NVIDIA 620.70.06, headless through the job queue (
--mode shared). The route, driven by the control bridge: themarket-entrancesave → Hyrule Field for 1500 frames → Market for 1800 frames, long enough for the 600-frame quiet window → Hyrule Field for 1500 frames. It ran twice onmain@9e10f6f7(its own renderer pack: the shared base8aa74983predates #2093) and twice here @892837ad.main, run 1: all six lists shrank to 0 in Market (resized 1216 -> 0...). Back in Hyrule Field they grew from 0 one at a time (resized 0 -> 1792,0 -> 32,32 -> 1664...). There were 2a capture's wait for write-back ... timed outand 0.4, then 0.2 fps for about 15 s. The longest submission was 3752.8 ms.main, run 2: the same shrink to 0 in Market. Back in Hyrule Field, one write-back timeout, then the GPU hung:vk: FATAL: the GPU hung: no submission finished in 30 s. The last checkpoint before the hang isdispatch of program d5a9475f2790532e, the blade list's producer.a frame's uploads took 440 ms), with no GPU stall. In run 1 the stop in Market on the way in had 5 write-back timeouts and a 2499 ms submission. No turf list changed size there, and run 2 did not show it;mainrun 1 also fell to 2–6 fps at the same place. The PC was swapping heavily during those runs (about 31 GB of swap in use).tests/test_sim_turf_floor.py(new) cutsSimTurfPrivateout ofvk_draw.cppand builds it against the realsim_turf_capacity.h. It plays 700 frames with no demand (Market), then Hyrule Field's 17013 blades and 10069 pool records. It expects both lists to stay at stock, with no resize on the way back in. It has not run on this PC; CI runs it. It should fail onmain, with the lists at 0, and pass here.Still to test:
a capture's wait for write-back ... timed outand no drop to 1 fps (@Beanstalk Windows NVIDIA: Market to Hyrule Field with simulated turf on its defaults)mainapart from the stalls (@Beanstalk AMD)tests/test_sim_turf_floor.pyboth ways and the whole suite, expecting a failure onmainand passes here (by hand, or CI)Measurements
Verdict: it removes the stall on the way back into Hyrule Field. On
mainthe return fell to 0.2–0.4 fps with seconds-long submissions in one run, and hung the GPU in the other. Here both returns ran at 57–60 fps once loaded, with no submission over 11 ms.Setup: Linux, RTX 3090, NVIDIA 620.70.06, the route above, headless at 1920x1080, two runs a side (main, fix, then main and fix side by side). Read from the log:
a capture's wait for write-back ... timed out,GPU time ... (the longest submission ...)andvi: ... fps over the last ..., from the map change into Hyrule Field to the end of the route.9e10f6f7892837ada frame's uploads took 440 ms; no GPU stall)Risks
RX_VK_SIM_TURF_ADAPTIVE=0and as before #2093.RX_VK_SIM_TURF_ADAPTIVE=0still keeps the lists at stock, as before.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (CI runs it; not run on this PC)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (written; not run on this PC, its CI result both ways to come)tests/that reads changed source is updated, not weakened. (the checks that readvk_draw.cppcut other functions;SimTurfPrivateis read only by the new one)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
https://claude.ai/code/session_017vw8e164QuKZTgE7GGxxT5
WIP: fix(vk): simulated-turf lists keep the game's size in areas without turf, so Hyrule Field no longer stalls 250 ms at a time on the way into fix(vk): simulated-turf lists keep the game's size in areas without turf, so Hyrule Field no longer stalls 250 ms at a time on the way indazemc referenced this pull request2026-11-22 04:07:24 +00:00
dazemc referenced this pull request2026-11-22 05:45:10 +00:00