Idea: on integrated GPUs without VRAM mirrors, end the waits that don't need a split submission's last part (ROG Ally Z1 Extreme measurements: +6 % with 0 flashes) #1190

Open
opened 2026-11-16 17:14:32 +00:00 by MrSkittlez · 5 comments

The idea

On a ROG Ally without VRAM mirrors, the waits for a split submission's last part (e0dbf40c, #2419 on the old tracker) still cost speed. Most of that comes back without bringing back the flashes that commit fixed. Two things worked here:

  1. RX_VK_READBACK_LATE with one more size, 8b040. No code change: RX_VK_READBACK_LATE=newest,3980,9b040,1b580,8b040.

    • RX_VK_LOG_READBACK_RANGES shows two 0x8b040-byte readbacks per frame, each waiting ~16.5 ms in Market Town and Kokiri Forest.
    • Read late, they return exactly what the waited read returns: a local check compared the words over ~720 reads and none differed.
    • Occlusion reports behave the same with and without it (RX_VK_OCC_LOG=1: the same share of 0 counts per spot, 0 left visible).
    • Maybe worth adding to the play profile's rule for integrated GPUs, or to the docs' list of sizes.
  2. Let only the capture's write-back wait (vk_timeline_wait) end at the submission's first part. I tried this as a local patch, split by wait site:

    • rb: the readback wait in invalidate();
    • sync: the fence waits in nvnSyncWait;
    • cap: the capture wait.

    On an RTX 4090 laptop with RX_VK_MIRROR=0 and the compute mesh fallback (which flashes far more readily than the Ally):

    • all three sites together: a whole-screen flash about 1 frame in 5, the flashes that e0dbf40c fixed;
    • each site alone, and rb+cap / rb+sync: 0 flashes in ~65,000 presents;
    • sync+cap: 1 flash, in a menu.

    On top of (1), cap alone gives another +2 % on the Ally (Hyrule Field +3.5 %), with 0 flashes on both machines. sync gives nothing.

    Patch (applies to 6fb13fe5): https://github.com/Predator04/hookshot-rog-ally/blob/longshot-ally/patches/0004-vk-RX_VK_FENCE_FIRST_PART-per-site-on-6fb13fe5.patch

Measurements (Ally, game fps, 2 interleaved rounds after a warm-up, each spot with 4 camera views and a 25 s walk; route = mean of Kokiri Forest, Hyrule Field, Market Town):

Setting Kokiri Hyrule Field Market Town Route
newest,3980,9b040,1b580 41.9 / 42.1 35.6 / 35.6 37.1 / 38.3 38.2 / 38.7
+ 8b040 44.8 / 43.5 35.0 / 35.8 40.5 / 41.2 40.1 / 40.2
+ 8b040 + capture wait at first part 44.5 / 43.8 36.8 / 36.7 40.4 / 41.0 40.6 / 40.5
all three wait sites at first part (rejected: flashes) 45.1 / 45.1 40.7 / 40.8 38.0 / 40.7 41.3 / 42.2

The last row is the ceiling (~+9 %). The gap between it and the safe setting is the fence wait on a whole submission. A fix that keeps the first-part mapping safe on mirrorless iGPUs would close it.

Flash counts use RX_VK_FLASH=1 with RX_VK_SHOT_EVERY=1:

  • Ally: 0 at all three spots for each safe setting (~4,100-4,600 presents per spot).
  • RTX 4090 laptop with mirrors off: 0 in 6-12 starts per setting.
  • Shots and per-view draw counts showed nothing missing. One Market Town view in 8 runs drew fewer objects once, which I put down to the town's moving crowd. It didn't repeat.

Setup:

  • ASUS ROG Ally (RC71L), Ryzen Z1 Extreme, 16 GB with the UMA frame buffer at 4 GB.
  • Windows 11, AMD driver 32.0.32015.14001.
  • Longshot 6fb13fe5 (rc.5's code), built from source.
  • Options: quality preset 1, resolution 67 % (3D at 1024x576), handheld profile, frame_generation=2.

Anything else

  • Also tried on the Ally on 6fb13fe5, with no gain: RX_VK_REPLAY_PIN=0, HOS_RESERVE_CORE=0, HOS_NATIVE_ZSTD, HOS_NATIVE_ZSTD_FRAMES, RX_VK_PASS_BARRIER=game, RX_VK_BATCH=1 (slower), RX_VK_CHUNK=240, HOS_SHORT_SLEEP_POLLERS=2. A lower output resolution gave ~1 %.
  • Hyrule Field's GPU time is ~21-22 ms a frame here, spread over many small passes.
  • Separately, I let the 30 fps cap from 02903b04 (#609) take any rate from 20 to 59 (HOS_FPS_MAX=40 holds exactly 40, game speed stepped in real time). Patch with tests: https://github.com/Predator04/hookshot-rog-ally/blob/longshot-ally/patches/0007-host-HOS_FPS_MAX-20-59-on-the-hosts-30-cap-pacer.patch. On the Ally, 36 holds everywhere and 40 holds except in Hyrule Field's heaviest views. I can open it as its own issue if that's useful.
### The idea On a ROG Ally without VRAM mirrors, the waits for a split submission's last part (e0dbf40c, #2419 on the old tracker) still cost speed. Most of that comes back without bringing back the flashes that commit fixed. Two things worked here: 1. **`RX_VK_READBACK_LATE` with one more size, `8b040`.** No code change: `RX_VK_READBACK_LATE=newest,3980,9b040,1b580,8b040`. - `RX_VK_LOG_READBACK_RANGES` shows two `0x8b040`-byte readbacks per frame, each waiting ~16.5 ms in Market Town and Kokiri Forest. - Read late, they return exactly what the waited read returns: a local check compared the words over ~720 reads and none differed. - Occlusion reports behave the same with and without it (`RX_VK_OCC_LOG=1`: the same share of 0 counts per spot, 0 left visible). - Maybe worth adding to the play profile's rule for integrated GPUs, or to the docs' list of sizes. 2. **Let only the capture's write-back wait (`vk_timeline_wait`) end at the submission's first part.** I tried this as a local patch, split by wait site: - `rb`: the readback wait in `invalidate()`; - `sync`: the fence waits in `nvnSyncWait`; - `cap`: the capture wait. On an RTX 4090 laptop with `RX_VK_MIRROR=0` and the compute mesh fallback (which flashes far more readily than the Ally): - **all three sites together:** a whole-screen flash about 1 frame in 5, the flashes that e0dbf40c fixed; - **each site alone, and `rb`+`cap` / `rb`+`sync`:** 0 flashes in ~65,000 presents; - **`sync`+`cap`:** 1 flash, in a menu. On top of (1), `cap` alone gives another +2 % on the Ally (Hyrule Field +3.5 %), with 0 flashes on both machines. `sync` gives nothing. Patch (applies to 6fb13fe5): https://github.com/Predator04/hookshot-rog-ally/blob/longshot-ally/patches/0004-vk-RX_VK_FENCE_FIRST_PART-per-site-on-6fb13fe5.patch **Measurements** (Ally, game fps, 2 interleaved rounds after a warm-up, each spot with 4 camera views and a 25 s walk; route = mean of Kokiri Forest, Hyrule Field, Market Town): | Setting | Kokiri | Hyrule Field | Market Town | Route | |---|---|---|---|---| | `newest,3980,9b040,1b580` | 41.9 / 42.1 | 35.6 / 35.6 | 37.1 / 38.3 | 38.2 / 38.7 | | + `8b040` | 44.8 / 43.5 | 35.0 / 35.8 | 40.5 / 41.2 | 40.1 / 40.2 | | + `8b040` + capture wait at first part | 44.5 / 43.8 | 36.8 / 36.7 | 40.4 / 41.0 | 40.6 / 40.5 | | all three wait sites at first part (rejected: flashes) | 45.1 / 45.1 | 40.7 / 40.8 | 38.0 / 40.7 | 41.3 / 42.2 | The last row is the ceiling (~+9 %). The gap between it and the safe setting is the fence wait on a whole submission. A fix that keeps the first-part mapping safe on mirrorless iGPUs would close it. **Flash counts** use `RX_VK_FLASH=1` with `RX_VK_SHOT_EVERY=1`: - Ally: 0 at all three spots for each safe setting (~4,100-4,600 presents per spot). - RTX 4090 laptop with mirrors off: 0 in 6-12 starts per setting. - Shots and per-view draw counts showed nothing missing. One Market Town view in 8 runs drew fewer objects once, which I put down to the town's moving crowd. It didn't repeat. **Setup:** - ASUS ROG Ally (RC71L), Ryzen Z1 Extreme, 16 GB with the UMA frame buffer at 4 GB. - Windows 11, AMD driver 32.0.32015.14001. - Longshot 6fb13fe5 (rc.5's code), built from source. - Options: quality preset 1, resolution 67 % (3D at 1024x576), handheld profile, `frame_generation=2`. ### Anything else - Also tried on the Ally on 6fb13fe5, with no gain: `RX_VK_REPLAY_PIN=0`, `HOS_RESERVE_CORE=0`, `HOS_NATIVE_ZSTD`, `HOS_NATIVE_ZSTD_FRAMES`, `RX_VK_PASS_BARRIER=game`, `RX_VK_BATCH=1` (slower), `RX_VK_CHUNK=240`, `HOS_SHORT_SLEEP_POLLERS=2`. A lower output resolution gave ~1 %. - Hyrule Field's GPU time is ~21-22 ms a frame here, spread over many small passes. - Separately, I let the 30 fps cap from 02903b04 (#609) take any rate from 20 to 59 (`HOS_FPS_MAX=40` holds exactly 40, game speed stepped in real time). Patch with tests: https://github.com/Predator04/hookshot-rog-ally/blob/longshot-ally/patches/0007-host-HOS_FPS_MAX-20-59-on-the-hosts-30-cap-pacer.patch. On the Ally, 36 holds everywhere and 40 holds except in Hyrule Field's heaviest views. I can open it as its own issue if that's useful.
Collaborator

Possibly related, for context:

  • #241 Game: on a 4 GB laptop GPU, readbacks wait ~6.5 ms for the whole submission (38 fps; 47.5 with RX_VK_NO_READBACK_WAIT=1) — Same broad readback-wait bottleneck on submissions without mirrors; different GPU and proposed optimization.
Possibly related, for context: - #241 Game: on a 4 GB laptop GPU, readbacks wait ~6.5 ms for the whole submission (38 fps; 47.5 with RX_VK_NO_READBACK_WAIT=1) — Same broad readback-wait bottleneck on submissions without mirrors; different GPU and proposed optimization.
Author

Update after testing main 5c284721: on the ROG Ally, #977's early reads (on by default without mirrors) already get what this issue asked for. Neither of my two suggestions adds anything on main, so I think this can be closed.

Ally Z1 Extreme, game fps over the same route (Kokiri Forest, Hyrule Field, Market Town; 2 rounds, unlocked, both builds warm):

Build and settings Route fps
6fb13fe5, READBACK_LATE=newest,3980,9b040,1b580,8b040 + FENCE_FIRST_PART=cap 41.2 / 41.3
5c284721, same settings 41.2 / 41.1
5c284721, without cap 40.9 / 40.9
5c284721, READBACK_LATE=newest only, no cap 40.8 / 41.1
5c284721, the size list with RX_VK_READBACK_EARLY=0 41.1 / 41.2

All rows on 5c284721 are within noise of each other.

  • With the size list, the early reads never fire ("readbacks waited for their writer's part: 0").
  • With newest only, they fire and give the same speed. Unlike the size list, they read the current frame's data, so newest alone is the better choice on main.

RTX 4090 laptop with RX_VK_MIRROR=0 and the compute mesh fallback, RX_VK_FLASH=1, a shot at every present:

  • 0 flashes in 24 runs (the four settings on 5c284721 above, 2 rounds, 3 spots each).
  • With newest only, the early reads waited 160-219 times per spot.
  • RX_VK_LOG_EARLY_CHECK=1 gave "100 unchanged, 0 changed" at all three spots.

I haven't re-measured the "all three wait sites" row on main, so I can't say whether any gap is left there.

These builds also carry local patches that only add logging, off-by-default switches, and the 20-59 frame cap.

Update after testing main 5c284721: on the ROG Ally, #977's early reads (on by default without mirrors) already get what this issue asked for. Neither of my two suggestions adds anything on main, so I think this can be closed. **Ally Z1 Extreme**, game fps over the same route (Kokiri Forest, Hyrule Field, Market Town; 2 rounds, unlocked, both builds warm): | Build and settings | Route fps | |---|---| | 6fb13fe5, `READBACK_LATE=newest,3980,9b040,1b580,8b040` + `FENCE_FIRST_PART=cap` | 41.2 / 41.3 | | 5c284721, same settings | 41.2 / 41.1 | | 5c284721, without `cap` | 40.9 / 40.9 | | 5c284721, `READBACK_LATE=newest` only, no `cap` | 40.8 / 41.1 | | 5c284721, the size list with `RX_VK_READBACK_EARLY=0` | 41.1 / 41.2 | All rows on 5c284721 are within noise of each other. - With the size list, the early reads never fire ("readbacks waited for their writer's part: 0"). - With `newest` only, they fire and give the same speed. Unlike the size list, they read the current frame's data, so `newest` alone is the better choice on main. **RTX 4090 laptop** with `RX_VK_MIRROR=0` and the compute mesh fallback, `RX_VK_FLASH=1`, a shot at every present: - 0 flashes in 24 runs (the four settings on 5c284721 above, 2 rounds, 3 spots each). - With `newest` only, the early reads waited 160-219 times per spot. - `RX_VK_LOG_EARLY_CHECK=1` gave "100 unchanged, 0 changed" at all three spots. I haven't re-measured the "all three wait sites" row on main, so I can't say whether any gap is left there. These builds also carry local patches that only add logging, off-by-default switches, and the 20-59 frame cap.
Contributor

On this Deck OLED, newest improves Kokiri standing by about 3.8%, but the additional size rules add no resolved Kokiri FPS benefit. Hyrule Field turning is less conclusive and includes an adverse newest signal. No default change proposed.

This tests the rule string discussed here, not the separate capture-first-part patch. It uses p0lux's existing opt-in from #238, on main 544229a2 with early reads at main's default; no renderer change between performance arms.

Configuration: Steam Deck OLED, 16 GB, RADV VANGOGH / Mesa 26.2.0-devel; the Deck's own 1280×800 / 90 Hz screen, AC, 15 W, main's profile_peak clock hold, not manual 1600 MHz. Pinned H options: saved Minimum preset with overrides, game docked profile (handheld_profile=0), 1280×800 output, fixed 50% render, the game's own upscaler, frame generation off. This is not Quality Auto. The same executable/renderer and unchanged options were used throughout the performance runs.

Method: a warm-up per arm, then four rotated rounds: U N B T / N T U B / T B N U / B U T N. The fourth row was predeclared as the extension; it was added after the initial Field exclusions, and both scenes' tables include it. Kokiri standing targets 45 s (logged frame durations 44.88–48.01 s); Field turning targets 30 s (29.76–32.07 s). Performance windows require settled pipeline/program counters and no queued jobs, omitted draws or new compilation across their bracketing checks. All exclusions remain; warm-ups and diagnostic safety runs do not enter these estimates.

Arm: RX_VK_READBACK_LATE Kokiri FPS median (range), admitted n Field FPS median (range), admitted n
U: unset 25.28 (24.96–25.40), 4 30.05 (29.86–30.25), 2
N: newest 26.23 (26.12–26.28), 4 29.36 (29.22–29.46), 4
T: newest,3980,9b040,1b580 26.21 (26.05–26.35), 4 29.93 (29.85–30.45), 3
B: newest,3980,9b040,1b580,8b040 26.18 (25.96–26.44), 4 30.40 (30.16–32.05), 3

The first estimate below is the ratio of admitted-arm medians; the second is the median percentage change using only complete within-round pairs. They need not be the same, especially with exclusions.

Contrast Kokiri: ratio / paired median (n pairs) Field: ratio / paired median (n pairs)
U→N: newest policy +3.76% / +3.71% (4) −2.32% / −1.99% (2)
N→B: four size rules bundled −0.21% / −0.07% (4) +3.54% / +4.04% (3)
T→B: 8b040 conditional on T −0.14% / +0.08% (4) +1.56% / +3.54% (2)

Kokiri: newest's paired changes are +3.44, +3.98, +4.92, +3.27%; every N run exceeds every U run (observed ranges separated by 0.72 fps). The independently bracketed bridge-present rate also improves about 3.8%. Process CPU milliseconds per renderer present are essentially unchanged (+0.01% by ratio of medians, overlapping ranges). The 1% low improves 6.47% and p99 decreases 4.17%, but both observed ranges overlap. The 1% low is 1000 divided by the mean of the slowest 1% of logged frame times.

The logged readback wait-path share rises 45.8% → 69.7%, while mean duration per counted wait falls 1.36 → 0.45 ms: more but shorter logged waits, not a measured reduction in process CPU work. Timed GPU work rises 0.76%, logged replay submit 5.74% and draw 8.04%; these are not separate additive frame-critical-path costs or an isolated code-efficiency measurement.

Field remains provisional: only 2/4 U windows, 4/4 N, 3/4 T and 3/4 B were admitted. Three exclusions were queued jobs; one was new pipelines inside the window. The surviving U→N FPS ranges are apart and process CPU per present rises 3.04%; both complete U→N pairs are slower. N→B's positive signal is also reported, but its extra four sizes are bundled. T→B has only two complete pairs and overlapping arm FPS ranges. These data do not establish which individual size helps, that B beats defaults, or that newest is harmless across scenes.

Safety scope: on a separate diagnostic renderer, all 8 tested K/F intervals had complete consecutive flash-comparison coverage and zero detected flashes; the sky/exposure and tree/foliage/occlusion spot checks were inspected without an obvious new artifact. Those runs supply no performance ordering. This is limited-route evidence, not proof of generally current readback values or universal picture safety.

One Deck, one session and shared arm data: the contrasts are not independent confirmations, and observed range separation is not a significance test. Kokiri-standing gains can coexist with the Field null results reported elsewhere; these are different scenes, settings, clocks and main revisions. This also does not overturn the later Ally update here that the extra suggestions added nothing resolved after early reads. The result supports keeping the rules opt-in, not a blanket Deck recommendation.

**On this Deck OLED, `newest` improves Kokiri standing by about 3.8%, but the additional size rules add no resolved Kokiri FPS benefit. Hyrule Field turning is less conclusive and includes an adverse `newest` signal. No default change proposed.** This tests the rule string discussed here, not the separate capture-first-part patch. It uses p0lux's existing opt-in from https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/238, on main 544229a2 with early reads at main's default; no renderer change between performance arms. **Configuration:** Steam Deck OLED, 16 GB, RADV VANGOGH / Mesa 26.2.0-devel; the Deck's own 1280×800 / 90 Hz screen, AC, 15 W, main's `profile_peak` clock hold, not manual 1600 MHz. Pinned H options: saved Minimum preset with overrides, game docked profile (`handheld_profile=0`), 1280×800 output, fixed 50% render, the game's own upscaler, frame generation off. This is **not** Quality Auto. The same executable/renderer and unchanged options were used throughout the performance runs. **Method:** a warm-up per arm, then four rotated rounds: `U N B T / N T U B / T B N U / B U T N`. The fourth row was predeclared as the extension; it was added after the initial Field exclusions, and both scenes' tables include it. Kokiri standing targets 45 s (logged frame durations 44.88–48.01 s); Field turning targets 30 s (29.76–32.07 s). Performance windows require settled pipeline/program counters and no queued jobs, omitted draws or new compilation across their bracketing checks. All exclusions remain; warm-ups and diagnostic safety runs do not enter these estimates. | Arm: `RX_VK_READBACK_LATE` | Kokiri FPS median (range), admitted n | Field FPS median (range), admitted n | |---|---|---| | U: unset | 25.28 (24.96–25.40), 4 | 30.05 (29.86–30.25), 2 | | N: `newest` | 26.23 (26.12–26.28), 4 | 29.36 (29.22–29.46), 4 | | T: `newest,3980,9b040,1b580` | 26.21 (26.05–26.35), 4 | 29.93 (29.85–30.45), 3 | | B: `newest,3980,9b040,1b580,8b040` | 26.18 (25.96–26.44), 4 | 30.40 (30.16–32.05), 3 | The first estimate below is the ratio of admitted-arm medians; the second is the median percentage change using only complete within-round pairs. They need not be the same, especially with exclusions. | Contrast | Kokiri: ratio / paired median (n pairs) | Field: ratio / paired median (n pairs) | |---|---|---| | U→N: newest policy | +3.76% / +3.71% (4) | −2.32% / −1.99% (2) | | N→B: four size rules bundled | −0.21% / −0.07% (4) | +3.54% / +4.04% (3) | | T→B: `8b040` conditional on T | −0.14% / +0.08% (4) | +1.56% / +3.54% (2) | **Kokiri:** newest's paired changes are +3.44, +3.98, +4.92, +3.27%; every N run exceeds every U run (observed ranges separated by 0.72 fps). The independently bracketed bridge-present rate also improves about 3.8%. Process CPU milliseconds per renderer present are essentially unchanged (+0.01% by ratio of medians, overlapping ranges). The 1% low improves 6.47% and p99 decreases 4.17%, but both observed ranges overlap. The 1% low is 1000 divided by the mean of the slowest 1% of logged frame times. The logged readback wait-path share rises 45.8% → 69.7%, while mean duration per counted wait falls 1.36 → 0.45 ms: more but shorter logged waits, not a measured reduction in process CPU work. Timed GPU work rises 0.76%, logged replay submit 5.74% and draw 8.04%; these are not separate additive frame-critical-path costs or an isolated code-efficiency measurement. **Field remains provisional:** only 2/4 U windows, 4/4 N, 3/4 T and 3/4 B were admitted. Three exclusions were queued jobs; one was new pipelines inside the window. The surviving U→N FPS ranges are apart and process CPU per present rises 3.04%; both complete U→N pairs are slower. N→B's positive signal is also reported, but its extra four sizes are bundled. T→B has only two complete pairs and overlapping arm FPS ranges. These data do not establish which individual size helps, that B beats defaults, or that newest is harmless across scenes. **Safety scope:** on a separate diagnostic renderer, all 8 tested K/F intervals had complete consecutive flash-comparison coverage and zero detected flashes; the sky/exposure and tree/foliage/occlusion spot checks were inspected without an obvious new artifact. Those runs supply no performance ordering. This is limited-route evidence, not proof of generally current readback values or universal picture safety. One Deck, one session and shared arm data: the contrasts are not independent confirmations, and observed range separation is not a significance test. Kokiri-standing gains can coexist with the Field null results reported elsewhere; these are different scenes, settings, clocks and main revisions. This also does not overturn the later Ally update here that the extra suggestions added nothing resolved after early reads. The result supports keeping the rules opt-in, not a blanket Deck recommendation.
Contributor

Instrumentation caveat for the Steam Deck numbers in our comment above: recurring long frames have nearly the same cadence as our /proc memory sampler. We are investigating an observer effect; no sampler-off control has established its size or whether it changes the arm contrasts. The tail figures (1% low, p95/p99, long-frame counts, maxima) and FPS comparisons include that instrumentation and must not yet be treated as unsampled player experience. The raw results and exclusions are unchanged.

Instrumentation caveat for the Steam Deck numbers in our comment above: recurring long frames have nearly the same cadence as our /proc memory sampler. We are investigating an observer effect; no sampler-off control has established its size or whether it changes the arm contrasts. The tail figures (1% low, p95/p99, long-frame counts, maxima) and FPS comparisons include that instrumentation and must not yet be treated as unsampled player experience. The raw results and exclusions are unchanged.
Contributor

Follow-up to the instrumentation caveat above: a sampler-cadence control on the same Deck moved the recurring long frames with the memory sampler's period (5.8 → 17.8 → 5.8 s), with every Kokiri interval over 100 ms intersecting its smaps_rollup read. That strengthens the observer-effect caveat for our Deck tail numbers; it doesn't estimate unsampled FPS or show that the arm contrasts cancel. Details: #1477 (comment)

Follow-up to the instrumentation caveat above: a sampler-cadence control on the same Deck moved the recurring long frames with the memory sampler's period (5.8 → 17.8 → 5.8 s), with every Kokiri interval over 100 ms intersecting its `smaps_rollup` read. That strengthens the observer-effect caveat for our Deck tail numbers; it doesn't estimate unsampled FPS or show that the arm contrasts cancel. Details: https://git.magicbean.dev/MagicBeanDev/Longshot/issues/1477#issuecomment-49657
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot#1190
No description provided.