Repository navigation
perf(vk): back-to-back passes and dispatches ordered by the game's barriers (NVIDIA by default) - #2559
perf(vk): back-to-back passes and dispatches ordered by the game's barriers (NVIDIA by default)#2559NotRexed wants to merge 1 commit into
Conversation
…rriers (NVIDIA by default) Every pass begin and every compute dispatch recorded a full barrier, which makes the GPU finish everything before each of them. The game records its own barrier (nvnCommandBufferBarrier, kept as a full barrier) wherever a pass samples what an earlier one drew or a dispatch reads what another wrote. With RX_VK_GAME_ORDER: a draw pass right after another waits in its fragment stages only (the existing RX_VK_PASS_BARRIER=game path), and a direct dispatch right after another, nothing recorded between, gets no barrier. A switch between draws and compute, the replay's own copies, clears, fills and uniform updates, indirect dispatches, a parallel replay and the game's barriers keep the full one. On NVIDIA by default (the game's barriers were placed for an NVIDIA GPU), off on others: =1 to try it there, =0 off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested in the game on NVIDIA (on by default there): no change in frame rate here; this machine is CPU-bound in this scene. Hardware: RTX 3060 12 GB, NVIDIA 615.71.09, Manjaro (kernel 6.12), Core Ultra 7 265KF (8 P-cores + 12 E-cores), Wayland. Built on main
(replay columns: medians of the last 20
|
Why. Every draw pass begin and every compute dispatch records a full barrier, which makes the GPU drain everything before each of them. The game already records its own barrier (
nvnCommandBufferBarrier, which the replay keeps as a full barrier) wherever a pass samples what an earlier one drew or a dispatch reads what another wrote. The extra barriers between back-to-back work are pure GPU idle time: elsewhere it measured 2.3 ms of a 9.7 ms GPU frame in Kokiri Forest, and about a tenth off the GPU's frame time on an RTX 5090.What (
RX_VK_GAME_ORDER):RX_VK_PASS_BARRIER=gamepath, now on with the switch.RX_VK_PASS_BARRIER=game/fullstill decide that part on their own.work_epochcount taken right after the previous dispatch's command.RX_VK_GAME_ORDER=1to try it there,=0to turn it off everywhere.Checks
tests/test_game_order.py: the rules as written.mesh_fallback,dump_readback,present_aspect,upscale_fallback,vulkan_clear_mip).vk_texture.cppcompiles.vk_draw.cppneeds Boost, which this machine lacks, so CI compiles it.Not yet verified in-game: GPU frame time A/B on this NVIDIA card plus the flash check (every-frame shots).
🤖 Generated with Claude Code