Repository navigation
Conversation
|
Would this fix the write-read wait from #1133? |
|
Yes — this addresses the same class of problem as #1133. The readback wait in |
|
I built it as AppImage and I can confirm the texture flickering that #1133 fixed returned. Does this need a rebase? |
A read of GPU results on the sync replay waited on the recordings' timeline without sending the batch: when the recording holding the write-back was still held (the flushes were present-time, 60/61 of them), the read blocked the rest of the frame for the display thread's present to flush it - 163 of 3000 reads at 23-28 ms each, ~1.4 blocking waits a frame (the ~25 ms pipeline bubble of the cpu-bottleneck investigation, its NotRexed#2 remaining lever). wait_recorded now flushes the batch first, gated on the recording still being held (its seq above what the last flush sent out): the GPU starts the write-back at read demand instead of at present. Empty or older batches are not flushed, and the reason is counted in the batched-submits log line as 'readback'.
26b9466 to
c0e8479
Compare
|
Yes — rebased onto current main (c0e8479), sorry about that. The branch was cut before #1133 merged, so an AppImage built from it lacked the direct-buffer-write bookkeeping and capture-readback invalidation fixes — that's the flickering you saw, not something the flush introduced. One thing worth noting for the rebuild: main has since added its own unconditional batch flush in |
|
Your review was of the pre-force-push branch — it is now a single commit ( On the substance we agree: with #1276's unconditional The one residual from our version is the conditional gate (flush only while the recording is still held, |
|
@DarkGhostHunter since you were testing the AppImage build: we are closing this PR in favour of #1276, whose flush in |
What
When a readback waits for a GPU write-back, the held command buffer batch is flushed before the wait, so the GPU starts processing it immediately instead of waiting for the next present. This closes the ~23-28ms readback latency bubble measured in the graveyard investigation.
Why
The investigation measured 163 of 3000 reads waiting 23-28ms because results only landed when the display thread's present flushed the batch (flush reasons were 60/61 "present"). The code's own design comment at vk_replay.cpp line 132 promised a readback flush that was never wired.
Changes (one file, ~20 lines)
FR_READBACKin the batch enum, printed in the stats log linerec_outtracks the recordings' timeline value the last flush sentwait_recorded()fires only when the exact recording being waited on is still held in the batchSafety
wait_recordedcall sites hold no locks (present_mu is a leaf)RX_VK_BATCH=0the pend is always empty so it never firesRX_VK_ASYNC=1the readback goes throughwait_value()which already flushes — this fix is load-bearing on sync mode onlyTesting
Built and deployed on RX 6700 XT. With
RX_VK_ASYNC=1the readback counter reads 0 (expected — the async path already flushes). WithRX_VK_ASYNC=0(sync), the fix addresses the measured 23-28ms bubble.AI assistance disclosure: the analysis and fix were developed with AI assistance, verified and tested by a human on the affected hardware.