Repository navigation
feat(vk): time a capture's GPU wait for its late pages apart in the log - #1243
Conversation
take_capture waits for the GPU (vk_timeline_wait(c->late_value)) before it copies the pages a submission still on the GPU writes back. That wait was counted in "retires and stamps", so the 600-take log line could not tell the replay thread waiting for the GPU from its own bookkeeping. The wait grows as fewer pools have a VRAM mirror: with RX_VK_MIRROR_MB=1024 on an RTX 3070 it was 1.5-1.8 ms of a 1.7-1.9 ms capture, six captures a frame, and Hyrule Field ran at ~41 fps instead of ~52 (issue 995). The line now reads "all; GPU wait for late pages (takes that waited), pools lock, retires and stamps, bytes copied". "Retires and stamps" starts once pools_mu is held. tests/test_capture_wait_log.py checks the timing and the line. Assisted-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The two red "Python source checks" jobs fail on |
hckrman101
left a comment
There was a problem hiding this comment.
Looks good. I checked the timing split in take_capture: tk1 is still taken after the lock, so measuring retires and stamps from tk_locked is right, and the wait and lock are now separate counters that reset together with the late-take count. The new test is picked up by run_all.py's tests/test_*.py glob and passes on both runners.
The two red Python source checks are only tests/test_output_resolution.py, which is the known failure on main (not this PR).
What changed
take_capturewaits for the GPU (vk_timeline_wait(c->late_value)) before it copies the pages that a submission still on the GPU writes back. That wait was counted in "retires and stamps". So the 600-take log line could not tell the replay thread waiting for the GPU from its own bookkeeping.The wait and the
pools_muacquisition are now timed apart, and the line reads:"Retires and stamps" now starts once
pools_muis held. Nothing else changes: no new switch, no behaviour change.Why
This is the cost behind part of #995 (low FPS with low GPU use). The fewer pools have a VRAM mirror, the more often a submit waits for the GPU here, about six captures a frame. Until now it only showed as an unexplained "retires and stamps". With this line a player's
hookshot_log.txttells at once whether a small mirror budget is what holds the frame rate. That coversRX_VK_MIRROR_MBset low, the VRAM/8 default of 6 GB cards, and the 4GB preset's 256 MB. Measurements are in this #995 comment.How it was tested
RTX 3070 8 GB, Windows 11, main at 09e4eb5 plus this commit. Scripted Hyrule Field run: load the save, run the same 45 s route.
RX_VK_MIRROR_MBtests/test_capture_wait_log.py(new) checks that the wait is timed on its own, that "retires and stamps" starts after the lock, and that the line names and resets both. It fails on main and passes here. The other tests readingvk_memory.cppstill pass:bind_memo,capture_copy_runs,mem_trim,parallel_rb_refresh,pool_span,report_words,submitted_page,vertex_bind,wb_diff_split,wb_pages(tests/run_all.py, llvm-mingw).No game data included.
🤖 Generated with Claude Code