fix(linux): a start with no window loads the renderer with the process's affinity, as a windowed start does #2784
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!2784
Loading…
Reference in a new issue
No description provided.
Delete branch "klimovich008/Longshot:perf/linux-core-count"
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
Why: on Linux a game started with no window (
HOS_HEADLESS=1) loads the renderer on the game's own thread. That thread is pinned off the reserved core, so the renderer counts the process without that core. Headless runs (the control bridge'stestprofile, the pipeline tour, the Test Farm's headless starts, a Steam Deck test harness) then measure a renderer set up differently from the one a player's windowed game runs.Who it affects: only headless starts on Linux. A windowed start (every player) and
--prepare-shadersalready count right, and Windows is not changed (host/display.cis untouched). On a Steam Deck the same build loggedCPUs 8 (6 usable, 3 cores)andThreaded rendering: Auto: off (3 cores of 6 logical processors; ...)when started headless, andCPUs 8 (8 usable, 4 cores)when it prepared its shaders. This PR gives no gain to players. What it gives is measurement parity: a headless Linux run now sets the renderer up as a windowed one does.The cause:
longshot_vk.sohas its own copy ofhost/posix/win32_posix.c(builder/crates/build-compile/src/plan.rs, linked-Bsymbolic). That copy'sGetProcessAffinityMaskis the mask its constructor read when the module was loaded, which is the affinity of the loading thread.renderer_main, aCreateThreadthread. Such a thread starts with the process's affinity (win32_posix.cthread_entry).hos_display_startcalledrx_start(NULL)on the game's thread, whichhos_thread_pinhad moved off the reserved core. Sousable_cpus()andusable_cores()counted one physical core fewer, and the module's own threads started on that narrower mask.How to see it on main: start a Linux build headless (
HOS_HEADLESS=1) on a PC with 8 or more logical processors. The log'sCPUs N (M usable, K cores)line has 2 usable processors and 1 core fewer than a windowed start of the same build.What changes:
host/posix/display_sdl.c(Linux only),hos_display_start's no-window branch, through the newheadless_renderer_startandheadless_renderer_main:rx_start(NULL)now runs on aCreateThreadthread, asrenderer_maindoes with a window, and the game's thread waits for it (WaitForSingleObject, thenCloseHandle).CreateThreadfails, the start runs on the game's thread as before.mkw_vk_start, then asks the all-thread sampler to list the threads again (hos_prof_relist), so the renderer's start is sampled from the sampler's next sweep on (review L1).hos_renderer_waitcomment follows.host/posix/prof.c(Linux only), for L1:hos_prof_relist()moves a generation on.sample_all_thread(HOS_SAMPLE_ALL, andHOS_SLOW_FRAMES's ring) lists the threads again at its next sweep when the generation moved, besides every 5 s as before..gofile's check, the list's and the sweep: an ask made during the wait reaches the next sweep (2 ms;HOS_SLOW_FRAMES_EVERY_MSin the ring), and no sweep follows a.gofile taken away in the wait.tests/test_headless_renderer_cpus.py(new):win32_posix.ctwice: into an executable, and into a-fPIC -shared -Wl,-Bsymbolicmodule, aslongshot_vk.sohas it.hos_display_startand its helpers from the source, and pins the calling thread off the highest processor, ashos_thread_pindoes.rx_startloads the module and asks both itsGetProcessAffinityMaskand the loading thread's own mask. Both must be the process's mask.rx_starton the game's thread) must fail, with both masks equal to the pinned thread's. Any other pair is a plain failure, not the expected one.win32_posix.c's masks are 64 bits).tests/test_display_startup_failure.pyandtests/display_startup_failure_test.cpp: they cuthos_display_start, so they cut and stub the new helpers too. The headless case now also checks that the start ran on its own thread, was named, and was waited for and closed, and that it asked the sampler to list it once, on that thread, after its name and before the start.tests/test_slow_frames.py: the sampler's order inhost/posix/prof.c(one wait, then the one.gocheck, the generation read and compared, the sweep), andhos_prof_relist, compiled from its cut, moving the generation by one a call.What headless Linux runs do differently after this PR:
usable_cpus()(the shader preparation, the noted pipelines, the texture threads) gets 2 more workers.win32_posix.cthread_self()registers a thread its copy did not create on that thread's firstGetCurrentThread(), and applies the copy's process mask to it. Invk_replay.cppReplayPinthat happens beforeSetThreadAffinityMaskreads the old mask. So withRX_VK_ASYNCoff, the submitting guest thread comes back from its first inline replay on the process's whole mask, the reserved core included. A windowed Linux start does this today; a headless one hid it, because its module mask was the pinned one. It now shows in headless runs too. It is not caused here, and it is not fixed here: fixing it changes players' thread placement on Linux, which needs its own change and a measurement.Unchanged: no
vk_api.hchange, and no file of the shader-cache stamp, so no player prepares again. Nothing undergpu/changes. Windows does not builddisplay_sdl.c, and a pack of this branch on a Windows base had no module that differs from the base's.Read first:
headless_renderer_startinhost/posix/display_sdl.c, thenthread_entryandprocess_affinityinhost/posix/win32_posix.c.Testing
Tested: in the game on a Steam Deck OLED (SteamOS 3.9.5, kernel 7.2.7, Mesa 26.2.0-devel RADV, 4 cores / 8 threads, AC power, stock 15 W), head
d9876f0f(main2ca7d4f74merged) against main2ca7d4f74, each built from source on the Deck. Headless starts (HOS_HEADLESS=1, the control bridge's test profile), Market as a child:CPUs 8 (6 usable, 3 cores),Threaded rendering: Auto: off (3 cores of 6 logical processors; the render thread and the recorder thread from 4 cores).CPUs 8 (8 usable, 4 cores),Threaded rendering: Auto: off (not safe on this run: the buffer pools have no mirrors). That is the reason a windowed start on the Deck logs. Every run of each side logged the same lines (9 starts).workers 2, capture helpers 2, texture threads 4), and both sides replay on0xc0while they replay.9315148headless on two Linux PCs (Ryzen AI MAX+ 395 / 8060S RADV, Ryzen 7 5800X / RX 9070 RADV): usable processors 30 -> 32 and 14 -> 16, cores 15 -> 16 and 7 -> 8, no crash.Game-free, on the Deck at
d9876f0f:tests/test_headless_renderer_cpus.py: PASS (process 0xff, game thread 0x7f, loader and module 0xff); its broken copy fails as it should (loader and module 0x7f).tests/test_display_startup_failure.py: 12 of 12. On main'sdisplay_sdl.c(--source-root) the headless case fails ("the headless renderer started on the game's thread, not on a thread of its own"), as it must.tests/run_all.py, the whole suite: 727 passed, 14 failed, 143 skipped. main2ca7d4f74on the same Deck: 726 passed and the same 14 failed. They are this Deck's toolchain, not the change: no ASan runtime (test_audio_source,test_obj_cache_size,test_obj_guest_id,test_obj_table_bounded);-fuse-ld=lldunder-Werror(test_option_ids,test_options_path,test_settings_atomic,test_ui_renderer); nostring.hforbuilder/rt(test_game_module,test_game_module_imports);test_check_cache,test_game_font,test_vk_wb_cpu_words_fast; andtest_i18n_complete(missing translations, main's).mise run lint, gitleaks not installed here): passes.694ae5820/3ab4db6e9) are unchanged: see the first comments.d9876f0f, the whole diff and the merge's fixture resolution: none found.L1's change, game-free on the Deck at
9c71d05a(mainf8b54338merged in,da3bb0a7):tests/test_display_startup_failure.py: 12 of 12. Negative controls: the call dropped fails ("the all-thread sampler was not asked to list the start's thread"), and the call before the name fails.tests/test_slow_frames.py: ok. Negative controls, each failing: the samplers of207652d8and067fb88f, the generation's load above the wait with its compare below, a second.gocheck before the wait, an emptyhos_prof_relist, one kept under#if 0beside an empty one, and a step of 2.tests/test_headless_renderer_cpus.py,test_profiling_mode,test_sampler_stack_walk,test_prof_walk_fault,test_prof_modules: pass. Both changed files syntax-checked with the build's own flags; ruff on the changed tests.067fb88f, round 2 (a sweep after the.gofile went; the order check too loose)c60a5f82, round 3 (an emptyhos_prof_relistpassed the tests)bbe4e625, round 4 (the text checks passed an#if 0copy and a second.gocheck)9c71d05a, round 5: none found.L3 and L1, in the game on the same Deck at
9c71d05a(built asv3.2.0-247-g9c71d05a) against mainf8b54338, each built from source there; headless, Market as a child:RX_VK_MIRROR=1(mirrored pools), Threaded rendering left to Auto, one long run each (--lead 600: about 10 minutes of turning before the measured window). main:CPUs 8 (6 usable, 3 cores),Threaded rendering: Auto: off (3 cores of 6 logical processors; the render thread and the recorder thread from 4 cores). This PR:CPUs 8 (8 usable, 4 cores),Threaded rendering: Auto: on, the render thread and the recorder thread (4 cores of 8 logical processors). No GPU ring timeout, reset or device loss in either game log (#2446), and no amdgpu timeout, reset, fault or hang in the kernel's log (journalctl -k) from the first start to the last run's end. No frame over 100 ms in either window (38.38 and 41.53 fps: one run each with a different thread choice, not a measurement of this PR). With the render thread on, this PR also logsRX_VK_READBACK_EARLY left off: the render thread is on ...; the renderer leaves it off whenever the render thread is on.HOS_SAMPLE_ALLfrom the boot (no mirrors:Threaded rendering: Auto: the recorder thread only (4 cores of 8 logical processors; the render thread off: the buffer pools have no mirrors)): the sampler began with 2 threads listed, and 19,487 of its 734,776 sample lines aremkw_vk_start's, from its first sweep (0 ms) on, insidelongshot_vk.so's load.Still to test:
linux+nvidia, no report yet).Measurements
Verdict: no change in speed on the Steam Deck, as expected (same pools, Auto off either way): fps +1.9 %, CPU ms +0.0 %, the two admitted pairs disagreeing in sign (fps +8.5 % / -4.4 %, CPU ms -4.8 % / +5.2 %), so noise.
Setup: Steam Deck OLED, SteamOS 3.9.5, Mesa 26.2.0-devel RADV, stock 15 W, AC; Market as a child, uncapped (
HOS_FPS_MAX=240), headless, 1280x720 at 75 %; 3 alternating pairs, 2 admitted (the third pair's PR run swapped 80 MB in and was refused); a 20 s window each, the median of the runs. Numbers from headless Linux runs before and after this PR are still not comparable on PCs where the count changes the pools or Auto (above).2ca7d4f74d9876f0fMeasured again on current main (2026-12-04), the same Deck and settings, at steady state.
6318f405against main6318f405with this PR's four files (applied locally, built as a player's build).--lead 150). 3 pairs, all admitted.6318f4056318f405+ this PRHOS_RESERVE_CORE=0) measured +1.0 % and +4.1 %. With it, −0.1 %. So that gain was this bug, and players (windowed) never had it.Risks
rx_starton such a thread for every player. A revert is enough; there is no switch, because it is a fix.Not covered:
HOS_PINexperiments that pin the loading thread by hand.HOS_SAMPLE_ALL, the start's thread is listed from the sweep after it named itself, and sampled when it runs at its turn in a sweep, as any thread: a start of a few milliseconds can still give no sample.ReplayPinwidening above: a follow-up, not this PR.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
mainand passes here.tests/that reads changed source is updated, not weakened.display_sdl.c; no path is handled by the change.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
9315148.)main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Not run in the game: the change is Linux only (host/posix/display_sdl.c, headless starts) and this PC (Windows 11, Ryzen 7 5700X3D, RX 9070 XT) has no Linux game build; on Windows no module differs from main's. Game-free in WSL Ubuntu with gcc and clang: the renderer module built as longshot_vk.so is, loaded by the headless start, sees the process's whole mask (0xffff) where main's sees the pinned thread's (0x7fff). A headless Linux start is asked of the Test Farm.
@Beanstalk linux, the Steam Deck or a 4-core / 8-thread PC if one is free (any Linux PC otherwise), this PR's head and main: one headless start each (HOS_HEADLESS=1, the farm's usual headless start), to the title screen or any area. No timing is needed. Expected in the log: this PR
CPUs 8 (8 usable, 4 cores)where main logsCPUs 8 (6 usable, 3 cores)on an 8-thread machine (on a larger one: every logical processor usable on this PR, two fewer and one core fewer on main), and theThreaded rendering: Auto: ...line of each. Fail on a crash or a hang at start-up. Please attach both logs' CPUs and Threaded rendering lines.@review
Beanstalk test farm · an earlier run: commit
9315148(the newer results are in a comment below)Commit
9315148· approved by klimovich008 (reviewed) · dashboard⚠️ Note: The farm cannot prefer a Steam Deck or 4-core/8-thread machine conditionally, so the target accepts any online Linux PC.
⚠️ Note: The plan records the counts and matches the log lines but cannot automatically check equality between CPU counts, the expected difference from main, or attach selected log excerpts.
Done (started 04:34 UTC, last report 04:46 UTC). Comment
@Beanstalkto run it again.linuxWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)One headless Linux start of the pull request and one of main will reach the title screen, with a bounded wait for startup. The runs will record the CPU counts and Threaded rendering Auto log lines for comparison; the pull request fails on a crash or startup hang. The expected change is that all logical processors are usable on the pull request, while main reports two fewer usable processors and one fewer core.
Measurements on `linux`, for the PR description
Verdict: pass on linux (2 reports): no rule failed and no PR run crashed.
Hardware: 1: linux+amd+radv+igpu
AMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMScene: headless-startup, from the title screen; each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); headless-startup: 1 game start a side; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
The testers' hardware
linuxAMD Radeon 8060S Graphics (RADV STRIX_HALO), 26.99.99AMD RYZEN AI MAX+ 395 w/ Radeon 8060S, 64 GB RAMlinuxAMD Radeon RX 9070 (RADV GFX1201), 26.0.8AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAMPossibly related, for context:
Recommendation: Approve. The affinity test demonstrates the intended mechanism, but this head has not yet run the real renderer on Linux. Headless starts can also select different renderer threads and worker counts, so the affected hardware needs a game run before merge. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
Headless Linux starts load the renderer on a thread with the process affinity, matching windowed startup. This improves the comparability of headless runs, at the cost of different worker counts and renderer thread selection; short renderer starts can also disappear from all-thread profiles.
Should fix (1): not blocking, but worth doing before merging.
host/posix/display_sdl.c:375: Moving startup to a short-lived thread can make the all-thread sampler miss renderer startup entirely. (more on the line) Do: Make the sampler discover the startup thread promptly, or otherwise keep startup visible to it.Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)
host/posix/display_sdl.c:376: Verify the real headless renderer startup and affinity on a Steam Deck. (more on the line) Do: Run headless starts of main and this head on a Steam Deck, check the CPU and Auto thread-selection log lines, and confirm startup reaches the game without a crash or hang.host/posix/display_sdl.c:376: Check the changed Auto thread selection on a RADV system with mirrored pools. (more on the line) Do: Run main and this head headless on a suitable RADV system, verify the CPU and Auto lines, and exercise rendering long enough to check for the reported hang.host/posix/display_sdl.c:376: Exercise the changed headless startup with the NVIDIA Linux driver as well. (more on the line) Do: Run a headless game start on an NVIDIA Linux system and check startup, rendering, CPU count and Auto thread selection.@fixcan do L1.Checks: Still running: 9 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven in the game. The reported game-free GCC and Clang runs saw mask 0xffff in both the loader and module, versus 0x7fff on the pinned caller and on main. No game run of this head has confirmed the resulting CPU counts or renderer startup.
Other systems: Windowed Linux startup, shader preparation and Windows do not use the changed branch. Headless Linux can change pool sizes, thread placement and Auto threaded-rendering selection across GPU drivers; the temporary startup thread also affects all-thread profiling. No real Linux renderer run of this head is reported.
Switches: None added, changed or removed.
Reviewed:
931514821dagainst3ab4db6e91: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the four changed files, the diff and commit messages. Read the relevant renderer loading, affinity, thread lifetime, replay pinning and profiler paths. Reviewed the reported test runs and comments; no review checklist file was present. Other renderer code and tests were searched or skimmed rather than read in full.; nothing run (a code review).Checked and fine:
Testing: No code, tests or project scripts were run during this review. The author reports game-free GCC and Clang passes; CI was still running.
Overlaps and merge order: Not checked; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by klimovich008. Nothing was run; a maintainer decides.
@ -363,0 +372,4 @@its thread list, taken again every 5 s, has the new thread: a start that ends before that is not sampled) */static DWORD WINAPI headless_renderer_main(void *p) {(void)p;SetThreadDescription(GetCurrentThread(), L"mkw_vk_start"); /* (itself, before the start: its pthread id is its own) */L1 (should fix): Moving startup to a short-lived thread can make the all-thread sampler miss renderer startup entirely.
When: With HOS_SAMPLE_ALL active, if the sampler has already listed threads and this thread starts and finishes before the next five-second refresh, its renderer startup stacks are absent. Previously that work ran on the already-listed guest thread.
Do: Make the sampler discover the startup thread promptly, or otherwise keep startup visible to it.
@ -363,0 +373,4 @@static DWORD WINAPI headless_renderer_main(void *p) {(void)p;SetThreadDescription(GetCurrentThread(), L"mkw_vk_start"); /* (itself, before the start: its pthread id is its own) */rx_start(NULL);L2 (should fix): Verify the real headless renderer startup and affinity on a Steam Deck.
When: The stand-in module checks affinity but does not initialize Vulkan or exercise the renderer's startup and worker pools.
Do: Run headless starts of main and this head on a Steam Deck, check the CPU and Auto thread-selection log lines, and confirm startup reaches the game without a crash or hang.
L3 (should fix): Check the changed Auto thread selection on a RADV system with mirrored pools.
When: On a four-core, eight-thread system the wider mask can enable both renderer threads where headless main left them off; the PR identifies an open RADV ring hang involving both threads.
Do: Run main and this head headless on a suitable RADV system, verify the CPU and Auto lines, and exercise rendering long enough to check for the reported hang.
L4 (should fix): Exercise the changed headless startup with the NVIDIA Linux driver as well.
When: The new thread initializes the real Vulkan renderer and its workers on a different affinity mask, but the reported checks use a stand-in module and do not exercise this driver.
Do: Run a headless game start on an NVIDIA Linux system and check startup, rendering, CPU count and Auto thread selection.
Synced with main and tested on a Steam Deck.
d9876f0f: main2ca7d4f74merged. Two test fixtures conflicted with main's windowless wait (#2786's 50 ms polls). Main's side is kept, the start thread's stubs are added beside it, andINFINITEis back for the start's wait. No change tohost/.CPUs 8 (6 usable, 3 cores). This PR logsCPUs 8 (8 usable, 4 cores)and Auto's windowed reason, "the buffer pools have no mirrors". That held on all 9 starts. Pools are unchanged on the Deck.run_all.pyon the Deck: the same 14 environment failures as main, plus this PR's own test passing. They are named in Tested.Still to test is now empty. Description updated.
@review
@Beanstalk
Beanstalk test farm · an earlier run: commit
d9876f0(the newer results are in a comment below)Commit
d9876f0· approved by klimovich008 (reviewed) · dashboard⚠️ Note: The log checks require the CPU and Auto lines but cannot establish that the reported usable CPU count equals the process affinity or compare it with a windowed start.
⚠️ Note: The farm cannot run the new game-free affinity and startup-failure fixtures or verify that short renderer starts appear in the all-thread sampler.
⚠️ Note: The RADV target does not guarantee mirrored pools or that Auto selects both threads, and the intermittent ring hang has no reliable trigger.
Started at 2026-12-03 11:57 UTC.
linux+radvlinux+nvidialinux+intelsteamdeckCouldn't be judged: the tester's PC could not finish the test. The farm tries another PC, or the same one after a fix; it says nothing about the PR on its own.
linux+radv, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'slinux+radv, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'slinux+nvidia, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'slinux+nvidia, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'slinux+intel, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'ssteamdeck, report 1:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'ssteamdeck, report 2:main's tools.lock: tools.lock line 32 (sdl): its first URLs are not Longshot's store'sWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)Three headless starts each of main and the PR will exercise Market and Hyrule Field on Linux RADV, NVIDIA and Intel systems, with a separate Steam Deck target that waits for a tester. Each start captures the CPU and threaded-rendering startup lines, compares stationary pictures, and measures uncapped frame times for 20 seconds in each area. Crashes, hangs, missing startup lines, substantial picture differences or frame-time regressions fail the PR. The run also exercises the RADV renderer, although a short test cannot rule out an intermittent ring hang. No tester online now matches steamdeck: that target waits for one.
market-entrance(settings vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0; switchesHOS_OUTPUT_RES=1280x720,RX_VK_AUTO_TUNE=0), then teleport to Market, take the picture market to compare with main, measure market for 20 s (after 10 s warm-up), teleport to Hyrule Field, take the picture field to compare with main, measure field for 20 s (after 10 s warm-up); 3 runs on each side.Measurements on `linux+radv`, for the PR description
Verdict: could not be judged on linux+radv (2 reports).
Hardware: 1: linux+amd+radv+igpu
AMD Radeon 890M Graphics (RADV STRIX1), 26.1.99AMD Ryzen Z2 Extreme, 32 GB RAM; 2: linux+amd+radv+dgpuAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAMScene: headless-start-and-render, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); headless-start-and-render: 3 game starts a side, market 20 s after 10 s warm-up, field 20 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `linux+nvidia`, for the PR description
Verdict: could not be judged on linux+nvidia (2 reports).
Hardware: 1: linux+nvidia+nvidia-proprietary+dgpu
NVIDIA GeForce RTX 5070, 620.73.4AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAM; 2: linux+nvidia+nvidia-proprietary+dgpu+dlssNVIDIA GeForce RTX 5070 Laptop GPU, 620.85.2AMD Ryzen AI 9 365 w/ Radeon 880M, 32 GB RAMScene: headless-start-and-render, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); headless-start-and-render: 3 game starts a side, market 20 s after 10 s warm-up, field 20 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `linux+intel`, for the PR description
Verdict: queued on linux+intel (1 report).
Hardware: 1: linux+intel+anv+igpu
Intel(R) Graphics (RKL GT1), 26.2.411th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz, 128 GB RAMScene: headless-start-and-render, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); headless-start-and-render: 3 game starts a side, market 20 s after 10 s warm-up, field 20 s after 10 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
Measurements on `steamdeck`, for the PR description
Verdict: could not be judged on steamdeck (2 reports).
Hardware: 1: linux+amd+radv+igpu+handheld
AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAM; 2: linux+amd+radv+igpu+handheldAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAMScene: headless-start-and-render, from the repository's save market-entrance (vsync=2, resolution=1, frame_rate_cap=6, quality_preset=0, HOS_OUTPUT_RES=1280x720, RX_VK_AUTO_TUNE=0); each cell's settings and switches as the table names them
Method: the Beanstalk test farm: main and this PR built and run on the same PC in one session, game starts alternating (ABBA); headless-start-and-render: 3 game starts a side, market 20 s after 10 s warm-up, field 20 s after 10 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (
@Beanstalkon this PR runs it again)Nothing was measured: no metric came back.
Flags and settings
None: the plan varied no setting, switch or build option.
As Markdown for the PR description:
The testers' hardware
linux+radvAMD Radeon 890M Graphics (RADV STRIX1), 26.1.99AMD Ryzen Z2 Extreme, 32 GB RAMlinux+radvAMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAMlinux+nvidiaNVIDIA GeForce RTX 5070, 620.73.4AMD Ryzen 5 9600X 6-Core Processor, 32 GB RAMlinux+nvidiaNVIDIA GeForce RTX 5070 Laptop GPU, 620.85.2AMD Ryzen AI 9 365 w/ Radeon 880M, 32 GB RAMlinux+intelIntel(R) Graphics (RKL GT1), 26.2.411th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz, 128 GB RAMsteamdeckAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAMsteamdeckAMD Custom GPU 0405 (RADV VANGOGH), 26.1.99AMD Custom APU 0405, 16 GB RAMRecommendation: Approve. The Steam Deck run shows the intended affinity correction, but the sampler can still miss a short renderer start. The requested mirrored-pool RADV and NVIDIA Linux runs also remain outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
Headless Linux starts load the renderer on a thread with the process affinity, matching windowed startup. This improves measurement parity at the cost of a separate startup thread and potentially different renderer worker and Auto-thread choices.
Should fix (1): not blocking, but worth doing before merging.
host/posix/display_sdl.c:375: Moving startup to a short-lived thread can make the all-thread sampler miss renderer startup entirely. When: With HOS_SAMPLE_ALL active, if the sampler has already listed threads and this thread starts and finishes before the next five-second refresh, its renderer startup stacks are absent. Previously that work ran on the already-listed guest thread. Do: Make the sampler discover the startup thread promptly, or otherwise keep startup visible to it.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
host/posix/display_sdl.c:376: Check the changed Auto thread selection on a RADV system with mirrored pools. When: On a four-core, eight-thread system the wider mask can enable both renderer threads where headless main left them off; the PR identifies an open RADV ring hang involving both threads. Do: Run main and this head headless on a suitable RADV system, verify the CPU and Auto lines, and exercise rendering long enough to check for the reported hang.host/posix/display_sdl.c:376: Exercise the changed headless startup with the NVIDIA Linux driver as well. When: The new thread initializes the real Vulkan renderer and its workers on a different affinity mask, but the reported checks use a stand-in module and do not exercise this driver. Do: Run a headless game start on an NVIDIA Linux system and check startup, rendering, CPU count and Auto thread selection.@fixcan do L1.Since the last review (on
931514821d)Resolved: L2 (Verify the real headless renderer startup and affinity on a Steam Deck.)
Still open: L1 (Moving startup to a short-lived thread can make the all-thread sampler miss renderer start…); L3 (Check the changed Auto thread selection on a RADV system with mirrored pools.); L4 (Exercise the changed headless startup with the NVIDIA Linux driver as well.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes: on a Steam Deck, nine headless starts reported 8 usable processors and 4 cores, versus 6 and 3 on main. This is an affinity fix, not a claimed player performance gain; the two admitted timing pairs were noisy.
Other systems: Windowed Linux startup and Windows do not use the changed branch. Headless Linux can select more workers or enable Auto threading on mirrored pools; the reported farm runs found no crash on two RADV PCs, but do not establish the requested mirrored-pool case. NVIDIA Linux remains untested.
Switches: None added, changed, or removed.
Reviewed:
d9876f0fc9against2ca7d4f741: Read the repository rules, pull request template, diff and changed test files, and inspected the display startup, affinity and sampler paths. Skimmed the recorded runs and other surrounding code; docs/review-checklist.md and the adjacent Tooling AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author reports the game-free tests passing and the same 14 full-suite failures on main and head; CI is still running.
Overlaps and merge order: None found.
Automated code review by BeanBot (gpt-6.1-terra), asked for by klimovich008. Nothing was run; a maintainer decides.
CI on
d9876f0f: the four failures look like main's, not this change's. I couldn't open the job logs (they need a browser sign-in), and main's own CI is still queued. So this rests on the evidence below, not on the logs.host/posix/display_sdl.c(Linux only) and its tests. None of the three builds anything it changes.cargo fmtfailure (from #3098) and a Windows build-core failure (#3113).6318f405into this branch locally and ran the checks on Linux (Steam Deck, SteamOS).test_headless_renderer_cpuspasses, and fails on plain main ("the module saw the pinned thread's mask");test_display_startup_failurepasses 12 of 12.test_cursor_hidden_linuxfails there exactly as it does on plain main (esc_had_captureset but not used). #3121 fixes it.tools.lockproblem, reported before.I'll check again once main's CI has run.
Measured again on current main (main
6318f405with this PR's changes, Steam Deck OLED, stock 15 W, Market child, steady state, 3 pairs, all admitted).f8b54338) into perf/linux-core-count da3bb0a7e1L1 (the all-thread sampler and the start's short thread): fixed, head
9c71d05a(mainf8b54338merged in first,da3bb0a7:display_sdl.cand the fixtures merged clean).host/posix/prof.c:hos_prof_relist()moves a generation on. The start's thread calls it right after naming itselfmkw_vk_start.sample_all_thread(HOS_SAMPLE_ALL, andHOS_SLOW_FRAMES's ring) lists the threads again at its next sweep when the generation moved, besides every 5 s..gocheck, the list's check and the sweep. So an ask made during the wait reaches the very next sweep (2 ms;HOS_SLOW_FRAMES_EVERY_MSin the ring), and no sweep follows a.gofile taken away in the wait.display_startup_failure_test.cpprequires the ask once, on the start's thread, after its name and beforerx_start.test_slow_frames.pychecks the sampler's order, and compiles and runshos_prof_relistfrom its cut.L3 (Auto's thread choice with mirrored pools on RADV, 4 cores / 8 threads): the Steam Deck is that system once
RX_VK_MIRROR=1gives it mirrored pools. Queued there, with the results to follow here:f8b54338and this head, headless, Threaded rendering left to Auto;HOS_SAMPLE_ALLstart of this head, to seemkw_vk_startin the samples (L1 in the game).L4 (NVIDIA's Linux driver): no NVIDIA Linux machine here, so I'm asking the farm below.
@Beanstalk on an NVIDIA GPU with the Linux driver (any Linux PC of the farm with one): a headless start (
HOS_HEADLESS=1) of main and of this head, each in the game for a few minutes (the Market or Hyrule Field). Report from each log theCPUs N (M usable, K cores)line, theThreaded rendering: Auto: ...line, whether it rendered (fps lines, no device lost), and the run's end. Uncapped (frame_rate_cap = 6,vsync = 2,frame_generation = 0). One run a side is enough; this is a startup and driver check, not a measurement.🤖 Generated with Claude Code
Beanstalk test farm · ⚠️ couldn't be judged on linux+nvidia
Commit
9c71d05· approved by klimovich008 (reviewed) · dashboard⚠️ Note: The draws probe reports rendering FPS rather than checking for FPS log lines; the logs retain the CPU and Auto lines for both sides.
⚠️ Note: This run does not independently verify the process affinity mask or exercise the all-thread sampler.
Done (started 01:35 UTC). Comment
@Beanstalkto run it again.linux+nvidiaWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)Run main and the PR headlessly on a Linux NVIDIA PC for three minutes each in the Market, with the frame cap and V-Sync off. Record the CPU-count and threaded-rendering Auto log lines, rendering FPS, and each run’s outcome. The PR fails if it crashes, reports device loss, omits either startup line, or produces no measurable rendering. No tester online now matches linux+nvidia: that target waits for one.
market-entrance(settings vsync=2, frame_rate_cap=6, frame_generation=0), then measure market for 3 min (after 10 s warm-up); 1 run on each side.L3 and L1 have run on the Steam Deck (OLED, SteamOS 3.9.5, Mesa 26.2.0-devel RADV, 4 cores / 8 threads, AC power, stock 15 W): this head
9c71d05aagainst mainf8b54338, each built from source there, headless, Market as a child. Both are now in Tested; L4 is queued on the Test Farm.L3, mirrored pools (
RX_VK_MIRROR=1), Threaded rendering left to Auto, one long run each (--lead 600):f8b54338CPUs 8 (6 usable, 3 cores)CPUs 8 (8 usable, 4 cores)The fps (38.38 and 41.53) are one run each with a different thread choice, so they are not a measurement of this PR.
L1, one start of this head with
HOS_SAMPLE_ALLfrom the boot: 19,487 of 734,776 sample lines aremkw_vk_start's, from the sampler's first sweep (0 ms) on, insidelongshot_vk.so's load. The sampler began with 2 threads listed, so the renderer's start is now sampled after its relist.@review
Recommendation: Approve. The code is ready: only testing is left. The headless affinity fix and sampler relist are demonstrated on the Steam Deck, including the changed Auto selection with mirrored pools. The requested NVIDIA Linux driver run is still pending. Recommend approval; not approved on the forge.
Linux headless starts load the renderer with the process affinity used by windowed starts, making their renderer configuration comparable. The sampler now refreshes its thread list for the short-lived startup thread; headless runs may consequently use different worker counts or rendering threads than before.
Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
host/posix/display_sdl.c:376: Exercise the changed headless startup with the NVIDIA Linux driver as well. When: The new thread initializes the real Vulkan renderer and its workers on a different affinity mask, but the reported checks use a stand-in module and do not exercise this driver. Do: Run a headless game start on an NVIDIA Linux system and check startup, rendering, CPU count and Auto thread selection.Since the last review (on
d9876f0fc9)Resolved: L1 (Moving startup to a short-lived thread can make the all-thread sampler miss renderer start…); L3 (Check the changed Auto thread selection on a RADV system with mirrored pools.)
Still open: L4 (Exercise the changed headless startup with the NVIDIA Linux driver as well.)
Checks: Failing on this head, which is behind its base, where they pass:
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request),CI / Host C for Windows (llvm-mingw, compile only) (pull_request),CI / Website build and checks (pull_request),CI / Game-free checks (run_all.py, part 2/2) (pull_request),CI / Game-free checks (run_all.py, part 1/2) (pull_request).@rebase(or@fix) brings it up to date and runs them again; not held against it.Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. On the Steam Deck, nine starts reported 8 usable logical processors and 4 cores on the PR versus 6 and 3 on main. The reported performance comparisons show no established speed gain, which is not the goal of the fix.
Other systems: Windowed starts and Windows are unchanged. RADV was exercised on the Deck with mirrored pools and Auto selecting both threads, without a reported hang or reset; NVIDIA Linux remains untested. The relist also affects the Linux slow-frame sampler.
Switches: None added, changed or removed.
Reviewed:
9c71d05a41againstf8b543384d: Read the repository rules, the startup and sampler changes, and the associated test changes; the full combined output for the changed files and diff was truncated, so portions were only skimmed. Reviewed the supplied comments, test reports and CI summary.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The supplied reports describe passing game-free checks and Deck game runs; the NVIDIA Linux run is pending.
Overlaps and merge order: None found in the supplied review context.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
WIP: fix(linux): a start with no window loads the renderer with the process's affinity, as a windowed start doesto fix(linux): a start with no window loads the renderer with the process's affinity, as a windowed start does