perf(vk): skip write-backs of large GPU-written bindings #1629
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!1629
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/wb-max"
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?
OoT's renderer copies back every GPU-written binding at each submit's memory sync, even the tens of MB of culling lists and per-frame buffers the CPU never reads. On a 10 GB RTX 3080 / i7-11700 at 1080p, Hyrule Field wrote about 66 MB and spent 4.4 ms per submit on the copy, holding the scene at 45-48 fps.
RX_VK_WB_MAX_KB=1024still copies the small results the CPU does read (the exposure meter and the like) and skips the large write-backs. The same scene runs at 59-60 fps; memory sync falls to about 0.5 ms and the replay from 14-15 ms to 8-10 ms. A 10-minute soak held 60 fps with no growth or crash; a further 300 s run with the compressed program cache also held 59-60 fps.0or unset keeps the old behavior.No visual change: the buffers skipped are write-only from the CPU's point of view (the game never reads them back). Tested in Hyrule Field, the Lost Woods, Lake Hylia and Kakariko.
Test report:
RX_VK_WB_MAX_KB=1024on an 8 GB card (RTX 3070, driver 610.88, i7-14700KF, Windows 11; v2.0.12046e37f6with this PR on top, nohookshot_env.txt, window 5760x2130). Runs alternated, off / on / on / off.Castle Town Market, Link standing, about 2 900 draws a frame, 6 + 6 runs (with stand-ins for the three damaged dump textures from my comment on #995):
=1024Kokiri Forest, from a save, 4 + 4 runs: 30 s standing still, then 40 s walking and turning the camera. In the Kokiri runs the binary also held a local switch of mine, off in those runs.
=1024The walking flash count also picks up sudden camera moves, and the two arms overlap. No device lost in any of these 20 runs.
What I didn't check: I only ran these two places, and I didn't compare the pictures by eye.
Looks good. The change is small and opt-in: unset or 0 keeps the old behavior, and when set it only skips queueing the write-back. The rb_hazard_locked call still runs, so tracking is unchanged. It's the same idea as the existing RX_VK_NO_WRITEBACK experiment, but with a size cutoff. The static init is thread-safe, the negative-atoi clamp is fine, and the readme matches the code. Test numbers in the thread look consistent.
Nit: the readme could say that a CPU-read binding above the limit would go stale, so people know why they shouldn't set it too low. No CI is reported on the branch.