Repository navigation
perf(vk): on the Steam Deck's APU, no idle send by default, and held submits go out while a readback waits - #2422
addisonbair wants to merge 2 commits into
Conversation
Joey-Magnus
left a comment
There was a problem hiding this comment.
The code change is fine: dev.props is filled before the first submit, the function-local static is initialised once, and RX_VK_BATCH_IDLE=0/1 still chooses either way. The two C++ fixtures that stub batch_gpu_idle() (tests/draw_stream_visibility_test.cpp, tests/fsr_image_retirement_test.cpp) aren't affected. My questions are about the default's reach and the evidence behind it, not the code:
question gpu/vk/vk_replay.cpp:179-180: batching is on by default only with RADV (batch_on), so in practice this default lands on every RADV APU: the Deck, but also 780M/890M laptops and the Radeon 8060S from issue 413, the machine batching was introduced for. As you say yourself, the Deck is the only one measured. The 8060S is a much stronger GPU that is more likely to sit idle between flushes, which is the case #1993 was fixing. Could you either get one A/B run on another APU (anyone from issue 413 / #1000), or narrow the rule (Van Gogh by deviceID, or a GPU-clock/CU threshold)? Otherwise, please state in the PR body that the 8060S is expected to change and nobody has checked.
question: the Deck numbers were taken on main with #1375 reverted and RX_VK_NO_READBACK_WAIT=1, so neither is what players run. #1375 changed how much the replay thread copies, which shifts exactly the CPU-vs-submit balance this default is about. Does the ~1.3 fps / ~4-5 ms of queue submit still show on unmodified main with default switches? With two runs per side the gap (18.6-18.8 vs 20.0-20.7) is plausible but small, and confirming it on the shipped configuration would make the default easy to accept.
minor: batch_on() logs its choice and why. batch_gpu_idle() now also depends on the device type but logs nothing, so a player's hookshot_log.txt won't show whether the idle send was on. A one-time logf beside batch_on's ("idle send off on an integrated GPU (RX_VK_BATCH_IDLE=1: on)") would make reports readable.
Only the title check has run in CI on this PR so far. The game-free suite still has to run once the workflow is approved.
Joey-Magnus
left a comment
There was a problem hiding this comment.
The code is correct (vk_replay.cpp:179 reads dev.props once, and RX_VK_BATCH_IDLE still overrides). The rule is broader than the title, though. Batching is only on with RADV, so "integrated" hits every RADV APU (780M/890M laptops, Radeon 8060S), not just the Deck. The Deck numbers were also taken with #1375 reverted and RX_VK_NO_READBACK_WAIT=1, not the shipped configuration. Either narrow it to Van Gogh by deviceID or measure another APU. A log line showing whether the idle send is on would help with reports.
hckrman101
left a comment
There was a problem hiding this comment.
Thanks for measuring this on a Deck, the per-submit cost on Van Gogh is a useful data point. I read the change and agree with Joey-Magnus's review: the code is correct (dev.props is filled before the first flush, the static is set once, RX_VK_BATCH_IDLE=0/1 still overrides either way, and main hasn't touched batch_gpu_idle() since, so it merges cleanly).
His open points still stand and I'd like them settled before this goes in:
- Reach: batching is only on by default with RADV, so "integrated" means every RADV APU, including the Radeon 8060S from issue 413 that batching was added for. A stronger APU is more likely to sit idle between flushes, which is the case #1993 fixed. Either one A/B on another APU, or narrow the rule to Van Gogh by
deviceID. - Configuration: the numbers come from main with #1375 reverted and
RX_VK_NO_READBACK_WAIT=1. One A/B pair on unmodified main with default switches would show the gain holds for what players actually run. - A one-time
logfof the idle-send choice next tobatch_on()'s, sohookshot_log.txtshows which path a report came from.
CI: only the title check has run; the game-free suite still needs the workflow approved. No verdict from me until the reach question is answered.
| /// fps -> 46-61, no flashes in 5230 frames; ~10 flushes a frame of ~3.7 command buffers each, so batching still groups the | ||
| /// submits while the GPU is busy. RX_VK_BATCH_IDLE=0: held until a wait, a present or the cap, as before | ||
| /// submits while the GPU is busy. RX_VK_BATCH_IDLE=0: held until a wait, a present or the cap, as before. | ||
| /// (Not by default on an integrated GPU: Steam Deck LCD (Van Gogh), Kokiri Forest, current main: queue submit 11-12 ms a frame |
There was a problem hiding this comment.
nit: "current main" here isn't quite what was measured (main with #1375 reverted and RX_VK_NO_READBACK_WAIT=1, per the PR body). Either say so, or re-measure on stock main and keep the wording.
… by default The idle send (NotRexed#1999) costs a Steam Deck LCD (Van Gogh, RADV) ~5 ms of queue submit a frame in Kokiri Forest on current main (11-12 ms with it, 6.6-7.1 without; 18.6-18.8 fps -> 20.0-20.7), where each vkQueueSubmit costs ~1 ms. The rule is limited to Van Gogh by device ID (0x163f LCD, 0x1435 OLED); every other GPU, other APUs included (780M, 890M, 8060S, unmeasured), keeps it. RX_VK_BATCH_IDLE=1 or 0 still chooses, and the log says which. Assisted-by: Claude Opus 5.5 (Anthropic) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry 8 command buffers A CPU read of GPU results (invalidate) waits for the recording that writes the range back, after catching the replay up (NotRexed#2125). With batched submits and no idle send (the Steam Deck's APU, the commit before) the work recorded during that catch-up was held until the wait's own flush, so the GPU started it cold and the reader waited for all of it. Now, while a readback waits, what is held goes out when the wait begins and then once 8 command buffers are held, and the GPU works through it during the catch-up. The waits themselves are unchanged. Steam Deck LCD, Kokiri Forest, main at eaef146 with default switches, two passes each: main 13.8 / 13.5 fps, no idle send 12.8 / 12.8, no idle send with this 14.6 / 14.3. P16 (NVIDIA, RX_VK_BATCH=1 RX_VK_BATCH_MAX=32 to imitate RADV): 40.9, 34.8, 38.6, with 15.6 / 2.8 / 5.4 flushes a frame. RX_VK_READBACK_SEND=0: off; RX_VK_READBACK_SEND_CBS: the count (default 8). tests/test_readback_send.py checks it. Assisted-by: Claude Opus 5.5 (Anthropic) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51e661c to
dc25850
Compare
|
Thanks, both. All three points are addressed at dc25850:
The second commit touches the readback path from #2125, so it's worth a look by whoever reviewed that one. A new source check, 🤖 Generated with Claude Code |
|
Confirmed on the Deck with this exact head (dc25850, built against today's main), against main's stock renderer on the same eaef146 game, with default switches and the standing Kokiri scene at a 1200 MHz GPU clock: main 13.5 / 13.5 fps, this PR 14.3 / 14.4. GPU time is unchanged (29.9 ms vs 29.8), so the gain is on the CPU side, as expected. 🤖 Generated with Claude Code |
|
Steam Deck results for this PR merged onto current main. They show a regression there, and I think it comes from its interaction with #2602. Setup: Steam Deck OLED (Galileo, APU 0932, RADV, SteamOS 3.9.5 Game Mode, handheld profile, docked to a 1920x1080 gamescope screen). Linux x86-64-v3 builds with the release play profile. Kokiri Forest standing scene from the same save (~2,400 draws). Each start loads the save, then logs 30 s of frame times and takes 80 compositor screenshots. Builds: main
The logs confirm the PR's switches were active: The PR's own numbers were taken on |
|
A second Deck's numbers, in case they help. On mine this PR is slower than main at Setup. Steam Deck OLED (Van Gogh Not default switches. This Deck runs with
Kokiri, per frame:
The log confirms the PR's paths were active ( Two things I take from it:
I also tried a middle way on |
Joey-Magnus
left a comment
There was a problem hiding this comment.
My earlier points are addressed: Van Gogh only by device ID (gpu/vk/vk_replay.cpp:206), numbers from stock main, both choices logged.
I merged it into current main and ran tests/run_all.py. Two failures are this PR's: tests/test_draw_stream_visibility.py (red in CI too) and tests/test_fsr_image_retirement.py cut submit_recording out, and their fixtures don't declare readback_send_now or FR_READBACK. Both pass on main; please add the stubs.
The bigger problem is the measurements since. Brett-D (Deck LCD, recent main) saw 30 fps drop to 9.6 and 24, and one start stalled with readbacks hitting the 250 ms cap. hclaria (Deck OLED, non-default switches) saw 22.9 to 18.5 fps in Kokiri. Both suspect #2602 changed when readbacks wait after your eaef146 runs. Could you re-measure on current main?
Smaller:
- The readback send in
invalidate()(:2388) is on for every RADV GPU, not just the Deck, and that's unmeasured. RX_VK_READBACK_SENDis read withatoi(:192), so=onturns it off; useenv_value_off, andenv_intfor_CBS(:200).
#1999 (from #1993) sends a held batch as soon as the GPU is idle. On an RX 9070 XT that took Kokiri Forest from 33-41 fps to 46-61. On a Steam Deck (Van Gogh, RADV) each submit costs ~1 ms of CPU, so the idle send costs more than it saves. Two commits:
0x163fLCD,0x1435OLED). Every other GPU, other APUs included (780M, 890M, 8060S), keeps it: none of them is measured.RX_VK_BATCH_IDLE=1or0still chooses, and the log says which (vk: idle send on/off).invalidate()sends what is held when the wait begins, then again every 8 held command buffers while it waits. The waits themselves are unchanged.RX_VK_READBACK_SEND=0turns it off;RX_VK_READBACK_SEND_CBSsets the count.Deck measurements on unmodified main (eaef146, which includes #2125 and #2222), default switches, standing Kokiri scene (~2,400 draws), GPU at 1200 MHz, deterministic headless runs, two passes:
submitqueue submitCommit 1 alone saves ~9 ms of replay but loses fps: readback waits gate the frame, and holding batches makes them longer. That's why the two belong together. The Deck runs used the same change with a few off-by-default diagnostics compiled in; this branch drops them.
P16 (NVIDIA,
RX_VK_BATCH=1 RX_VK_BATCH_MAX=32to imitate RADV's batching): main 40.9 fps / 15.6 flushes a frame, commit 1 34.8 / 2.8, both 38.6 / 5.4. So on a GPU that keeps the idle send, commit 2 only acts while a readback waits.Testing:
tests/run_all.pyin an Ubuntu 22.04 builder: the same failures as main (tools missing in my container), plus a newtests/test_readback_send.py. The renderer builds.🤖 Generated with Claude Code