perf(vk): the recorder thread alone from 4 cores on non-mirrored systems #3157
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3157
Loading…
Reference in a new issue
No description provided.
Delete branch "omgitsgela/Longshot:perf/recorder-thread-from-4-cores"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On a Steam Deck, Auto leaves the recorder thread off: it starts at 6 physical cores, and the Deck reports 4 (8 threads). The recorder thread alone is a measured CPU win there, and this makes Auto pick it from 4 cores on systems whose buffer pools have no mirrors, so Deck players get it without an environment switch.
Files a reviewer should read first:
gpu/vk/threaded_rendering.h(the constant andwithout_mirrors()),tests/test_threaded_rendering.py(the cases that move with it),gpu/vk/switches.def(RX_VK_RECORDER's row).See #2480: this addresses its recorder-thread half. Its load-mode half (
RX_VK_LOAD) is separate and unchanged here.Testing
Tested: Steam Deck LCD, SteamOS, RADV (VANGOGH), 1280x800, Render resolution 100%, the game's own upscaler: Hyrule Field (child save, slot 02) and the Market entrance, 15 s settling and 60 s standing and walking, auto profile. On the change's commit (9d4e7997, the same working branch and build configuration as its base 93aa8539) the start line reads "Auto: the recorder thread only (4 cores of 8 logical processors; the render thread off: the buffer pools have no mirrors)"; both scenes are faster and their screenshots are clean. Statistics below are filtered steady gameplay (frames of 20 ms or more, the first 45% for load and first-use pipelines and the last 2% for quit dropped), not whole-run fps.
Linux,
python3 -I -B tests/test_threaded_rendering.py: passes, 44 broken copies caught.python3 -I -B tests/run_all.py: 725 passed, 16 failed, 157 skipped. The same 16 fail on clean main atca830e89with the same names, so they are inherited: test_builtin_spv, test_cloth_kernels, test_cloth_loops, test_cloth_step8, test_colour_vision, test_crt_shaders, test_drawn_page_map, test_gfx_world, test_hdr_encode, test_rgba16f_scene_dlss, test_rgba16f_scene_taau, test_taau_fxaa, test_target_retention, test_tex_desc_memo, test_thinlto_tls, test_vk_tex_btree_get_fast.Still to test:
9d24ffae5): by hand. This Deck cannot build current main's builder (shaderc-sys needs cmake, which it does not have), so that build is still outstanding.buffer_mirrors=Off), main against this PR in the Market, expecting no regression and the startup line to change from off to "the recorder thread only" (@Beanstalk)Measurements
Verdict: On the Deck the recorder thread is 3.4 ms a frame faster in Hyrule Field at the median (9.6%) and 5.8 ms in the Market (14.3%), with GPU time flat. The 1% low rises 22.8 to 26.5 fps in Field (16%) and 20.4 to 20.9 in the Market (2.5%, where the forced-switch arm reached 23.2, so treat that one as within the runs' spread); p99 falls 16% and 4.7%.
Baseline: the Before column is the change's parent commit on the Deck's working branch (main plus that tree's own commits, 93aa8539); current main
ca830e89has the same threading code and the change is one constant, so the comparison isolateskAutoRecorderOnlyCores. The After commit is the change as measured (9d4e7997);9d24ffae5is the same change rebased onto current main, not yet run. The forcedRX_VK_RECORDER=threadarms are shown separately, not counted as repeats of the default.Setup: Steam Deck LCD, SteamOS, RADV VANGOGH, 1280x800, Render resolution 100% (the run's pinned options file, not the game's Auto preset), no frame cap, sound off; each run 15 s settling then 60 s standing and walking; numbers from the run's
longshot_frames.csv.RX_VK_RECORDER=threadRX_VK_RECORDER=threadRisks
4- and 5-core systems whose pools have no mirrors newly run the recorder thread. That includes integrated GPUs and discrete cards with
buffer_mirrors=Off: the menu asks the pools, not the GPU type. On the Deck that is faster with the same GPU time and the same pictures; other hardware could differ, which is why the 4/5-core and Windows checks are listed under Still to test. The render thread still stays off without mirrors, so the mirrored-path risk is unchanged. Turn it off per run withRX_VK_RECORDER=off, or the Debug tab's Threaded rendering row set to Off; a revert restores the old threshold. Nothing changes for players after updating: no saves, settings or caches move.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
gpu/vk/switches.def.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Steam Deck LCD, SteamOS, RADV VANGOGH, 1280x800, Render resolution 100%: Hyrule Field and the Market entrance, 15 s settling and 60 s standing and walking. Auto picked the recorder thread and the frame time fell from p50 35.07/40.63 ms to 31.71/34.84 ms (p99 42.11/48.22 to 35.37/45.97), GPU time unchanged, screenshots clean, no errors. The rebased head on current main has not been run yet.
Possibly related, for context:
@review
Recommendation: Approve. The code is ready: only testing is left. The Deck results indicate a promising frame-time improvement, but the measured Auto result is a single run per scene on an earlier tree. The new default also reaches other four- and five-core systems that have not been measured. Recommend approval; not approved on the forge.
Auto enables the recorder thread without the render thread on non-mirrored systems with four or five usable physical cores. This can improve Deck frame times, at the cost of another active thread and its scheduling overhead on newly affected systems.
Nits (1): optional.
gpu/vk/threaded_rendering.h:87: The preceding comment still says the threshold is held at six and leaves four- and five-core handhelds unchanged. (more on the line) Do: Update the comment to describe the new threshold and the Deck measurement.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/threaded_rendering.h:87: The reported Deck Auto result has only one run per scene and was taken on an earlier tree, so it does not establish the gain on this head. (more on the line) Do: Run interleaved baseline and head Auto comparisons on the Deck in both scenes, with at least two runs per side and fps, median and p99 frame times.gpu/vk/threaded_rendering.h:87: The new default also enables the recorder on four- and five-core non-mirrored PCs beyond the tested Deck, with no comparison on those systems. (more on the line) Do: Compare baseline and head in representative gameplay on the listed Windows integrated GPU and another affected Linux integrated system, including frame-time tails and correctness. (@fixdoes its part first: Restrict the four-core default to the measured hardware until the broader default is validated.)@fixcan do L2 and L3.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven for the rebased head: the reported earlier-tree Deck Auto runs reduced p50 from 35.07 to 31.71 ms in Hyrule Field and from 40.63 to 34.84 ms in the Market, with p99 also lower. There is only one reported Auto run per scene, and the head has not been run.
Other systems: The default also changes on Windows and Linux integrated GPUs and on discrete systems with mirrors disabled, when four or five physical cores are usable. Mirrored systems, fewer-core systems, explicit overrides, and unsafe Auto paths retain their existing selection; performance and correctness on the newly affected non-Deck systems remain unmeasured.
Switches: RX_VK_RECORDER is unchanged as an override; its unset default follows Threaded rendering Auto, which now selects the recorder alone from four rather than six physical cores without mirrors. The table and user documentation were updated; the wider default still needs hardware measurements.
Reviewed:
9d24ffae56againstca830e8959: Read the repository instructions, contribution rules, pull request template, full diff, commit message, threaded_rendering.h, and the affected selection and recorder paths; examined the changed tests and recorded run. Skimmed the remaining large changed renderer files and reference documents around the edits; did not read those files in full. docs/review-checklist.md is absent.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no project code, builds or tests were run. The author reports the threaded-rendering test passed on Linux; CI is still running.
Overlaps and merge order: Not checked; network unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -85,3 +85,3 @@/// recording and submits (RX_VK_RECORDER_PARTS). Holding this tier at 6 physical cores leaves 4- and 5-core non-mirrored/// handhelds (such as the Steam Deck) unchanged until tested on that hardwareinline constexpr unsigned kAutoRecorderOnlyCores = 6;inline constexpr unsigned kAutoRecorderOnlyCores = 4;L1 (should fix): The reported Deck Auto result has only one run per scene and was taken on an earlier tree, so it does not establish the gain on this head.
When: The default selects the recorder on a four-core Deck; run-to-run variation or changes on current main may change the reported improvement and frame pacing.
Do: Run interleaved baseline and head Auto comparisons on the Deck in both scenes, with at least two runs per side and fps, median and p99 frame times.
L2 (should fix): The new default also enables the recorder on four- and five-core non-mirrored PCs beyond the tested Deck, with no comparison on those systems.
When: An integrated GPU on Windows or another Linux PC now runs an additional recorder thread; its scheduling and driver costs may affect frame time or pacing differently from the Deck.
Do: Compare baseline and head in representative gameplay on the listed Windows integrated GPU and another affected Linux integrated system, including frame-time tails and correctness.
L3 (nit): The preceding comment still says the threshold is held at six and leaves four- and five-core handhelds unchanged.
Do: Update the comment to describe the new threshold and the Deck measurement.
Review fixes in
f90e3a713: the Auto hint and the thread table now say 4. The settings and switches checks require the recorder-only clause itself, because they could pass on the mirrored clause before; the constant mutation now proves the behaviour (4 -> 6 fails at 4 cores); an unreachable assertion is gone. The description labels the filtered statistics, adds 1% lows, per-scene GPU time, the discrete buffer_mirrors=Off case and the Windows build box. Tests: 44 broken copies caught. The exact-head Deck run is still outstanding: current main's builder needs cmake for shaderc-sys, absent here.@review
Recommendation: Approve. The code is ready: only testing is left. The Deck measurements indicate a gain, but they include only one Auto run per scene on an earlier tree. The broader four- and five-core default also needs comparison on affected PCs. Recommend approval; not approved on the forge.
Auto enables the recorder thread on non-mirrored systems with four or five usable cores, including the Steam Deck. This can reduce frame time, at the cost of enabling threaded recording by default on other hardware that has not yet been measured.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/threaded_rendering.h:87: The reported Deck Auto result has only one run per scene and was taken on an earlier tree, so it does not establish the gain on this head. When: The default selects the recorder on a four-core Deck; run-to-run variation or changes on current main may change the reported improvement and frame pacing. Do: Run interleaved baseline and head Auto comparisons on the Deck in both scenes, with at least two runs per side and fps, median and p99 frame times.gpu/vk/threaded_rendering.h:87: The new default also enables the recorder on four- and five-core non-mirrored PCs beyond the tested Deck, with no comparison on those systems. When: An integrated GPU on Windows or another Linux PC now runs an additional recorder thread; its scheduling and driver costs may affect frame time or pacing differently from the Deck. Do: Compare baseline and head in representative gameplay on the listed Windows integrated GPU and another affected Linux integrated system, including frame-time tails and correctness. (@fixdoes its part first: Restrict the four-core default to the measured hardware until the broader default is validated.)@fixcan do L2.Since the last review (on
9d24ffae56)Resolved: L3 (The preceding comment still says the threshold is held at six and leaves four- and five-co…)
Still open: L1 (The reported Deck Auto result has only one run per scene and was taken on an earlier tree,…); L2 (The new default also enables the recorder on four- and five-core non-mirrored PCs beyond t…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven on this head. On the earlier Deck tree, one Auto run per scene reduced median frame time from 35.07 to 31.71 ms in Hyrule Field and from 40.63 to 34.84 ms in the Market; the recorded baseline had three and four runs respectively.
Other systems: The new default also affects four- and five-core integrated GPUs and discrete GPUs with buffer mirrors off, on Linux and Windows. Comparisons on those systems and an in-game run of the rebased head remain outstanding.
Switches: RX_VK_RECORDER remains unset by default, taking its choice from Threaded rendering Auto. Its effective Auto default changes to the recorder thread alone at four cores without mirrors; the broader default remains unvalidated.
Reviewed:
f90e3a7138againstca830e8959: Read threaded_rendering.h and the recorded Deck run in full; inspected the changes since the ledger and the relevant renderer diff. Other changed files, repository rules, and surrounding code were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports the targeted check passing, with 16 suite failures also present on main; CI is still running.
Overlaps and merge order: Not checked.
Automated code review by BeanBot (gpt-6.1-terra), asked for by omgitsgela. Nothing was run; a maintainer decides.
@fix
I didn't fix this pull request: the change I made would take out 16 of the 23 lines this pull request adds outside its tests, which undoes it rather than fixing it. So L2 is the author's now. Nothing was pushed.
Automated fix by BeanBot (gpt-6.1-terra), asked for by omgitsgela. Nothing was run; a maintainer decides.
WIP: perf(vk): the recorder thread alone from 4 cores on non-mirrored systemsto perf(vk): the recorder thread alone from 4 cores on non-mirrored systems@ask is there a reason not to have recorder thread on for all? basically everyone has 4+ cores already
In reply to this comment
I didn't answer: this pull request isn't open.
Automated answer by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.