Repository navigation
perf(vk): per-piece write-back tracking and early write-back emission (RX_VK_WB_PIECE) - #123
Open
meansabine wants to merge 1 commit into
Open
meansabine wants to merge 1 commit into
meansabine wants to merge 1 commit into
Conversation
Owner
|
Thanks, the per-piece tracking is a nice idea and the wait numbers look good. Two things before I can review it properly: it's stacked on #116, so could you split the write-back commit into its own PR? And it overlaps with a readback rework landing on main soon (a staged ring that serves the exposure and the 0x40/0x2000 readbacks without waiting, plus per-submission write-back lists). Once that's in, a rebase on main would let me A/B it on top. The waits it still helps with would be the remaining ones (culling and small ranges). Also, please measure without the 60 fps cap so the fps difference shows. |
… (RX_VK_WB_PIECE)
meansabine
force-pushed
the
perf/early-piece-writeback
branch
from
November 22, 2026 06:13
7a58bfa to
0ab3f9e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces CPU readback and
LateFixstalls on multi-piece submissions by tracking write-backs perrec_timelinerecording instead of waiting for the entire submission's final piece (timeline):rec_timelinewrite-back tracking (RX_VK_WB_PIECE, default1)wb_rec_pagesalongsidewb_pagesinengine/gpu/vk/vk_memory.cppso each page records both its submissiontimelinevalue and the exactrec_timelinesequence (vk_next_rec_seq()) of the recording that emitted its write-back copy (memory_writeback_rec).emit_writebacks_locked()and addedmemory_flush_writebacks()to flush pending write-backs from earlier command buffers beforesubmit_recording()inreplay_handle_earlyandreplay_handle(RX_VK_WB_PIECE=2also flushes immediately after segmented command buffers).direct_writebacks(unmirrored in-place writes) andStagedWb(RX_VK_POOL_MIRROR) to tag and release per-piece onrec_timeline.capture_make()to skip marking a page as late (LateFix) when its piece write-back has already completed onrec_timeline.LateFixflushesrec_signal_sentvianote_rec_sent()at bothvkQueueSubmit2sites that signalrec_timeline(queue_flush_lockedandsubmit_recording).wait_recorded_seq()inengine/gpu/vk/vk_replay.cpp: returns immediately whenvk_rec_timeline_completed() >= seqand skipsqueue_flush_for(FR_WAIT)(and itslate_fix_wait_unlocked()stall on unrelated held submissions) whenseq <= vk_rec_signal_sent().invalidate()to wait onwb_recviawait_recorded_seqand skip the whole-submission strict wait oncerec_timelinereacheswb_rec.engine/tests/test_wb_piece.py(registered inengine/tests/run_all.py) and regenerateddocs/SWITCHES.mdandengine/docs/switches.jsonviaengine/scripts/list_switches.py.Verification
clang++,C:\emsdk\upstream\bin):tests/test_wb_piece.py(PASS: per-piece write-back tracking and isolation across pieces and chunk edges)tests/test_wb_pages.py,tests/test_readback_ticket.py,tests/test_readback_late.py,tests/test_readback_wait.pytests/test_late_defer.py,tests/test_fence_poll_fast.py,tests/test_recorded_wait_flush.py,tests/test_wb_pool_eager.py,tests/test_late_fix_order.py,tests/test_capture_merge.py,tests/test_switches_documented.pyhookshot_vk.dllbuilt withllvm-mingw, 60 fps cap active):0.914 msmean /0.930 msmedian (RX_VK_WB_PIECE=0) →0.262 msmean /0.200 msmedian (RX_VK_WB_PIECE=1, -71% mean / -78% median).54.73 fpsmean /55.10 fpsmedian (=0) →57.58 fpsmean /59.70 fpsmedian (=1).