Batched submits: send the held batch as soon as the GPU is idle (+40% fps in Kokiri Forest on RX 9070 XT / RADV, no flashes) #1993
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#1993
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
The idea
With batched submits (
RX_VK_BATCH, on by default with RADV), the replay's command buffers are held until something needs the GPU: a wait, a present, a readback or the 32-buffer cap. When the GPU has already finished everything it was sent, it sits idle while the batch waits, and only gets the work when the game starts waiting for it. With serial replay that is every frame: the game waits for the GPU mid-frame (take_capture's late-page wait,RX_VK_CAPTURE_WAIT=2), so the GPU starts cold right when it is waited for.Proposal: when a submit is added to the batch and the GPU has completed every batch sent so far (
batch_tl>=batch_flushed), send the batch at once. While the GPU is busy, submits keep being batched as today. #1276 and #1905 flush when someone waits; this flushes before anyone has to, so the GPU is already working when the wait comes.The patch as tested (opt-in with
RX_VK_BATCH_IDLE=1; applies on currentmain)Measured on RX 9070 XT (RADV), Ryzen 9 9950X3D, NixOS,
main51de681+be8b512(#1858, the link fix), AMD FSR 4 at 3840x1080 -> 5120x1440. Same Kokiri Forest area each run, default settings (RX_VK_CAPTURE_WAIT=2), GPU power levelauto. Flashes counted withRX_VK_FRAMELOG+scripts/framelog.py.take_capture's late-page wait (once a frame) drops from ~8.4 ms to ~3.8 ms a frame; GPU time ~10.4 ms a frame.RX_VK_BATCH=0gave 44-55 fps, against 41-48 for the default, both with the GPU's power level forced tohighinstead ofauto:card1is my RX 9070 XT on this machine (card0is the Ryzen's integrated GPU); the number may differ elsewhere:cat /sys/class/drm/card*/device/devicegives each card's PCI device ID (0x7550 here for the 9070 XT).(
highalone took the default from 33-41 to 41-48 fps: the serial path's bursty load keeps the GPU at low clocks underauto.)Anything else
Not tested: other GPUs or drivers (batching is only on with RADV by default), other areas, Windows.
Claude Code (Anthropic's AI coding assistant) did the analysis and wrote the patch; I checked the idea and ran the tests on my machine.
I not purpose as PR because I need more feedback. You can try it without any patch
If it improve the performance, my idea works for you.
A data point from the other end: on a Steam Deck LCD (Van Gogh, RADV, GPU at 1200 MHz), the idle send costs CPU time. This is current main (
ebbba2ewith #1375 reverted, plusRX_VK_NO_READBACK_WAIT=1, see #1000), in a deterministic headless run of the standing Kokiri scene (~2,400 draws), alternating A/B:submitqueue submitRX_VK_BATCH_IDLE=0The frame logs 6 submits either way. Each
vkQueueSubmitalready costs the Deck ~1.1 ms on this setup, so I'd guess that sending batches early adds submission work there that the RX 9070 XT's fast CPU doesn't notice. v2.0.14 on the same Deck has queue submit at 6.8-7.6 ms. Maybe the idle send could be held back where submits are this expensive, or measured per device. Happy to rerun a candidate on the Deck.Thanks for the report. Reports of the same problem are now collected in #995, which lists this one with your details and links back here, so one fix closes them together and the open list stays readable. Follow #995 for the fix, and add new details there (or here). If this turns out to be a separate problem it will be reopened.
github-sync referenced this issue2026-11-12 06:22:54 +00:00