fix(vk): seed_keys is filled only for RX_VK_SEED_CHECK, its one reader #393

Merged
HumanBean merged 3 commits from madebyjordan/Longshot:fix/seed-keys-race into main 2026-11-15 22:02:50 +00:00
Member

Type: fix · Risk: low · Tested on: Windows 11, AMD RX 6700 XT · Needs: Linux, any GPU

Why

When the shaders' preparation runs during play (RX_VK_PREPARE_BACKGROUND), it can fill a hash set while the renderer's thread is reading it. That's a data race that can walk freed memory and crash. The set only serves a debugging switch, so now it's filled only when that switch is on.

How to reproduce

Seen on: Windows 11, AMD Radeon RX 6700 XT, AMD driver 26.10.1 (Ryzen 5 5600, 16 GB)
Settings and switches: RX_VK_PREPARE_BACKGROUND=1 RX_VK_NO_STATE_LIST=1 HOS_SKIP_OPENING=1, after an update start (another translator's prepare record kept, caches removed), a cold driver cache. With the state list on, the seed opens before the title and the race can't happen.
Steps: New Game into Link's house and Kokiri Forest, headless, 480 s. prepare_background opens the seed 20 s into play while play misses programs. Count the miss_note lines in the game log after the in-play seed opens, and the ones with a +. Or run tests/test_seed_keys_race.py.
Expected: Without RX_VK_SEED_CHECK, nothing fills seed_keys in play, so no miss_note line has a + and nothing races the reads.
Actual: On main, the seed's keys go into seed_keys while the replay's misses read it: every miss_note line after the in-play seed opens has a + (135, 150 and 134 of them in three runs). A rehash under a reader can walk freed buckets. The crash itself didn't fire in the runs here; it depends on timing. tests/test_seed_keys_race.py fails on main ("seed_open fills seed_keys outside RX_VK_SEED_CHECK").

What changed

seed_open() now puts the seed's keys into seed_keys only when RX_VK_SEED_CHECK=1, the one switch whose code reads the set. Without it the set stays empty, so the in-play seed open no longer writes a set the renderer is reading. A new test checks this, and the switch gets a row in the switch table.

  • vk: in seed_open() (gpu/vk/vk_shader.cpp), every seed stage's key goes into seed_keys only when RX_VK_SEED_CHECK=1 (read once, seed_check).
    • seed_keys (a std::unordered_set) has one reader: miss_note, which marks the replay's program misses (the first 1,500 in play) with the stages the seed holds.
    • On main, a seed opened in play by prepare_background inserted every key while those reads ran. A rehash under a reader can walk freed buckets.
    • Without RX_VK_SEED_CHECK the set now stays empty, and miss_note reads an empty set that nothing writes.
  • tests: tests/test_seed_keys_race.py (new) reads seed_open() and checks that every seed_keys.insert is under seed_check, and that seed_check is RX_VK_SEED_CHECK read once. It fails on main.
  • tests: tests/test_seed_reader.py, which compiles the real seed_open() against stand-ins, gets one for env_on. Its 20,000 mutations are unchanged.
  • docs: docs/development.md, an RX_VK_SEED_CHECK row; it wasn't in the switch table, only in docs/BAKE.md.

Measurements

Verdict: The fix works and changes nothing else. On main every miss_note line after the in-play seed opens has a + (the set read while it was filled); with this PR none does (0 of 131, 144, 147). Full 480 s, no crash on both, 3 of 3. The longest frame (median 141.7 s on main, 127.5 s here) and the fps after the load (median 52.0 against 52.2) are within the runs' spread. A fix of a timing-dependent race, so the evidence for the race is the test; the game runs show the fix changes nothing else.

Baseline: the numbers were measured on main aa95d35f (2026-11-15) and this PR at c8d151de, before the rebase onto main 16d87c83. The rebase was clean and didn't touch these files' changes.
Hardware: Windows 11, AMD Radeon RX 6700 XT, AMD driver 26.10.1, Ryzen 5 5600, 16 GB
Scene: the path where the seed is first opened in play. An update start (another translator's prepare record kept, caches removed), RX_VK_PREPARE_BACKGROUND=1 RX_VK_NO_STATE_LIST=1, so prepare_background opens the seed 20 s into play while play misses programs. Then HOS_SKIP_OPENING=1, New Game into Link's house and Kokiri Forest, headless, 480 s, a cold driver cache each run. With the state list on, the seed opens before the title and the race can't happen.
Method: longshot_vk.dll built from each commit (RX_VK_ONLY=1 RX_RELEASE=1, llvm-mingw clang 23) into the same game folder, with a longshot.exe built here from main aa95d35f (the same exe for every run), main and this PR alternated, 3 runs each, all six in one sitting. Read from the game log (miss_note lines, crash lines) and RX_VK_FRAME_LOG.
How to reproduce: the scene above, with each build's longshot_vk.dll; count the miss_note lines with a + after the in-play seed opens.

Before: main @ aa95d35f After: this PR @ c8d151de
full 480 s, no crash 3 of 3 3 of 3
miss_note lines after the seed opened in play 135, 150, 134 131, 144, 147
of them with a + (the set read while it was filled) 135, 150, 134 (all) 0, 0, 0
longest frame (the cold load's compile stall, the same on both) 141.7 s, 130.9 s, 144.5 s (median 141.7) 126.9 s, 144.1 s, 127.5 s (median 127.5)
fps after the load (median frame, from 30 s after it) 47.5, 52.5, 52.0 (median 52.0) 51.2, 52.2, 52.8 (median 52.2)

The frame rate after the load climbs for a few minutes while the in-play preparation finishes, so "fps after the load"
follows how late the load ended (174-186 s on main, 162-181 s here). Minute by minute from 30 s after the load (the last
figure is the run's partial last minute), the runs match: main 32 38 52 52 41 / 32 53 55 53 46 / 40 48 54 55 43, this PR
32 49 53 54 45 / 38 48 53 55 45 / 34 45 57 54 52.

The lines name the same programs: the six runs name 145-164 programs each, and every pair shares at least 136. Programs a
run named that no run of the other build did: 0, 16 and 0 in main's runs, 0, 1 and 6 in this PR's. The race didn't visibly fire in these
six runs; it depends on timing.

The same comparison on earlier mains gave the same result: on 1be60eae (3 runs each) + on all 130, 140 and 134 of main's
lines and on none of the PR's; on 5e072fc8 (2 each) on 130 and 137 against 0 and 0. Full 480 s, no crash in all ten.

Before: main @ aa95d35f After: this PR @ c8d151de
tests/test_seed_keys_race.py fails ("seed_open fills seed_keys outside RX_VK_SEED_CHECK") passes
tests/run_all.py --jobs 4 503 passed, 18 failed, 72 skipped 504 passed, the same 18 failed, 72 skipped

The 18 fail on main on this PC and touch nothing here: test_appimage_player_build, test_cpm_discovery, test_cpp_preflight,
test_crash_dialog, test_env_on, test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_make_game_prepare,
test_missing_nup, test_oot_state_tap, test_options_budget_once, test_portable_builder_home, test_portable_builder_startup,
test_readback_late, test_tested_configurations, test_vk_pgo, test_walk_key.

Flags and settings

No new switch. RX_VK_SEED_CHECK (existing) now also decides whether seed_keys is filled, and gets its row in docs/development.md.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
RX_VK_SEED_CHECK=1 (existing) A developer switch: marks the replay's program misses with the seed's stages (miss_note's +) off; seed_keys filled on every seed open, switch or not off; seed_keys filled only with the switch on Without it, the in-play seed open no longer writes the set the renderer reads. With it on, the in-play fill can still race the reads, as before Helps: checking a seed against what play asks for. Doesn't help: players. Untested with it on in this PR's runs Off: debugging only, as before

Testing

Tested:

  • The runs above (Windows 11, RX 6700 XT, AMD 26.10.1), on main aa95d35f and this PR at c8d151de.
  • tests/test_seed_keys_race.py.
  • tests/test_seed_reader.py with clang 23.
  • python -I -B tests/run_all.py --jobs 4 on main aa95d35f and this PR at c8d151de (the table above).
  • After the rebase onto main 16d87c83, at ee028d58: python -I -B tests/run_all.py --jobs 2: 200 passed, 66 failed, 355 skipped. The same 66 fail in the same run on main bbe7a078, ten commits earlier (197 passed, 66 failed, 349 skipped; main's newer commits add tests). tests/test_seed_keys_race.py passes. This shell had no C or C++ compiler on its path, so most compiled checks were skipped or failed for that, tests/test_seed_reader.py among them ("no C++ compiler 'g++'"), on main too. The 66: test_alt_enter, test_appimage_player_build, test_audio_deadline, test_audio_output_errors, test_audio_wave_buffer_release, test_bc_levels, test_bind_memo, test_capture_copy_helpers, test_collect_wide, test_dlss_actor, test_dlss_checks, test_dlss_math, test_draw_binds, test_env_file, test_fps_overlay_order, test_fps_rate, test_fps_stats, test_framegen_auto, test_framegen_gate, test_fsr3_math, test_gpu_choice, test_hd_rumble, test_import_span, test_jobs_wait_runs_queued, test_lift_cache, test_lift_cleanup_error, test_make_game_cache, test_make_game_prepare, test_menu_mouse_scroll, test_mirror_inherit, test_missing_nup, test_movie_upscale_policy, test_nvn_texture_handle, test_oot_jitter, test_options_budget_once, test_pass_hazard, test_pool_span, test_portable_builder_startup, test_present_ahead, test_present_thread, test_prof_clock, test_prompt_auto_face, test_push_state, test_quick_pipelines, test_report_words, test_rt_pool_minimum, test_rumble_mapping, test_rumble_menu, test_rumble_refresh, test_same_bind, test_same_draw, test_same_dyn, test_seed_reader, test_skip_code, test_status_line, test_submitted_page, test_table_track, test_tested_configurations, test_tex_spans_once_a_present, test_texture_layout_sizes, test_ub_gap, test_upscale_independent, test_upscale_label, test_vertex_bind, test_vk_pgo, test_wb_pages.

Not tested:

  • Linux: the renderer wasn't built for it here, so the host code wasn't built on both Windows and Linux for this PR. The change is a static const bool and an if, in code Linux already compiles.
  • NVIDIA and Intel: the change is the same on every driver, and is only the set's fill.
  • The game runs after the rebase: the numbers above are from c8d151de on main aa95d35f. The rebase onto 16d87c83 was clean.
  • tests/test_seed_reader.py after the rebase: it passed with clang 23 at c8d151de, but the run at ee028d58 had no C++ compiler, so it failed there as on main.

Must be tested:

  • Linux, any GPU: build the renderer, then start with RX_VK_PREPARE_BACKGROUND=1 and play into Kokiri Forest, expecting a clean build and no crash (by hand: test request T-5QMM).

Risks

What could break: Only the debugging marks: without RX_VK_SEED_CHECK, miss_note reads an empty set, so its lines have no +. With RX_VK_SEED_CHECK=1 the set is filled as before, and so is the race; that's a developer switch.

Turning it off: Reverting the commit gives main's behaviour.

Compatibility: gpu/vk/vk_shader.cpp is part of the translator's stamp, so every player's programs are translated once more after this lands, as with any release that touches the translator. Saves, longshot_options.ini and the vk ABI don't change.

Issues

Found while measuring the in-play shader preparation (#362's shader work). No issue in the tracker is known to come from this race (searched "seed" and "crash").

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** Windows 11, AMD RX 6700 XT · **Needs:** Linux, any GPU ## Why When the shaders' preparation runs during play (`RX_VK_PREPARE_BACKGROUND`), it can fill a hash set while the renderer's thread is reading it. That's a data race that can walk freed memory and crash. The set only serves a debugging switch, so now it's filled only when that switch is on. ## How to reproduce **Seen on:** Windows 11, AMD Radeon RX 6700 XT, AMD driver 26.10.1 (Ryzen 5 5600, 16 GB) **Settings and switches:** `RX_VK_PREPARE_BACKGROUND=1 RX_VK_NO_STATE_LIST=1 HOS_SKIP_OPENING=1`, after an update start (another translator's prepare record kept, caches removed), a cold driver cache. With the state list on, the seed opens before the title and the race can't happen. **Steps:** New Game into Link's house and Kokiri Forest, headless, 480 s. `prepare_background` opens the seed 20 s into play while play misses programs. Count the `miss_note` lines in the game log after the in-play seed opens, and the ones with a `+`. Or run `tests/test_seed_keys_race.py`. **Expected:** Without `RX_VK_SEED_CHECK`, nothing fills `seed_keys` in play, so no `miss_note` line has a `+` and nothing races the reads. **Actual:** On main, the seed's keys go into `seed_keys` while the replay's misses read it: every `miss_note` line after the in-play seed opens has a `+` (135, 150 and 134 of them in three runs). A rehash under a reader can walk freed buckets. The crash itself didn't fire in the runs here; it depends on timing. `tests/test_seed_keys_race.py` fails on main ("seed_open fills seed_keys outside RX_VK_SEED_CHECK"). ## What changed `seed_open()` now puts the seed's keys into `seed_keys` only when `RX_VK_SEED_CHECK=1`, the one switch whose code reads the set. Without it the set stays empty, so the in-play seed open no longer writes a set the renderer is reading. A new test checks this, and the switch gets a row in the switch table. - vk: in `seed_open()` (`gpu/vk/vk_shader.cpp`), every seed stage's key goes into `seed_keys` only when `RX_VK_SEED_CHECK=1` (read once, `seed_check`). - `seed_keys` (a `std::unordered_set`) has one reader: `miss_note`, which marks the replay's program misses (the first 1,500 in play) with the stages the seed holds. - On main, a seed opened in play by `prepare_background` inserted every key while those reads ran. A rehash under a reader can walk freed buckets. - Without `RX_VK_SEED_CHECK` the set now stays empty, and `miss_note` reads an empty set that nothing writes. - tests: `tests/test_seed_keys_race.py` (new) reads `seed_open()` and checks that every `seed_keys.insert` is under `seed_check`, and that `seed_check` is `RX_VK_SEED_CHECK` read once. It fails on main. - tests: `tests/test_seed_reader.py`, which compiles the real `seed_open()` against stand-ins, gets one for `env_on`. Its 20,000 mutations are unchanged. - docs: `docs/development.md`, an `RX_VK_SEED_CHECK` row; it wasn't in the switch table, only in `docs/BAKE.md`. ## Measurements **Verdict:** The fix works and changes nothing else. On main every `miss_note` line after the in-play seed opens has a `+` (the set read while it was filled); with this PR none does (0 of 131, 144, 147). Full 480 s, no crash on both, 3 of 3. The longest frame (median 141.7 s on main, 127.5 s here) and the fps after the load (median 52.0 against 52.2) are within the runs' spread. A fix of a timing-dependent race, so the evidence for the race is the test; the game runs show the fix changes nothing else. Baseline: the numbers were measured on main aa95d35f (2026-11-15) and this PR at c8d151de, before the rebase onto main 16d87c83. The rebase was clean and didn't touch these files' changes. Hardware: Windows 11, AMD Radeon RX 6700 XT, AMD driver 26.10.1, Ryzen 5 5600, 16 GB Scene: the path where the seed is first opened in play. An update start (another translator's prepare record kept, caches removed), `RX_VK_PREPARE_BACKGROUND=1 RX_VK_NO_STATE_LIST=1`, so `prepare_background` opens the seed 20 s into play while play misses programs. Then `HOS_SKIP_OPENING=1`, New Game into Link's house and Kokiri Forest, headless, 480 s, a cold driver cache each run. With the state list on, the seed opens before the title and the race can't happen. Method: `longshot_vk.dll` built from each commit (`RX_VK_ONLY=1 RX_RELEASE=1`, llvm-mingw clang 23) into the same game folder, with a `longshot.exe` built here from main aa95d35f (the same exe for every run), main and this PR alternated, 3 runs each, all six in one sitting. Read from the game log (`miss_note` lines, crash lines) and `RX_VK_FRAME_LOG`. How to reproduce: the scene above, with each build's `longshot_vk.dll`; count the `miss_note` lines with a `+` after the in-play seed opens. | | Before: main @ aa95d35f | After: this PR @ c8d151de | |---|---|---| | full 480 s, no crash | 3 of 3 | 3 of 3 | | `miss_note` lines after the seed opened in play | 135, 150, 134 | 131, 144, 147 | | of them with a `+` (the set read while it was filled) | 135, 150, 134 (all) | 0, 0, 0 | | longest frame (the cold load's compile stall, the same on both) | 141.7 s, 130.9 s, 144.5 s (median 141.7) | 126.9 s, 144.1 s, 127.5 s (median 127.5) | | fps after the load (median frame, from 30 s after it) | 47.5, 52.5, 52.0 (median 52.0) | 51.2, 52.2, 52.8 (median 52.2) | The frame rate after the load climbs for a few minutes while the in-play preparation finishes, so "fps after the load" follows how late the load ended (174-186 s on main, 162-181 s here). Minute by minute from 30 s after the load (the last figure is the run's partial last minute), the runs match: main 32 38 52 52 41 / 32 53 55 53 46 / 40 48 54 55 43, this PR 32 49 53 54 45 / 38 48 53 55 45 / 34 45 57 54 52. The lines name the same programs: the six runs name 145-164 programs each, and every pair shares at least 136. Programs a run named that no run of the other build did: 0, 16 and 0 in main's runs, 0, 1 and 6 in this PR's. The race didn't visibly fire in these six runs; it depends on timing. The same comparison on earlier mains gave the same result: on 1be60eae (3 runs each) `+` on all 130, 140 and 134 of main's lines and on none of the PR's; on 5e072fc8 (2 each) on 130 and 137 against 0 and 0. Full 480 s, no crash in all ten. | | Before: main @ aa95d35f | After: this PR @ c8d151de | |---|---|---| | `tests/test_seed_keys_race.py` | fails ("seed_open fills seed_keys outside RX_VK_SEED_CHECK") | passes | | `tests/run_all.py --jobs 4` | 503 passed, 18 failed, 72 skipped | 504 passed, the same 18 failed, 72 skipped | The 18 fail on main on this PC and touch nothing here: test_appimage_player_build, test_cpm_discovery, test_cpp_preflight, test_crash_dialog, test_env_on, test_lift_cleanup_error, test_linux_preflight, test_make_game_cache, test_make_game_prepare, test_missing_nup, test_oot_state_tap, test_options_budget_once, test_portable_builder_home, test_portable_builder_startup, test_readback_late, test_tested_configurations, test_vk_pgo, test_walk_key. ### Flags and settings No new switch. `RX_VK_SEED_CHECK` (existing) now also decides whether `seed_keys` is filled, and gets its row in docs/development.md. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `RX_VK_SEED_CHECK=1` (existing) | A developer switch: marks the replay's program misses with the seed's stages (`miss_note`'s `+`) | off; `seed_keys` filled on every seed open, switch or not | off; `seed_keys` filled only with the switch on | Without it, the in-play seed open no longer writes the set the renderer reads. With it on, the in-play fill can still race the reads, as before | Helps: checking a seed against what play asks for. Doesn't help: players. Untested with it on in this PR's runs | Off: debugging only, as before | ## Testing **Tested:** - The runs above (Windows 11, RX 6700 XT, AMD 26.10.1), on main aa95d35f and this PR at c8d151de. - `tests/test_seed_keys_race.py`. - `tests/test_seed_reader.py` with clang 23. - `python -I -B tests/run_all.py --jobs 4` on main aa95d35f and this PR at c8d151de (the table above). - After the rebase onto main 16d87c83, at ee028d58: `python -I -B tests/run_all.py --jobs 2`: 200 passed, 66 failed, 355 skipped. The same 66 fail in the same run on main bbe7a078, ten commits earlier (197 passed, 66 failed, 349 skipped; main's newer commits add tests). `tests/test_seed_keys_race.py` passes. This shell had no C or C++ compiler on its path, so most compiled checks were skipped or failed for that, `tests/test_seed_reader.py` among them ("no C++ compiler 'g++'"), on main too. The 66: test_alt_enter, test_appimage_player_build, test_audio_deadline, test_audio_output_errors, test_audio_wave_buffer_release, test_bc_levels, test_bind_memo, test_capture_copy_helpers, test_collect_wide, test_dlss_actor, test_dlss_checks, test_dlss_math, test_draw_binds, test_env_file, test_fps_overlay_order, test_fps_rate, test_fps_stats, test_framegen_auto, test_framegen_gate, test_fsr3_math, test_gpu_choice, test_hd_rumble, test_import_span, test_jobs_wait_runs_queued, test_lift_cache, test_lift_cleanup_error, test_make_game_cache, test_make_game_prepare, test_menu_mouse_scroll, test_mirror_inherit, test_missing_nup, test_movie_upscale_policy, test_nvn_texture_handle, test_oot_jitter, test_options_budget_once, test_pass_hazard, test_pool_span, test_portable_builder_startup, test_present_ahead, test_present_thread, test_prof_clock, test_prompt_auto_face, test_push_state, test_quick_pipelines, test_report_words, test_rt_pool_minimum, test_rumble_mapping, test_rumble_menu, test_rumble_refresh, test_same_bind, test_same_draw, test_same_dyn, test_seed_reader, test_skip_code, test_status_line, test_submitted_page, test_table_track, test_tested_configurations, test_tex_spans_once_a_present, test_texture_layout_sizes, test_ub_gap, test_upscale_independent, test_upscale_label, test_vertex_bind, test_vk_pgo, test_wb_pages. **Not tested:** - Linux: the renderer wasn't built for it here, so the host code wasn't built on both Windows and Linux for this PR. The change is a `static const bool` and an `if`, in code Linux already compiles. - NVIDIA and Intel: the change is the same on every driver, and is only the set's fill. - The game runs after the rebase: the numbers above are from c8d151de on main aa95d35f. The rebase onto 16d87c83 was clean. - `tests/test_seed_reader.py` after the rebase: it passed with clang 23 at c8d151de, but the run at ee028d58 had no C++ compiler, so it failed there as on main. **Must be tested:** - Linux, any GPU: build the renderer, then start with `RX_VK_PREPARE_BACKGROUND=1` and play into Kokiri Forest, expecting a clean build and no crash (by hand: test request T-5QMM). ## Risks **What could break:** Only the debugging marks: without `RX_VK_SEED_CHECK`, `miss_note` reads an empty set, so its lines have no `+`. With `RX_VK_SEED_CHECK=1` the set is filled as before, and so is the race; that's a developer switch. **Turning it off:** Reverting the commit gives main's behaviour. **Compatibility:** `gpu/vk/vk_shader.cpp` is part of the translator's stamp, so every player's programs are translated once more after this lands, as with any release that touches the translator. Saves, `longshot_options.ini` and the vk ABI don't change. ## Issues Found while measuring the in-play shader preparation (#362's shader work). No issue in the tracker is known to come from this race (searched "seed" and "crash"). ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
seed_open() inserted every seed stage's key into seed_keys; miss_note reads it on the replay's program picks (the first
1500 misses in play). A seed opened in play (prepare_background) filled it while those reads ran: a std::unordered_set
rehashed under a reader, which can walk freed buckets. Now filled only when RX_VK_SEED_CHECK=1 asks for the marks.
vk_shader.cpp is part of the translator's stamp: this change translates the programs again once, as any release does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): seed_open fills seed_keys only for RX_VK_SEED_CHECK
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
e867b43417
tests/test_seed_keys_race.py reads seed_open() in gpu/vk/vk_shader.cpp: every seed_keys.insert is under seed_check, and
seed_check is RX_VK_SEED_CHECK read once. It fails on main, where every seed stage's key went in while miss_note read
the set in play. tests/test_seed_reader.py, which compiles the real seed_open against stand-ins, gets one for env_on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
madebyjordan changed title from WIP: fix(vk): seed_keys is filled only for RX_VK_SEED_CHECK, its one reader to fix(vk): seed_keys is filled only for RX_VK_SEED_CHECK, its one reader 2026-11-14 08:08:10 +00:00
docs: RX_VK_SEED_CHECK in the switch table
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
74e7350f26
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Pushed 74e7350f: RX_VK_SEED_CHECK gets a row in docs/development.md's switch table (it was only in docs/BAKE.md), since this changes what the switch does. Docs only; no code change.

Pushed 74e7350f: `RX_VK_SEED_CHECK` gets a row in docs/development.md's switch table (it was only in docs/BAKE.md), since this changes what the switch does. Docs only; no code change.
madebyjordan force-pushed fix/seed-keys-race from 74e7350f26
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 87a2628252
Some checks failed
PR description / Description follows the template (pull_request_target) Failing after 16s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-15 10:00:02 +00:00
Compare
Author
Member

Rebased onto main a00c485c (87a26282; the same three commits, no conflicts) and measured again on main 1be60eae, since #400 and #59 had changed the renderer since the first runs.

  • The race test still fails on main (a00c485c) and passes here.
  • The game runs: 3 each, main and this PR alternated, 480 s from an update start with the seed opened in play. All six ran the full time with no crash. All of main's miss lines after the seed opened had the + mark (130, 140, 134); none of this PR's did.
  • The "fps after the load" row:
    • The medians differ (43.8 vs 40.7), but that follows how late each run's load ended: frame rate climbs for a few minutes after it.
    • Minute by minute the runs match; the description lists them.
    • This PR only leaves a set empty that one log line reads.
  • New exe: main's renderer interface moved to version 22, so these runs used an exe built from main 1be60eae, not nightly-130's.
  • Since 1be60eae main has changed no line of gpu/vk/vk_shader.cpp.
  • run_all: the same 18 failures on main and here; the extra pass is the race test.
Rebased onto main a00c485c (87a26282; the same three commits, no conflicts) and measured again on main 1be60eae, since #400 and #59 had changed the renderer since the first runs. - **The race test** still fails on main (a00c485c) and passes here. - **The game runs:** 3 each, main and this PR alternated, 480 s from an update start with the seed opened in play. All six ran the full time with no crash. All of main's miss lines after the seed opened had the `+` mark (130, 140, 134); none of this PR's did. - **The "fps after the load" row:** - The medians differ (43.8 vs 40.7), but that follows how late each run's load ended: frame rate climbs for a few minutes after it. - Minute by minute the runs match; the description lists them. - This PR only leaves a set empty that one log line reads. - **New exe:** main's renderer interface moved to version 22, so these runs used an exe built from main 1be60eae, not nightly-130's. - **Since 1be60eae** main has changed no line of `gpu/vk/vk_shader.cpp`. - **run_all:** the same 18 failures on main and here; the extra pass is the race test.
madebyjordan force-pushed fix/seed-keys-race from 87a2628252
Some checks failed
PR description / Description follows the template (pull_request_target) Failing after 16s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to c8d151ded6
Some checks failed
PR description / Description follows the template (pull_request_target) Failing after 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-15 15:58:36 +00:00
Compare
Author
Member

Rebased onto main aa95d35f (c8d151de; the same three commits, no conflicts) and measured again there, so the Measurements now name the main the PR sits on.

  • Game runs (the same in-play seed scene, main's exe of aa95d35f, 3 runs each alternated): every miss_note line after the in-play seed opened carries the + on main (135, 150, 134) and none does on this PR (0 of 131, 144, 147). All six went the full 480 s with no crash; fps after the load 52.0 on main against 52.2 here (medians), with the same climb minute by minute.
  • tests/test_seed_keys_race.py: fails on main aa95d35f, passes here.
  • tests/run_all.py --jobs 4: main 503 passed, 18 failed, 72 skipped; this PR 504 passed, the same 18 failed.
Rebased onto main aa95d35f (c8d151de; the same three commits, no conflicts) and measured again there, so the Measurements now name the main the PR sits on. - Game runs (the same in-play seed scene, main's exe of aa95d35f, 3 runs each alternated): every `miss_note` line after the in-play seed opened carries the `+` on main (135, 150, 134) and none does on this PR (0 of 131, 144, 147). All six went the full 480 s with no crash; fps after the load 52.0 on main against 52.2 here (medians), with the same climb minute by minute. - `tests/test_seed_keys_race.py`: fails on main aa95d35f, passes here. - `tests/run_all.py --jobs 4`: main 503 passed, 18 failed, 72 skipped; this PR 504 passed, the same 18 failed.
madebyjordan force-pushed fix/seed-keys-race from c8d151ded6
Some checks failed
PR description / Description follows the template (pull_request_target) Failing after 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to ee028d58b7
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-15 19:38:51 +00:00
Compare
HumanBean deleted branch fix/seed-keys-race 2026-11-15 22:02:50 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!393
No description provided.