perf(vk): cut 120 Hz Auto framegen latency 68-83% and lift native FPS 20-48% (+27-53% 1% low) on GPU-limited GPUs via AutoGuard and Visual FPS target #2369

Open
Jer9 wants to merge 5 commits from Jer9/Longshot:feat/vk-auto-framegen-guard-and-target into main
Contributor

Summary

On high-refresh displays (120 Hz, 180 Hz, 240 Hz), setting Frame generation to Auto (frame_generation=1) computes auto_cap() = clamp((hz + 29) / 30, 2, 4) and generates up to 3–4 frames per game frame. When the GPU is saturated (such as integrated GPUs or power-constrained laptops running at 22–35 FPS native), generating 3 made frames adds ~11–18 ms of FSR 3.1 optical-flow and interpolation passes per game frame. That triggers a negative feedback loop: GPU frame time climbs, native FPS drops 20–48%, display latency balloons past 120–145 ms, and presentations bunch under 2 ms. In issue #2226, locking the game to 30 FPS with V-Sync (FIFO) on 120–180 Hz displays caused Auto frame generation to collapse native FPS to ~24 FPS with ~147 ms of display lag.

This PR resolves the overload loop with two complementary additions:

  1. Auto Overload Guard (gpu/vk/framegen_auto.h): Tracks smoothed native frame time (game_ns), GPU time (gpu_ns), and presentation bunching. When GPU load is heavy, native FPS falls under GPU saturation, or pacing bunches, AutoGuard steps auto_most down conservatively and skips multi-frame interpolation across single-frame hitches (> 50 ms and > 2x smoothed frame time). Thresholds are maker-aware (distinguishing light Built-in FG from heavy FSR 3.1 FI), allow recovery under capped play (such as a 30 FPS cap when spare GPU headroom returns), and reset state cleanly whenever the cap, Visual FPS target, or active frame-generation maker changes (including clearing the GPU EMA on maker switches and guarding missing initial GPU timestamp deltas). RX_VK_FG_AUTO_GUARD=0 disables the guard and hitch suppression completely, restoring prior behavior.
  2. Visual FPS target (longshot_options.ini: frame_generation_target): Adds a row under Frame generation (visible while Frame generation is Auto) offering Display Hz (default), 60, 72, 90, or 120 FPS (never above the display's refresh), published atomically via menu_framegen_target() and clamping Auto's target period and made-frame cap immediately.

What a player notices:

  • On 120+ Hz displays with GPU-limited hardware (such as Radeon 860M / 880M / 890M iGPUs), Frame generation: Auto becomes responsive and smooth: display latency drops by ~70–105 ms (124–147 ms down to 22–34 ms) and native gameplay speeds up by +20–48% (+27–53% 1% low).
  • Under a 30 FPS cap with V-Sync On (FIFO) on 120 Hz displays (#2226), native FPS holds steady at ~30 FPS instead of collapsing to 24 FPS, and Auto now recovers back up to the chosen Visual FPS target (e.g. 0 -> 1 -> 2 -> 3, ~119.4 FPS with Built-in FG) once GPU headroom returns instead of staying latched at 1/3.

Helps:

  • Players on 120+ Hz displays with integrated GPUs (AMD Radeon 860M/880M/890M, Intel Arc Xe/Xe2) or GPU-limited discrete GPUs using Frame generation: Auto.
  • Players capping the game at 30 FPS or targeting 60 / 72 / 90 / 120 FPS visual output on high-refresh displays.

No measurable impact:

  • Players with Frame generation: Off (frame_generation=0) or Fixed multipliers (frame_generation >= 2).
  • High-headroom discrete GPUs whose GPU time stays below the overload floor.

Addresses #2226.

Files to read first:

  • gpu/vk/framegen_auto.h: AutoGuard EMA filters, maker-aware overload/recovery thresholds, hitch suppression, and state reset on (cap, target_choice, heavy_maker).
  • gpu/vk/vk_framegen.cpp: integration with auto_slots(), framegen_record(), have_gpu_delta guard, and framegen_idle().
  • gpu/vk/menu/framegen.cpp and gpu/vk/menu_i18n.h: the Visual FPS target menu row and translations.
  • tests/test_framegen_auto.py: game-free unit tests covering overload step-down, capped recovery, maker asymmetry, target/maker reset, missing GPU delta, hitch suppression, and target clamping.

Testing

Tested:

  • Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon(TM) 860M Graphics (8 CUs, RDNA 3.5 iGPU, 6 GB VRAM), Adrenalin 26.10.1 (LLPC), 2880x1800 @ 120 Hz display.
  • Rebased standalone A/B on current main (8aa5ab87 vs this PR):
    • Market (market-entrance, walked straight forward ~5 s 0:LUP/5000 to the central fountain before panning, 1600x1000 windowed @ 120 Hz, FSR 3.1 67% render scale, FSR 3.1 FG Auto Uncapped, RX_VK_PRECOMPILE=1, 2 interleaved rounds): Immediate native FPS 23.47 -> 33.49 FPS (+42.7%), 1% low 13.61 -> 17.28 FPS (+27.0%), fg_latency.csv median 127.7 -> 22.0 ms (-82.8%). FIFO (vsync=1) native FPS 22.47 -> 33.29 FPS (+48.2%), 1% low 13.72 -> 18.09 FPS (+31.9%), fg_latency.csv median 139.5 -> 30.7 ms (-78.0%).
    • Hyrule Field (castle-gate, 2 interleaved rounds, Immediate): native FPS 23.70 -> 31.40 FPS (+32.5%), 1% low 15.12 -> 19.87 FPS (+31.4%), fg_latency.csv median 132.6 -> 31.7 ms (-76.1%).
  • Capped 30 FPS recovery (Visual FPS target = 120):
    • Built-in FG (Market 1680x1048, 50% render scale, 21.5–22.3 ms GPU): recovered 0 -> 1 -> 2 -> 3 (step-ups=4), reached 119.4 FPS (597 frames/5 s, cap 3/3), held steady with 0 seesaw.
    • FSR 3.1 FI (Kokiri 1280x720, 50% render scale, 15.3–18.4 ms GPU): recovered 0 -> 1 -> 2 -> 3 (step-ups=4, 112.2 FPS); under heavier Market load (24.2–26.2 ms GPU) held 1/3 (60 FPS, 0 <2 ms across 6 windows, 0 late).
  • Live target and maker switch resets (with cap=3 unchanged): switching Display Hz -> 120 FPS reset cap 1/3 -> 3/3; switching FSR 3.1 FG -> Built-in FG reset cap 0/3 -> 3/3.
  • Inverse & switch-bypass probes: RX_VK_MIRROR=1 RX_VK_ASYNC=1, RX_VK_RECORDER=off, RX_VK_FG_AUTO_GUARD=0, and frame_generation=0 all ran cleanly with 0 device-lost or crashes.
  • Prior 3-round standalone A/B (0e32bc10): Market Uncapped +19.7% FPS / +40.5% 1% low / -73.5% latency, Hyrule Uncapped +25.7% FPS / +53.0% 1% low / -68.4% latency, Market 60 cap +20.3% FPS / -73.6% latency, and #2226 Kokiri 30 cap FIFO 24.01 -> 29.99 FPS / -77.4% latency / 99 -> 0 <2 ms bunching.
  • Checks: tests/test_framegen_auto.py (failed before the fix on main and before the recovery fix on f6860d2f, passes here with both clang++ and g++); all 9 test_framegen_* and 21/21 targeted framegen/menu/switch/doc --strict checks pass; full python -I -B tests/run_all.py --strict --jobs 12 passed 900 checks (51 skipped) with 0 regressions unique to this PR (27/27 pre-existing Windows baseline failures reproduced identically on clean forge/main @ 8aa5ab87, including the 3 unrelated #2383 menu failures test_crt_options, test_rumble_menu, test_vibration_menu, plus Windows/POSIX/PATH baseline checks such as test_auto_handheld, test_crash_dialog, test_dev_*, test_linux_preflight, test_pads_after_menu, test_perf_report, test_portable_builder_*, test_vram_compact; test_srccut.py passes via canonical path).

How to test:

  1. On a 120+ Hz display with an integrated or GPU-limited GPU, set Upscaler = AMD FSR 3.1, Render resolution = 67%, Frame generation = Auto, and Visual FPS target = Display Hz.
  2. Load market-entrance, walk straight forward ~5 s (0:LUP/5000) to the central fountain before panning, and compare vk: frame interpolation: display latency and native FPS against RX_VK_FG_AUTO_GUARD=0 (or main).
  3. Set Game frame rate cap = 30, Frame generation = Auto, Visual FPS target = 120, and Frame generation by = Built-in FG at 50% render scale, verifying vk: frame interpolation: logs step-ups > 0 and reaches cap 3/3 (~120 FPS visual).

Still to test:

  • Linux AMD RDNA 3/3.5/4 (RADV Mesa): verify Auto overload guard steps down under GPU saturation and recovers cleanly (@Beanstalk test)
  • Steam Deck LCD/OLED (4c/8t AMD Van Gogh APU, 60 Hz / 90 Hz): verify Auto overload guard and 60 Hz / 90 Hz cadence (@Beanstalk test)
  • Windows NVIDIA RTX 40/50 series GPU: verify DLSS Frame Generation and high-headroom Auto are unaffected by the overload guard (@Beanstalk test)

Measurements

Verdict: On current main (8aa5ab87, Radeon 860M @ 120 Hz, 67% render scale), cuts Auto framegen fg_latency.csv median display latency by 76.1%–82.8% (127.7–139.5 ms -> 22.0–31.7 ms), lifts native FPS by +32.5% to +48.2%, and lifts 1% low FPS by +27.0% to +31.9%; in prior 3-round A/B (0e32bc10), also verified -68.4% to -77.4% log display latency, +19.7% to +25.7% native FPS, +40.5% to +53.0% 1% lows, and #2226 30 FPS cap FIFO recovery (24.01 -> 29.99 FPS, 99 -> 0 <2 ms bunching). Under a 30 FPS cap with Visual FPS target = 120, Auto now recovers 0 -> 1 -> 2 -> 3 (step-ups=4, 119.4 FPS Built-in FG / 112.2 FPS FSR 3.1 FI). Zero impact when Frame Generation is Off (< 0.5% variance) or when RX_VK_FG_AUTO_GUARD=0.

Setup: Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon(TM) 860M Graphics (8 CUs, RDNA 3.5 iGPU, 6 GB VRAM), Adrenalin 26.10.1 (LLPC), 1600x1000 windowed at 120 Hz (screen 2880x1800 at 120 Hz), AMD FSR 3.1 (dlss=3), 67% render scale, AMD FSR 3.1 Frame Generation (frame_generation=1, frame_generation_by=0), RX_VK_PRECOMPILE=1, >= 12 s post-load settle, interleaved runs (2 rounds Immediate in Market & Hyrule Field, 1 interleaved pair FIFO in Market). (A/B binary was built from commit 49097aae; follow-up commits 657af9bd/670c2411 only add the have_gpu_delta initial-sample guard and maker_changed settle frames, leaving steady-state A/B paths identical.)

Where it makes a difference (current main @ 8aa5ab87, 67% render scale):

Metric Before: main @ 8aa5ab87 After: this PR @ 670c2411 Delta
Market Uncapped, Immediate, Auto (Display Hz), 67% render scale:
Native FPS 23.47 33.49 +42.7%
Native 1% low FPS 13.61 17.28 +27.0%
fg_latency.csv median display latency 127.7 ms 22.0 ms -82.8%
Market Uncapped, FIFO V-Sync, Auto (Display Hz), 67% render scale:
Native FPS 22.47 33.29 +48.2%
Native 1% low FPS 13.72 18.09 +31.9%
fg_latency.csv median display latency 139.5 ms 30.7 ms -78.0%
Hyrule Field (castle-gate) Uncapped, Immediate, Auto (Display Hz), 67% render scale:
Native FPS 23.70 31.40 +32.5%
Native 1% low FPS 15.12 19.87 +31.4%
fg_latency.csv median display latency 132.6 ms 31.7 ms -76.1%

Prior 3-round standalone A/B (0e32bc10, #2226 30 FPS cap FIFO + 60 FPS cap, 67% render scale):

Metric Before: main @ 0e32bc10 After: this PR @ 95afa556 Delta
Market 60 FPS Cap, Auto (Display Hz), 67% render scale:
Native FPS 25.47 30.65 +20.3%
Native 1% low FPS 18.53 26.26 +41.7%
Display latency (log mean) 124.0 ms 32.7 ms -73.6%
Issue #2226: Kokiri 30 FPS Cap, FIFO V-Sync, 120 Hz, 67% render scale:
Native FPS 24.01 29.99 +24.9%
Native 1% low FPS 22.16 27.09 +22.2%
Display latency (log mean) 147.1 ms 33.3 ms -77.4%
Presentations < 2 ms apart (per 5 s) 99 0 -100%

Where it does NOT make a difference (within run-to-run variance):

Metric Before: main @ 0e32bc10 After: this PR @ 95afa556 Delta
Market Uncapped, Frame Generation Off (frame_generation=0), 67% render scale — Native FPS 47.06 46.84 -0.5%
Market Uncapped, RX_VK_FG_AUTO_GUARD=0, 67% render scale — Native FPS 25.52 25.70 +0.7%
Market Uncapped, RX_VK_FG_AUTO_GUARD=0, 67% render scale — Display latency 123.7 ms 124.5 ms +0.6%

Raw log excerpt — capped 30 FPS recovery (Visual FPS target = 120, Built-in FG, Market 1680x1048, 50% render scale):

[hos host] vk: frame interpolation: 597 frames shown on time, 0 late (over 2 ms); shown apart: <2 ms 7, 2-7 95, 7-9 343, 9-12 110, 12-17 38, 17-25 4, over 25 0; the game's frames presented 33.6 ms after the game handed them over
[hos host] vk: frame interpolation: Auto target 120 FPS, cap 3/3 made frames/game frame (step-downs 0, step-ups 0, hitches capped 0; RX_VK_FG_AUTO_GUARD=1)

Risks

  • Escape hatch: Setting RX_VK_FG_AUTO_GUARD=0 in longshot_env.txt disables the overload guard and hitch suppression completely, restoring prior unguarded Auto behavior.
  • Options compatibility: frame_generation_target defaults to 0 (Display Hz) in longshot_options.ini; existing configs remain fully backwards-compatible.
  • Caches & ABI: Zero shader or SPIR-V changes (shader cache untouched). MKWVK_API_VERSION remains 45. No game assets or save files are touched.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary On high-refresh displays (120 Hz, 180 Hz, 240 Hz), setting **Frame generation** to **Auto** (`frame_generation=1`) computes `auto_cap() = clamp((hz + 29) / 30, 2, 4)` and generates up to 3–4 frames per game frame. When the GPU is saturated (such as integrated GPUs or power-constrained laptops running at 22–35 FPS native), generating 3 made frames adds ~11–18 ms of FSR 3.1 optical-flow and interpolation passes per game frame. That triggers a negative feedback loop: GPU frame time climbs, native FPS drops 20–48%, display latency balloons past 120–145 ms, and presentations bunch under 2 ms. In issue #2226, locking the game to 30 FPS with V-Sync (FIFO) on 120–180 Hz displays caused Auto frame generation to collapse native FPS to ~24 FPS with ~147 ms of display lag. This PR resolves the overload loop with two complementary additions: 1. **Auto Overload Guard (`gpu/vk/framegen_auto.h`):** Tracks smoothed native frame time (`game_ns`), GPU time (`gpu_ns`), and presentation bunching. When GPU load is heavy, native FPS falls under GPU saturation, or pacing bunches, `AutoGuard` steps `auto_most` down conservatively and skips multi-frame interpolation across single-frame hitches (> 50 ms and > 2x smoothed frame time). Thresholds are maker-aware (distinguishing light Built-in FG from heavy FSR 3.1 FI), allow recovery under capped play (such as a 30 FPS cap when spare GPU headroom returns), and reset state cleanly whenever the cap, `Visual FPS target`, or active frame-generation maker changes (including clearing the GPU EMA on maker switches and guarding missing initial GPU timestamp deltas). `RX_VK_FG_AUTO_GUARD=0` disables the guard and hitch suppression completely, restoring prior behavior. 2. **Visual FPS target (`longshot_options.ini: frame_generation_target`):** Adds a row under **Frame generation** (visible while **Frame generation** is **Auto**) offering **Display Hz** (default), **60**, **72**, **90**, or **120** FPS (never above the display's refresh), published atomically via `menu_framegen_target()` and clamping Auto's target period and made-frame cap immediately. **What a player notices:** - On 120+ Hz displays with GPU-limited hardware (such as Radeon 860M / 880M / 890M iGPUs), **Frame generation: Auto** becomes responsive and smooth: display latency drops by ~70–105 ms (124–147 ms down to 22–34 ms) and native gameplay speeds up by +20–48% (+27–53% 1% low). - Under a 30 FPS cap with V-Sync On (FIFO) on 120 Hz displays (#2226), native FPS holds steady at ~30 FPS instead of collapsing to 24 FPS, and Auto now recovers back up to the chosen `Visual FPS target` (e.g. `0 -> 1 -> 2 -> 3`, ~119.4 FPS with Built-in FG) once GPU headroom returns instead of staying latched at `1/3`. **Helps:** - Players on 120+ Hz displays with integrated GPUs (AMD Radeon 860M/880M/890M, Intel Arc Xe/Xe2) or GPU-limited discrete GPUs using **Frame generation: Auto**. - Players capping the game at 30 FPS or targeting 60 / 72 / 90 / 120 FPS visual output on high-refresh displays. **No measurable impact:** - Players with **Frame generation: Off** (`frame_generation=0`) or **Fixed** multipliers (`frame_generation >= 2`). - High-headroom discrete GPUs whose GPU time stays below the overload floor. Addresses #2226. Files to read first: - `gpu/vk/framegen_auto.h`: `AutoGuard` EMA filters, maker-aware overload/recovery thresholds, hitch suppression, and state reset on `(cap, target_choice, heavy_maker)`. - `gpu/vk/vk_framegen.cpp`: integration with `auto_slots()`, `framegen_record()`, `have_gpu_delta` guard, and `framegen_idle()`. - `gpu/vk/menu/framegen.cpp` and `gpu/vk/menu_i18n.h`: the `Visual FPS target` menu row and translations. - `tests/test_framegen_auto.py`: game-free unit tests covering overload step-down, capped recovery, maker asymmetry, target/maker reset, missing GPU delta, hitch suppression, and target clamping. ## Testing **Tested:** - Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon(TM) 860M Graphics (8 CUs, RDNA 3.5 iGPU, 6 GB VRAM), Adrenalin 26.10.1 (LLPC), 2880x1800 @ 120 Hz display. - **Rebased standalone A/B on current `main` (`8aa5ab87` vs this PR):** - Market (`market-entrance`, walked straight forward ~5 s `0:LUP/5000` to the central fountain before panning, 1600x1000 windowed @ 120 Hz, FSR 3.1 `67% render scale`, FSR 3.1 FG Auto Uncapped, `RX_VK_PRECOMPILE=1`, 2 interleaved rounds): Immediate native FPS `23.47 -> 33.49 FPS` (+42.7%), 1% low `13.61 -> 17.28 FPS` (+27.0%), `fg_latency.csv` median `127.7 -> 22.0 ms` (-82.8%). FIFO (`vsync=1`) native FPS `22.47 -> 33.29 FPS` (+48.2%), 1% low `13.72 -> 18.09 FPS` (+31.9%), `fg_latency.csv` median `139.5 -> 30.7 ms` (-78.0%). - Hyrule Field (`castle-gate`, 2 interleaved rounds, Immediate): native FPS `23.70 -> 31.40 FPS` (+32.5%), 1% low `15.12 -> 19.87 FPS` (+31.4%), `fg_latency.csv` median `132.6 -> 31.7 ms` (-76.1%). - **Capped 30 FPS recovery (`Visual FPS target = 120`):** - Built-in FG (Market `1680x1048`, `50% render scale`, `21.5–22.3 ms` GPU): recovered `0 -> 1 -> 2 -> 3` (`step-ups=4`), reached `119.4 FPS` (`597` frames/5 s, `cap 3/3`), held steady with `0` seesaw. - FSR 3.1 FI (Kokiri `1280x720`, `50% render scale`, `15.3–18.4 ms` GPU): recovered `0 -> 1 -> 2 -> 3` (`step-ups=4`, `112.2 FPS`); under heavier Market load (`24.2–26.2 ms` GPU) held `1/3` (`60 FPS`, `0` `<2 ms` across 6 windows, `0` late). - **Live target and maker switch resets (with `cap=3` unchanged):** switching `Display Hz -> 120 FPS` reset `cap 1/3 -> 3/3`; switching `FSR 3.1 FG -> Built-in FG` reset `cap 0/3 -> 3/3`. - **Inverse & switch-bypass probes:** `RX_VK_MIRROR=1 RX_VK_ASYNC=1`, `RX_VK_RECORDER=off`, `RX_VK_FG_AUTO_GUARD=0`, and `frame_generation=0` all ran cleanly with `0` device-lost or crashes. - **Prior 3-round standalone A/B (`0e32bc10`):** Market Uncapped `+19.7%` FPS / `+40.5%` 1% low / `-73.5%` latency, Hyrule Uncapped `+25.7%` FPS / `+53.0%` 1% low / `-68.4%` latency, Market 60 cap `+20.3%` FPS / `-73.6%` latency, and #2226 Kokiri 30 cap FIFO `24.01 -> 29.99 FPS` / `-77.4%` latency / `99 -> 0` `<2 ms` bunching. - **Checks:** `tests/test_framegen_auto.py` (failed before the fix on `main` and before the recovery fix on `f6860d2f`, passes here with both `clang++` and `g++`); all 9 `test_framegen_*` and 21/21 targeted framegen/menu/switch/doc `--strict` checks pass; full `python -I -B tests/run_all.py --strict --jobs 12` passed **900** checks (`51` skipped) with `0` regressions unique to this PR (27/27 pre-existing Windows baseline failures reproduced identically on clean `forge/main @ 8aa5ab87`, including the 3 unrelated `#2383` menu failures `test_crt_options`, `test_rumble_menu`, `test_vibration_menu`, plus Windows/POSIX/PATH baseline checks such as `test_auto_handheld`, `test_crash_dialog`, `test_dev_*`, `test_linux_preflight`, `test_pads_after_menu`, `test_perf_report`, `test_portable_builder_*`, `test_vram_compact`; `test_srccut.py` passes via canonical path). **How to test:** 1. On a 120+ Hz display with an integrated or GPU-limited GPU, set `Upscaler = AMD FSR 3.1`, `Render resolution = 67%`, `Frame generation = Auto`, and `Visual FPS target = Display Hz`. 2. Load `market-entrance`, walk straight forward ~5 s (`0:LUP/5000`) to the central fountain before panning, and compare `vk: frame interpolation:` display latency and native FPS against `RX_VK_FG_AUTO_GUARD=0` (or `main`). 3. Set `Game frame rate cap = 30`, `Frame generation = Auto`, `Visual FPS target = 120`, and `Frame generation by = Built-in FG` at `50% render scale`, verifying `vk: frame interpolation:` logs `step-ups` > 0 and reaches `cap 3/3` (~120 FPS visual). **Still to test:** - Linux AMD RDNA 3/3.5/4 (RADV Mesa): verify Auto overload guard steps down under GPU saturation and recovers cleanly (@Beanstalk test) - Steam Deck LCD/OLED (4c/8t AMD Van Gogh APU, 60 Hz / 90 Hz): verify Auto overload guard and 60 Hz / 90 Hz cadence (@Beanstalk test) - Windows NVIDIA RTX 40/50 series GPU: verify DLSS Frame Generation and high-headroom Auto are unaffected by the overload guard (@Beanstalk test) ## Measurements **Verdict:** On current `main` (`8aa5ab87`, Radeon 860M @ 120 Hz, `67% render scale`), cuts Auto framegen `fg_latency.csv` median display latency by **76.1%–82.8%** (`127.7–139.5 ms -> 22.0–31.7 ms`), lifts native FPS by **+32.5% to +48.2%**, and lifts 1% low FPS by **+27.0% to +31.9%**; in prior 3-round A/B (`0e32bc10`), also verified **-68.4% to -77.4%** log display latency, **+19.7% to +25.7%** native FPS, **+40.5% to +53.0%** 1% lows, and #2226 30 FPS cap FIFO recovery (`24.01 -> 29.99 FPS`, `99 -> 0` `<2 ms` bunching). Under a 30 FPS cap with `Visual FPS target = 120`, Auto now recovers `0 -> 1 -> 2 -> 3` (`step-ups=4`, `119.4 FPS` Built-in FG / `112.2 FPS` FSR 3.1 FI). Zero impact when Frame Generation is Off (< 0.5% variance) or when `RX_VK_FG_AUTO_GUARD=0`. Setup: Windows 11 (build 26200), AMD Ryzen AI 7 350, AMD Radeon(TM) 860M Graphics (8 CUs, RDNA 3.5 iGPU, 6 GB VRAM), Adrenalin 26.10.1 (LLPC), `1600x1000` windowed at 120 Hz (`screen 2880x1800 at 120 Hz`), AMD FSR 3.1 (`dlss=3`), `67% render scale`, AMD FSR 3.1 Frame Generation (`frame_generation=1`, `frame_generation_by=0`), `RX_VK_PRECOMPILE=1`, `>= 12 s` post-load settle, interleaved runs (2 rounds Immediate in Market & Hyrule Field, 1 interleaved pair FIFO in Market). *(A/B binary was built from commit `49097aae`; follow-up commits `657af9bd`/`670c2411` only add the `have_gpu_delta` initial-sample guard and `maker_changed` settle frames, leaving steady-state A/B paths identical.)* **Where it makes a difference (current `main` @ `8aa5ab87`, `67% render scale`):** | Metric | Before: main @ 8aa5ab87 | After: this PR @ 670c2411 | Delta | |---|---:|---:|---:| | **Market Uncapped, Immediate, Auto (Display Hz), 67% render scale:** | | | | | Native FPS | 23.47 | 33.49 | +42.7% | | Native 1% low FPS | 13.61 | 17.28 | +27.0% | | `fg_latency.csv` median display latency | 127.7 ms | 22.0 ms | -82.8% | | **Market Uncapped, FIFO V-Sync, Auto (Display Hz), 67% render scale:** | | | | | Native FPS | 22.47 | 33.29 | +48.2% | | Native 1% low FPS | 13.72 | 18.09 | +31.9% | | `fg_latency.csv` median display latency | 139.5 ms | 30.7 ms | -78.0% | | **Hyrule Field (`castle-gate`) Uncapped, Immediate, Auto (Display Hz), 67% render scale:** | | | | | Native FPS | 23.70 | 31.40 | +32.5% | | Native 1% low FPS | 15.12 | 19.87 | +31.4% | | `fg_latency.csv` median display latency | 132.6 ms | 31.7 ms | -76.1% | **Prior 3-round standalone A/B (`0e32bc10`, `#2226` 30 FPS cap FIFO + 60 FPS cap, `67% render scale`):** | Metric | Before: main @ 0e32bc10 | After: this PR @ 95afa556 | Delta | |---|---:|---:|---:| | **Market 60 FPS Cap, Auto (Display Hz), 67% render scale:** | | | | | Native FPS | 25.47 | 30.65 | +20.3% | | Native 1% low FPS | 18.53 | 26.26 | +41.7% | | Display latency (log mean) | 124.0 ms | 32.7 ms | -73.6% | | **Issue #2226: Kokiri 30 FPS Cap, FIFO V-Sync, 120 Hz, 67% render scale:** | | | | | Native FPS | 24.01 | 29.99 | +24.9% | | Native 1% low FPS | 22.16 | 27.09 | +22.2% | | Display latency (log mean) | 147.1 ms | 33.3 ms | -77.4% | | Presentations `< 2 ms` apart (per 5 s) | 99 | 0 | -100% | **Where it does NOT make a difference (within run-to-run variance):** | Metric | Before: main @ 0e32bc10 | After: this PR @ 95afa556 | Delta | |---|---:|---:|---:| | Market Uncapped, Frame Generation Off (`frame_generation=0`), 67% render scale — Native FPS | 47.06 | 46.84 | -0.5% | | Market Uncapped, `RX_VK_FG_AUTO_GUARD=0`, 67% render scale — Native FPS | 25.52 | 25.70 | +0.7% | | Market Uncapped, `RX_VK_FG_AUTO_GUARD=0`, 67% render scale — Display latency | 123.7 ms | 124.5 ms | +0.6% | **Raw log excerpt — capped 30 FPS recovery (`Visual FPS target = 120`, Built-in FG, Market `1680x1048`, `50% render scale`):** ```text [hos host] vk: frame interpolation: 597 frames shown on time, 0 late (over 2 ms); shown apart: <2 ms 7, 2-7 95, 7-9 343, 9-12 110, 12-17 38, 17-25 4, over 25 0; the game's frames presented 33.6 ms after the game handed them over [hos host] vk: frame interpolation: Auto target 120 FPS, cap 3/3 made frames/game frame (step-downs 0, step-ups 0, hitches capped 0; RX_VK_FG_AUTO_GUARD=1) ``` ## Risks - **Escape hatch:** Setting `RX_VK_FG_AUTO_GUARD=0` in `longshot_env.txt` disables the overload guard and hitch suppression completely, restoring prior unguarded Auto behavior. - **Options compatibility:** `frame_generation_target` defaults to `0` (`Display Hz`) in `longshot_options.ini`; existing configs remain fully backwards-compatible. - **Caches & ABI:** Zero shader or SPIR-V changes (shader cache untouched). `MKWVK_API_VERSION` remains 45. No game assets or save files are touched. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
Assisted-by: Antigravity
feat(vk): add Auto framegen overload guard, hitch suppression, and Visual FPS target
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
beanstalk/approval can't be tested as asked: see the farm's comment
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
95afa5567a
Assisted-by: Antigravity
Member

Possibly related, for context:

  • issue #1519 Frame pacing has no single owner: the host sets game time and the cap in three places, and the renderer picks the present mode by a nest of conditions — Open frame-pacing architecture issue; adjacent context, not the specific overload/Auto fix
Possibly related, for context: - issue #1519 Frame pacing has no single owner: the host sets game time and the cap in three places, and the renderer picks the present mode by a nest of conditions — Open frame-pacing architecture issue; adjacent context, not the specific overload/Auto fix
Author
Contributor

@Beanstalk Please test Frame generation: Auto on Linux AMD RADV (120+ Hz), Steam Deck (60 Hz / 90 Hz), and Windows NVIDIA RTX 40/50 (DLSS-G + high-headroom Auto) to confirm overload guard backoff on GPU-limited hardware and zero throttling on high-headroom GPUs.

@Beanstalk Please test Frame generation: Auto on Linux AMD RADV (120+ Hz), Steam Deck (60 Hz / 90 Hz), and Windows NVIDIA RTX 40/50 (DLSS-G + high-headroom Auto) to confirm overload guard backoff on GPU-limited hardware and zero throttling on high-headroom GPUs.
Member

@Jer9 only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@Jer9 only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The guard can permanently reduce visual frame rate when the game is CPU-limited even though the GPU has ample headroom, and the new live setting is accessed across threads without synchronization. The reported iGPU gains are substantial, but the default also needs coverage on the other systems it affects.

Auto frame generation gains an overload guard, hitch suppression, and a selectable visual FPS target. The reported Windows iGPU runs show lower latency and higher native FPS at the cost of fewer displayed frames; the guard can also unnecessarily reduce smoothness on CPU-limited systems.

Blocking (1): must change before merging.

  1. L1 gpu/vk/framegen_auto.h:169: Low native FPS alone is treated as GPU overload, even when GPU timing shows ample headroom. (more on the line) Do: Distinguish CPU-limited low FPS from GPU overload, and allow recovery when GPU timing shows sufficient headroom; add a sustained CPU-limited case to the guard tests.

Should fix (1): not blocking, but worth doing before merging.

  • L2 gpu/vk/vk_framegen.cpp:1691: The replay thread reads the new plain integer while the menu can write it on the display thread, creating a data race. (more on the line) Do: Publish the selected target through an atomic or the existing appropriate synchronization mechanism, and read a synchronized snapshot in framegen_record.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L3 gpu/vk/vk_framegen.cpp:1711: The default guard changes Auto pacing on Linux AMD and Steam Deck, where no run is reported. (more on the line) Do: Run Auto under load and after load clears on Linux RADV and Steam Deck, comparing native FPS, frame times and presentation pacing against the base.
  • L4 gpu/vk/vk_framegen.cpp:1711: The default guard also changes Auto on NVIDIA systems, but high-headroom behavior has not been measured there. (more on the line) Do: Compare Auto against the base on a Windows NVIDIA Tier 1 GPU, including a high-headroom scene and a transition out of load.

@fix can do L1 and L2.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • tests/test_framegen_auto.py:488: Is there a current production case where the guard decision fails to control the generated slots?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes on the reported Radeon 860M workload: three interleaved runs report 25.52 to 30.54 native FPS and 123.7 to 32.8 ms display latency in Market, with 1% lows rising from 18.39 to 25.83 FPS. The baseline is 0e32bc10 rather than the merge base, and the effect on other hardware remains unproven.

Other systems: Auto uses FSR or the built-in interpolator on Windows and Linux, including NVIDIA, AMD, Intel and Steam Deck; fixed multipliers use a separate path. The guard consumes replay GPU timing and display-thread pacing feedback, so both timing and presentation behavior need coverage. The supplied runs cover Windows Radeon 860M; Linux RADV, Steam Deck and NVIDIA results are pending.

Switches: RX_VK_FG_AUTO_GUARD is added, default on, with a switches.def row; its default is measured on the 860M but is not yet established across affected hardware. Setting it to 0 disables the guard and hitch suppression. The saved frame_generation_target option defaults to Display Hz and offers 60, 72, 90 and 120 FPS.

Reviewed: 95afa5567a against 958b71f957: Read the repository rules, PR template, standards, commit messages, framegen_auto.h and the changed frame-generation integration and menu paths. Reviewed the test fixture and changed test wiring; skimmed translation additions and user documentation. The complete vk_framegen.cpp and vk_replay.cpp files and the full translation tables were not read. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The new switch has a switches.def row, and the saved menu key and settings documentation are updated.
  • The changed files contain no game assets, shader changes, or renderer API structure changes.
  • Fixed multipliers bypass the new Auto decision path.

Testing: Read-only review; no builds, tests, or project scripts were run. The PR reports Windows iGPU runs and game-free tests; CI is still running.

Overlaps and merge order: Not checked; network access is unavailable.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The guard can permanently reduce visual frame rate when the game is CPU-limited even though the GPU has ample headroom, and the new live setting is accessed across threads without synchronization. The reported iGPU gains are substantial, but the default also needs coverage on the other systems it affects. Auto frame generation gains an overload guard, hitch suppression, and a selectable visual FPS target. The reported Windows iGPU runs show lower latency and higher native FPS at the cost of fewer displayed frames; the guard can also unnecessarily reduce smoothness on CPU-limited systems. **Blocking (1)**: must change before merging. 1. **L1** `gpu/vk/framegen_auto.h:169`: Low native FPS alone is treated as GPU overload, even when GPU timing shows ample headroom. (more on the line) **Do:** Distinguish CPU-limited low FPS from GPU overload, and allow recovery when GPU timing shows sufficient headroom; add a sustained CPU-limited case to the guard tests. **Should fix (1)**: not blocking, but worth doing before merging. - **L2** `gpu/vk/vk_framegen.cpp:1691`: The replay thread reads the new plain integer while the menu can write it on the display thread, creating a data race. (more on the line) **Do:** Publish the selected target through an atomic or the existing appropriate synchronization mechanism, and read a synchronized snapshot in framegen_record. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L3** `gpu/vk/vk_framegen.cpp:1711`: The default guard changes Auto pacing on Linux AMD and Steam Deck, where no run is reported. (more on the line) **Do:** Run Auto under load and after load clears on Linux RADV and Steam Deck, comparing native FPS, frame times and presentation pacing against the base. - **L4** `gpu/vk/vk_framegen.cpp:1711`: The default guard also changes Auto on NVIDIA systems, but high-headroom behavior has not been measured there. (more on the line) **Do:** Compare Auto against the base on a Windows NVIDIA Tier 1 GPU, including a high-headroom scene and a transition out of load. `@fix` can do L1 and L2. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `tests/test_framegen_auto.py:488`: Is there a current production case where the guard decision fails to control the generated slots? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the reported Radeon 860M workload: three interleaved runs report 25.52 to 30.54 native FPS and 123.7 to 32.8 ms display latency in Market, with 1% lows rising from 18.39 to 25.83 FPS. The baseline is 0e32bc10 rather than the merge base, and the effect on other hardware remains unproven. **Other systems:** Auto uses FSR or the built-in interpolator on Windows and Linux, including NVIDIA, AMD, Intel and Steam Deck; fixed multipliers use a separate path. The guard consumes replay GPU timing and display-thread pacing feedback, so both timing and presentation behavior need coverage. The supplied runs cover Windows Radeon 860M; Linux RADV, Steam Deck and NVIDIA results are pending. **Switches:** RX_VK_FG_AUTO_GUARD is added, default on, with a switches.def row; its default is measured on the 860M but is not yet established across affected hardware. Setting it to 0 disables the guard and hitch suppression. The saved frame_generation_target option defaults to Display Hz and offers 60, 72, 90 and 120 FPS. **Reviewed:** 95afa5567a6d against 958b71f9574f: Read the repository rules, PR template, standards, commit messages, framegen_auto.h and the changed frame-generation integration and menu paths. Reviewed the test fixture and changed test wiring; skimmed translation additions and user documentation. The complete vk_framegen.cpp and vk_replay.cpp files and the full translation tables were not read. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The new switch has a switches.def row, and the saved menu key and settings documentation are updated. - The changed files contain no game assets, shader changes, or renderer API structure changes. - Fixed multipliers bypass the new Auto decision path. **Testing:** Read-only review; no builds, tests, or project scripts were run. The PR reports Windows iGPU runs and game-free tests; CI is still running. **Overlaps and merge order:** Not checked; network access is unavailable. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +166,4 @@
if (max_made >= 2) {
const bool gpu_over =
gpu_ready && smooth_gpu_ns >= kGpuHeavyNs && smooth_gpu_ns * 100 >= smooth_game_ns * 72;
const bool fps_over = smooth_game_ns > kLowFpsMultiNs;
Member

L1 (blocking): Low native FPS alone is treated as GPU overload, even when GPU timing shows ample headroom.

When: At a sustained CPU-limited 25 FPS with a 5 ms GPU time and a 120 Hz display, fps_over steps the cap from three made frames to one. Recovery requires a frame time of at most 35 ms, so Auto stays near 50 displayed FPS instead of using the available GPU headroom to approach 100 FPS.

Do: Distinguish CPU-limited low FPS from GPU overload, and allow recovery when GPU timing shows sufficient headroom; add a sustained CPU-limited case to the guard tests.

**L1** (blocking): Low native FPS alone is treated as GPU overload, even when GPU timing shows ample headroom. *When:* At a sustained CPU-limited 25 FPS with a 5 ms GPU time and a 120 Hz display, fps_over steps the cap from three made frames to one. Recovery requires a frame time of at most 35 ms, so Auto stays near 50 displayed FPS instead of using the available GPU headroom to approach 100 FPS. **Do:** Distinguish CPU-limited low FPS from GPU overload, and allow recovery when GPU timing shows sufficient headroom; add a sustained CPU-limited case to the guard tests.
@ -1648,2 +1689,3 @@
if (auto_rate) { // (Auto: a frame for each of the display's refreshes or Visual FPS target, with overload guard)
const int mhz = display_refresh_mhz();
const int64_t period = (int64_t)(1e12 / (mhz > 0 ? mhz : 60000));
const int target_choice = opts.framegen_target;
Member

L2 (should fix): The replay thread reads the new plain integer while the menu can write it on the display thread, creating a data race.

When: Changing Visual FPS target while Auto is running writes opts.framegen_target through the menu row while framegen_record reads it to choose the period and cap. Those unsynchronized concurrent accesses have undefined behavior.

Do: Publish the selected target through an atomic or the existing appropriate synchronization mechanism, and read a synchronized snapshot in framegen_record.

**L2** (should fix): The replay thread reads the new plain integer while the menu can write it on the display thread, creating a data race. *When:* Changing Visual FPS target while Auto is running writes opts.framegen_target through the menu row while framegen_record reads it to choose the period and cap. Those unsynchronized concurrent accesses have undefined behavior. **Do:** Publish the selected target through an atomic or the existing appropriate synchronization mechanism, and read a synchronized snapshot in framegen_record.
@ -1653,2 +1709,3 @@
if (blend) {
n = auto_slots(before, now, period, fg.slot_next, t, at, std::min(fg.mult, kMaxMult));
const uint32_t d0 = fg_auto.auto_guard.step_downs, u0 = fg_auto.auto_guard.step_ups, h0 = fg_auto.auto_guard.hitches_capped;
const auto dec = fg_auto.auto_guard.step({now - before, gpu_delta, gpu_now > 0, pace_bad, cap_made,
Member

L3 (should fix): The default guard changes Auto pacing on Linux AMD and Steam Deck, where no run is reported.

When: The same pacing feedback and step-down logic runs on RADV and the Deck, but the supplied evidence cannot show its cadence, recovery or performance there.

Do: Run Auto under load and after load clears on Linux RADV and Steam Deck, comparing native FPS, frame times and presentation pacing against the base.

**L3** (should fix): The default guard changes Auto pacing on Linux AMD and Steam Deck, where no run is reported. *When:* The same pacing feedback and step-down logic runs on RADV and the Deck, but the supplied evidence cannot show its cadence, recovery or performance there. **Do:** Run Auto under load and after load clears on Linux RADV and Steam Deck, comparing native FPS, frame times and presentation pacing against the base.
Member

L4 (should fix): The default guard also changes Auto on NVIDIA systems, but high-headroom behavior has not been measured there.

When: Auto uses the same guard and display pacing feedback on NVIDIA; the reported AMD iGPU runs do not show whether it preserves high-refresh cadence on that driver.

Do: Compare Auto against the base on a Windows NVIDIA Tier 1 GPU, including a high-headroom scene and a transition out of load.

**L4** (should fix): The default guard also changes Auto on NVIDIA systems, but high-headroom behavior has not been measured there. *When:* Auto uses the same guard and display pacing feedback on NVIDIA; the reported AMD iGPU runs do not show whether it preserves high-refresh cadence on that driver. **Do:** Compare Auto against the base on a Windows NVIDIA Tier 1 GPU, including a high-headroom scene and a transition out of load.
Member

Beanstalk test farm

Commit 670c241 · approved by nobody yet · dashboard

A member of BigBeans can review this commit and comment @Beanstalk to test it.

<!-- beanstalk:sticky --> ### Beanstalk test farm Commit `670c241` · approved by nobody yet · [dashboard](https://beanstalk.magicbean.dev/prs/2369) A member of `BigBeans` can review this commit and comment `@Beanstalk` to test it.
Owner

@beanstalk send job to zireael9797

@beanstalk send job to zireael9797
Owner

@beanstalk

@beanstalk
fix(vk): gate Auto FG low-FPS throttle by GPU load and publish target atomically
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
19e565649c
Gate fps_over by GPU utilization when GPU timestamps are ready and allow 0->1->3 step-up recovery under sustained CPU-limited low FPS with ample GPU headroom. Publish opts.framegen_target through an atomic snapshot (menu_framegen_target()) mirrored on grass_distance_now to eliminate the cross-thread data race.

Assisted-by: Antigravity
Author
Contributor

Addressed BeanBot review findings L1 and L2 in commit 19e565649ce90977495c61e1bfa9a70f04acebc4 (also updated the stale ## Summary description of fps_over):

Changes

  1. L1 (gpu/vk/framegen_auto.h:169-170, 211-224) — Distinguish CPU-limited low FPS from GPU overload:

    • Gated fps_over (max_made >= 2) on GPU utilization when gpu_ready is true (smooth_game_ns > kLowFpsMultiNs && (!gpu_ready || smooth_gpu_ns * 100 >= smooth_game_ns * 72)), so sustained CPU-limited low native FPS with ample GPU headroom does not trigger overload backoff.
    • Enabled 0 -> 1 and 1 -> 3 step-up recovery when gpu_ready shows ample GPU headroom (smooth_gpu_ns <= kGpuHeadroomNs && smooth_gpu_ns * 100 <= smooth_game_ns * 55) even under sustained CPU-limited low FPS.
    • Added sustained CPU-limited non-throttling and 0 -> 1 -> 2 -> 3 recovery tests plus atomic target wiring checks in tests/test_framegen_auto.py.
    • These adjustments do not change the GPU-bound Radeon 860M behavior reported in ## Measurements, where GPU busy time remains well above the overload thresholds.
  2. L2 (gpu/vk/vk_menu.cpp, gpu/vk/vk_menu.h, gpu/vk/vk_framegen.cpp:1691) — Synchronize opts.framegen_target reads:

    • Added std::atomic<int> framegen_target_now{0} (matching grass_distance_now), updated on menu_init() and set_row(), and exposed via menu_framegen_target() for lock-free reading in framegen_record().
    • Updated affected srccut test fixtures (tests/present_source_crop_test.cpp, tests/test_crt_options.py, tests/test_framegen_preset.py, tests/test_rumble_menu.py, tests/test_upscaler_round_trip.py, tests/test_vibration_menu.py).

Verification

  • python -I -B tests/run_all.py --strict across all 15 affected checks (test_framegen_auto, test_present_source_crop, test_crt_options, test_framegen_preset, test_rumble_menu, test_upscaler_round_trip, test_vibration_menu, test_switch_table, test_menu_modules, test_menu_rows_model, test_menu_i18n_count, test_preset_exempt, test_framegen_by_row, test_framegen_dlss_cap, test_framegen_fixed_pace): 15 passed, 0 failed, 0 skipped.
  • python -I -B tests/run_all.py --changed 958b71f9 on Windows: 144 passed, 5 failed, 4 skipped (all 5 failures are unrelated Windows console encoding / path / llvm-mingw -Wunused-but-set-global issues: test_crash_dialog, test_dev_ab, test_dev_packs, test_input_movie, test_srccut).
  • python -I scripts/dev.py vk on Windows (llvm-mingw): builds cleanly (longshot_vk.dll).

Remaining Hardware Coverage (Should fix L3 & L4)

  • L3 (Linux AMD / Steam Deck Auto pacing) and L4 (Windows NVIDIA high-headroom Auto behavior) require hardware unavailable locally and are queued for Beanstalk Test Farm execution once CI finishes on the updated head.
Addressed BeanBot review findings **L1** and **L2** in commit `19e565649ce90977495c61e1bfa9a70f04acebc4` (also updated the stale `## Summary` description of `fps_over`): ### Changes 1. **L1 (`gpu/vk/framegen_auto.h:169-170, 211-224`) — Distinguish CPU-limited low FPS from GPU overload:** - Gated `fps_over` (`max_made >= 2`) on GPU utilization when `gpu_ready` is true (`smooth_game_ns > kLowFpsMultiNs && (!gpu_ready || smooth_gpu_ns * 100 >= smooth_game_ns * 72)`), so sustained CPU-limited low native FPS with ample GPU headroom does not trigger overload backoff. - Enabled `0 -> 1` and `1 -> 3` step-up recovery when `gpu_ready` shows ample GPU headroom (`smooth_gpu_ns <= kGpuHeadroomNs && smooth_gpu_ns * 100 <= smooth_game_ns * 55`) even under sustained CPU-limited low FPS. - Added sustained CPU-limited non-throttling and `0 -> 1 -> 2 -> 3` recovery tests plus atomic target wiring checks in `tests/test_framegen_auto.py`. - These adjustments do not change the GPU-bound Radeon 860M behavior reported in `## Measurements`, where GPU busy time remains well above the overload thresholds. 2. **L2 (`gpu/vk/vk_menu.cpp`, `gpu/vk/vk_menu.h`, `gpu/vk/vk_framegen.cpp:1691`) — Synchronize `opts.framegen_target` reads:** - Added `std::atomic<int> framegen_target_now{0}` (matching `grass_distance_now`), updated on `menu_init()` and `set_row()`, and exposed via `menu_framegen_target()` for lock-free reading in `framegen_record()`. - Updated affected `srccut` test fixtures (`tests/present_source_crop_test.cpp`, `tests/test_crt_options.py`, `tests/test_framegen_preset.py`, `tests/test_rumble_menu.py`, `tests/test_upscaler_round_trip.py`, `tests/test_vibration_menu.py`). ### Verification - `python -I -B tests/run_all.py --strict` across all 15 affected checks (`test_framegen_auto`, `test_present_source_crop`, `test_crt_options`, `test_framegen_preset`, `test_rumble_menu`, `test_upscaler_round_trip`, `test_vibration_menu`, `test_switch_table`, `test_menu_modules`, `test_menu_rows_model`, `test_menu_i18n_count`, `test_preset_exempt`, `test_framegen_by_row`, `test_framegen_dlss_cap`, `test_framegen_fixed_pace`): **15 passed, 0 failed, 0 skipped**. - `python -I -B tests/run_all.py --changed 958b71f9` on Windows: **144 passed, 5 failed, 4 skipped** (all 5 failures are unrelated Windows console encoding / path / `llvm-mingw` `-Wunused-but-set-global` issues: `test_crash_dialog`, `test_dev_ab`, `test_dev_packs`, `test_input_movie`, `test_srccut`). - `python -I scripts/dev.py vk` on Windows (`llvm-mingw`): builds cleanly (`longshot_vk.dll`). ### Remaining Hardware Coverage (`Should fix` L3 & L4) - L3 (Linux AMD / Steam Deck Auto pacing) and L4 (Windows NVIDIA high-headroom Auto behavior) require hardware unavailable locally and are queued for Beanstalk Test Farm execution once CI finishes on the updated head.
Jer9 force-pushed feat/vk-auto-framegen-guard-and-target from 19e565649c
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 7bd7b80a57
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-23 23:27:11 +00:00
Compare
Jer9 changed title from perf(vk): cut 120 Hz Auto framegen latency 68-77% and lift native FPS 20-26% (+41-53% 1% low) on GPU-limited GPUs via overload guard and Visual FPS target to WIP: perf(vk): cut 120 Hz Auto framegen latency 68-77% and lift native FPS 20-26% (+41-53% 1% low) on GPU-limited GPUs via overload guard and Visual FPS target 2026-11-24 09:40:03 +00:00
Author
Contributor

Moving back to WIP: briefly after catching an AutoGuard recovery issue in extended playtesting on Radeon 860M:

  • Under a 30 FPS cap (33.3 ms frame budget) with Built-in FG and Visual FPS target: 120 (on a 100 Hz display), once AutoGuard stepped down 3 -> 2 -> 1 made frames, it stayed latched at 1/3 (60 FPS) with 0 step-ups even while GPU time sat around 19.1–19.9 ms (>13 ms spare headroom, and fixed 8x ran smoothly).
  • Root causes: the step-up gate (smooth_gpu_ns <= 18.0 ms and <= 55% of frame time) is too tight for capped 30 FPS play and applies the same FSR 3.1 FI-tuned thresholds to the much lighter Built-in FG path; additionally, switching between Display Hz and 120 FPS doesn't reset AutoGuard when cap == last_cap.

I will update AutoGuard recovery/maker awareness + target-change reset, re-run the A/B and unit tests, and mark ready again once verified.

Moving back to `WIP:` briefly after catching an `AutoGuard` recovery issue in extended playtesting on Radeon 860M: - Under a `30 FPS` cap (`33.3 ms` frame budget) with Built-in FG and `Visual FPS target: 120` (on a 100 Hz display), once `AutoGuard` stepped down `3 -> 2 -> 1` made frames, it stayed latched at `1/3` (`60 FPS`) with `0` step-ups even while GPU time sat around `19.1–19.9 ms` (>13 ms spare headroom, and fixed `8x` ran smoothly). - Root causes: the step-up gate (`smooth_gpu_ns <= 18.0 ms` and `<= 55%` of frame time) is too tight for capped `30 FPS` play and applies the same FSR 3.1 FI-tuned thresholds to the much lighter Built-in FG path; additionally, switching between `Display Hz` and `120 FPS` doesn't reset `AutoGuard` when `cap == last_cap`. I will update `AutoGuard` recovery/maker awareness + target-change reset, re-run the A/B and unit tests, and mark ready again once verified.
Jer9 force-pushed feat/vk-auto-framegen-guard-and-target from 7bd7b80a57
Some checks failed
beanstalk/approval not approved yet
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 670c2411cc
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 9s
2026-11-24 14:48:05 +00:00
Compare
Jer9 changed title from WIP: perf(vk): cut 120 Hz Auto framegen latency 68-77% and lift native FPS 20-26% (+41-53% 1% low) on GPU-limited GPUs via overload guard and Visual FPS target to WIP: perf(vk): cut 120 Hz Auto framegen latency 68-83% and lift native FPS 20-48% (+27-53% 1% low) on GPU-limited GPUs via AutoGuard and Visual FPS target 2026-11-24 14:48:47 +00:00
Jer9 changed title from WIP: perf(vk): cut 120 Hz Auto framegen latency 68-83% and lift native FPS 20-48% (+27-53% 1% low) on GPU-limited GPUs via AutoGuard and Visual FPS target to perf(vk): cut 120 Hz Auto framegen latency 68-83% and lift native FPS 20-48% (+27-53% 1% low) on GPU-limited GPUs via AutoGuard and Visual FPS target 2026-11-24 14:48:58 +00:00
Author
Contributor

Updated head 670c2411 (rebased onto forge/main @ 8aa5ab87, AutoGuard capped 30 FPS recovery, maker-aware thresholds, and target/maker switch state reset verified on Windows 11 Radeon 860M).

@Beanstalk please test on the updated head:

  • Linux AMD RADV (RDNA 3/3.5/4): verify Auto overload step-down under GPU saturation and clean capped recovery
  • Steam Deck LCD/OLED (60 Hz / 90 Hz): verify Auto overload guard and 60/90 Hz cadence
  • Windows NVIDIA RTX 40/50: verify DLSS Frame Generation and high-headroom Auto are unaffected by the overload guard
Updated head `670c2411` (rebased onto `forge/main @ 8aa5ab87`, `AutoGuard` capped `30 FPS` recovery, maker-aware thresholds, and target/maker switch state reset verified on Windows 11 Radeon 860M). @Beanstalk please test on the updated head: - Linux AMD RADV (RDNA 3/3.5/4): verify Auto overload step-down under GPU saturation and clean capped recovery - Steam Deck LCD/OLED (60 Hz / 90 Hz): verify Auto overload guard and 60/90 Hz cadence - Windows NVIDIA RTX 40/50: verify DLSS Frame Generation and high-headroom Auto are unaffected by the overload guard
Member

@Jer9 only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@Jer9 only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 9s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/vk-auto-framegen-guard-and-target:Jer9-feat/vk-auto-framegen-guard-and-target'
git switch 'Jer9-feat/vk-auto-framegen-guard-and-target'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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!2369
No description provided.