fix(vk): the replay's queue at global priority low with fixed frame generation on NVIDIA's Windows driver #2183

Open
Jiro113 wants to merge 15 commits from Jiro113/Longshot:fix/fg-replay-queue-priority into main
Contributor

Summary

With a fixed frame generation multiplier on NVIDIA's Windows driver, the game frame and the generated frame do not
share the screen evenly: at 2x and 60 fps each should stay 8.33 ms, but the game frame's present waits for the replay's
GPU work and the generated frame's does not, so the intervals swing by a few milliseconds and the motion judders.

To see it on main: Windows, an NVIDIA card (measured on an RTX 4090, 621.24), a VRR display, frame generation 2x
(DLSS, FSR 3.1 or Built-in), the frame rate capped at 60, V-Sync on; pan the camera in Hyrule Field and record the
presents with PresentMon. About 10 % of the intervals on screen are within 0.5 ms of 8.33 ms (six runs here: 7.3 to 12.3 %).

This makes the replay's queue at the global priority low (VK_KHR_global_priority, else VK_EXT_global_priority)
where frame generation starts at a fixed multiplier (2x to 8x) with NVIDIA's driver on Windows, and where the queue's
family lists that level. The game frame's work then no longer waits behind the replay's: 29.8 % of the intervals within 0.5 ms here (four
runs: 26.5 to 33.6 %), and the game frame on screen 1.5 ms sooner after its present. The aim, 95 % within 0.5 ms,
is not reached: the game frame still waits on the replay's queue behind the next
frame's work, which a queue-wide priority cannot reorder (inferred), and #2184 deals with the sets' own timing.

The level is set when the device is made and kept, so:

  • where the level follows frame generation, the menu's Frame generation row takes a restart: turning it on or off
    (a fixed multiplier against Off or Auto) says After restart and Restart needed, as the menu's other such rows do, and
    the frames keep the start's kind until then (framegen_hold, framegen_running). Off to Auto, and 2x to 8x, apply
    at once;
  • a run with no window (HOS_HEADLESS, as the control bridge's test runs and dev.py ab --headless set) starts with
    frame generation off and asks no priority; so does RX_VK_FRAMEGEN=0 (frame generation kept off);
  • RX_VK_QUEUE_PRIORITY (added as a diagnosis switch by #2182) becomes a hw switch: low, medium, high
    or realtime asks that level whatever frame generation is, 0 or off none;
  • Auto asks none: it was not measured.

On the way, menu_row_takes_restart said a row takes a restart even with no slot left to follow its value (15 of the
menu's 16 slots are now taken); it now takes one only with its slot, and tests/test_menu_restart_slots.py counts the
modules' rows again.

This pull request carries #2182's two commits (the switches it is built on); the one merged first brings them.

Read first: gpu/vk/device_policy.h (policy_rule::replay_queue_priority, framegen_at_start,
replay_priority_follows_framegen, queue_priority_look/_chained/_restart), gpu/vk/vk_main.cpp (create_device),
gpu/vk/vk_framegen.cpp (framegen_hold, framegen_running), gpu/vk/vk_menu.cpp (menu_row_takes_restart).

Testing

Tested: Windows 11, RTX 4090, NVIDIA 621.24, a 240 Hz VRR display, full screen. Four runs of this PR against six of main (Measurements). The log said:

vk: global priority low for the replay's queue (family 0, by this PC's default with frame generation at 2x or more): the family lists low/medium; turning frame generation on or off in the menu takes a restart
vk: the device was made with the queues' global priority asked (VK_KHR_global_priority; the replay's low, the presents' own none)

No device was lost. This PR's head, on main a2dc53859, ran again 30 s in a window (in the Market: the run's
teleport to Hyrule Field didn't take): the same two lines, frame interpolation ready at 2x, no device lost.

On earlier builds of this work, the same PC:

  • each maker with RX_VK_QUEUE_PRIORITY=low against without, one full-screen capture each: within 0.5 ms of 8.33 ms,
    DLSS 5.1 β†’ 34.9 %, FSR 3.1 5.2 β†’ 35.3 %, Built-in 4.5 β†’ 41.7 %;
  • the menu's row set through the control bridge (option set, then option get), in windowed runs started twice,
    the presents' geometry lines read before and after the set: with DLSS, FSR 3.1 and Built-in, 2x to Off and Off to 2x
    said Restart needed, the frames kept the start's kind and the next start took the new value; DLSS 2x to Auto the
    same, Off to Auto at once; with RX_VK_QUEUE_PRIORITY=0, 2x to Off at once with no priority asked; with no window,
    frame generation started off and no priority was asked (9 of 9 as expected).

mise run test (tests/run_all.py --strict) on this PC, Windows with llvm-mingw's clang++: 37 checks fail on main
a2dc53859 here (listed below), and the same 37 fail here, on the same lines, and no other (test_sampler_admission's
concurrent cases fail a varying number of times from run to run on main: 2 of 147 in its full run, 3 in this PR's;
run alone three times, it failed twice on main and passed each time here). Every check this PR changes passes here with clang++ and with g++ (11.4,
Linux), and the renderer builds on Linux (RX_VK_ONLY=1).

Each fix's check fails at its test commit for the bug's reason and passes at the fix (clang++):
test_device_policy (no replay_queue_priority, the switch's levels and its log block), test_menu_modules (Frame
generation's row and its restart_value), test_menu_row_takes_restart (a row said to take a restart with no slot to
follow it), test_framegen_hold (frame generation turned off at once where its row takes a restart) and
test_framegen_windowless_start (3 of its 7 cases). test_menu_restart_slots is a check made right, not a failing
one: on main it counted only vk_menu.cpp's own table (0 rows) and passed; it now counts 14 rows there and 15 here,
of 16 slots.

The 37 checks that fail on main a2dc53859 on this PC

nx2/test_import_windows, test_auto_handheld, test_bug_report, test_close_waits_for_save, test_compile_zero_byte, test_crash_dialog, test_damaged_rom_files, test_dev_ab, test_dev_build, test_dev_migrate, test_dev_packs, test_draw_stream_visibility, test_fs_save_commit, test_fsr3fi_hud_layer, test_fsr3fi_hudless_colour, test_fsr_uniform_ownership, test_game_menu_mouse_buttons, test_guest_copies, test_hold_toggle, test_input_movie, test_linux_preflight, test_lower_atomg_cas, test_menu_i18n, test_menu_keys, test_menu_slider_ends, test_pads_after_menu, test_perf_report, test_portable_builder_home, test_portable_builder_startup, test_recording_admission, test_sampler_admission, test_sdiv_overflow, test_sim_turf_pools, test_switch_table, test_tls_objects, test_vibration_menu, test_work_lock

Still to test:

  • Other NVIDIA cards on Windows (a laptop RTX 4070 or 3060, an RTX 50 series): frame generation 2x at a 60 fps cap with
    V-Sync on, PresentMon over a camera pan, main against this PR, expecting more frames within 0.5 ms of 8.33 ms and
    the log's line of the low priority (Test Farm)
  • AMD and Intel on Windows, and NVIDIA on Linux: frame generation 2x, expecting no priority asked (the log's facts line)
    and the Frame generation row without a restart (Test Farm)
  • A driver that refuses the device with the level (none here does): the device made again without it, the log saying
    so, and the row without a restart (by hand)

Measurements

Verdict: a fix, measured: 29.8 % of the intervals on screen within 0.5 ms of 8.33 ms (26.5 to 33.6, four runs)
against 10.0 % on main (7.3 to 12.3, six runs), their standard deviation 1.64 ms against 2.43, and the game frame on
screen 1.5 ms sooner after its present (median 21.16 against 22.68 ms). Not reached: 95 % within 0.5 ms, and a game
frame's two halves (game to generated frame, generated to game frame) within 0.2 ms of each other on average: -1.36
to +0.34 ms here, none of four runs; with #2184 too, three of four.

Setup: Windows 11, RTX 4090, NVIDIA 621.24, 240 Hz VRR display; DLSS Frame Gen 2x, 60 fps cap, FIFO, full screen,
Hyrule Field with the camera panning for 60 s after a teleport, PresentMon over the pan; every run with the same logging
switches on (HOS_PRESENT_TRACE, RX_VK_FG_LATENCY_LOG, RX_VK_REFLEX_LOG), RX_VK_PRESENT_QUEUE=0 (the default).
Runs interleaved with the other heads of this work, after one warm-up run each; the mean of each head's runs, (lowest-highest).
One more run of main was left out: PresentMon saw 5309 of its 13240 frames composed by the desktop (Composed: Flip),
not flipped straight to the display.

Before: main @ 8aa749834 After: this PR @ ccdeb469e
Intervals on screen within 0.5 ms of 8.33 ms, % 10.0 (7.3-12.3) 29.8 (26.5-33.6)
Within 1 ms, % 21.3 (15.6-25.9) 59.9 (51.8-65.9)
Intervals on screen, standard deviation, ms 2.43 (2.27-2.94) 1.64 (1.40-2.12)
Game frames on screen, their intervals' standard deviation, ms 2.36 (2.27-2.44) 2.24 (2.03-2.56)
Game frame to generated frame, minus generated to game frame, mean, ms -3.46 (-4.56 to -2.97) -0.13 (-1.36 to +0.34)
Generated frame on screen, from the middle of its two game frames, median, ms -1.77 (-2.23 to -1.57) +0.33 (-0.09 to +0.56)
Game frame on screen after its present, median, ms 22.68 (22.58-23.01) 21.16 (20.96-21.67)
The same, 90th percentile, ms 25.68 (25.41-26.25) 24.21 (23.45-25.79)
Runs 6 4

What the low priority costs the game alone on the GPU, by dev.py ab (this PR's pack and main's on the same base,
three interleaved pairs, 60 s of the frame trace each, in a window, DLSS Frame Gen 2x, uncapped with
HOS_FPS_MAX=1000, V-Sync off, Render resolution 67 %): no difference shown, 98.3 against 98.9 fps (the median of
three runs; main 98.2 to 98.9, this PR 97.4 to 98.4), within the runs' spread. The logs said the replay's queue was at
global priority low in this PR's three runs and in none of main's. (dev.py ab refuses its write-up when the control
bridge's pipe name, HOS_CONTROL, differs from run to run, as it does; these runs left it out with --allow HOS_CONTROL.)

Before: main @ 8aa74983 After: this PR @ ccdeb469
fps (each run) 98.2 / 98.9 / 98.9 97.4 / 98.4 / 98.3
Median frame time, ms 10.10 10.15
p99 frame time, ms 10.82 10.91

Measured on main 8aa749834 with this PR's commits on it (ccdeb469e). This PR is now on main a2dc53859, its commits'
changes the same (checked with git range-diff) but in test_present_device_loss (the diagnosis commits: it now takes
main's list of the present routine's calls and adds the probe's to it), and, since, a line in the guide images'
README. main's commits since change neither the presents' timing, the queues nor the menu's restart rows; in the
renderer, one keeps the HUD's colours with FSR 3.1 frame generation in Native HDR (DLSS here), one starts the replay's
threads through a guard that reports their C++ exceptions, one logs fewer memory imports,
#2171 moves two includes, spells rx_nvn.h's static assertions so g++
builds them and changes menu texts, and #2174 keeps the simulated-turf lists at the game's own size in areas without turf, so that Hyrule
Field, the scene measured, no longer stalls 250 ms at a time on the way in: that changes frame times there, and both
sides above ran without it. #1722 adds a save.

RX_VK_QUEUE_PRIORITY ships unset: the rule above decides, and the numbers above are that rule's.
RX_VK_PRESENT_PROBE and RX_VK_PRESENT_QUEUE_PRIORITY come with #2182's commits: diagnosis switches that
ship unset (off).

Risks

  • At low priority the replay gives the GPU up to other programs' work at normal priority: with frame generation, a
    60 fps cap and a synthetic compute load at 8 of 10 beside it, 42.7 β†’ 25.0 fps (one pair, earlier build). A player who
    streams or records on the same GPU may see it. RX_VK_QUEUE_PRIORITY=0 turns it off.
  • Turning frame generation on or off now needs a restart on NVIDIA's Windows driver; the row says so.
  • Measured on one RTX 4090 only, with DLSS FG; FSR 3.1 and Built-in on earlier builds. Other NVIDIA cards get the same
    rule (Still to test).
  • Nothing changes in longshot_options.ini (no new key), the saves or the caches. A revert is enough.

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.

No screenshots: the change is in the frames' timing, which a still picture does not show, and the Frame generation row
uses the menu's existing After restart / Restart needed lines. The guide's Graphics capture reviews six files this
changes (scripts/check_guide_screenshots.py --review-sources): the capture makes no device and shows the compiled
defaults, so the image is retained, and docs/user/images/guide/README.md records the review. That check fails on
main already (ten files changed since the capture's reviewed revision); this adds three to its list
(gpu/vk/menu/framegen.cpp, gpu/vk/menu_restart.h, gpu/vk/vk_framegen.h).

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.

πŸ€– Generated with Claude Code

## Summary With a fixed frame generation multiplier on NVIDIA's Windows driver, the game frame and the generated frame do not share the screen evenly: at 2x and 60 fps each should stay 8.33 ms, but the game frame's present waits for the replay's GPU work and the generated frame's does not, so the intervals swing by a few milliseconds and the motion judders. To see it on `main`: Windows, an NVIDIA card (measured on an RTX 4090, 621.24), a VRR display, frame generation 2x (DLSS, FSR 3.1 or Built-in), the frame rate capped at 60, V-Sync on; pan the camera in Hyrule Field and record the presents with PresentMon. About 10 % of the intervals on screen are within 0.5 ms of 8.33 ms (six runs here: 7.3 to 12.3 %). This makes the replay's queue at the global priority low (`VK_KHR_global_priority`, else `VK_EXT_global_priority`) where frame generation starts at a fixed multiplier (2x to 8x) with NVIDIA's driver on Windows, and where the queue's family lists that level. The game frame's work then no longer waits behind the replay's: 29.8 % of the intervals within 0.5 ms here (four runs: 26.5 to 33.6 %), and the game frame on screen 1.5 ms sooner after its present. The aim, 95 % within 0.5 ms, is not reached: the game frame still waits on the replay's queue behind the next frame's work, which a queue-wide priority cannot reorder (inferred), and https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2184 deals with the sets' own timing. The level is set when the device is made and kept, so: - where the level follows frame generation, the menu's Frame generation row takes a restart: turning it on or off (a fixed multiplier against Off or Auto) says After restart and Restart needed, as the menu's other such rows do, and the frames keep the start's kind until then (`framegen_hold`, `framegen_running`). Off to Auto, and 2x to 8x, apply at once; - a run with no window (`HOS_HEADLESS`, as the control bridge's test runs and `dev.py ab --headless` set) starts with frame generation off and asks no priority; so does `RX_VK_FRAMEGEN=0` (frame generation kept off); - `RX_VK_QUEUE_PRIORITY` (added as a diagnosis switch by https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2182) becomes a `hw` switch: `low`, `medium`, `high` or `realtime` asks that level whatever frame generation is, `0` or `off` none; - Auto asks none: it was not measured. On the way, `menu_row_takes_restart` said a row takes a restart even with no slot left to follow its value (15 of the menu's 16 slots are now taken); it now takes one only with its slot, and `tests/test_menu_restart_slots.py` counts the modules' rows again. This pull request carries https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2182's two commits (the switches it is built on); the one merged first brings them. Read first: `gpu/vk/device_policy.h` (`policy_rule::replay_queue_priority`, `framegen_at_start`, `replay_priority_follows_framegen`, `queue_priority_look`/`_chained`/`_restart`), `gpu/vk/vk_main.cpp` (`create_device`), `gpu/vk/vk_framegen.cpp` (`framegen_hold`, `framegen_running`), `gpu/vk/vk_menu.cpp` (`menu_row_takes_restart`). ## Testing **Tested:** Windows 11, RTX 4090, NVIDIA 621.24, a 240 Hz VRR display, full screen. Four runs of this PR against six of `main` (Measurements). The log said: ``` vk: global priority low for the replay's queue (family 0, by this PC's default with frame generation at 2x or more): the family lists low/medium; turning frame generation on or off in the menu takes a restart vk: the device was made with the queues' global priority asked (VK_KHR_global_priority; the replay's low, the presents' own none) ``` No device was lost. This PR's head, on `main` a2dc53859, ran again 30 s in a window (in the Market: the run's teleport to Hyrule Field didn't take): the same two lines, frame interpolation ready at 2x, no device lost. On earlier builds of this work, the same PC: - each maker with `RX_VK_QUEUE_PRIORITY=low` against without, one full-screen capture each: within 0.5 ms of 8.33 ms, DLSS 5.1 β†’ 34.9 %, FSR 3.1 5.2 β†’ 35.3 %, Built-in 4.5 β†’ 41.7 %; - the menu's row set through the control bridge (`option set`, then `option get`), in windowed runs started twice, the presents' geometry lines read before and after the set: with DLSS, FSR 3.1 and Built-in, 2x to Off and Off to 2x said Restart needed, the frames kept the start's kind and the next start took the new value; DLSS 2x to Auto the same, Off to Auto at once; with `RX_VK_QUEUE_PRIORITY=0`, 2x to Off at once with no priority asked; with no window, frame generation started off and no priority was asked (9 of 9 as expected). `mise run test` (`tests/run_all.py --strict`) on this PC, Windows with llvm-mingw's clang++: 37 checks fail on `main` a2dc53859 here (listed below), and the same 37 fail here, on the same lines, and no other (`test_sampler_admission`'s concurrent cases fail a varying number of times from run to run on `main`: 2 of 147 in its full run, 3 in this PR's; run alone three times, it failed twice on `main` and passed each time here). Every check this PR changes passes here with clang++ and with g++ (11.4, Linux), and the renderer builds on Linux (`RX_VK_ONLY=1`). Each fix's check fails at its test commit for the bug's reason and passes at the fix (clang++): `test_device_policy` (no `replay_queue_priority`, the switch's levels and its log block), `test_menu_modules` (Frame generation's row and its `restart_value`), `test_menu_row_takes_restart` (a row said to take a restart with no slot to follow it), `test_framegen_hold` (frame generation turned off at once where its row takes a restart) and `test_framegen_windowless_start` (3 of its 7 cases). `test_menu_restart_slots` is a check made right, not a failing one: on `main` it counted only `vk_menu.cpp`'s own table (0 rows) and passed; it now counts 14 rows there and 15 here, of 16 slots. <details><summary>The 37 checks that fail on <code>main</code> a2dc53859 on this PC</summary> `nx2/test_import_windows`, `test_auto_handheld`, `test_bug_report`, `test_close_waits_for_save`, `test_compile_zero_byte`, `test_crash_dialog`, `test_damaged_rom_files`, `test_dev_ab`, `test_dev_build`, `test_dev_migrate`, `test_dev_packs`, `test_draw_stream_visibility`, `test_fs_save_commit`, `test_fsr3fi_hud_layer`, `test_fsr3fi_hudless_colour`, `test_fsr_uniform_ownership`, `test_game_menu_mouse_buttons`, `test_guest_copies`, `test_hold_toggle`, `test_input_movie`, `test_linux_preflight`, `test_lower_atomg_cas`, `test_menu_i18n`, `test_menu_keys`, `test_menu_slider_ends`, `test_pads_after_menu`, `test_perf_report`, `test_portable_builder_home`, `test_portable_builder_startup`, `test_recording_admission`, `test_sampler_admission`, `test_sdiv_overflow`, `test_sim_turf_pools`, `test_switch_table`, `test_tls_objects`, `test_vibration_menu`, `test_work_lock` </details> **Still to test:** - Other NVIDIA cards on Windows (a laptop RTX 4070 or 3060, an RTX 50 series): frame generation 2x at a 60 fps cap with V-Sync on, PresentMon over a camera pan, `main` against this PR, expecting more frames within 0.5 ms of 8.33 ms and the log's line of the low priority (Test Farm) - AMD and Intel on Windows, and NVIDIA on Linux: frame generation 2x, expecting no priority asked (the log's facts line) and the Frame generation row without a restart (Test Farm) - A driver that refuses the device with the level (none here does): the device made again without it, the log saying so, and the row without a restart (by hand) ## Measurements **Verdict:** a fix, measured: 29.8 % of the intervals on screen within 0.5 ms of 8.33 ms (26.5 to 33.6, four runs) against 10.0 % on `main` (7.3 to 12.3, six runs), their standard deviation 1.64 ms against 2.43, and the game frame on screen 1.5 ms sooner after its present (median 21.16 against 22.68 ms). Not reached: 95 % within 0.5 ms, and a game frame's two halves (game to generated frame, generated to game frame) within 0.2 ms of each other on average: -1.36 to +0.34 ms here, none of four runs; with https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2184 too, three of four. Setup: Windows 11, RTX 4090, NVIDIA 621.24, 240 Hz VRR display; DLSS Frame Gen 2x, 60 fps cap, FIFO, full screen, Hyrule Field with the camera panning for 60 s after a teleport, PresentMon over the pan; every run with the same logging switches on (`HOS_PRESENT_TRACE`, `RX_VK_FG_LATENCY_LOG`, `RX_VK_REFLEX_LOG`), `RX_VK_PRESENT_QUEUE=0` (the default). Runs interleaved with the other heads of this work, after one warm-up run each; the mean of each head's runs, (lowest-highest). One more run of `main` was left out: PresentMon saw 5309 of its 13240 frames composed by the desktop (Composed: Flip), not flipped straight to the display. | | Before: main @ 8aa749834 | After: this PR @ ccdeb469e | |---|---|---| | Intervals on screen within 0.5 ms of 8.33 ms, % | 10.0 (7.3-12.3) | 29.8 (26.5-33.6) | | Within 1 ms, % | 21.3 (15.6-25.9) | 59.9 (51.8-65.9) | | Intervals on screen, standard deviation, ms | 2.43 (2.27-2.94) | 1.64 (1.40-2.12) | | Game frames on screen, their intervals' standard deviation, ms | 2.36 (2.27-2.44) | 2.24 (2.03-2.56) | | Game frame to generated frame, minus generated to game frame, mean, ms | -3.46 (-4.56 to -2.97) | -0.13 (-1.36 to +0.34) | | Generated frame on screen, from the middle of its two game frames, median, ms | -1.77 (-2.23 to -1.57) | +0.33 (-0.09 to +0.56) | | Game frame on screen after its present, median, ms | 22.68 (22.58-23.01) | 21.16 (20.96-21.67) | | The same, 90th percentile, ms | 25.68 (25.41-26.25) | 24.21 (23.45-25.79) | | Runs | 6 | 4 | What the low priority costs the game alone on the GPU, by `dev.py ab` (this PR's pack and `main`'s on the same base, three interleaved pairs, 60 s of the frame trace each, in a window, DLSS Frame Gen 2x, uncapped with `HOS_FPS_MAX=1000`, V-Sync off, Render resolution 67 %): no difference shown, 98.3 against 98.9 fps (the median of three runs; `main` 98.2 to 98.9, this PR 97.4 to 98.4), within the runs' spread. The logs said the replay's queue was at global priority low in this PR's three runs and in none of `main`'s. (`dev.py ab` refuses its write-up when the control bridge's pipe name, `HOS_CONTROL`, differs from run to run, as it does; these runs left it out with `--allow HOS_CONTROL`.) | | Before: main @ 8aa74983 | After: this PR @ ccdeb469 | |---|---|---| | fps (each run) | 98.2 / 98.9 / 98.9 | 97.4 / 98.4 / 98.3 | | Median frame time, ms | 10.10 | 10.15 | | p99 frame time, ms | 10.82 | 10.91 | Measured on `main` 8aa749834 with this PR's commits on it (ccdeb469e). This PR is now on `main` a2dc53859, its commits' changes the same (checked with `git range-diff`) but in `test_present_device_loss` (the diagnosis commits: it now takes `main`'s list of the present routine's calls and adds the probe's to it), and, since, a line in the guide images' README. `main`'s commits since change neither the presents' timing, the queues nor the menu's restart rows; in the renderer, one keeps the HUD's colours with FSR 3.1 frame generation in Native HDR (DLSS here), one starts the replay's threads through a guard that reports their C++ exceptions, one logs fewer memory imports, https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2171 moves two includes, spells `rx_nvn.h`'s static assertions so g++ builds them and changes menu texts, and https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2174 keeps the simulated-turf lists at the game's own size in areas without turf, so that Hyrule Field, the scene measured, no longer stalls 250 ms at a time on the way in: that changes frame times there, and both sides above ran without it. https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1722 adds a save. `RX_VK_QUEUE_PRIORITY` ships unset: the rule above decides, and the numbers above are that rule's. `RX_VK_PRESENT_PROBE` and `RX_VK_PRESENT_QUEUE_PRIORITY` come with https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2182's commits: diagnosis switches that ship unset (off). ## Risks - At low priority the replay gives the GPU up to other programs' work at normal priority: with frame generation, a 60 fps cap and a synthetic compute load at 8 of 10 beside it, 42.7 β†’ 25.0 fps (one pair, earlier build). A player who streams or records on the same GPU may see it. `RX_VK_QUEUE_PRIORITY=0` turns it off. - Turning frame generation on or off now needs a restart on NVIDIA's Windows driver; the row says so. - Measured on one RTX 4090 only, with DLSS FG; FSR 3.1 and Built-in on earlier builds. Other NVIDIA cards get the same rule (Still to test). - Nothing changes in `longshot_options.ini` (no new key), the saves or the caches. A revert is enough. ## 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. No screenshots: the change is in the frames' timing, which a still picture does not show, and the Frame generation row uses the menu's existing After restart / Restart needed lines. The guide's Graphics capture reviews six files this changes (`scripts/check_guide_screenshots.py --review-sources`): the capture makes no device and shows the compiled defaults, so the image is retained, and `docs/user/images/guide/README.md` records the review. That check fails on `main` already (ten files changed since the capture's reviewed revision); this adds three to its list (`gpu/vk/menu/framegen.cpp`, `gpu/vk/menu_restart.h`, `gpu/vk/vk_framegen.h`). ### 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. πŸ€– Generated with [Claude Code](https://claude.com/claude-code)
One CSV line a present: timestamps submitted alone on the present's queue right
before and right after vkQueuePresentKHR and at the end of its image's copy, with
the QPC clock at the submits, the call, the return and each probe's fence. For
where the game frame's present waits with frame generation. Off unless set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
diag(vk): RX_VK_QUEUE_PRIORITY and RX_VK_PRESENT_QUEUE_PRIORITY, the queues' global priority
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 / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 9s
e4be36674c
low, medium, high or realtime through VK_KHR_global_priority (else the EXT), asked
only where the queue's family lists the level; a device refused with them is made
again without them, and the log says what was asked and what it was made with.
Off unless set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With DLSS Frame Gen 2x at 60 fps under FIFO on a 240 Hz VRR display the
game frame's present waited for the replay's work while the generated
frame's did not (RTX 4090, 621.24). The replay's queue at the global
priority low (RX_VK_QUEUE_PRIORITY=low) took the game frame's GPU work
done after its present's start from 2.91 to 1.25 ms at the median
(PresentMon) and the frames on screen within 0.5 ms of 8.33 ms from 5.7% to
33.2% (one full-screen capture each, the presents on the replay's queue as
by default). Without frame generation there is no generated frame for the
game frame to fall behind (inferred, not measured); Auto was not measured.

tests/test_device_policy.py gives DeviceFacts frame generation as the run
starts (0 off, 1 Auto, 2 to 8 fixed) and expects, on each of its 24 PCs at
0, 1, 2 and 8, the replay's queue's priority low (128) with NVIDIA's driver
on Windows at 2x and up, none (0) elsewhere and with Auto. Nine cases put
RX_VK_QUEUE_PRIORITY over it: 0 asks none with frame generation on (the
witness), low and medium ask theirs without it, a word not a level leaves
the default; each marked as its switch's or not, the facts' line saying
the level of frame generation and the policy's block the priority's name.
The policy's environment case "low" now expects the level it asks. The
text checks look for create_device putting frame generation in the facts
before the policy is made, and, once the device is made, making the menu's
Frame generation row take a restart (the device keeps the level it is made
with).

tests/test_menu_modules.py expects that row to compare 2x and up against
Off and Auto (restart_value: 0, 1 -> 0; 2, 3, 8 -> 1) without taking a
restart itself: the row takes one only where the level follows it.

On this commit's parent there is no default and no frame generation in the
facts, and the row has no restart_value: both tests fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With frame generation the game frame's present waited for the replay's
work and the generated frame's did not, so the frames reached the screen
unevenly (DLSS FG 2x at 60 fps, FIFO, a 240 Hz VRR display, RTX 4090,
621.24). The replay's queue at the global priority low (VK_KHR, else
VK_EXT, global_priority), asked through RX_VK_QUEUE_PRIORITY on a build of
the diagnosis, took the game frame's GPU work done after its present's
start from 2.91 to 1.25 ms at the median (PresentMon) and the frames within
0.5 ms of 8.33 ms on the screen from 5.7% to 33.2% (one full-screen capture
each, the presents on the replay's queue as by default). Its cost with
frame generation: -4.2% fps uncapped, nothing at a 60 fps cap; beside
another program's GPU work at its own priority the replay gives the GPU up
(a compute load at 8 of 10: 42.7 -> 25.0 fps at a 60 fps cap, one pair).

DeviceFacts::framegen is frame generation as the run starts (the menu's
row, RX_VK_FRAMEGEN_MULT over it, 0 with RX_VK_FRAMEGEN=0), and
DevicePolicy::replay_queue_priority is low with NVIDIA's driver on Windows
at 2x and up, else none (policy_rule::replay_queue_priority). Auto was not
measured and asks none; without frame generation there is no generated
frame for the game frame to fall behind (inferred, not measured).
RX_VK_QUEUE_PRIORITY, a diagnosis switch until now, becomes a hw switch
read by device_policy_env: low, medium, high or realtime (any case) asks
that level whatever frame generation is, 0 or off none, anything else is
ignored and said so. The facts' line says frame generation at the start,
the policy's block replay_queue_priority.

create_device asks the policy's level where the queue's family lists it,
as the diagnosis did, and sets the policy's level to 0 where none was
asked or the device was refused with it. The device keeps the level it is
made with, so where this PC's default follows frame generation (the switch
unset, RX_VK_FRAMEGEN not 0) and the family lists low, the menu's Frame
generation row takes a restart from then on (menu_row_takes_restart, a slot
of the menu's restart state, its start value the run's): turning it on or
off says After restart and Restart needed, as the menu's other such rows
do. Its restart_value compares 2x and up against Off and Auto, so changing
between 2x and 8x, or Off and Auto, asks none; the frames themselves still
change at once.

RX_VK_PRESENT_QUEUE_PRIORITY (diagnosis) is read with the same names, and
an off word asks none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What create_device asks of each queue's global priority, and when the
menu's Frame generation row takes a restart, were worked out inline, so
the policy test could only read their text: dropping the unasked level's
"continue" (FG Off or Auto then running at low while the log and the
policy said none), the menu's RX_VK_FRAMEGEN=0, or the restart's
condition all passed it.

device_policy.h's policy_rule now has them:
- framegen_at_start: the menu's multiplier, 0 where RX_VK_FRAMEGEN=0;
- replay_priority_follows_framegen: the replay's level follows frame
  generation (its default differs with it, its switch unset,
  RX_VK_FRAMEGEN not 0);
- queue_priority_look, _chained and _restart: the level looked for,
  whether it is only looked for, then, with the family's list read,
  whether it is asked and whether the row takes a restart.
create_device calls them, and the test runs them (queue_step's cases)
and checks create_device calls them in their order, the replay's queue
alone following frame generation. Each of nine mutations of the rules or
their calls fails the test.

With Auto at the start the log line said "frame generation is off at the
start"; it says "not at a fixed multiplier (2x or more)". Nothing else
the game does changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
menu_row_takes_restart (vk_menu.cpp), which vk_main.cpp's create_device
calls for the Frame generation row where the replay's queue's global
priority follows it, had no check of what it does. The real
restart_init, row_restart_value, restart_changed and
menu_row_takes_restart, with menu_restart.h's State and framegen.cpp's
framegen_restart_value, run over a few rows of the check's own, one run
a case:
- the row's slot and name; its start value by its restart_value, so the
  multiplier the game started with and any other that runs with the
  same priority say nothing, while Off or Auto against 2x and up says
  Restart needed;
- asked again, the same slot; asked for a value no row has, nothing;
- the last slot left taken; with none left, no slot, the log saying so.

It fails on the last: with every slot of kMax taken the row still says
it takes a restart (Row::restart, what the control bridge reports as the
setting's restart), though no slot follows its value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
menu_row_takes_restart set Row::restart before asking menu_restart.h's
State for a slot. With every slot of kMax taken (15 of 16 are now: the
modules' 13 rows that take a restart, the Mods tab's, and Frame
generation's where the replay's queue's global priority follows it), the
row got none, so nothing compared its value with the start's, yet it
said it takes a restart: the control bridge reported the setting's
restart. The row now takes one only with its slot; with none it stays a
row that changes at once, and the log says there was no room.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test_menu_restart_slots.py counted only vk_menu.cpp's own rows[] table,
which since the rows moved to gpu/vk/menu/ has none that take a restart:
it said "0 rows take a restart, 16 slots" while 15 of the 16 were taken.
It now counts the modules' rows with .restart = true, the Mods tab's slot
(restart_init's mods_slot) and the rows made to take one while the game
runs (menu_row_takes_restart's callers: Frame generation's, vk_main.cpp),
and names them when they pass kMax. menu_restart.h's comment said the menu
had ten.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Frame generation row takes a restart where the replay's queue's global priority follows frame generation at the
start (NVIDIA's driver on Windows), but turned from a fixed multiplier to Off or Auto, or back, the frames changed at
once, at the priority made for the other. The real framegen_now and framegen_on, the start's line of create_device and
the row's restart value, compiled with stand-ins: fails on main for 4 of 7 cases (the multiplier and on/off that run
follow the menu at once); with no restart or no slot left, each change runs at once, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Where the replay's queue's global priority follows frame generation at the start (NVIDIA's driver on Windows), the
Frame generation row said Restart needed between a fixed multiplier and Off or Auto, but the frames changed at once: 2x
turned Off ran without frame generation at the priority made for it, and Off turned to 2x made frames at the driver's
own priority, the uneven pacing the low one fixes.

create_device now holds frame generation's kind once the row has its slot (menu_row_takes_restart returns whether it
did; framegen_hold). framegen_running is what the renderer reads: the setting while it stays of the start's kind (a
fixed multiplier, or Off and Auto), else the last value of that kind, until the restart. framegen_now, framegen_on,
DLSS FG's inputs, FSR 3.1's frame interpolation, the FPS counter, the frame rate target, the auto-tune's guard, the
maker's name and the present trace read it. The row, the options file, the bridge and the restart still read the
setting, as do the pipeline list's values (Save my pipeline list: as the menu has them). Off and Auto change at once,
as do 2x to 8x, and with no restart or no slot each change runs at once, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The player's page (Frame generation's row) and the control bridge's option_set: where the replay's queue's global
priority follows frame generation at the start, turning it on or off waits for the next start, and Off to Auto or one
multiplier to another applies at once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Frame generation runs in a window only (vk_framegen.cpp framegen_on), but create_device read the menu's saved
multiplier as frame generation at the start, and whether the replay's queue's level follows it, from the menu and
RX_VK_FRAMEGEN alone. A run with no window (HOS_HEADLESS: scripted and A/B runs) and 2x saved asked global priority
low for the replay's queue with NVIDIA's driver on Windows, which main does not, with no frame generated, and the
Frame generation row took a restart with nothing to wait for.

The check cuts create_device's two lines out of vk_main.cpp and compiles them with the real device_policy.h and
longshot_env.h; each case runs with its own environment. On this commit the three cases with no window fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Frame generation runs in a window only (vk_framegen.cpp framegen_on), so a run with no window (HOS_HEADLESS, read as
the host reads it) is frame generation off at the start, as RX_VK_FRAMEGEN=0 is: device_policy.h framegen_at_start and
replay_priority_follows_framegen take whether the run has a window. Scripted and A/B runs with no window and a fixed
multiplier saved no longer ask global priority low for the replay's queue with NVIDIA's driver on Windows, and the
Frame generation row takes no restart there.

tests/test_device_policy.py: the rules' cases with the new argument, and no-window cases; its source checks read the
new calls. switches.def and the control bridge's page say it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The branch where vkCreateDevice refuses the level and the device is made again without it ran in no test: the replay's
queue then has the driver's own level, so frame generation's row must not take a restart (none would have the level).
No driver here refuses it, so create_device's branch is checked as the file's other create_device steps are, by its text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(guide): the Frame generation row's restart leaves the Graphics capture as it is
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 / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 10s
00be3e01df
The guide's Graphics capture reviews the menu's sources, and this work changes six of them
(scripts/check_guide_screenshots.py --review-sources). The row takes a restart only where a device
is made with the replay's queue's priority following frame generation; the capture makes no device
and shows the compiled defaults, so the image is retained. The README records the review, as
earlier source reviews there do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11, RTX 4090, NVIDIA 621.24, a 240 Hz VRR display, full screen; DLSS Frame Gen 2x at a 60 fps cap, V-Sync on, Hyrule Field with the camera panning, PresentMon recording, four runs against six of main: the log said the replay's queue was at global priority low, and 29.8 % of the intervals on screen were within 0.5 ms of 8.33 ms against 10.0 % on main. On earlier builds of this work, same PC: FSR 3.1 and Built-in frame generation, and the Frame generation row's restart through the control bridge (on to off and off to on said Restart needed and applied at the next start). No device was lost. The final head, on main a2dc53859, ran again 30 s in a window: the replay's queue at global priority low, frame interpolation ready at 2x, no device lost.

Tested in game: Windows 11, RTX 4090, NVIDIA 621.24, a 240 Hz VRR display, full screen; DLSS Frame Gen 2x at a 60 fps cap, V-Sync on, Hyrule Field with the camera panning, PresentMon recording, four runs against six of main: the log said the replay's queue was at global priority low, and 29.8 % of the intervals on screen were within 0.5 ms of 8.33 ms against 10.0 % on main. On earlier builds of this work, same PC: FSR 3.1 and Built-in frame generation, and the Frame generation row's restart through the control bridge (on to off and off to on said Restart needed and applied at the next start). No device was lost. The final head, on main a2dc53859, ran again 30 s in a window: the replay's queue at global priority low, frame interpolation ready at 2x, no device lost.
Member

Possibly related, for context:

  • PR #2182 WIP: feat(vk): RX_VK_PRESENT_PROBE and RX_VK_QUEUE_PRIORITY, switches to see where a present waits on the GPU β€” Open PR; this change carries its queue-priority switch commits.
  • PR #1442 fix(vk): frame generation's fixed multipliers on the game's timeline under V-Sync On (FIFO) too β€” Merged FIFO frame-generation pacing work; relevant adjacent present-path behavior.
Possibly related, for context: - PR #2182 WIP: feat(vk): RX_VK_PRESENT_PROBE and RX_VK_QUEUE_PRIORITY, switches to see where a present waits on the GPU β€” Open PR; this change carries its queue-priority switch commits. - PR #1442 fix(vk): frame generation's fixed multipliers on the game's timeline under V-Sync On (FIFO) too β€” Merged FIFO frame-generation pacing work; relevant adjacent present-path behavior.
Jiro113 changed title from WIP: fix(vk): the replay's queue at global priority low with fixed frame generation on NVIDIA's Windows driver to fix(vk): the replay's queue at global priority low with fixed frame generation on NVIDIA's Windows driver 2026-11-22 02:07:42 +00:00
dazemc left a comment

Read of 00be3e01 (on main a2dc5385; ready for review, mergeable; the #2182 commits carried). Game-free checks only; no game run from me.

1. The selection is what it says. The replay's queue (dev.queue_family, the graphics+compute queue that also carries the default present) gets DevicePolicy::replay_queue_priority: low only for windows && VK_DRIVER_ID_NVIDIA_PROPRIETARY and framegen >= 2 at the start, or the switch's level. The presents' own queue (compute_family, only with RX_VK_PRESENT_QUEUE, off by default) gets only RX_VK_PRESENT_QUEUE_PRIORITY (none by default). The level is chained per queue create info, only where the family lists it (KHR/EXT query), and the extension is added to the device's list. The gate, framegen_at_start, RX_VK_FRAMEGEN=0/HOS_HEADLESS, and Auto/Off asking none are all as described.

2. Fixed frame generation and the NVIDIA Windows gate are right, and the restart is coherent. framegen >= 2 is a fixed multiplier; Auto (1) and Off (0) ask none; the gate is the proprietary driver id plus windows; the start value is framegen_at_start (menu, RX_VK_FRAMEGEN=0, HOS_HEADLESS). framegen_hold/framegen_running make the renderer keep the start's kind until the restart, while a change within a kind applies at once; the row's restart_value = framegen_restart_value (0 for Off/Auto, 1 for 2x+) matches, and menu_row_takes_restart only says so when it has a slot. The framegen_running() substitution across vk_dlss.cpp, vk_fsr3fi.cpp, vk_framegen.cpp, the FPS counter and the present trace is consistent.

3. The starvation risk is real, and it is not only the replay's. The low queue is the default present's queue too: the own queue is off by default (the RTX 4090/5080 history), so a normal-priority load starves the game's rendering and its presents, not just the replay β€” the body's own 42.7 β†’ 25.0 fps pair (one pair, an earlier build) is that. The switch (RX_VK_QUEUE_PRIORITY=0) is the only off, and it is a hw/env switch with no menu row. Two things to settle before merge: the final numbers under a load (the pair is old and single), and the wording "the presents' own none" β€” by default the present is on the replay's low queue; only the optional own queue is at none. If the present is meant to stay protected, the own queue (none) or a narrower low is the place; otherwise say the default present yields too.

4. The fallback works, with two rough edges and one test gap. Not listed β†’ not chained and no restart; no extension β†’ not asked; vkCreateDevice refused β†’ both queues' pNext cleared, the extension removed, the policy set to 0, fg_restart false, and the device made again (the policy log then says none). Good. But the retry treats any VkResult as "refused the queues' global priority" (a failure for another reason is misattributed and the priority dropped), and when the query fails or the family index is out of range the code leaves in_list = true, asks, and logs "not listed" anyway. The refusal path itself is Still to test by hand; the game-free test_device_policy covers queue_priority_look/_chained/_restart, not the vkCreateDevice retry. Worth either a small test of the retry (the look/chained result plus the log) or a comment that the log is a best guess.

5. The no-slot edge. If menu_row_takes_restart returns false (no slot), the device keeps the start's priority while frame generation changes at once. At 15/16 that does not happen today, but if it did, the low could stay with frame generation off (harmless) or be missing after turning it on (the fix absent) with no line. A log there would make it diagnosable.

6. Tests and measurements. Here (Linux, g++/clang++, the same tree):

  • test_device_policy --headers _deps/vulkan-headers/include: ok, 24 PCs, 87 environments, 9 switch cases, 93 rule edges.
  • test_framegen_hold: PASS (7 cases); test_framegen_windowless_start --headers …: PASS (7); test_menu_row_takes_restart: PASS (9, kMax 16); test_menu_restart_slots: PASS (15 rows, 16 slots).
    The author's full mise run test has 37 failures on main and here on the same lines; the changed checks pass. The Still to test (other NVIDIA cards, AMD/Intel, NVIDIA Linux, the refusal by hand) and the one RTX 4090 / 95 % aim not reached are the remaining evidence; the #2184 dependency is named. pr status also warns that the table's "Before: main @ 8aa749834" predates the current main; the Measurements paragraph says why the numbers still hold β€” it may be worth a comment so the merge check sees it.

No approval and no claim. The queue selection, the fixed-multiplier/NVIDIA Windows gate, the restart hold and the fallback's logic look right; the present's shared low queue and the untested refusal path are the two I would settle first.

**Read of `00be3e01` (on `main` `a2dc5385`; ready for review, mergeable; the #2182 commits carried). Game-free checks only; no game run from me.** **1. The selection is what it says.** The replay's queue (`dev.queue_family`, the graphics+compute queue that also carries the **default present**) gets `DevicePolicy::replay_queue_priority`: low only for `windows && VK_DRIVER_ID_NVIDIA_PROPRIETARY` and `framegen >= 2` at the start, or the switch's level. The presents' own queue (`compute_family`, only with `RX_VK_PRESENT_QUEUE`, off by default) gets only `RX_VK_PRESENT_QUEUE_PRIORITY` (none by default). The level is chained per queue create info, only where the family lists it (KHR/EXT query), and the extension is added to the device's list. The gate, `framegen_at_start`, `RX_VK_FRAMEGEN=0`/`HOS_HEADLESS`, and Auto/Off asking none are all as described. **2. Fixed frame generation and the NVIDIA Windows gate are right, and the restart is coherent.** `framegen >= 2` is a fixed multiplier; Auto (1) and Off (0) ask none; the gate is the proprietary driver id plus `windows`; the start value is `framegen_at_start` (menu, `RX_VK_FRAMEGEN=0`, `HOS_HEADLESS`). `framegen_hold`/`framegen_running` make the renderer keep the start's kind until the restart, while a change within a kind applies at once; the row's `restart_value = framegen_restart_value` (0 for Off/Auto, 1 for 2x+) matches, and `menu_row_takes_restart` only says so when it has a slot. The `framegen_running()` substitution across `vk_dlss.cpp`, `vk_fsr3fi.cpp`, `vk_framegen.cpp`, the FPS counter and the present trace is consistent. **3. The starvation risk is real, and it is not only the replay's.** The low queue is the **default present's** queue too: the own queue is off by default (the RTX 4090/5080 history), so a normal-priority load starves the game's rendering **and** its presents, not just the replay β€” the body's own 42.7 β†’ 25.0 fps pair (one pair, an earlier build) is that. The switch (`RX_VK_QUEUE_PRIORITY=0`) is the only off, and it is a `hw`/env switch with no menu row. Two things to settle before merge: the final numbers under a load (the pair is old and single), and the wording "the presents' own none" β€” by default the present is on the replay's **low** queue; only the optional own queue is at none. If the present is meant to stay protected, the own queue (none) or a narrower low is the place; otherwise say the default present yields too. **4. The fallback works, with two rough edges and one test gap.** Not listed β†’ not chained and no restart; no extension β†’ not asked; `vkCreateDevice` refused β†’ both queues' `pNext` cleared, the extension removed, the policy set to 0, `fg_restart` false, and the device made again (the policy log then says none). Good. But the retry treats **any** `VkResult` as "refused the queues' global priority" (a failure for another reason is misattributed and the priority dropped), and when the query fails or the family index is out of range the code leaves `in_list = true`, asks, and logs "not listed" anyway. The refusal path itself is **Still to test by hand**; the game-free `test_device_policy` covers `queue_priority_look`/`_chained`/`_restart`, not the `vkCreateDevice` retry. Worth either a small test of the retry (the look/chained result plus the log) or a comment that the log is a best guess. **5. The no-slot edge.** If `menu_row_takes_restart` returns false (no slot), the device keeps the start's priority while frame generation changes at once. At 15/16 that does not happen today, but if it did, the low could stay with frame generation off (harmless) or be missing after turning it on (the fix absent) with no line. A log there would make it diagnosable. **6. Tests and measurements.** Here (Linux, g++/clang++, the same tree): - `test_device_policy --headers _deps/vulkan-headers/include`: ok, 24 PCs, 87 environments, 9 switch cases, 93 rule edges. - `test_framegen_hold`: PASS (7 cases); `test_framegen_windowless_start --headers …`: PASS (7); `test_menu_row_takes_restart`: PASS (9, kMax 16); `test_menu_restart_slots`: PASS (15 rows, 16 slots). The author's full `mise run test` has 37 failures on `main` and here on the same lines; the changed checks pass. The **Still to test** (other NVIDIA cards, AMD/Intel, NVIDIA Linux, the refusal by hand) and the **one RTX 4090 / 95 % aim not reached** are the remaining evidence; the #2184 dependency is named. `pr status` also warns that the table's "Before: main @ 8aa749834" predates the current `main`; the Measurements paragraph says why the numbers still hold β€” it may be worth a comment so the merge check sees it. No approval and no claim. The queue selection, the fixed-multiplier/NVIDIA Windows gate, the restart hold and the fallback's logic look right; the present's shared low queue and the untested refusal path are the two I would settle first.
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 / The same as upstream (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 10s
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
Some workflows are waiting to be reviewed.
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 'fix/fg-replay-queue-priority:Jiro113-fix/fg-replay-queue-priority'
git switch 'Jiro113-fix/fg-replay-queue-priority'
Sign in to join this conversation.
No reviewers
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!2183
No description provided.