perf(os): mutex lookups through the guest MutexType word, on by default (port of #2090 and #1969) #2665

Merged
HumanBean merged 21 commits from klimovich008/Longshot:perf/2090-port into main 2026-11-27 15:24:38 +00:00
Member

Summary

LockMutex and UnlockMutex are the game's busiest nn::os calls, and each one looks its host object up by the mutex's guest address (the per-thread cache, then the table). This PR keeps the object's number in the guest MutexType itself and reads it from there first, so most lookups skip the cache. It is on by default, and HOS_MUTEX_GUEST_ID=0 turns it off. On one PC it gained +3.5 % fps in the Market (child) and +5.8 % in Lost Woods (child), with better 1 % lows in both (Measurements).

Credit. This is a port of siantm's #1969 and #2090 onto the current main, which has the Rust builder (#2286). siantm wrote the design and most of the code, and the 14 commits keep siantm as author:

  • #1969 whole (10 commits): object numbers in chunks that are never freed, an object's key and kind read as one identity word (obj_is), the cache mode read once, and HOS_OBJ_CACHE=sets. Only gpu/vk/switches.def conflicted, a row beside it. The host/ and tests/ diff is byte-for-byte #1969's head 617c4fba.
  • #2090's own 4 commits: mutex_guest_id, obj_of_word, obj_miss, obj_by_word. They are identical to its head 179e9947, except that the obj_at hunk and its test_cv_handoff_threads.py hunk are left out. Bracketed port notes in those commits say so.
  • Left out: #2090 builds on #1957 (obj_at, the calling thread and the core checkpoint's test taken from the context), and #1957 builds on #1956. #1956's lifter half lives in nx2/guest_os.py and nx2/rtgen.py, and #2286 deleted nx2/. Main's Ctx has no HosThreadHead or vc_kick offset, so #1956 can't come over, and #1957 is left out with it. Here, obj_mutex(key, kind) stands in for obj_at. It runs obj()'s core checkpoint first, then the guest-word lookup, or obj_nockpt with the switch off.

Our commits on top (each with a Co-Authored-By trailer):

  • af5a9c898: obj_mutex, and LockMutex/UnlockMutex call it.
  • 1730d1eca: drops an unused pattern in tests/test_multiwait_wake.py. Ruff flags it once the file changes.
  • a3c1e3db9: hardening and tests from a review:
    • a mutex in the first MiB (a null pointer) is looked up as before, and its bytes are never read;
    • the switch is read at the first sync object with HOS_OBJ_CACHE=sets too;
    • the HLE bodies are tested through obj_mutex, with the checkpoint before any lookup, the mark after the store, and a one-load identity read.
  • 17e1be712: on by default.
  • b6b80b457: comment and switch-row fixes from a second review (when the word is read again; an empty value on Windows). A broken test variant now counts as caught only when one of the fixture's checks fails.
  • A merge of main 86b3b9e4f.

Read first: obj_mutex, mutex_guest_id, obj_by_word, obj_of_word, obj_is and obj_new_locked in host/nn_os_sync.c, then tests/test_obj_guest_id.py.

Testing

Tested: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2.

  • Smoke tour at 17e1be712 with the switch unset (the new default): Market child, pause and unpause; teleport to Lost Woods, pause and unpause; teleport to Fire Temple, pause and unpause.
    • Every step was reached.
    • Compared with the switch off: no new error lines, 0 virtual-core escapes, and no fatal, crash or exception lines.
    • The long frames are the teleport loads: 3 over 250 ms, none over 1 s.
    • The guest-word path ran: one module worker's per-thread cache lookups were 1.9–2.5 M, against 25–46 M with the switch off.
  • Tours of both arms at af5a9c898 (Market, Lost Woods, Fire Temple with the pause menu): every step reached, and no error lines in either arm.
  • The 18 A/B runs below: every run admitted, the game clock 1.000 ± 0.015 on every contained reading, no frame over 50 ms in any window, and no error lines.
  • Game-free checks:
    • Focused, at this head (llvm-mingw, tests/run_all.py): test_obj_guest_id, test_obj_cache_size, test_multiwait_wake, test_cv_handoff_threads, test_switch_table, test_switches_removed pass. All 10 of test_obj_guest_id's broken variants fail on a check, each for its stated reason (the word's object taken without obj_is; obj_mutex ignoring the switch; no checkpoint; the checkpoint after the lookup; LockMutex or UnlockMutex through obj(); the mark before the store; no first-MiB guard; the sets cache's mode read before the switch; unset read as off).
    • WSL (clang with ASan+UBSan, and gcc): test_obj_guest_id and test_obj_cache_size pass, and test_cv_handoff_threads passes, at 17e1be712.
    • All 66 host/*.c syntax-compile with the build's flags. nn_os_sync.c with -Wall -Wextra gives no new warnings on llvm-mingw, Linux clang or Linux gcc.
    • The full suite at 1730d1eca: 743 passed, 14 failed, 103 skipped. All 14 fail on main 09dea503 too: auto_handheld, builder_channel, coverage_run, dev_ab, dev_build, dev_migrate, game_menu_mouse_buttons, input_movie, job_queue, longshot_ctl, oot_menu_mouse, pads_after_menu, parity_gates, run_all_mingw.
    • mise run lint passes.
  • Two gpt-6.2-sol reviews. The first covered 09dea503..1730d1eca: its points 2 and 4–8 were fixed in a3c1e3db9, and points 1, 3 and 9 are answered below. The second covered the round-2 delta: its points were fixed in b6b80b457, and the fixed-cache probe count is answered below.

Still to test:

  • Linux in the game, the Steam Deck first: Market child and Lost Woods child, unset against HOS_MUTEX_GUEST_ID=0, expecting fps and 1 % low equal or better unset, and no crash, hang or new error line (@Beanstalk).
  • Other CPUs: 6- and 8-core AMD and Intel, an Intel hybrid (P/E cores), and a PC with 8 or fewer threads, the same comparison and expectation (@Beanstalk).
  • NVIDIA and other AMD GPUs on Windows and Linux, the same comparison and expectation (@Beanstalk).
  • HOS_MUTEX_GUEST_ID=1 and HOS_OBJ_CACHE=sets in the game: start, play the Market and Lost Woods, expecting no crash or new error line (by hand).

Measurements

Verdict: faster on this PC in both scenes. Market child: +3.5 % fps by median, with a better 1 % low. Lost Woods child: +5.8 % fps, with a better 1 % low. Both are "diagnostic": in the Market, n = 3 pairs at that scene's ~3 % run-to-run noise. In each of the two sessions of 3 Market pairs, every pair gained.

Setup: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2.

  • 16:9, frame rate uncapped (HOS_FPS_MAX=240), the render thread on (RX_VK_ASYNC=1), the same fixed options file.
  • A 20 s window after the teleport, with the right stick held (camera turning).
  • Alternating pairs, with no warm-up runs and none replaced.
  • Before: main 09dea503 with no pack. After: this branch's pack at af5a9c898 with HOS_MUTEX_GUEST_ID=2, the mode the default now gives (17e1be712 makes unset mean 2). The commits since af5a9c898 add the first-MiB guard, tests, comments and the default.
  • Measured on main 09dea503; this branch is now on 86b3b9e4f. The numbers still hold, because the 9 commits between them don't touch the host's sync layer or the lifted code. They are builder, release and docs fixes, plus #2158, a mesh-fallback change for AMD's Windows driver on GCN only, which leaves this RDNA 4 card's path alone.
Market child, 3 pairs (medians) Before: main @ 09dea503 After, HOS_MUTEX_GUEST_ID=2: this PR @ af5a9c898
fps 105.49 (105.2–106.0) 109.19 (108.6–109.6), +3.5 %
1 % low fps 50.5 52.6
p99 frame time, ms 17.89 17.57
worst frame, ms 26.7 21.1
CPU ms a frame 43.03 41.24
game clock 1.000 1.000
Lost Woods child, 6 pairs (medians) Before: main @ 09dea503 After, HOS_MUTEX_GUEST_ID=2: this PR @ af5a9c898
fps 120.12 127.04, +5.8 % (5 of 6 pairs gained)
1 % low fps 79.1 85.9
p99 frame time, ms 11.71 10.99
worst frame, ms 14.9 13.75
CPU ms a frame 41.18 39.87

Two more Market sessions:

  • Another session (the same pack, unset when it was still off, against =2): fps 105.89 → 109.39, +3.3 %. The 1 % low was about the same (52.4 → 51.8 by median, 51.9 → 52.0 by mean).
  • The two controls agree: that session's off arm (main plus #1969's identity check, 105.89) sat beside plain main (105.49). So the gain comes from the guest word, not from #1969's part.

The target: summed per-thread cache lookups fell from 168 M to 21 M (Market, the first pair), so most mutex lookups skip the cache.

The default ships on (unset = mode 2), and HOS_MUTEX_GUEST_ID=0 (or off, no, false) is the kill switch. futondestroyer asked on #1966 that siantm's experiments stay off while the enabled and disabled results were gathered, and that the default follow evidence from the affected CPUs (review). It is on here for two reasons:

  • It was measured. On this PC there are three sessions, Market and Lost Woods, and no run lost.
  • Who reads the word. Each sdk function that passes a MutexType's +0x18 word to the internal critical-section helpers was checked against the game's executable. All of them but one are replaced by the HLE: Lock, TryLock, Unlock, IsMutexLockedByCurrentThread, WaitConditionVariable and TimedWaitConditionVariable. The exception, nn::os::GetMutexOwnerThread, is unreachable: no branch reaches it in any module, no absolute pointer names it, and neither main nor subsdk0 imports it. The scan's limit: it looked for the +0x18 argument within 4 instructions before each branch, and didn't search exhaustively for inlined atomics on +0x18 elsewhere. No game code or bytes were kept from it.
  • The farm decides the merge. It is asked (Still to test) to run the other CPUs, GPUs, Linux and the Steam Deck before this leaves WIP, and an unfavourable result there turns the default off before merge.

Risks

  • What changes for players: nothing to set. Unset is now on, and the HLE writes an object number into each guest mutex's +0x18 word, marked as written (HOS_WRITTEN).
  • The word is never trusted. The object it names is taken only while it is still that address's mutex (obj_is: key and kind in one load). Anything else falls back to the lookup as before, and the word is rewritten.
  • Lifetimes. The numbered chunks are never freed. Re-init keeps the number. Finalize and another kind at the same address fall back. Past 4M objects, or if a chunk can't be allocated, the object gets no number and its word is left alone.
  • Not covered: a guest thread that locks a mutex while another finalizes and reuses its storage can have its word store land in the new bytes (sol, first review, point 1). That race is already a game bug, and on hardware nn::os writes +0x18 in Lock/Unlock too.
  • Cost with the switch off: one relaxed load and a compare in obj_mutex. The off arm is main plus #1969's one-load identity check.
  • HOS_OBJ_CACHE=sets (off by default): two live mutexes whose addresses share the low 32 bits can thrash one set (sol, first review, point 3; #1969's code). It costs speed only, with that switch.
  • switches.def changed: it is not a shader-cache stamp file, so no pipeline preparation follows.
  • To turn it off: HOS_MUTEX_GUEST_ID=0 in longshot_env.txt or the environment. On Windows an empty value removes the variable, which then reads as on, so use 0. A revert is enough too: no saves, options or caches change.

Review points left as they are:

  • First review, point 9: the fixtures prefer LONGSHOT_MINGW's clang on Linux, whose release lacks the sanitizer runtimes. This is #1969's code, and CI doesn't set that variable.
  • Second review, the fixed-cache probe: with HOS_MUTEX_GUEST_ID=0 and HOS_OBJ_CACHE=0, a warm fixed-cache hit moves none of the fixture's counters, so the order check is weaker in that one configuration. The "checkpoint after the lookup" variant still fails in the default configuration.

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 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.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary `LockMutex` and `UnlockMutex` are the game's busiest `nn::os` calls, and each one looks its host object up by the mutex's guest address (the per-thread cache, then the table). This PR keeps the object's number in the guest `MutexType` itself and reads it from there first, so most lookups skip the cache. It is on by default, and `HOS_MUTEX_GUEST_ID=0` turns it off. On one PC it gained +3.5 % fps in the Market (child) and +5.8 % in Lost Woods (child), with better 1 % lows in both (Measurements). **Credit.** This is a port of siantm's #1969 and #2090 onto the current `main`, which has the Rust builder (#2286). siantm wrote the design and most of the code, and the 14 commits keep siantm as author: - **#1969 whole** (10 commits): object numbers in chunks that are never freed, an object's key and kind read as one identity word (`obj_is`), the cache mode read once, and `HOS_OBJ_CACHE=sets`. Only `gpu/vk/switches.def` conflicted, a row beside it. The `host/` and `tests/` diff is byte-for-byte #1969's head 617c4fba. - **#2090's own 4 commits**: `mutex_guest_id`, `obj_of_word`, `obj_miss`, `obj_by_word`. They are identical to its head 179e9947, except that the `obj_at` hunk and its `test_cv_handoff_threads.py` hunk are left out. Bracketed port notes in those commits say so. - **Left out:** #2090 builds on #1957 (`obj_at`, the calling thread and the core checkpoint's test taken from the context), and #1957 builds on #1956. #1956's lifter half lives in `nx2/guest_os.py` and `nx2/rtgen.py`, and #2286 deleted `nx2/`. Main's `Ctx` has no `HosThreadHead` or `vc_kick` offset, so #1956 can't come over, and #1957 is left out with it. Here, `obj_mutex(key, kind)` stands in for `obj_at`. It runs `obj()`'s core checkpoint first, then the guest-word lookup, or `obj_nockpt` with the switch off. Our commits on top (each with a `Co-Authored-By` trailer): - `af5a9c898`: `obj_mutex`, and LockMutex/UnlockMutex call it. - `1730d1eca`: drops an unused pattern in `tests/test_multiwait_wake.py`. Ruff flags it once the file changes. - `a3c1e3db9`: hardening and tests from a review: - a mutex in the first MiB (a null pointer) is looked up as before, and its bytes are never read; - the switch is read at the first sync object with `HOS_OBJ_CACHE=sets` too; - the HLE bodies are tested through `obj_mutex`, with the checkpoint before any lookup, the mark after the store, and a one-load identity read. - `17e1be712`: on by default. - `b6b80b457`: comment and switch-row fixes from a second review (when the word is read again; an empty value on Windows). A broken test variant now counts as caught only when one of the fixture's checks fails. - A merge of `main` 86b3b9e4f. Read first: `obj_mutex`, `mutex_guest_id`, `obj_by_word`, `obj_of_word`, `obj_is` and `obj_new_locked` in `host/nn_os_sync.c`, then `tests/test_obj_guest_id.py`. ## Testing **Tested:** Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2. - **Smoke tour** at 17e1be712 with the switch unset (the new default): Market child, pause and unpause; teleport to Lost Woods, pause and unpause; teleport to Fire Temple, pause and unpause. - Every step was reached. - Compared with the switch off: no new error lines, 0 virtual-core escapes, and no fatal, crash or exception lines. - The long frames are the teleport loads: 3 over 250 ms, none over 1 s. - The guest-word path ran: one module worker's per-thread cache lookups were 1.9–2.5 M, against 25–46 M with the switch off. - **Tours of both arms** at af5a9c898 (Market, Lost Woods, Fire Temple with the pause menu): every step reached, and no error lines in either arm. - **The 18 A/B runs** below: every run admitted, the game clock 1.000 ± 0.015 on every contained reading, no frame over 50 ms in any window, and no error lines. - **Game-free checks:** - Focused, at this head (llvm-mingw, `tests/run_all.py`): `test_obj_guest_id`, `test_obj_cache_size`, `test_multiwait_wake`, `test_cv_handoff_threads`, `test_switch_table`, `test_switches_removed` pass. All 10 of `test_obj_guest_id`'s broken variants fail on a check, each for its stated reason (the word's object taken without `obj_is`; `obj_mutex` ignoring the switch; no checkpoint; the checkpoint after the lookup; LockMutex or UnlockMutex through `obj()`; the mark before the store; no first-MiB guard; the sets cache's mode read before the switch; unset read as off). - WSL (clang with ASan+UBSan, and gcc): `test_obj_guest_id` and `test_obj_cache_size` pass, and `test_cv_handoff_threads` passes, at 17e1be712. - All 66 `host/*.c` syntax-compile with the build's flags. `nn_os_sync.c` with `-Wall -Wextra` gives no new warnings on llvm-mingw, Linux clang or Linux gcc. - The full suite at 1730d1eca: 743 passed, 14 failed, 103 skipped. All 14 fail on `main` 09dea503 too: auto_handheld, builder_channel, coverage_run, dev_ab, dev_build, dev_migrate, game_menu_mouse_buttons, input_movie, job_queue, longshot_ctl, oot_menu_mouse, pads_after_menu, parity_gates, run_all_mingw. - `mise run lint` passes. - **Two gpt-6.2-sol reviews.** The first covered 09dea503..1730d1eca: its points 2 and 4–8 were fixed in a3c1e3db9, and points 1, 3 and 9 are answered below. The second covered the round-2 delta: its points were fixed in b6b80b457, and the fixed-cache probe count is answered below. **Still to test:** - Linux in the game, the Steam Deck first: Market child and Lost Woods child, unset against `HOS_MUTEX_GUEST_ID=0`, expecting fps and 1 % low equal or better unset, and no crash, hang or new error line (@Beanstalk). - Other CPUs: 6- and 8-core AMD and Intel, an Intel hybrid (P/E cores), and a PC with 8 or fewer threads, the same comparison and expectation (@Beanstalk). - NVIDIA and other AMD GPUs on Windows and Linux, the same comparison and expectation (@Beanstalk). - `HOS_MUTEX_GUEST_ID=1` and `HOS_OBJ_CACHE=sets` in the game: start, play the Market and Lost Woods, expecting no crash or new error line (by hand). ## Measurements **Verdict:** faster on this PC in both scenes. Market child: +3.5 % fps by median, with a better 1 % low. Lost Woods child: +5.8 % fps, with a better 1 % low. Both are "diagnostic": in the Market, n = 3 pairs at that scene's ~3 % run-to-run noise. In each of the two sessions of 3 Market pairs, every pair gained. Setup: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2. - 16:9, frame rate uncapped (`HOS_FPS_MAX=240`), the render thread on (`RX_VK_ASYNC=1`), the same fixed options file. - A 20 s window after the teleport, with the right stick held (camera turning). - Alternating pairs, with no warm-up runs and none replaced. - Before: `main` 09dea503 with no pack. After: this branch's pack at af5a9c898 with `HOS_MUTEX_GUEST_ID=2`, the mode the default now gives (17e1be712 makes unset mean 2). The commits since af5a9c898 add the first-MiB guard, tests, comments and the default. - **Measured on `main` 09dea503; this branch is now on 86b3b9e4f.** The numbers still hold, because the 9 commits between them don't touch the host's sync layer or the lifted code. They are builder, release and docs fixes, plus #2158, a mesh-fallback change for AMD's Windows driver on GCN only, which leaves this RDNA 4 card's path alone. | Market child, 3 pairs (medians) | Before: main @ 09dea503 | After, HOS_MUTEX_GUEST_ID=2: this PR @ af5a9c898 | |---|---|---| | fps | 105.49 (105.2–106.0) | 109.19 (108.6–109.6), +3.5 % | | 1 % low fps | 50.5 | 52.6 | | p99 frame time, ms | 17.89 | 17.57 | | worst frame, ms | 26.7 | 21.1 | | CPU ms a frame | 43.03 | 41.24 | | game clock | 1.000 | 1.000 | | Lost Woods child, 6 pairs (medians) | Before: main @ 09dea503 | After, HOS_MUTEX_GUEST_ID=2: this PR @ af5a9c898 | |---|---|---| | fps | 120.12 | 127.04, +5.8 % (5 of 6 pairs gained) | | 1 % low fps | 79.1 | 85.9 | | p99 frame time, ms | 11.71 | 10.99 | | worst frame, ms | 14.9 | 13.75 | | CPU ms a frame | 41.18 | 39.87 | Two more Market sessions: - **Another session** (the same pack, unset when it was still off, against `=2`): fps 105.89 → 109.39, **+3.3 %**. The 1 % low was about the same (52.4 → 51.8 by median, 51.9 → 52.0 by mean). - **The two controls agree:** that session's off arm (main plus #1969's identity check, 105.89) sat beside plain `main` (105.49). So the gain comes from the guest word, not from #1969's part. **The target:** summed per-thread cache lookups fell from 168 M to 21 M (Market, the first pair), so most mutex lookups skip the cache. **The default** ships on (unset = mode 2), and `HOS_MUTEX_GUEST_ID=0` (or `off`, `no`, `false`) is the kill switch. futondestroyer asked on #1966 that siantm's experiments stay off while the enabled and disabled results were gathered, and that the default follow evidence from the affected CPUs ([review](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1966#issuecomment-67223)). It is on here for two reasons: - **It was measured.** On this PC there are three sessions, Market and Lost Woods, and no run lost. - **Who reads the word.** Each sdk function that passes a `MutexType`'s +0x18 word to the internal critical-section helpers was checked against the game's executable. All of them but one are replaced by the HLE: Lock, TryLock, Unlock, IsMutexLockedByCurrentThread, WaitConditionVariable and TimedWaitConditionVariable. The exception, `nn::os::GetMutexOwnerThread`, is unreachable: no branch reaches it in any module, no absolute pointer names it, and neither main nor subsdk0 imports it. The scan's limit: it looked for the +0x18 argument within 4 instructions before each branch, and didn't search exhaustively for inlined atomics on +0x18 elsewhere. No game code or bytes were kept from it. - **The farm decides the merge.** It is asked (Still to test) to run the other CPUs, GPUs, Linux and the Steam Deck before this leaves WIP, and an unfavourable result there turns the default off before merge. ## Risks - **What changes for players:** nothing to set. Unset is now on, and the HLE writes an object number into each guest mutex's +0x18 word, marked as written (`HOS_WRITTEN`). - **The word is never trusted.** The object it names is taken only while it is still that address's mutex (`obj_is`: key and kind in one load). Anything else falls back to the lookup as before, and the word is rewritten. - **Lifetimes.** The numbered chunks are never freed. Re-init keeps the number. Finalize and another kind at the same address fall back. Past 4M objects, or if a chunk can't be allocated, the object gets no number and its word is left alone. - **Not covered:** a guest thread that locks a mutex while another finalizes and reuses its storage can have its word store land in the new bytes (sol, first review, point 1). That race is already a game bug, and on hardware `nn::os` writes +0x18 in Lock/Unlock too. - **Cost with the switch off:** one relaxed load and a compare in `obj_mutex`. The off arm is `main` plus #1969's one-load identity check. - **`HOS_OBJ_CACHE=sets` (off by default):** two live mutexes whose addresses share the low 32 bits can thrash one set (sol, first review, point 3; #1969's code). It costs speed only, with that switch. - **`switches.def` changed:** it is not a shader-cache stamp file, so no pipeline preparation follows. - **To turn it off:** `HOS_MUTEX_GUEST_ID=0` in `longshot_env.txt` or the environment. On Windows an empty value removes the variable, which then reads as on, so use `0`. A revert is enough too: no saves, options or caches change. Review points left as they are: - **First review, point 9:** the fixtures prefer `LONGSHOT_MINGW`'s clang on Linux, whose release lacks the sanitizer runtimes. This is #1969's code, and CI doesn't set that variable. - **Second review, the fixed-cache probe:** with `HOS_MUTEX_GUEST_ID=0` and `HOS_OBJ_CACHE=0`, a warm fixed-cache hit moves none of the fixture's counters, so the order check is weaker in that one configuration. The "checkpoint after the lookup" variant still fails in the default configuration. ## 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 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] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Beside #1781's sized cache (HOS_OBJ_CACHE, 16384 entries of four ways by default), a second shape of the same 16384
entries to compare it with: 2048 sets of 8 ways, a set one 64-byte line of 8 tags and the 8 objects' numbers (128 KB a
thread, made at its first lookup), an address in either of two sets by two hashes, so no set overflows before the
cache is nearly full; a miss takes a stale way of the address's, else an empty one, else one at random. The table now
numbers its objects as it makes them (chunks of 1024, never freed, as objects never are), so an entry is a 32-bit
number and a set holds eight. Counted in the existing sync: object cache log line. Off unless HOS_OBJ_CACHE=sets,
which obj_cache_entries reads with the size, once (OBJ_CACHE_SETS; no string compare on the lookup's path).

tests/test_obj_cache_size.py runs the sets too: obj_cache_entries("sets") and its near misses, the 4,000-object walk's
later passes miss under 2 %, every lookup is the table's object over 200,000 random operations with objects re-made,
buried and reused, the log line; --bench times it beside the other sizes. tests/test_multiwait_wake.py allows
__builtin_ctz under mw_lock (the compiler's, one instruction: the set's ways are found with it).

From 3cf76270 on exp/x86-asm-sync, where it replaced the 1,024-entry cache (its HOS_OBJ_CACHE_SMALL switch is main's
HOS_OBJ_CACHE=0 now).

Assisted-by: Claude Code
tests/test_obj_cache_size.py gains two modes:
- reuse (with HOS_OBJ_CACHE=sets, unset and 0): an address's object is dropped, buried and, after the grave's 30 s, made a
  spare; a lookup of the old address through its stale cache entry reads the object's identity, and the table gives the
  spare to a new address right after that lookup's first read of it (the harness runs the reuse after the n-th atomic
  load of the object's key or kind), with the same kind and with another; before the lookup as the control. The lookup
  must return its own address's object, and the spare must have gone to the new address. It fails here for the same kind
  in all three caches: each reads the key, then the kind, so the old key and the new kind pass.
- churn (sets): 64 threads made and ended one after another, each looking 4,000 objects up, with calloc and free of 64 KB
  and up counted: what is live after them must be what was live before. It fails here: each thread leaves its 128 KB.

The sets case of the walk now has to miss at most 10 of 4,000 on its last pass (the four-way default misses 47), so a sets
dispatch that fell back to the default would fail. Each fixture run clears HOS_KEEP_DEAD_OBJECTS and HOS_SYNC_TABLE_LOCK,
which the cut code reads, as well as the two cache switches; the compiler is --cc, then CC, then LONGSHOT_MINGW's clang,
then cc, clang or gcc on PATH (RUN_ALL_ARGS no longer forces clang).

Assisted-by: Claude Code
- Identity: every cache (sets, the sized default, the fixed one) and find_unlocked checked an object by its key, then its
  kind (acquire). The table gives a spare to another address by storing kind 0, the new key, then the new kind (release):
  a lookup could read the old key, then the new kind, and take the spare, now another address's, for the old one (with
  the same kind), up to holder_ready under mw_lock. obj_is reads the kind first (acquire), then the key: a reader that
  sees the new kind sees the new key. main's pointer caches had the same order; the same two loads swapped fix them. What
  a lookup returns stays that address's until the guest drops it: objects are never freed, and a dropped one is reused
  only after 30 s in the graves and not while a condition variable waiter or a multi-wait holds it.
- A thread's sets are freed as it ends, from the allocation's base: an FLS slot's callback on Windows (ExitThread too),
  a pthread key's destructor on Linux (the POSIX layer's ExitThread is pthread_exit), the slot or key made once. If the
  cache or its owner cannot be had, the thread goes without, not asking again at every lookup.
- Objects are numbered (made in chunks of 1024) with HOS_OBJ_CACHE=sets only; otherwise each is made alone, as before. An
  object that cannot be had ends the process with hos_fatal, not a write through NULL.
- HOS_NO_OBJ_CACHE and HOS_OBJ_CACHE are read once into one atomic word (obj_cache_mode_read), as is
  HOS_SYNC_TABLE_LOCK: two first lookups at once no longer race on plain statics.
- The comment and the switch row (now a string: sets is a word) say the replacement policy as it is (stale way, else
  empty, else the next of the two sets' 16 ways in turn) and the memory (128 KB a thread against the default's 256 KB).
- tests/test_multiwait_wake.py allows the once-only calls and hos_fatal under mw_lock: none sleeps or waits for a core.

tests/test_obj_cache_size.py passes (reuse with sets, unset and 0; churn).

Assisted-by: Claude Code
tests/test_obj_cache_size.py:
- reuse now runs on every way a lookup reads an object without table_lock: sets, the sized default, the fixed cache,
  and no cache (HOS_NO_OBJ_CACHE=1, the table's unlocked path). The object an address's lookup will read is reassigned
  by the table's own paths (dropped, buried, after the grave's 30 s a spare, taken) to another address of the same
  kind, of another kind, or to another address and then back to its own as another kind; before the lookup, and right
  after each of the lookup's atomic loads in turn (the harness counts every load the cut code makes outside its locks,
  where a writer could come in), until the lookup has no load left. The lookup must return the table's object of that
  address and kind, or the old object only if it read the object's identity wholly before the reassignment. It fails
  here in all four: a kind read before the reassignments, then the address read back after them, return the address's
  new event for its old mutex.
- fiber (sets, Windows): a thread makes its cache on a guest fiber (a Win32 fiber, as hos_thread.c runs the game's),
  switches back, deletes the fiber and looks the same 4,000 objects up again; the harness keeps a freed allocation of
  64 KB and up filled with 0xA5. The cache must still be live and hit, nothing may be written in freed memory, and it is
  freed as the thread ends. It fails here: the FLS slot's callback frees the cache with the fiber, and the thread's
  lookups write into the freed memory.

Assisted-by: Claude Code
The cache's pointer is a thread-local, but its release was an FLS slot's callback, which follows the fiber that made
the cache: a guest fiber is a Win32 fiber (hos_thread.c, fibers) that may run on several threads in turn and that the
game deletes (FinalizeFiber) while the thread that ran it runs on, so deleting it freed the cache under that thread,
whose lookups then read and wrote the freed memory. Now pointer and release have the same owner, the host thread: on
Windows the image's TLS callback (DLL_THREAD_DETACH, run by the loader on the ending thread with its thread-locals still
there, ExitThread too, whatever fiber it runs) frees it from its base; elsewhere the pthread key's destructor, as
before. A lookup after it on that thread goes without. tests/test_multiwait_wake.py drops InitOnceExecuteOnce and
FlsSetValue from what may be called under mw_lock (no longer called).

tests/test_obj_cache_size.py fiber and churn pass.

Assisted-by: Claude Code
obj_is read the kind, then the key: a kind read before a reassignment could pair with a key read after it, and an
object given to another address and then back to its own as another kind passed for the old kind (a mutex lookup
returning the address's new event). Every lookup without table_lock uses obj_is: the sets cache, the sized default, the
fixed cache and find_unlocked. An object now has a seq beside its life (kept as life is): obj_lookup steps it to odd,
with a release fence, before it gives the object another identity (a spare taken by an address, a tombstone made again
at its address) and back to even (release) after; obj_is takes the key and kind only if seq was even and the same
before and after them (acquire, then an acquire fence before the second read), so both are of one life. A new object
needs no step: no reader has it before its slot is published. The cost on a hit: two more loads of the object's first
cache line and a compiler barrier on x86-64. tests/test_multiwait_wake.py allows __atomic_thread_fence under mw_lock.

tests/test_obj_cache_size.py reuse passes with sets, unset, 0 and HOS_NO_OBJ_CACHE=1.

Assisted-by: Claude Code
The harness set an object's kind to 0 itself to make a tombstone (the reuse mode's drops and the check mode's
finalizations); it now calls drop, cut from host/nn_os_sync.c with the table, so a tombstone is whatever drop makes. The
reuse mode's watch (a call after every atomic load of the cut code) is left out of the --bench build (OBJ_BENCH): it
measured the watch with the loads, a call for each, which made a check with more loads look dearer than it is in the
game, where nothing follows a load.

tests/test_obj_cache_size.py passes as before; reuse and fiber still fail on 9baebe0d's source.

Assisted-by: Claude Code
obj_is read a sequence, the kind, the key and the sequence again (four loads and an acquire fence) to take the key and
kind of one life; the micro-benchmark (built with the test's call after each load) put that at about 3 ns a lookup in
every cache mode, the default included. An object now keeps its key and kind as one 64-bit word as well (ident: the
kind in the top 4 bits over a key under 2^60, a guest address; 0 for a tombstone or a larger key), and obj_is compares
that word, read once (acquire), with the one the lookup makes from its key and kind: one load, so a kind never pairs
with another identity's key. Every write of a kind goes through obj_kind_set, which writes the word after it (release);
an object gets another identity only as a tombstone, whose word is 0, and gets the new word last, so the sequence, its
steps and the fences go. An object with a key of 2^60 or more is never a cache hit (its word is 0) and is found under
table_lock. An object grows by 8 bytes (the word; the sequence's 4 went). tests/test_multiwait_wake.py no longer allows
__atomic_thread_fence under mw_lock (none is made).

tests/test_obj_cache_size.py reuse (sets, unset, 0, HOS_NO_OBJ_CACHE=1), fiber, churn and check pass.

Assisted-by: Claude Code
HOS_OBJ_CACHE=0 (the fixed 1,024 entries) took 24.6 and 26.0 ns a lookup at 712ee7e7 against main's 22.5 and 22.8 in
the micro-benchmark. At 712ee7e7 every lookup, in every cache mode, first calls obj_cache_mode_read, a function of its
own (llvm-objdump of the fixture and of host/nn_os_sync.c with the host build's flags: a call, a frame, a load, a
compare and a return before the cache), where main read its two statics inline. The test now builds the fixture's
assembly as well and fails if anything calls obj_cache_mode_read.

At 712ee7e7 it fails: "a lookup calls obj_cache_mode_read".

Assisted-by: Claude Code
HOS_OBJ_CACHE=0 (the fixed 1,024 entries) took 24.6 and 26.0 ns a lookup at 712ee7e7 against main's 22.5 and 22.8 in
the micro-benchmark, a walk that misses that cache every time. On that path (llvm-objdump of the fixture and of
host/nn_os_sync.c with the host build's flags) 712ee7e7 added, against main: a call to obj_cache_mode_read, a function
of its own (a frame, a load, a compare, a return) on every lookup in every mode; the fixed cache tested third, after
sets and the sized cache; and in find_unlocked, the identity's range test (a key under 2^60, a kind) at every probe.

obj_cache_mode_read is now inline, the word's load and a compare, and the switches are read out of line by the first
lookup (obj_cache_mode_first, cold). obj_nockpt tests a size first (the default), then 0 (the fixed cache), as main,
then sets. find_unlocked returns before its probe when the identity is one no object has (obj_ident 0), so the probe
compares the key and the identity word only. The identity check itself is unchanged: one acquire load of the word.

tests/test_obj_cache_size.py: the mode is read inline (no call to obj_cache_mode_read); reuse (sets, unset, 0,
HOS_NO_OBJ_CACHE=1), fiber, churn and check pass.

Assisted-by: Claude Code
A mutex's object number is kept in its guest MutexType's internal critical-section word (+0x18; nn::os's own mutex code
was its only user, and the HLE functions replace all of it). obj_at, LockMutex's and UnlockMutex's lookup, reads it: with
2 (the default) before the per-thread cache, with =1 only where the cache misses, before the table (obj_miss, through a
thread-local pointer obj_at sets around its lookup). The object it names is taken only while it is still that address's
mutex (obj_is: its key and kind as one word, as the caches check an entry); anything else there (0, the game's bytes, a number
out of range or not given yet, another object's) is never taken: the lookup as before, after which the word is written
and marked. The word is read and written with relaxed atomics, and only on a 4-byte boundary inside the guest window;
otherwise the lookup alone. While it is on the table numbers its objects (chunks of 1024), as HOS_OBJ_CACHE=sets does,
so the word works with every cache.

HOS_MUTEX_GUEST_ID is read once through an atomic word, as HOS_OBJ_CACHE (obj_cache_mode_read): at the first LockMutex
or UnlockMutex or the first object made. Unset: 2; 0 or another of env_on's off values (empty, false, off, no): off, the
guest struct left alone and the parents' lookup, with one relaxed load of the mode in obj_at; exactly 1: 1; any other
value: 2, as unset. 2 is the value the performance branch ran it at, and the one that spares a mutex found through its
word both the cache and the table; =0 is the kill switch for a change that writes a word of guest memory. Not measured
in play yet.

tests/test_obj_guest_id.py: the real table, caches, lookup and switch read (as test_obj_cache_size.py cuts them) with
obj_at and obj_by_word; HOS_MUTEX_GUEST_ID unset, 0, off, 1, 2, 3, 12 and on, each in a fresh process with the child's
environment set, with each cache (sized, fixed, sets, none): the value read (unset 2; 0 and off: off; exactly 1: 1;
else 2) and kept when the variable is flipped after the first lookups; the table's object every time, through 100,000
operations with mutexes finalized (drop, cut with the table), made again and re-made as another kind; words written and
marked only when on, fixed when they name anything else, no table lookup once right (2: no cache lookup either); off
without sets, objects unnumbered as before; an object with no number, a word outside the window and one off a 4-byte
boundary are left alone;
only the mutexes' words change. The compiler is test_obj_cache_size.py's (--cc, CC, LONGSHOT_MINGW's clang, a C compiler
on PATH).
tests/test_cv_handoff_threads.py: its fixture has the switch at its default (mutex_guest_id 2, obj_by_word its lookup)
and its kick-after-lookup variant moves the checkpoint past obj_at's new lookup line. tests/test_obj_cache_size.py
clears HOS_MUTEX_GUEST_ID for its runs (its cut now reads it: they run at the default).

From c565d05a, 02be0b02 and 064574ab on exp/x86-asm-sync, where it sat in the set cache's obj_find. Needs the object
numbers of perf/obj-cache-sets (#1969) and obj_at of perf/mutex-ctx-thread (#1957).

[Ported onto main 09dea503 without #1957, whose obj_at is not on main: its obj_at hunk is left out here, and the
lookup is wired into LockMutex and UnlockMutex in the port commit that follows.]

Assisted-by: Claude Code
tests/test_obj_guest_id.py locks a mutex at 0xFFFFFFFFFFFFFFF0: its address plus MUTEX_GUEST_WORD (+0x18) wraps round
to guest address 8, inside the window. obj_by_word checks only the word's own 4 bytes (hos_guest_range(key + 0x18, 4)),
so it writes the mutex's number there, at the window's start, and the check "only the mutexes' words changed" fails
with the switch on (unset, 1, 2: every cache). The mutex itself is still the table's.

Assisted-by: Claude Code
obj_by_word checked only the word's 4 bytes at key + MUTEX_GUEST_WORD: a mutex address within 0x18 of 2^64 wrapped
round to the guest window's first bytes, and the mutex's number was written there. It now checks the struct from its
address to the end of the word (hos_guest_range(key, MUTEX_GUEST_WORD + 4)), which has no wrap: such a mutex is looked
up as before and no guest byte is touched. tests/test_obj_guest_id.py (the commit before) passes again.

Assisted-by: Claude Code
futondestroyer's answer for the host experiments (#1966, comment 67223): keep the draft experiment off while the
enabled and disabled results are gathered. Unset now reads as 0: LockMutex and UnlockMutex look their object up
through the per-thread cache and the table, the guest MutexType is left alone and the sync objects are numbered only
with HOS_OBJ_CACHE=sets, as before this change (obj_at keeps one relaxed load of the mode). =1 and =2 keep their
meanings (the word read only where the cache misses; before the cache), any other on value is 2, the off values
(0, empty, false, off, no) are off.

gpu/vk/switches.def: the row is an attempt, off unset. tests/test_obj_guest_id.py: unset expects off (no guest write,
no numbers without sets), and runs again last, each in a fresh process with 0, off, 1, 2, 3, 12 and on.
tests/test_cv_handoff_threads.py: its fixture has the switch at the default, off (obj_nockpt the lookup).

[Ported onto main 09dea503 without #1957: test_cv_handoff_threads.py's fixture on main has no obj_at, so its hunk is left out.]

Assisted-by: Claude Code
#2090 sits on #1957, whose obj_at (the checkpoint's test through the context's thread) is not on main, and #1957 sits on
#1956's lifter half (nx2/, which the Rust builder replaced). This port keeps main's hos_vcore_checkpoint() and gives the
two HLE functions obj_mutex: obj with HOS_MUTEX_GUEST_ID's lookup (obj_by_word when the switch is on, obj_nockpt when
unset or 0), as #2090's obj_at did. Nothing else of #1957 is taken.

tests/test_obj_guest_id.py cuts obj_mutex in place of obj_at, counts the checkpoint (once a lookup), and gains three
broken variants that must fail: the word's object taken without obj_is, obj_mutex ignoring the switch, and obj_mutex
without its checkpoint. tests/test_cv_handoff_threads.py's fixture gets obj_mutex as its obj (the switch at its
default, off).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
main's tests/test_multiwait_wake.py assigns a regular expression to sched and never uses it; CI's ruff checks changed files
only, so main passes, and the first change to the file (#1969's allowlist) fails lint. The two lines go; nothing read them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The checker's sol review (2090-port-chk-r1) on the port:
- A mutex below 1 MiB (a null pointer's page, which the Windows commit-on-touch handler never commits) is looked up as
  before and its guest bytes are not read: with the switch on, LockMutex(NULL) read guest address 0x18, where main
  touched no guest memory (point 2). MUTEX_GUEST_LOW is mkw_glue.c's threshold.
- The first object made reads HOS_MUTEX_GUEST_ID before the cache's mode, so with HOS_OBJ_CACHE=sets the switch is read
  there too, as its row says (point 5; the || short-circuited it).
- The comments and the switch row say that mode 1 still reads the word after every lookup, a cache hit's too (point 4).

tests/test_obj_guest_id.py: LockMutex's and UnlockMutex's HLE bodies, cut from the source, run over counted stubs and
must look their mutex up through obj_mutex, never obj() (point 6); every lookup's checkpoint must come before any cache
probe, table lookup or guest read (point 6); a written word must be marked after its store (point 7); a mutex in the
first MiB is never read; a first-object mode checks the switch read at the first sync object, with the sets cache and
without. New broken variants that must fail: the checkpoint after the lookup, LockMutex or UnlockMutex through obj(),
the mark before the store, no first-MiB guard, the sets cache's mode read first. The 64 test mutexes move above 1 MiB.
tests/test_obj_cache_size.py: obj_is's body must read the identity in one load of o->ident and nothing of o->key or
o->kind; a split read (the kind atomically, then the key) is refused (point 8: the reuse mode sees only atomic loads).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The user's decision for this PR: the guest-word path is on unless set off. Unset now reads as 2, the mode the A/Bs
measured (Market child +3.3 to +3.5 % fps, Lost Woods child +4.0 to +5.8 %, RX 9070 XT / 5700X3D); 0 and env_on's other
off values (empty, off, no, false) turn it off, for bisecting; 1 is unchanged. Its row in gpu/vk/switches.def is now a
kill switch with the default described. #2090 kept it off unless set while it was measured (futondestroyer on #1966).

tests/test_obj_guest_id.py: unset must read as 2 (both unset runs, with every cache), no and false as off; a broken
variant reading unset as off must fail. tests/test_cv_handoff_threads.py: its obj_mutex stub's comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sol review of the round-2 delta:
- An empty HOS_MUTEX_GUEST_ID is off only where the variable reaches the game empty: on Windows,
  _putenv (longshot_env.txt) and cmd's set remove it, so it reads as unset, which is now on. The
  switch row and the comment say so; =0 is the off switch everywhere.
- The word is read again after a lookup in mode 1 always and in mode 2 only when the word did not
  answer, and never for an object with no number; the comments said every lookup in both modes.
- test_obj_guest_id: a broken variant counts as caught only when it fails on one of the fixture's
  checks (a FAIL line), not on any non-zero exit such as a sanitizer's start-up abort.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge main 86b3b9e4f into perf/2090-port
Some checks reported errors
CI / What the change needs (pull_request) Successful in 6s
CI / Third-party parts and guide screenshots (pull_request) Failing after 10s
PR description / Title and description (pull_request_target) Successful in 4s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 1m5s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 1m50s
beanstalk/any 0/1 pass, 0 running, 0 queued
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m46s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 2m57s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 3m25s
CI / Website build and checks (pull_request) Successful in 2m16s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Successful in 14m54s
beanstalk/approval approved by klimovich008 (reviewed)
beanstalk/steamdeck 0/1 pass, 0 running, 1 queued
beanstalk/linux+amd 0/1 pass, 2 error
beanstalk/linux+nvidia 0/1 pass, 0 running, 2 queued
beanstalk/windows+amd 0/1 pass, 2 error
beanstalk/windows+nvidia 0/1 pass, 2 error
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 28m7s
01b867c739
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2: with the switch unset (on) at 17e1be712, Market child, Lost Woods child and Fire Temple with the pause menu, every step reached, no new error lines, 0 virtual-core escapes, the guest-word path in use (per-thread cache lookups 1.9-2.5 M against 25-46 M off); 18 A/B runs (Market and Lost Woods child, uncapped) against plain main, all admitted, game clock 1.000 +-0.015, no frame over 50 ms.

Tested in game: Windows 11, Ryzen 7 5700X3D, RX 9070 XT, AMD 26.11.2: with the switch unset (on) at 17e1be712, Market child, Lost Woods child and Fire Temple with the pause menu, every step reached, no new error lines, 0 virtual-core escapes, the guest-word path in use (per-thread cache lookups 1.9-2.5 M against 25-46 M off); 18 A/B runs (Market and Lost Woods child, uncapped) against plain main, all admitted, game clock 1.000 +-0.015, no frame over 50 ms.
Author
Member
@review
Author
Member

@Beanstalk This is a performance change in the host's nn::os layer (host/nn_os_sync.c), on Windows and Linux alike: LockMutex and UnlockMutex find their host object through a number kept in the guest mutex, on by default, with HOS_MUTEX_GUEST_ID=0 as the off switch.

  • Hardware: Windows and Linux; on Linux, the Steam Deck first. Spread the targets over 6- and 8-core AMD and Intel CPUs, an Intel hybrid CPU (P and E cores), a PC with 8 or fewer CPU threads if one is online, and NVIDIA and AMD GPUs.
  • Scenes: a start, then a teleport to the Market as child, about 20 s of play turning the camera; then a teleport to Lost Woods as child, the same. 2 or 3 runs a side.
  • The comparison: on the PR's side, HOS_MUTEX_GUEST_ID unset (the new default) against HOS_MUTEX_GUEST_ID=0, as a matrix.pr_only axis ["", "0"]. Judge it with pass.compare on fps_mean and frametime_p99_ms (unset against 0), besides the usual PR-against-main rules. If the time doesn't fit, baseline ref = "pr" is fine.
  • Settings, every cell and both sides: frame_rate_cap = 6 (uncapped), vsync = 2 (off), frame_generation = 0, fullscreen off.
  • Pass: no crash or hang. Keep the one-start metrics (run_hitch_count, run_frametime_max_ms) report-only.
@Beanstalk This is a performance change in the host's nn::os layer (host/nn_os_sync.c), on Windows and Linux alike: LockMutex and UnlockMutex find their host object through a number kept in the guest mutex, on by default, with HOS_MUTEX_GUEST_ID=0 as the off switch. - **Hardware:** Windows and Linux; on Linux, the Steam Deck first. Spread the targets over 6- and 8-core AMD and Intel CPUs, an Intel hybrid CPU (P and E cores), a PC with 8 or fewer CPU threads if one is online, and NVIDIA and AMD GPUs. - **Scenes:** a start, then a teleport to the Market as child, about 20 s of play turning the camera; then a teleport to Lost Woods as child, the same. 2 or 3 runs a side. - **The comparison:** on the PR's side, HOS_MUTEX_GUEST_ID unset (the new default) against HOS_MUTEX_GUEST_ID=0, as a matrix.pr_only axis ["", "0"]. Judge it with [[pass.compare]] on fps_mean and frametime_p99_ms (unset against 0), besides the usual PR-against-main rules. If the time doesn't fit, baseline ref = "pr" is fine. - **Settings, every cell and both sides:** frame_rate_cap = 6 (uncapped), vsync = 2 (off), frame_generation = 0, fullscreen off. - **Pass:** no crash or hang. Keep the one-start metrics (run_hitch_count, run_frametime_max_ms) report-only.
Member
Beanstalk test farm · an earlier run: commit 01b867c (the newer results are in a comment below)

Commit 01b867c · approved by klimovich008 (reviewed) · dashboard

Done (started 11:55 UTC, last report 11:56 UTC). Comment @Beanstalk to run it again.

Target Result Reports Frame time p99 (ms), main → PR VRAM peak (MB) Crashes
any ⚠️ couldn't be judged 2 1 2 — — none

Couldn'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.

  • any, report 1: main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Y:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)
  • any, report 2: main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)
What was tested

What will be tested · default plan (AI failed: the summary says 'tester will': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again)

The AI plan failed: the summary says 'tester will': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again; using the default plan.

  • Where: any (any PC, 1-2 reports).
  • title: from the title screen, then measure title for 20 s (after 5 s warm-up); 2 runs on each side.
  • hyrule-field: from the repository's save kokiri-start, then teleport to Hyrule Field, measure field for 60 s (after 10 s warm-up); 2 runs on each side.
  • Measured: crashes, boot time, frame times, stutters and hitches, VRAM use, the game's log.
  • The PR fails if: it crashes; or peak VRAM is more than 10% above main; or frame time (p99) is more than 15% above main.
  • Time: about 47 min of game runs per tester (8 game starts), plus the two builds.
Measurements on `any`, for the PR description

Verdict: could not be judged on any (2 reports).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4070, 621.24.0 AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM; 2: windows+intel+intel-proprietary+igpu Intel(R) UHD Graphics 630, 0.404.2115 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM
Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; 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); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 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 (@Beanstalk on 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

**Verdict:** could not be judged on any (2 reports).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+intel+intel-proprietary+igpu `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM`  
Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; 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); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 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 (`@Beanstalk` on 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.
The testers' hardware
Target Report Ran on
any 1 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4070, 621.24.0 AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM
any 2 windows+intel+intel-proprietary+igpu Intel(R) UHD Graphics 630, 0.404.2115 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM
<!-- beanstalk:previous --> <details><summary>Beanstalk test farm · an earlier run: commit <code>01b867c</code> (the newer results are in a comment below)</summary> Commit `01b867c` · approved by klimovich008 (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/2665) Done (started 11:55 UTC, last report 11:56 UTC). Comment `@Beanstalk` to run it again. | Target | Result | Reports | Frame time p99 (ms), main → PR | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | --- | | `any` | ⚠️ couldn't be judged | 2 [1](https://beanstalk.magicbean.dev/reports/rp_a1983aa9968130b3) [2](https://beanstalk.magicbean.dev/reports/rp_d8e7c039bafdb55c) | — | — | none | **Couldn'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. - `any`, [report 1](https://beanstalk.magicbean.dev/reports/rp_a1983aa9968130b3): `main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Y:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)` - `any`, [report 2](https://beanstalk.magicbean.dev/reports/rp_d8e7c039bafdb55c): `main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)` <details><summary>What was tested</summary> **What will be tested** · default plan (AI failed: the summary says 'tester will': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again) The AI plan failed: the summary says 'tester will': the farm is unattended, so it must describe only what the plan's steps do (no one looks at, checks or does anything by hand); write it again; using the default plan. - **Where:** any (any PC, 1-2 reports). - **title:** from the title screen, then measure title for 20 s (after 5 s warm-up); 2 runs on each side. - **hyrule-field:** from the repository's save `kokiri-start`, then teleport to Hyrule Field, measure field for 60 s (after 10 s warm-up); 2 runs on each side. - **Measured:** crashes, boot time, frame times, stutters and hitches, VRAM use, the game's log. - **The PR fails if:** it crashes; or peak VRAM is more than 10% above main; or frame time (p99) is more than 15% above main. - **Time:** about 47 min of game runs per tester (8 game starts), plus the two builds. </details> <details><summary>Measurements on `any`, for the PR description</summary> **Verdict:** could not be judged on any (2 reports). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+intel+intel-proprietary+igpu `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; 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); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 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 (`@Beanstalk` on 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: ```markdown ## Measurements **Verdict:** could not be judged on any (2 reports). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+intel+intel-proprietary+igpu `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` Scene: title, from the title screen; hyrule-field, from the repository's save kokiri-start; 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); title: 2 game starts a side, title 20 s after 5 s warm-up; hyrule-field: 2 game starts a side, field 60 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 (`@Beanstalk` on 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. ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `any` | [1](https://beanstalk.magicbean.dev/reports/rp_a1983aa9968130b3) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM` | | `any` | [2](https://beanstalk.magicbean.dev/reports/rp_d8e7c039bafdb55c) | windows+intel+intel-proprietary+igpu `Intel(R) UHD Graphics 630, 0.404.2115` `Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz, 8 GB RAM` | </details> </details>
Author
Member

@Beanstalk plan The previous plan fell back to the default because the planner's summary was refused. Here is the same request, for an unattended run. Describe only what the steps do.

This PR changes the host's nn::os layer (host/nn_os_sync.c) on Windows and Linux alike. LockMutex and UnlockMutex now find their host object through a number kept in the guest mutex. It is on by default, and HOS_MUTEX_GUEST_ID=0 turns it off.

  • Targets: Windows and Linux; on Linux, the Steam Deck first. Spread them over 6- and 8-core AMD and Intel CPUs, an Intel hybrid CPU, a PC with 8 or fewer CPU threads if one is online, and NVIDIA and AMD GPUs: one target per GPU maker and OS, plus steamdeck.
  • Scenario: start, teleport to Market as child, measure 20 s turning the camera; then teleport to Lost Woods as child and measure 20 s the same way. 2 runs a side.
  • Matrix: matrix.pr_only HOS_MUTEX_GUEST_ID = ["", "0"], with pass.compare on fps_mean and on frametime_p99_ms, the value "" against "0" on the PR side. If the 60 minutes don't fit, use baseline ref = "pr".
  • Settings in every cell, both sides: frame_rate_cap = 6, vsync = 2, frame_generation = 0, fullscreen off.
  • Pass: crash = false. run_hitch_count and run_frametime_max_ms are report-only, with no rule on them.
@Beanstalk plan The previous plan fell back to the default because the planner's summary was refused. Here is the same request, for an unattended run. Describe only what the steps do. This PR changes the host's nn::os layer (host/nn_os_sync.c) on Windows and Linux alike. LockMutex and UnlockMutex now find their host object through a number kept in the guest mutex. It is on by default, and HOS_MUTEX_GUEST_ID=0 turns it off. - **Targets:** Windows and Linux; on Linux, the Steam Deck first. Spread them over 6- and 8-core AMD and Intel CPUs, an Intel hybrid CPU, a PC with 8 or fewer CPU threads if one is online, and NVIDIA and AMD GPUs: one target per GPU maker and OS, plus steamdeck. - **Scenario:** start, teleport to Market as child, measure 20 s turning the camera; then teleport to Lost Woods as child and measure 20 s the same way. 2 runs a side. - **Matrix:** matrix.pr_only HOS_MUTEX_GUEST_ID = ["", "0"], with [[pass.compare]] on fps_mean and on frametime_p99_ms, the value "" against "0" on the PR side. If the 60 minutes don't fit, use baseline ref = "pr". - **Settings in every cell, both sides:** frame_rate_cap = 6, vsync = 2, frame_generation = 0, fullscreen off. - **Pass:** crash = false. run_hitch_count and run_frametime_max_ms are report-only, with no rule on them.
Member
Beanstalk test farm · an earlier run: commit 01b867c, run 2 (the newer results are in a comment below)

Commit 01b867c · approved by klimovich008 (reviewed) · dashboard

⚠️ Note: The plan can turn the camera before each measurement, but cannot hold the stick during a measure step; it therefore does not reproduce the claimed turning-camera measurements exactly.
⚠️ Note: Core count, thread count, and hybrid CPU architecture cannot be selected directly by the target schema, so the requested CPU spread is not guaranteed.
⚠️ Note: Two runs per side and the regression thresholds may not distinguish the claimed 3.5–5.8% gains from noise.

Started at 11:56 UTC. Run 2: re-planned by klimovich008.

Target Result Reports VRAM peak (MB) Crashes
steamdeck ⏳ queued 1 1 — none
linux+amd ⚠️ couldn't be judged 2 1 2 — none
linux+nvidia ⏳ queued 0 of 1 — —
windows+amd ⚠️ couldn't be judged 2 1 2 — none
windows+nvidia ⚠️ couldn't be judged 2 1 2 — none

market-lost-woods · frame time p99 (ms)

Target main HOS_MUTEX_GUEST_ID= HOS_MUTEX_GUEST_ID=0 (reference)
steamdeck — — —
linux+amd — — —
linux+nvidia — — —
windows+amd — — —
windows+nvidia — — —

Couldn'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.

  • steamdeck, report 1: main's longshot-builder failed (exit 1): Traceback (most recent call last):
  • linux+amd, report 1: main's longshot-builder failed (exit 1): Traceback (most recent call last):
  • linux+amd, report 2: main's longshot-builder failed (exit 1): Traceback (most recent call last):
  • windows+amd, report 1: main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)
  • windows+amd, report 2: main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)
  • windows+nvidia, report 1: main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Y:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)
  • windows+nvidia, report 2: main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)
What was tested

What will be tested · AI plan (gpt-6.1-terra)

The plan compares main with the PR’s default mutex lookup and its disabled setting on Windows, Linux, and Steam Deck. From a child save, each run teleports to Market and Lost Woods, takes a stationary picture, turns the camera, and measures each scene for 20 seconds after warm-up. Two runs per side and setting report frame rate, frame times, hitches, and worst frames; a crash, a substantial performance regression, or a picture difference beyond the threshold fails the plan. No tester online now matches linux+nvidia: that target waits for one.

  • Where: steamdeck (1-2 reports), linux+amd (1-2 reports), linux+nvidia (1-2 reports), windows+amd (1-2 reports), windows+nvidia (1-2 reports).
  • Matrix: 2 cells, each on main and the PR: HOS_MUTEX_GUEST_ID `` or 0 (PR only).
  • market-lost-woods: from the repository's save market-entrance (settings vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=0), then teleport to Market, take the picture market to compare with main, move the stick, measure market for 20 s (after 5 s warm-up), teleport to Lost Woods, take the picture lost-woods to compare with main, measure lost-woods for 20 s (after 5 s warm-up); 2 runs on each side for each of 2 cells (2 game starts a run).
  • Measured: crashes, frame times, stutters and hitches, draws and frame rate.
  • The PR fails if: it crashes; or the PR's frame rate with HOS_MUTEX_GUEST_ID= is more than 10% below HOS_MUTEX_GUEST_ID=0; or the PR's frame time (p99) with HOS_MUTEX_GUEST_ID= is more than 15% above HOS_MUTEX_GUEST_ID=0; or frame rate is more than 10% below main; or a picture differs from main by more than 20%; or frame time (p99) is more than 15% above main; or frame time (worst 1%) is more than 15% above main.
  • Time: about 48 min of game runs per tester (8 game starts), plus the two builds.
Measurements on `steamdeck`, for the PR description

Verdict: queued on steamdeck (1 report).

Hardware: 1: linux+amd+radv+igpu+handheld AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99 AMD Custom APU 0405, 12 GB RAM
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 1 report
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame rate) Helps / doesn't help / untested
HOS_MUTEX_GUEST_ID switch the PR adds (set on the PR side only) ``, 0 not in main the PR's default market-lost-woods, main without it → the PR with : not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** queued on steamdeck (1 report).

Hardware: 1: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM`  
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 1 report  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested |
Measurements on `linux+amd`, for the PR description

Verdict: could not be judged on linux+amd (2 reports).

Hardware: 1: linux+amd+radv+dgpu AMD Radeon RX 9070 (RADV GFX1201), 26.0.8 AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM; 2: linux+amd+radv+dgpu AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1 AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame rate) Helps / doesn't help / untested
HOS_MUTEX_GUEST_ID switch the PR adds (set on the PR side only) ``, 0 not in main the PR's default market-lost-woods, main without it → the PR with : not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** could not be judged on linux+amd (2 reports).

Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 9070 (RADV GFX1201), 26.0.8` `AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM`  
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested |
Measurements on `windows+amd`, for the PR description

Verdict: could not be judged on windows+amd (2 reports).

Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9070 XT, 2.0.416 AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM; 2: windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9060 XT, 2.0.416 AMD Ryzen 5 5600 6-Core Processor, 32 GB RAM
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame rate) Helps / doesn't help / untested
HOS_MUTEX_GUEST_ID switch the PR adds (set on the PR side only) ``, 0 not in main the PR's default market-lost-woods, main without it → the PR with : not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** could not be judged on windows+amd (2 reports).

Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM`; 2: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9060 XT, 2.0.416` `AMD Ryzen 5 5600 6-Core Processor, 32 GB RAM`  
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested |
Measurements on `windows+nvidia`, for the PR description

Verdict: could not be judged on windows+nvidia (2 reports).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4070, 621.24.0 AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.0 12th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports
How to reproduce: the farm's plan above (@Beanstalk on this PR runs it again)

Nothing was measured: no metric came back.

Flags and settings

Flag What it is Values tried Before this PR After this PR Effect (frame rate) Helps / doesn't help / untested
HOS_MUTEX_GUEST_ID switch the PR adds (set on the PR side only) ``, 0 not in main the PR's default market-lost-woods, main without it → the PR with : not measured untested

As Markdown for the PR description:

## Measurements

**Verdict:** could not be judged on windows+nvidia (2 reports).

Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss `NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.0` `12th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM`  
Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports  
How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again)

Nothing was measured: no metric came back.

**Flags and settings**

| Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested |
|---|---|---|---|---|---|---|
| `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested |
The testers' hardware
Target Report Ran on
steamdeck 1 linux+amd+radv+igpu+handheld AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99 AMD Custom APU 0405, 12 GB RAM
linux+amd 1 linux+amd+radv+dgpu AMD Radeon RX 9070 (RADV GFX1201), 26.0.8 AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM
linux+amd 2 linux+amd+radv+dgpu AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1 AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM
windows+amd 1 windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9070 XT, 2.0.416 AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM
windows+amd 2 windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9060 XT, 2.0.416 AMD Ryzen 5 5600 6-Core Processor, 32 GB RAM
windows+nvidia 1 windows+nvidia+nvidia-proprietary+dgpu NVIDIA GeForce RTX 4070, 621.24.0 AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM
windows+nvidia 2 windows+nvidia+nvidia-proprietary+dgpu+dlss NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.0 12th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM
Run by hand on PCs that don't match their target (not counted)
Target Ran on Result
steamdeck off target (ran on windows+amd+amd-proprietary+dgpu+fsr4 AMD Radeon RX 9060 XT, 2.0.416) error
<!-- beanstalk:previous --> <details><summary>Beanstalk test farm · an earlier run: commit <code>01b867c</code>, run 2 (the newer results are in a comment below)</summary> Commit `01b867c` · approved by klimovich008 (reviewed) · [dashboard](https://beanstalk.magicbean.dev/prs/2665) ⚠️ **Note:** The plan can turn the camera before each measurement, but cannot hold the stick during a measure step; it therefore does not reproduce the claimed turning-camera measurements exactly. ⚠️ **Note:** Core count, thread count, and hybrid CPU architecture cannot be selected directly by the target schema, so the requested CPU spread is not guaranteed. ⚠️ **Note:** Two runs per side and the regression thresholds may not distinguish the claimed 3.5–5.8% gains from noise. Started at 11:56 UTC. Run 2: re-planned by klimovich008. | Target | Result | Reports | VRAM peak (MB) | Crashes | | --- | --- | --- | --- | --- | | `steamdeck` | ⏳ queued | 1 [1](https://beanstalk.magicbean.dev/reports/rp_f0d2fa7fae842cd7) | — | none | | `linux+amd` | ⚠️ couldn't be judged | 2 [1](https://beanstalk.magicbean.dev/reports/rp_5a76eb25639e534a) [2](https://beanstalk.magicbean.dev/reports/rp_b524c7e02371afde) | — | none | | `linux+nvidia` | ⏳ queued | 0 of 1 | — | — | | `windows+amd` | ⚠️ couldn't be judged | 2 [1](https://beanstalk.magicbean.dev/reports/rp_ce0dd55f4a8dc9ae) [2](https://beanstalk.magicbean.dev/reports/rp_38e83e33ce7df16d) | — | none | | `windows+nvidia` | ⚠️ couldn't be judged | 2 [1](https://beanstalk.magicbean.dev/reports/rp_6af04510face2f92) [2](https://beanstalk.magicbean.dev/reports/rp_3fef15bc80f4ef38) | — | none | **`market-lost-woods`** · frame time p99 (ms) | Target | main | `HOS_MUTEX_GUEST_ID=` | `HOS_MUTEX_GUEST_ID=0` (reference) | | --- | --- | --- | --- | | `steamdeck` | — | — | — | | `linux+amd` | — | — | — | | `linux+nvidia` | — | — | — | | `windows+amd` | — | — | — | | `windows+nvidia` | — | — | — | **Couldn'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. - `steamdeck`, [report 1](https://beanstalk.magicbean.dev/reports/rp_f0d2fa7fae842cd7): `main's longshot-builder failed (exit 1): Traceback (most recent call last):` - `linux+amd`, [report 1](https://beanstalk.magicbean.dev/reports/rp_5a76eb25639e534a): `main's longshot-builder failed (exit 1): Traceback (most recent call last):` - `linux+amd`, [report 2](https://beanstalk.magicbean.dev/reports/rp_b524c7e02371afde): `main's longshot-builder failed (exit 1): Traceback (most recent call last):` - `windows+amd`, [report 1](https://beanstalk.magicbean.dev/reports/rp_ce0dd55f4a8dc9ae): `main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)` - `windows+amd`, [report 2](https://beanstalk.magicbean.dev/reports/rp_38e83e33ce7df16d): `main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)` - `windows+nvidia`, [report 1](https://beanstalk.magicbean.dev/reports/rp_6af04510face2f92): `main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Y:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)` - `windows+nvidia`, [report 2](https://beanstalk.magicbean.dev/reports/rp_3fef15bc80f4ef38): `main's longshot-builder failed (exit 1): longshot_builder: no llvm-mingw: pass --llvm-mingw <folder> or set LONGSHOT_MINGW (Z:\builder\tools\tools\llvm-mingw\bin\x86_64-w64-mingw32-clang.exe is not there)` <details><summary>What was tested</summary> **What will be tested** · AI plan (`gpt-6.1-terra`) The plan compares main with the PR’s default mutex lookup and its disabled setting on Windows, Linux, and Steam Deck. From a child save, each run teleports to Market and Lost Woods, takes a stationary picture, turns the camera, and measures each scene for 20 seconds after warm-up. Two runs per side and setting report frame rate, frame times, hitches, and worst frames; a crash, a substantial performance regression, or a picture difference beyond the threshold fails the plan. No tester online now matches linux+nvidia: that target waits for one. - **Where:** steamdeck (1-2 reports), linux+amd (1-2 reports), linux+nvidia (1-2 reports), windows+amd (1-2 reports), windows+nvidia (1-2 reports). - **Matrix:** 2 cells, each on main and the PR: HOS_MUTEX_GUEST_ID `` or `0` (PR only). - **market-lost-woods:** from the repository's save `market-entrance` (settings vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=0), then teleport to Market, take the picture market to compare with main, move the stick, measure market for 20 s (after 5 s warm-up), teleport to Lost Woods, take the picture lost-woods to compare with main, measure lost-woods for 20 s (after 5 s warm-up); 2 runs on each side for each of 2 cells (2 game starts a run). - **Measured:** crashes, frame times, stutters and hitches, draws and frame rate. - **The PR fails if:** it crashes; or the PR's frame rate with HOS_MUTEX_GUEST_ID= is more than 10% below HOS_MUTEX_GUEST_ID=0; or the PR's frame time (p99) with HOS_MUTEX_GUEST_ID= is more than 15% above HOS_MUTEX_GUEST_ID=0; or frame rate is more than 10% below main; or a picture differs from main by more than 20%; or frame time (p99) is more than 15% above main; or frame time (worst 1%) is more than 15% above main. - **Time:** about 48 min of game runs per tester (8 game starts), plus the two builds. </details> <details><summary>Measurements on `steamdeck`, for the PR description</summary> **Verdict:** queued on steamdeck (1 report). Hardware: 1: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** queued on steamdeck (1 report). Hardware: 1: linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 1 report How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | ``` </details> <details><summary>Measurements on `linux+amd`, for the PR description</summary> **Verdict:** could not be judged on linux+amd (2 reports). Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 9070 (RADV GFX1201), 26.0.8` `AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** could not be judged on linux+amd (2 reports). Hardware: 1: linux+amd+radv+dgpu `AMD Radeon RX 9070 (RADV GFX1201), 26.0.8` `AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM`; 2: linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | ``` </details> <details><summary>Measurements on `windows+amd`, for the PR description</summary> **Verdict:** could not be judged on windows+amd (2 reports). Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM`; 2: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9060 XT, 2.0.416` `AMD Ryzen 5 5600 6-Core Processor, 32 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** could not be judged on windows+amd (2 reports). Hardware: 1: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM`; 2: windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9060 XT, 2.0.416` `AMD Ryzen 5 5600 6-Core Processor, 32 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | ``` </details> <details><summary>Measurements on `windows+nvidia`, for the PR description</summary> **Verdict:** could not be judged on windows+nvidia (2 reports). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss `NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.0` `12th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | As Markdown for the PR description: ```markdown ## Measurements **Verdict:** could not be judged on windows+nvidia (2 reports). Hardware: 1: windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM`; 2: windows+nvidia+nvidia-proprietary+dgpu+dlss `NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.0` `12th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM` Scene: market-lost-woods, from the repository's save market-entrance (vsync=2, fullscreen=0, frame_rate_cap=6, frame_generation=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); market-lost-woods: 2 game starts a side, market 20 s after 5 s warm-up, lost-woods 20 s after 5 s warm-up; each number the median of the runs, then of 2 reports How to reproduce: the farm's plan above (`@Beanstalk` on this PR runs it again) Nothing was measured: no metric came back. **Flags and settings** | Flag | What it is | Values tried | Before this PR | After this PR | Effect (frame rate) | Helps / doesn't help / untested | |---|---|---|---|---|---|---| | `HOS_MUTEX_GUEST_ID` | switch the PR adds (set on the PR side only) | ``, `0` | not in main | the PR's default | market-lost-woods, main without it → the PR with : not measured | untested | ``` </details> <details><summary>The testers' hardware</summary> | Target | Report | Ran on | | --- | --- | --- | | `steamdeck` | [1](https://beanstalk.magicbean.dev/reports/rp_f0d2fa7fae842cd7) | linux+amd+radv+igpu+handheld `AMD Custom GPU 0405 (RADV VANGOGH), 26.1.99` `AMD Custom APU 0405, 12 GB RAM` | | `linux+amd` | [1](https://beanstalk.magicbean.dev/reports/rp_5a76eb25639e534a) | linux+amd+radv+dgpu `AMD Radeon RX 9070 (RADV GFX1201), 26.0.8` `AMD Ryzen 7 5800X 8-Core Processor, 32 GB RAM` | | `linux+amd` | [2](https://beanstalk.magicbean.dev/reports/rp_b524c7e02371afde) | linux+amd+radv+dgpu `AMD Radeon RX 9070 XT (RADV GFX1201), 26.3.1` `AMD Ryzen 7 5700X3D 8-Core Processor, 32 GB RAM` | | `windows+amd` | [1](https://beanstalk.magicbean.dev/reports/rp_ce0dd55f4a8dc9ae) | windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9070 XT, 2.0.416` `AMD Ryzen 9 7950X 16-Core Processor, 128 GB RAM` | | `windows+amd` | [2](https://beanstalk.magicbean.dev/reports/rp_38e83e33ce7df16d) | windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9060 XT, 2.0.416` `AMD Ryzen 5 5600 6-Core Processor, 32 GB RAM` | | `windows+nvidia` | [1](https://beanstalk.magicbean.dev/reports/rp_6af04510face2f92) | windows+nvidia+nvidia-proprietary+dgpu `NVIDIA GeForce RTX 4070, 621.24.0` `AMD Ryzen 9 7900X 12-Core Processor, 64 GB RAM` | | `windows+nvidia` | [2](https://beanstalk.magicbean.dev/reports/rp_3fef15bc80f4ef38) | windows+nvidia+nvidia-proprietary+dgpu+dlss `NVIDIA GeForce RTX 3050 Laptop GPU, 621.40.0` `12th Gen Intel(R) Core(TM) i5-12500H, 16 GB RAM` | </details> <details><summary>Run by hand on PCs that don't match their target (not counted)</summary> | Target | Ran on | Result | | --- | --- | --- | | steamdeck | off target (ran on windows+amd+amd-proprietary+dgpu+fsr4 `AMD Radeon RX 9060 XT, 2.0.416`) | [error](https://beanstalk.magicbean.dev/reports/rp_ed9a706d5369d354) | </details> </details>
BeanBot requested changes 2026-11-27 11:56:40 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The new checks fail on Linux when LONGSHOT_MINGW selects an llvm-mingw installation without Linux sanitizer runtimes. The reported runs also leave the default-on synchronization path unmeasured on Linux, Steam Deck and other affected CPUs.

LockMutex and UnlockMutex can find their host object through a number stored in guest memory, bypassing the per-thread cache. This adds numbered object storage, a guest-memory write and another experimental cache mode in exchange for the reported frame-rate gain.

Blocking (1): must change before merging.

  1. L4: The check CI / Third-party parts and guide screenshots (pull_request) fails on this head and passes on the base branch: Failing after 10s.

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

  • L1 tests/test_obj_cache_size.py:468: The compiler selection prefers llvm-mingw on Linux even though both fixtures unconditionally request Linux sanitizer runtimes that that distribution does not supply. (more on the line) Do: On Linux select a native compiler ahead of LONGSHOT_MINGW, while continuing to honor explicit --cc and CC; keep llvm-mingw selection for Windows.

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

  • L2 host/nn_os_sync.c:264: The default-on hot path needs comparison on the other supported CPU and OS configurations before its default can be settled. (more on the line) Do: Run warmed, interleaved base-versus-head game comparisons in the target and heavy scenes at player settings, including Linux/Steam Deck and the requested CPU coverage; report fps, 1% lows and frame times. (@fix does its part first: Keep the guest-word path off on configurations where it does not win, or remove the extra lookup from those paths.)
  • L3 host/nn_os_sync.c:348: The default now allocates synchronization objects in chunks, but its memory cost has not been measured. (more on the line) Do: Compare peak and steady host RAM against the base through startup and representative play, including a scene transition. (@fix does its part first: Reduce chunk granularity or allocate numbered storage in smaller increments.)

@fix can do L1, L2, L3 and L4.

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

  • Does the complete game-side audit rule out inlined accesses to the mutex word outside the replaced HLE functions? The description explicitly limits its scan.

Checks: Still running: 8 checks.

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

Does it help: Unproven for the supported player configurations. The PR reports median gains of 3.5% in Market and 5.8% in Lost Woods, with better 1% lows, over 3 and 6 interleaved pairs respectively on one Windows Ryzen 7 5700X3D/RX 9070 XT PC. The Market result is near the stated 3% noise, the runs had no warm-up, and the comparison used uncapped settings rather than establishing the gain at normal player settings.

Other systems: The lookup and object identity changes affect all synchronization objects and both Windows and Linux, regardless of GPU. The guest-word path is default-on; Linux, Steam Deck, other CPUs and GPUs, and the sets-cache combination remain untested in game. Numbered chunks also change host memory use. The PR reports Windows smoke runs without new errors; it does not establish those other configurations.

Switches: HOS_MUTEX_GUEST_ID is new, defaults to 2 and accepts 0/off/no/false to disable it or 1 to consult the word on cache misses; its default needs the outstanding platform measurements. HOS_OBJ_CACHE adds the experimental sets value; its default remains 16384 entries. Both have switch-table rows.

Reviewed: 01b867c739 against 86b3b9e4f0: Read AGENTS.md, CONTRIBUTING.md, the PR template, docs/dev/standards.md, the commit log and diff, the changed synchronization and test code, and the guest range and platform memory implementation around the change. Skimmed the longer fixture bodies and commit histories; did not inspect game-derived material. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • The guest-word range check rejects wrapping and unaligned addresses, and the first MiB is left untouched.
  • The word is marked after its store, and the checkpoint precedes the mutex lookup.
  • The identity check uses one atomic word; numbered chunks remain allocated while cached IDs can refer to them.
  • The changed switch rows describe their defaults and off values, and the commit log records AI assistance.

Testing: No commands from the project were run, as requested. The PR reports Windows game smoke tests and focused game-free checks; Linux game runs and the other requested hardware runs remain outstanding. One head-only CI check is failing and several are still running; the supplied CI result is not restated as an item.

Overlaps and merge order: The description identifies this as a port of #1969 and #2090; their current status and merge order cannot be checked from the supplied checkout.


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

**Recommendation: Request changes.** The new checks fail on Linux when LONGSHOT_MINGW selects an llvm-mingw installation without Linux sanitizer runtimes. The reported runs also leave the default-on synchronization path unmeasured on Linux, Steam Deck and other affected CPUs. LockMutex and UnlockMutex can find their host object through a number stored in guest memory, bypassing the per-thread cache. This adds numbered object storage, a guest-memory write and another experimental cache mode in exchange for the reported frame-rate gain. **Blocking (1)**: must change before merging. 1. **L4**: The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head and passes on the base branch: Failing after 10s. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `tests/test_obj_cache_size.py:468`: The compiler selection prefers llvm-mingw on Linux even though both fixtures unconditionally request Linux sanitizer runtimes that that distribution does not supply. (more on the line) **Do:** On Linux select a native compiler ahead of LONGSHOT_MINGW, while continuing to honor explicit --cc and CC; keep llvm-mingw selection for Windows. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `host/nn_os_sync.c:264`: The default-on hot path needs comparison on the other supported CPU and OS configurations before its default can be settled. (more on the line) **Do:** Run warmed, interleaved base-versus-head game comparisons in the target and heavy scenes at player settings, including Linux/Steam Deck and the requested CPU coverage; report fps, 1% lows and frame times. *(`@fix` does its part first: Keep the guest-word path off on configurations where it does not win, or remove the extra lookup from those paths.)* - **L3** `host/nn_os_sync.c:348`: The default now allocates synchronization objects in chunks, but its memory cost has not been measured. (more on the line) **Do:** Compare peak and steady host RAM against the base through startup and representative play, including a scene transition. *(`@fix` does its part first: Reduce chunk granularity or allocate numbered storage in smaller increments.)* `@fix` can do L1, L2, L3 and L4. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - Does the complete game-side audit rule out inlined accesses to the mutex word outside the replaced HLE functions? The description explicitly limits its scan. **Checks:** Still running: 8 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven for the supported player configurations. The PR reports median gains of 3.5% in Market and 5.8% in Lost Woods, with better 1% lows, over 3 and 6 interleaved pairs respectively on one Windows Ryzen 7 5700X3D/RX 9070 XT PC. The Market result is near the stated 3% noise, the runs had no warm-up, and the comparison used uncapped settings rather than establishing the gain at normal player settings. **Other systems:** The lookup and object identity changes affect all synchronization objects and both Windows and Linux, regardless of GPU. The guest-word path is default-on; Linux, Steam Deck, other CPUs and GPUs, and the sets-cache combination remain untested in game. Numbered chunks also change host memory use. The PR reports Windows smoke runs without new errors; it does not establish those other configurations. **Switches:** HOS_MUTEX_GUEST_ID is new, defaults to 2 and accepts 0/off/no/false to disable it or 1 to consult the word on cache misses; its default needs the outstanding platform measurements. HOS_OBJ_CACHE adds the experimental sets value; its default remains 16384 entries. Both have switch-table rows. **Reviewed:** 01b867c7393a against 86b3b9e4f0e1: Read AGENTS.md, CONTRIBUTING.md, the PR template, docs/dev/standards.md, the commit log and diff, the changed synchronization and test code, and the guest range and platform memory implementation around the change. Skimmed the longer fixture bodies and commit histories; did not inspect game-derived material. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - The guest-word range check rejects wrapping and unaligned addresses, and the first MiB is left untouched. - The word is marked after its store, and the checkpoint precedes the mutex lookup. - The identity check uses one atomic word; numbered chunks remain allocated while cached IDs can refer to them. - The changed switch rows describe their defaults and off values, and the commit log records AI assistance. **Testing:** No commands from the project were run, as requested. The PR reports Windows game smoke tests and focused game-free checks; Linux game runs and the other requested hardware runs remain outstanding. One head-only CI check is failing and several are still running; the supplied CI result is not restated as an item. **Overlaps and merge order:** The description identifies this as a port of #1969 and #2090; their current status and merge order cannot be checked from the supplied checkout. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by klimovich008. Nothing was run; a maintainer decides.</sub>
@ -226,0 +261,4 @@
static Obj *obj_by_word(uint64_t key, int kind, int mode);
static int mutex_guest_id(void); /* (HOS_MUTEX_GUEST_ID: 0 off, 1 or 2; below, with the caches' switches) */
static Obj *obj_mutex(uint64_t key, int kind) {
hos_vcore_checkpoint(); /* (as obj: before the lookup) */
Member

L2 (should fix): The default-on hot path needs comparison on the other supported CPU and OS configurations before its default can be settled.

When: Every lock and unlock now reads guest memory and follows a numbered-object pointer before the cache; their locality and contention can differ on Linux, Steam Deck and CPUs unlike the tested 5700X3D.

Do: Run warmed, interleaved base-versus-head game comparisons in the target and heavy scenes at player settings, including Linux/Steam Deck and the requested CPU coverage; report fps, 1% lows and frame times.

**L2** (should fix): The default-on hot path needs comparison on the other supported CPU and OS configurations before its default can be settled. *When:* Every lock and unlock now reads guest memory and follows a numbered-object pointer before the cache; their locality and contention can differ on Linux, Steam Deck and CPUs unlike the tested 5700X3D. **Do:** Run warmed, interleaved base-versus-head game comparisons in the target and heavy scenes at player settings, including Linux/Steam Deck and the requested CPU coverage; report fps, 1% lows and frame times.
@ -255,0 +345,4 @@
if (id >> OBJ_CHUNK_BITS >= OBJ_CHUNKS) return (Obj *)calloc(1, sizeof(Obj));
Obj *k = obj_chunks[id >> OBJ_CHUNK_BITS];
if (!k) {
k = (Obj *)calloc((size_t)1 << OBJ_CHUNK_BITS, sizeof(Obj));
Member

L3 (should fix): The default now allocates synchronization objects in chunks, but its memory cost has not been measured.

When: The first numbered object allocates 1024 Obj slots and every subsequent chunk can retain unused slots for the process lifetime, whereas the base allocates objects individually.

Do: Compare peak and steady host RAM against the base through startup and representative play, including a scene transition.

**L3** (should fix): The default now allocates synchronization objects in chunks, but its memory cost has not been measured. *When:* The first numbered object allocates 1024 Obj slots and every subsequent chunk can retain unused slots for the process lifetime, whereas the base allocates objects individually. **Do:** Compare peak and steady host RAM against the base through startup and representative play, including a scene transition.
@ -188,0 +465,4 @@
for c in (given, os.environ.get("CC")):
if c:
return shutil.which(c) or (c if os.path.isfile(c) else None)
mingw = os.environ.get("LONGSHOT_MINGW")
Member

L1 (should fix): The compiler selection prefers llvm-mingw on Linux even though both fixtures unconditionally request Linux sanitizer runtimes that that distribution does not supply.

When: On a Linux developer machine with LONGSHOT_MINGW set and CC unset, compiler() selects its clang; both this test and test_obj_guest_id then fail to link their ASan/UBSan fixtures instead of running the checks, even when a suitable native compiler is on PATH.

Do: On Linux select a native compiler ahead of LONGSHOT_MINGW, while continuing to honor explicit --cc and CC; keep llvm-mingw selection for Windows.

**L1** (should fix): The compiler selection prefers llvm-mingw on Linux even though both fixtures unconditionally request Linux sanitizer runtimes that that distribution does not supply. *When:* On a Linux developer machine with LONGSHOT_MINGW set and CC unset, compiler() selects its clang; both this test and test_obj_guest_id then fail to link their ASan/UBSan fixtures instead of running the checks, even when a suitable native compiler is on PATH. **Do:** On Linux select a native compiler ahead of LONGSHOT_MINGW, while continuing to honor explicit --cc and CC; keep llvm-mingw selection for Windows.
Author
Member

On BeanBot's review of 01b867c7:

  • L4, CI "Third-party parts and guide screenshots": this is not from this PR. It fails the same way on main 86b3b9e4f's own push run (run 55611, job 2), and the log here says "Guide screenshot check failed: 1 issue(s)". This PR changes no UI, guide or third_party/ file. CI "Rust" fails on main too (run 55611, job 3): clippy's three "creates a reference which is immediately dereferenced" errors in build-driver, and this PR has no Rust. I'll merge main again once it fixes them.
  • L1, the fixtures' compiler on Linux: agreed. It was the sol review's point 9 too, on code from #1969. CI's tests job doesn't set LONGSHOT_MINGW, so CI is not affected, and CC or --cc picks the compiler. A commit will make the fixtures prefer a native compiler on Linux ahead of LONGSHOT_MINGW, keeping CC/--cc first and llvm-mingw on Windows.
  • L2, other CPUs and OSes: that is this PR's Still to test, and the Test Farm round is running now. It covers the Steam Deck, Linux and Windows on AMD and NVIDIA, with unset against HOS_MUTEX_GUEST_ID=0 and against main, uncapped, in the Market and Lost Woods. If it goes against the default on a platform, that platform turns it off before this leaves WIP.
  • L3, memory: not measured yet. Numbered objects are made in chunks of 1024 Obj that are never freed. So the extra memory over main is at most the unused slots of the last chunk, plus a chunk pointer table of 4096 entries (32 KiB). Peak and steady host RAM against main, through start, play and a scene change, will be measured and added under Measurements.
  • The question (inlined accesses to +0x18): the scan doesn't rule them out exhaustively, as the description says. It found every call into the internal critical-section helpers that is given a MutexType's +0x18, but it didn't search for inlined atomics on that offset elsewhere. Code there would see the object number in place of the sdk's critical-section word. HOS_MUTEX_GUEST_ID=0 is the switch if any player-facing case shows it.
On BeanBot's [review](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2665#issuecomment-84744) of 01b867c7: - **L4, CI "Third-party parts and guide screenshots":** this is not from this PR. It fails the same way on `main` 86b3b9e4f's own push run ([run 55611, job 2](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/55611/jobs/2)), and the log here says "Guide screenshot check failed: 1 issue(s)". This PR changes no UI, guide or `third_party/` file. **CI "Rust"** fails on `main` too ([run 55611, job 3](https://git.magicbean.dev/MagicBeanDev/Longshot/actions/runs/55611/jobs/3)): clippy's three "creates a reference which is immediately dereferenced" errors in `build-driver`, and this PR has no Rust. I'll merge `main` again once it fixes them. - **L1, the fixtures' compiler on Linux:** agreed. It was the sol review's point 9 too, on code from #1969. CI's tests job doesn't set `LONGSHOT_MINGW`, so CI is not affected, and `CC` or `--cc` picks the compiler. A commit will make the fixtures prefer a native compiler on Linux ahead of `LONGSHOT_MINGW`, keeping `CC`/`--cc` first and llvm-mingw on Windows. - **L2, other CPUs and OSes:** that is this PR's Still to test, and the Test Farm round is running now. It covers the Steam Deck, Linux and Windows on AMD and NVIDIA, with unset against `HOS_MUTEX_GUEST_ID=0` and against `main`, uncapped, in the Market and Lost Woods. If it goes against the default on a platform, that platform turns it off before this leaves WIP. - **L3, memory:** not measured yet. Numbered objects are made in chunks of 1024 `Obj` that are never freed. So the extra memory over `main` is at most the unused slots of the last chunk, plus a chunk pointer table of 4096 entries (32 KiB). Peak and steady host RAM against `main`, through start, play and a scene change, will be measured and added under Measurements. - **The question (inlined accesses to +0x18):** the scan doesn't rule them out exhaustively, as the description says. It found every call into the internal critical-section helpers that is given a `MutexType`'s +0x18, but it didn't search for inlined atomics on that offset elsewhere. Code there would see the object number in place of the sdk's critical-section word. `HOS_MUTEX_GUEST_ID=0` is the switch if any player-facing case shows it.
Author
Member

Answers to L1 and L3 from the review.

L1: fixed in 836a55e69. test_obj_cache_size.compiler, which test_obj_guest_id uses too, now picks the compiler in this order:

  • --cc, then CC;
  • on Windows: LONGSHOT_MINGW's clang, then cc, clang or gcc on PATH, as before;
  • on any other OS: cc, clang or gcc on PATH, and LONGSHOT_MINGW's clang only when PATH has none.

compiler_choice_check runs this choice over a fake PATH and file system before the fixtures build. It checks six cases, and each Linux case is asked again as Windows and must answer differently. With the old order (llvm-mingw first everywhere) it fails on "Linux: a native compiler before llvm-mingw".

What ran:

  • WSL Ubuntu, with LONGSHOT_MINGW naming a clang that cannot link and no --cc or CC: both fixtures build with the native compiler and pass.
  • Windows: the focused run (obj_guest_id, obj_cache_size, multiwait_wake, cv_handoff_threads, switch_table, switches_removed) passes 6/6, and lint passes.

L3: measured, and the difference is below run-to-run noise.

  • Setup: one run per arm of the same pack, with the switch unset (on) and HOS_MUTEX_GUEST_ID=0 (off). Each run was a tour from the save: Market child (play, pause menu), teleport to Lost Woods (play, pause menu), teleport to the Fire Temple (play, pause menu, then idle to the end).
  • Hardware: Windows 11, Ryzen 7 5700X3D, RX 9070 XT.
  • Readings: GetProcessMemoryInfo every 0.25 s. "Private" is the commit charge (PrivateUsage).
unset (on) =0 (off) on minus off
peak private (PeakPagefileUsage) 23.190 GiB 23.133 GiB +58 MiB
peak working set 12.483 GiB 12.287 GiB +201 MiB
steady, last 60 s in the Fire Temple: private 22.653 GiB 22.788 GiB −138 MiB
steady, last 60 s in the Fire Temple: working set 12.019 GiB 12.081 GiB −63 MiB
median private in Market / Lost Woods / Fire Temple 19.97 / 21.18 / 22.53 GiB 20.07 / 21.33 / 22.69 GiB −0.10 / −0.15 / −0.16 GiB

The differences go in both directions between scenes and metrics, so with one run per arm they are noise.

By construction, the switch adds no more than:

  • the unused slots of the last 1,024-object chunk, under 352 KiB (an object is 352 bytes);
  • the 32 KiB table of chunk pointers, which is static and present in both arms.

The numbered objects replace one allocation per object, so the steady cost is that bound or less.

The guest-word path was active in the "on" run. A module worker's per-thread cache saw 2.19 M lookups with the switch on and 46.0 M with it off. Neither run logged a vcore escape or any fatal or crash line.

Not covered: Linux, the Steam Deck and other GPUs (that is L2, for the farm round), and more than one run per arm.

The farm round (Run 2) is on 01b867c73. 836a55e69 changes only these two test files, so that round still measures this head's game code.

🤖 Generated with Claude Code

Answers to L1 and L3 from the review. **L1: fixed in 836a55e69.** `test_obj_cache_size.compiler`, which `test_obj_guest_id` uses too, now picks the compiler in this order: - `--cc`, then `CC`; - on Windows: `LONGSHOT_MINGW`'s clang, then cc, clang or gcc on PATH, as before; - on any other OS: cc, clang or gcc on PATH, and `LONGSHOT_MINGW`'s clang only when PATH has none. `compiler_choice_check` runs this choice over a fake PATH and file system before the fixtures build. It checks six cases, and each Linux case is asked again as Windows and must answer differently. With the old order (llvm-mingw first everywhere) it fails on "Linux: a native compiler before llvm-mingw". What ran: - WSL Ubuntu, with `LONGSHOT_MINGW` naming a clang that cannot link and no `--cc` or `CC`: both fixtures build with the native compiler and pass. - Windows: the focused run (`obj_guest_id`, `obj_cache_size`, `multiwait_wake`, `cv_handoff_threads`, `switch_table`, `switches_removed`) passes 6/6, and lint passes. **L3: measured, and the difference is below run-to-run noise.** - Setup: one run per arm of the same pack, with the switch unset (on) and `HOS_MUTEX_GUEST_ID=0` (off). Each run was a tour from the save: Market child (play, pause menu), teleport to Lost Woods (play, pause menu), teleport to the Fire Temple (play, pause menu, then idle to the end). - Hardware: Windows 11, Ryzen 7 5700X3D, RX 9070 XT. - Readings: `GetProcessMemoryInfo` every 0.25 s. "Private" is the commit charge (PrivateUsage). | | unset (on) | `=0` (off) | on minus off | |---|---|---|---| | peak private (PeakPagefileUsage) | 23.190 GiB | 23.133 GiB | +58 MiB | | peak working set | 12.483 GiB | 12.287 GiB | +201 MiB | | steady, last 60 s in the Fire Temple: private | 22.653 GiB | 22.788 GiB | −138 MiB | | steady, last 60 s in the Fire Temple: working set | 12.019 GiB | 12.081 GiB | −63 MiB | | median private in Market / Lost Woods / Fire Temple | 19.97 / 21.18 / 22.53 GiB | 20.07 / 21.33 / 22.69 GiB | −0.10 / −0.15 / −0.16 GiB | The differences go in both directions between scenes and metrics, so with one run per arm they are noise. By construction, the switch adds no more than: - the unused slots of the last 1,024-object chunk, under 352 KiB (an object is 352 bytes); - the 32 KiB table of chunk pointers, which is static and present in both arms. The numbered objects replace one allocation per object, so the steady cost is that bound or less. The guest-word path was active in the "on" run. A module worker's per-thread cache saw 2.19 M lookups with the switch on and 46.0 M with it off. Neither run logged a vcore escape or any fatal or crash line. Not covered: Linux, the Steam Deck and other GPUs (that is L2, for the farm round), and more than one run per arm. The farm round (Run 2) is on 01b867c73. 836a55e69 changes only these two test files, so that round still measures this head's game code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(os): the object-cache fixtures prefer a native compiler on Linux; llvm-mingw first on Windows only (L1)
Some checks failed
CI / What the change needs (pull_request) Successful in 7s
CI / Third-party parts and guide screenshots (pull_request) Failing after 11s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 46s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m38s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 3m15s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 5m13s
CI / Website build and checks (pull_request) Successful in 2m13s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 8m12s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Successful in 11m23s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 26m18s
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Successful in 11s
836a55e69c
BeanBot's L1 on #2665: test_obj_cache_size.compiler (also test_obj_guest_id's) took LONGSHOT_MINGW's clang before a
compiler on PATH everywhere. Off Windows the fixtures link with -fsanitize=address,undefined, and the pinned llvm-mingw
strips its Linux compiler runtimes, so a Linux developer with LONGSHOT_MINGW set (dev.py env) got a link failure.

The order is now --cc, then CC; then on Windows LONGSHOT_MINGW's clang before cc, clang or gcc on PATH, as before; on
any other OS cc, clang or gcc on PATH first, LONGSHOT_MINGW's clang only when there is none. compiler_choice_check runs
the choice over a fake PATH and file system (six cases, and each Linux case asked as Windows must answer differently)
before the fixtures build; with the old order (llvm-mingw first everywhere) it fails on "Linux: a native compiler
before llvm-mingw".

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

Beanstalk test farm

Commit 836a55e · approved by nobody yet · dashboard

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

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

/review

/review
BeanBot left a comment

Recommendation: Request changes. The guest-word lookup improves frame rates on the measured Windows PC, but the default-on path still needs results on other supported CPUs and operating systems. (It stands on L4: The check CI / Third-party parts and guide screenshots (pull_request) fails on this head and passes on the base branch: Failing after 10s.)

Mutex lookups can bypass the per-thread cache using an object number stored in guest memory. This adds lookup and allocation complexity in exchange for the reported performance gain.

Blocking (3): must change before merging.

  1. L4: The check CI / Third-party parts and guide screenshots (pull_request) fails on this head and passes on the base branch: Failing after 10s.
  2. L5: The check CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) fails on this head and passes on the base branch: Failing after 5m13s.
  3. L6: The check CI / Game-free checks (run_all.py, part 2/2) (pull_request) fails on this head and passes on the base branch: Failing after 26m18s.

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

  • L2 host/nn_os_sync.c:264: The default-on hot path needs comparison on the other supported CPU and OS configurations before its default can be settled. When: Every lock and unlock now reads guest memory and follows a numbered-object pointer before the cache; their locality and contention can differ on Linux, Steam Deck and CPUs unlike the tested 5700X3D. Do: Run warmed, interleaved base-versus-head game comparisons in the target and heavy scenes at player settings, including Linux/Steam Deck and the requested CPU coverage; report fps, 1% lows and frame times. (@fix does its part first: Keep the guest-word path off on configurations where it does not win, or remove the extra lookup from those paths.)

@fix can do L2, L4, L5 and L6.

Since the last review (on 01b867c739)
Resolved: L1 (The compiler selection prefers llvm-mingw on Linux even though both fixtures unconditional…); L3 (The default now allocates synchronization objects in chunks, but its memory cost has not b…)
Still open: L2 (The default-on hot path needs comparison on the other supported CPU and OS configurations…); L4 (The check CI / Third-party parts and guide screenshots (pull_request) fails on this head…)
New: L5 (The check CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) fails on th…); L6 (The check CI / Game-free checks (run_all.py, part 2/2) (pull_request) fails on this head…)

Also noticed (1; not asked for, not blocking)
  • The memory comparison has one run per arm, so its process-level differences are noisy.
More: does it help, other systems, switches, what was read

Does it help: Yes on the measured PC: median FPS rose 3.5% in the Market and 5.8% in Lost Woods, with better median 1% lows. These are author-reported runs against an earlier main commit; results on other systems remain outstanding.

Other systems: The synchronization path runs on Windows and Linux across CPUs and GPUs. The author reports Windows AMD gameplay and Linux game-free checks; Steam Deck, Linux gameplay, other CPUs and GPUs remain under test.

Switches: HOS_MUTEX_GUEST_ID is added, defaulting to mode 2; 0 disables it and 1 uses the guest word on cache misses. The default remains subject to the outstanding hardware comparisons. HOS_OBJ_CACHE gains the experimental sets value; its existing default remains 16384 entries.

Reviewed: 836a55e69c against 86b3b9e4f0: Read the repository rules and pull request template, the incremental diff, compiler selection and its callers, and the relevant synchronization allocation and lookup code. Skimmed the remaining changed files and recorded runs; the full base-to-head diff and all changed code were not read in full.; nothing run (a code review).

Checked and fine:

  • The compiler choice retains explicit --cc and CC precedence and the Windows llvm-mingw preference.
  • The changed compiler selection is shared by both fixtures.

Testing: No commands that build or run tests were executed. The author reports focused Windows checks, Linux fixture runs, and a Windows gameplay tour; broader gameplay and performance results are pending.

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


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

**Recommendation: Request changes.** The guest-word lookup improves frame rates on the measured Windows PC, but the default-on path still needs results on other supported CPUs and operating systems. (It stands on L4: The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head and passes on the base branch: Failing after 10s.) Mutex lookups can bypass the per-thread cache using an object number stored in guest memory. This adds lookup and allocation complexity in exchange for the reported performance gain. **Blocking (3)**: must change before merging. 1. **L4**: The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head and passes on the base branch: Failing after 10s. 2. **L5**: The check `CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)` fails on this head and passes on the base branch: Failing after 5m13s. 3. **L6**: The check `CI / Game-free checks (run_all.py, part 2/2) (pull_request)` fails on this head and passes on the base branch: Failing after 26m18s. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `host/nn_os_sync.c:264`: The default-on hot path needs comparison on the other supported CPU and OS configurations before its default can be settled. *When:* Every lock and unlock now reads guest memory and follows a numbered-object pointer before the cache; their locality and contention can differ on Linux, Steam Deck and CPUs unlike the tested 5700X3D. **Do:** Run warmed, interleaved base-versus-head game comparisons in the target and heavy scenes at player settings, including Linux/Steam Deck and the requested CPU coverage; report fps, 1% lows and frame times. *(`@fix` does its part first: Keep the guest-word path off on configurations where it does not win, or remove the extra lookup from those paths.)* `@fix` can do L2, L4, L5 and L6. **Since the last review** (on 01b867c7393a) Resolved: L1 (The compiler selection prefers llvm-mingw on Linux even though both fixtures unconditional…); L3 (The default now allocates synchronization objects in chunks, but its memory cost has not b…) Still open: L2 (The default-on hot path needs comparison on the other supported CPU and OS configurations…); L4 (The check `CI / Third-party parts and guide screenshots (pull_request)` fails on this head…) New: L5 (The check `CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request)` fails on th…); L6 (The check `CI / Game-free checks (run_all.py, part 2/2) (pull_request)` fails on this head…) <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The memory comparison has one run per arm, so its process-level differences are noisy. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the measured PC: median FPS rose 3.5% in the Market and 5.8% in Lost Woods, with better median 1% lows. These are author-reported runs against an earlier main commit; results on other systems remain outstanding. **Other systems:** The synchronization path runs on Windows and Linux across CPUs and GPUs. The author reports Windows AMD gameplay and Linux game-free checks; Steam Deck, Linux gameplay, other CPUs and GPUs remain under test. **Switches:** HOS_MUTEX_GUEST_ID is added, defaulting to mode 2; 0 disables it and 1 uses the guest word on cache misses. The default remains subject to the outstanding hardware comparisons. HOS_OBJ_CACHE gains the experimental sets value; its existing default remains 16384 entries. **Reviewed:** 836a55e69c9d against 86b3b9e4f0e1: Read the repository rules and pull request template, the incremental diff, compiler selection and its callers, and the relevant synchronization allocation and lookup code. Skimmed the remaining changed files and recorded runs; the full base-to-head diff and all changed code were not read in full.; nothing run (a code review). **Checked and fine:** - The compiler choice retains explicit --cc and CC precedence and the Windows llvm-mingw preference. - The changed compiler selection is shared by both fixtures. **Testing:** No commands that build or run tests were executed. The author reports focused Windows checks, Linux fixture runs, and a Windows gameplay tour; broader gameplay and performance results are pending. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
HumanBean changed title from WIP: perf(os): mutex lookups through the guest MutexType word, on by default (port of #2090 and #1969) to perf(os): mutex lookups through the guest MutexType word, on by default (port of #2090 and #1969) 2026-11-27 15:24:28 +00:00
HumanBean deleted branch perf/2090-port 2026-11-27 15:24:38 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2665
No description provided.