fix(vk): count a first start's load at create on the start-up bar #1575

Merged
HumanBean merged 2 commits from dukenheimer/Longshot:fix/start-bar-at-create into main 2026-11-19 07:14:54 +00:00
Contributor

Type: fix · Risk: low · Tested on: Windows 11 (llvm-mingw clang) and Linux (WSL Ubuntu 24.04, g++), game-free; in the game: Steam Deck OLED (RADV) · Needs: none

TL;DR

On the first start after preparing shaders, the start-up screen's bar read 100% while the game was still building pipelines: about 90 seconds on a Steam Deck, with "Loading pipelines 100%" on screen the whole time. The start does its work in two passes, and the bar counted only the first. This PR counts both passes in one total, so the bar stays under 100% and keeps moving until the second pass ends. A new test fails on main and passes here, on Windows and Linux. This changes the bar only: nothing is built differently and nothing gets faster.

Breakdown

  • Who it helps: anyone whose first start after a shader preparation builds pipelines before the title, most visibly Steam Deck players.
  • What was wrong: the first pass reached its own total, and the bar never goes back, so it showed 100% through the second pass.
  • What changes: the bar counts the second pass's steps from the start, so it shows the real progress through both.
  • What does not change: what the start builds and how long it takes; --prepare-shaders' own bar; later starts; every switch and setting.
  • How it was checked: a new game-free test (fails on main, passes here, Windows and Linux), three updated source checks, teeth checks, a syntax build of the changed files against main; in the game: Steam Deck OLED (RADV).
  • What is still open: #1522's slow build and resumability questions, which this PR does not address.
  • Risk: low: a wrong count could only make the bar move unevenly; it can't stop the start or change what is built.

Why

Under RX_VK_LOAD=create, the first start after a preparation runs two passes before the title, both on the bar's last part:

  1. the warm (precompile_warm): every noted pipeline built into the pipeline cache;
  2. load at create (precompile_at_create): each mesh fallback program's compute pipelines, then the kept programs' noted pipelines.

Each reported its own done of total. The warm reached its total, PrepareBar never goes back, so the screen read 100% for the whole second pass. On a Steam Deck at main 7daafa7a that was 91 s, with the log saying "start-up: pipelines 1883 of 4568, 100% of all". This is the same plateau family as #714, which fixed it for the predicted pipelines.

See #1522: its "stuck at Loading Pipelines 100%" matches this symptom. #1522 also asks about the slow build itself, a UI that stopped taking clicks, and whether a restart resumes the work. This PR does none of those, and #1522 has no log tying them to this cause, so it doesn't close the issue.

How to reproduce

Seen on: Steam Deck (SteamOS, RADV), main 7daafa7a
Settings and switches: defaults (RX_VK_LOAD=create); a GPU that draws mesh programs through the compute fallback, as the Deck does
Steps: prepare the shaders (--prepare-shaders), then start the game for the first time after that preparation, and watch the start-up screen and longshot_log.txt
Expected: the bar under 100% while "load at create: X of Y steps" is still counting
Actual: "start-up: pipelines N of 4568, 100% of all" from N = 31 to 1883, for about 90 s, then "load at create: its pipelines took 91 s"

What changed

The two passes are counted as one, as #714 did for the predicted pipelines. The warm's steps come first. The second pass's steps are counted before the warm, from the same programs it will be given, and they stand in the total until the pass counts them itself.

  • vk: new gpu/vk/start_steps.h:
    • begin / warm / create / end wrap the progress callback. The warm reports done of total + steps; load at create reports warm + done of warm + total; end reports the full count when the pass returns.
    • create_steps(taken, programs) counts the second pass's steps as precompile_at_create does (total = fallbacks + kept):
      • every variant of each key whose kind-4 records program_cache_load_some(..., fallbacks) takes;
      • those keys' variants already in memory;
      • the mesh fallback programs in memory under other keys (fallback_loaded::each).
    • At least one step is held whenever a second pass follows, so the warm's end is never the bar's.
  • vk: precompile_run (gpu/vk/vk_draw.cpp) wraps both passes' progress through start_steps:
    • a --prepare-shaders run (LONGSHOT_PREPARE_ONLY) has no second pass, so it holds no steps and its warm still ends at 100%;
    • a start whose notes are already covered runs the second pass alone, from 0.
  • vk: program_cache_fallback_steps() (gpu/vk/vk_progcache.cpp, declared in vk_progcache.h and vk_pipelines.h): a snapshot of the records program_cache_load_some(..., fallbacks) would take (under disk_mu), then create_steps under shader_mu. The warm only borrows programs, so the count taken before it still holds.
  • tests: new tests/test_start_progress_at_create.py:
    • it cuts precompile_run's at-create branch from the source, runs it with stand-ins for the two passes, and feeds the real PrepareBar;
    • plus a count case against the real create_steps, and source checks that the snapshot takes what load_some takes and that precompile_at_create still counts fallbacks + kept.
      +'+s old call text. They now read the new calls and keep their guards: the lost-sample check still comes before the covered-notes decision.'s old call text. They now read the new calls and keep their guards: the lost-sample check still comes before the covered-notes decision.

A follow-up idea for HumanBean, not in this PR: the preparation's own process returns before load at create (LONGSHOT_PREPARE_ONLY), so the mesh fallback programs' compute pipelines (2284 programs, 4568 steps on the Deck) are compiled only at the game's first start after each preparation. That's the Deck's ~90 s first start; later starts find them in the caches ("none built", ~9 s). Building them in --prepare-shaders would move that time into the preparation.

Measurements

Verdict: nothing to time: this changes what the bar shows, not how long anything takes. The before and after are the new test's output, and the start-up log lines in the game run.

Hardware: Windows 11, llvm-mingw clang (the builder's); Linux: WSL Ubuntu 24.04, g++
Scene: game-free (the test's stand-ins for the two passes); in the game, the first windowed start after a Most preparation on a Steam Deck OLED, defaults (RX_VK_LOAD=create)
Method: python -I -B tests/test_start_progress_at_create.py on main and on this PR; the touched checks through tests/run_all.py; in the game, the log's start-up: pipelines N of M, X% of all lines beside load at create: X of Y steps, one attended run
How to reproduce: python -I -B tests/test_start_progress_at_create.py [--cxx g++]; in the game, --prepare-shaders, then start the game and read longshot_log.txt's start-up lines

Before: main @ 1055077d After: this PR @ d13bdcbf
New check, Windows clang fails (bar at 100% through the second pass) passes
New check, Linux g++ fails (same) passes
main (Windows and Linux):
FAIL: the start-up bar through a first start's two passes:
FAIL line 92: under
FAIL line 93: after_warm.size() > 2 && after_warm[after_warm.size() - 2] > after_warm.front()
FAIL line 102: under

this PR (Windows and Linux):
PASS: the bar counts the load-at-create pass after the warm: under 100% until it ends

Teeth checks, each breaking the fix on purpose; each makes the new check fail (run on 430eef4f; line numbers from then):

  • the count by keys instead of variants: fails at line 148 (the count case);
  • resident programs left out: fails at lines 148 and 149;
  • no step held for the second pass: fails at line 106 (under 100%).

Before the rebase onto 430eef4f, run_all.py --changed (151 checks) gave Windows 142 pass / 9 fail and Linux 117 pass / 8 fail. The same checks fail on main 7daafa7a on each OS: on Windows test_fsr_uniform_ownership, test_draw_stream_visibility, test_dev_packs, test_pipeline_play_cache, test_compute_warm_apart, test_linux_pressure, test_upscaler_rows, test_vk_occlusion_queries and test_recorder_sync; on Linux byte_compile_tracked, test_bake_ds, test_dev_packs, test_linux_pressure, test_pipeline_cache_save, test_pipeline_play_cache, test_shader_module_guard and test_upscaler_rows. test_recorder_sync's failure is the missing vk_new.h that #1363 fixes.

A syntax build of vk_draw.cpp and vk_progcache.cpp with the build's flags gives the same diagnostics on main and here (117 and 1).

After the rebase onto 430eef4f (which changed the warm, #1567): the new check fails on main 430eef4f and passes here, on Windows and Linux. The new check, test_bounded_wait, test_cold_cache_check, test_warm_bounded, test_fallback_loaded, test_doc_anchors, test_compute_warm_apart, test_precompile_warm_computes and test_pipeline_state_computes all pass on both (9 of 9). The syntax build again matches main (117 and 1).

After the rebase onto 1055077d: main's #789 added pcache_init() and pcache_file_rejected to precompile_run's at-create branch, so the new test's fixture has two stand-ins for them. #789 also added a check in test_pcache_stamp on the old precompile_warm call text; it now reads the new calls, and still fails if the dropped or refused file's removal of the marker comes after the covered-notes decision. The new check fails on main 1055077d and passes here, on Windows and Linux; the new check, test_bounded_wait, test_cold_cache_check, test_warm_bounded, test_pcache_stamp, test_fallback_loaded and test_doc_anchors pass on both (7 of 7). run_all.py --changed on Windows: 146 passed, 9 failed, 5 skipped; all 9 fail on main 1055077d too (test_dev_packs, test_draw_stream_visibility, test_fsr_uniform_ownership, test_linux_pressure, test_pipeline_play_cache, test_prepare_cache_save, test_recorder_sync, test_upscaler_rows, test_vk_occlusion_queries).

Flags and settings

None. The diff reads LONGSHOT_PREPARE_ONLY, which already exists (the preparation's own process; switches.def), and changes nothing about it.

Testing

Tested: In the game on a Steam Deck OLED (AMD Custom GPU 0932, RADV VANGOGH, Mesa 26.2.0-devel git-5c65d4fc31, SteamOS Game Mode, 1280x800 at 90 Hz, 15 W), run by our Deck agent. The renderer was built from 5c835025 on the m430 base (main 430eef4f). The copy was freshly prepared on Most, and this was its first windowed start after that preparation, the case in How to reproduce.

  • The bar's total is now the warm's 34,710 steps plus load at create's 4,568 (39,278).
  • Through load at create, the log's bar lines rose from "pipelines 35041 of 39278, 89%" (load at create 205 of 4568, 10 s) to "36533 of 39278, 93%" (1337 of 4568, 70 s). They reached the end of the count with "load at create: its pipelines took 88 s". On main 7daafa7a the same stretch logged "pipelines N of 4568, 100% of all" throughout.
  • The log prints "100% of all" at 39276 of 39278 (two steps left) because of its "%.0f" rounding; the screen floors to 99% until the work is done.
  • Screen captures, sampled about every 15 s, showed "Loading pipelines" at 90% (35,369 / 39,278) and 93% (36,554 / 39,278), then the title. They are kept on the PC.
  • The shaders took 101.6 s in total, against m430's 101.0 s. That's one sample each, as expected for a display-only change, not a speed comparison.
  • The game then played normally, with no GPU fault, timeout or reset.

Game-free, on Windows (llvm-mingw clang) and Linux (WSL, g++): the new check fails on main and passes here. test_bounded_wait, test_cold_cache_check, test_warm_bounded, test_fallback_loaded and test_doc_anchors pass. The three teeth checks fail as expected.

Not tested: the time-left estimate, which still jumps during load at create (about 15 s, then 1 to 4 min); that is outside this fix. The bar on a GPU with mesh shaders, where load at create has no fallback programs: the held step and end() keep the bar's end where it was, and the test covers that case (an empty second pass ends at 100%). The full run_all.py was not rerun after the rebases: --changed ran on 7daafa7a and again on 1055077d. The in-game run was on 5c835025 (main 430eef4f); the rebase onto 1055077d changed none of the fix

Must be tested: None.

Risks

What could break: the bar's movement on the first start after a preparation. A count that differs from the second pass's own total can only make the bar move unevenly; it can't stop the start, change what is built, or touch later starts.

Turning it off: revert the commit.

Compatibility: Nothing changes: no caches, saves, options or the vk ABI.

Issues

See #1522

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).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • 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.
  • 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.
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux: the Deck's renderer build from this branch. Windows: vk_draw.cpp and vk_progcache.cpp compiled with the build's flags, -fsyntax-only, with the same diagnostics as main.)
**Type:** fix · **Risk:** low · **Tested on:** Windows 11 (llvm-mingw clang) and Linux (WSL Ubuntu 24.04, g++), game-free; in the game: Steam Deck OLED (RADV) · **Needs:** none ## TL;DR On the first start after preparing shaders, the start-up screen's bar read 100% while the game was still building pipelines: about 90 seconds on a Steam Deck, with "Loading pipelines 100%" on screen the whole time. The start does its work in two passes, and the bar counted only the first. This PR counts both passes in one total, so the bar stays under 100% and keeps moving until the second pass ends. A new test fails on main and passes here, on Windows and Linux. This changes the bar only: nothing is built differently and nothing gets faster. ## Breakdown - **Who it helps:** anyone whose first start after a shader preparation builds pipelines before the title, most visibly Steam Deck players. - **What was wrong:** the first pass reached its own total, and the bar never goes back, so it showed 100% through the second pass. - **What changes:** the bar counts the second pass's steps from the start, so it shows the real progress through both. - **What does not change:** what the start builds and how long it takes; --prepare-shaders' own bar; later starts; every switch and setting. - **How it was checked:** a new game-free test (fails on main, passes here, Windows and Linux), three updated source checks, teeth checks, a syntax build of the changed files against main; in the game: Steam Deck OLED (RADV). - **What is still open:** #1522's slow build and resumability questions, which this PR does not address. - **Risk:** low: a wrong count could only make the bar move unevenly; it can't stop the start or change what is built. ## Why Under `RX_VK_LOAD=create`, the first start after a preparation runs two passes before the title, both on the bar's last part: 1. the warm (`precompile_warm`): every noted pipeline built into the pipeline cache; 2. load at create (`precompile_at_create`): each mesh fallback program's compute pipelines, then the kept programs' noted pipelines. Each reported its own done of total. The warm reached its total, `PrepareBar` never goes back, so the screen read 100% for the whole second pass. On a Steam Deck at main 7daafa7a that was 91 s, with the log saying "start-up: pipelines 1883 of 4568, 100% of all". This is the same plateau family as #714, which fixed it for the predicted pipelines. See #1522: its "stuck at Loading Pipelines 100%" matches this symptom. #1522 also asks about the slow build itself, a UI that stopped taking clicks, and whether a restart resumes the work. This PR does none of those, and #1522 has no log tying them to this cause, so it doesn't close the issue. ## How to reproduce **Seen on:** Steam Deck (SteamOS, RADV), main 7daafa7a **Settings and switches:** defaults (`RX_VK_LOAD=create`); a GPU that draws mesh programs through the compute fallback, as the Deck does **Steps:** prepare the shaders (`--prepare-shaders`), then start the game for the first time after that preparation, and watch the start-up screen and `longshot_log.txt` **Expected:** the bar under 100% while "load at create: X of Y steps" is still counting **Actual:** "start-up: pipelines N of 4568, 100% of all" from N = 31 to 1883, for about 90 s, then "load at create: its pipelines took 91 s" ## What changed The two passes are counted as one, as #714 did for the predicted pipelines. The warm's steps come first. The second pass's steps are counted before the warm, from the same programs it will be given, and they stand in the total until the pass counts them itself. - vk: new `gpu/vk/start_steps.h`: - `begin` / `warm` / `create` / `end` wrap the progress callback. The warm reports `done of total + steps`; load at create reports `warm + done of warm + total`; `end` reports the full count when the pass returns. - `create_steps(taken, programs)` counts the second pass's steps as `precompile_at_create` does (`total = fallbacks + kept`): - every variant of each key whose kind-4 records `program_cache_load_some(..., fallbacks)` takes; - those keys' variants already in memory; - the mesh fallback programs in memory under other keys (`fallback_loaded::each`). - At least one step is held whenever a second pass follows, so the warm's end is never the bar's. - vk: `precompile_run` (`gpu/vk/vk_draw.cpp`) wraps both passes' progress through `start_steps`: - a `--prepare-shaders` run (`LONGSHOT_PREPARE_ONLY`) has no second pass, so it holds no steps and its warm still ends at 100%; - a start whose notes are already covered runs the second pass alone, from 0. - vk: `program_cache_fallback_steps()` (`gpu/vk/vk_progcache.cpp`, declared in `vk_progcache.h` and `vk_pipelines.h`): a snapshot of the records `program_cache_load_some(..., fallbacks)` would take (under `disk_mu`), then `create_steps` under `shader_mu`. The warm only borrows programs, so the count taken before it still holds. - tests: new `tests/test_start_progress_at_create.py`: - it cuts `precompile_run`'s at-create branch from the source, runs it with stand-ins for the two passes, and feeds the real `PrepareBar`; - plus a count case against the real `create_steps`, and source checks that the snapshot takes what `load_some` takes and that `precompile_at_create` still counts `fallbacks + kept`. +'+s old call text. They now read the new calls and keep their guards: the lost-sample check still comes before the covered-notes decision.'s old call text. They now read the new calls and keep their guards: the lost-sample check still comes before the covered-notes decision. **A follow-up idea for HumanBean, not in this PR:** the preparation's own process returns before load at create (`LONGSHOT_PREPARE_ONLY`), so the mesh fallback programs' compute pipelines (2284 programs, 4568 steps on the Deck) are compiled only at the game's first start after each preparation. That's the Deck's ~90 s first start; later starts find them in the caches ("none built", ~9 s). Building them in `--prepare-shaders` would move that time into the preparation. ## Measurements **Verdict:** nothing to time: this changes what the bar shows, not how long anything takes. The before and after are the new test's output, and the start-up log lines in the game run. Hardware: Windows 11, llvm-mingw clang (the builder's); Linux: WSL Ubuntu 24.04, g++ Scene: game-free (the test's stand-ins for the two passes); in the game, the first windowed start after a Most preparation on a Steam Deck OLED, defaults (RX_VK_LOAD=create) Method: `python -I -B tests/test_start_progress_at_create.py` on main and on this PR; the touched checks through `tests/run_all.py`; in the game, the log's `start-up: pipelines N of M, X% of all` lines beside `load at create: X of Y steps`, one attended run How to reproduce: `python -I -B tests/test_start_progress_at_create.py [--cxx g++]`; in the game, `--prepare-shaders`, then start the game and read `longshot_log.txt`'s start-up lines | | Before: main @ 1055077d | After: this PR @ d13bdcbf | |---|---|---| | New check, Windows clang | fails (bar at 100% through the second pass) | passes | | New check, Linux g++ | fails (same) | passes | ``` main (Windows and Linux): FAIL: the start-up bar through a first start's two passes: FAIL line 92: under FAIL line 93: after_warm.size() > 2 && after_warm[after_warm.size() - 2] > after_warm.front() FAIL line 102: under this PR (Windows and Linux): PASS: the bar counts the load-at-create pass after the warm: under 100% until it ends ``` Teeth checks, each breaking the fix on purpose; each makes the new check fail (run on 430eef4f; line numbers from then): - the count by keys instead of variants: fails at line 148 (the count case); - resident programs left out: fails at lines 148 and 149; - no step held for the second pass: fails at line 106 (under 100%). Before the rebase onto 430eef4f, `run_all.py --changed` (151 checks) gave Windows 142 pass / 9 fail and Linux 117 pass / 8 fail. The same checks fail on main 7daafa7a on each OS: on Windows test_fsr_uniform_ownership, test_draw_stream_visibility, test_dev_packs, test_pipeline_play_cache, test_compute_warm_apart, test_linux_pressure, test_upscaler_rows, test_vk_occlusion_queries and test_recorder_sync; on Linux byte_compile_tracked, test_bake_ds, test_dev_packs, test_linux_pressure, test_pipeline_cache_save, test_pipeline_play_cache, test_shader_module_guard and test_upscaler_rows. test_recorder_sync's failure is the missing `vk_new.h` that #1363 fixes. A syntax build of `vk_draw.cpp` and `vk_progcache.cpp` with the build's flags gives the same diagnostics on main and here (117 and 1). After the rebase onto 430eef4f (which changed the warm, #1567): the new check fails on main 430eef4f and passes here, on Windows and Linux. The new check, test_bounded_wait, test_cold_cache_check, test_warm_bounded, test_fallback_loaded, test_doc_anchors, test_compute_warm_apart, test_precompile_warm_computes and test_pipeline_state_computes all pass on both (9 of 9). The syntax build again matches main (117 and 1). After the rebase onto 1055077d: main's #789 added `pcache_init()` and `pcache_file_rejected` to `precompile_run`'s at-create branch, so the new test's fixture has two stand-ins for them. #789 also added a check in `test_pcache_stamp` on the old `precompile_warm` call text; it now reads the new calls, and still fails if the dropped or refused file's removal of the marker comes after the covered-notes decision. The new check fails on main 1055077d and passes here, on Windows and Linux; the new check, test_bounded_wait, test_cold_cache_check, test_warm_bounded, test_pcache_stamp, test_fallback_loaded and test_doc_anchors pass on both (7 of 7). `run_all.py --changed` on Windows: 146 passed, 9 failed, 5 skipped; all 9 fail on main 1055077d too (test_dev_packs, test_draw_stream_visibility, test_fsr_uniform_ownership, test_linux_pressure, test_pipeline_play_cache, test_prepare_cache_save, test_recorder_sync, test_upscaler_rows, test_vk_occlusion_queries). ### Flags and settings None. The diff reads `LONGSHOT_PREPARE_ONLY`, which already exists (the preparation's own process; `switches.def`), and changes nothing about it. ## Testing **Tested:** In the game on a Steam Deck OLED (AMD Custom GPU 0932, RADV VANGOGH, Mesa 26.2.0-devel git-5c65d4fc31, SteamOS Game Mode, 1280x800 at 90 Hz, 15 W), run by our Deck agent. The renderer was built from 5c835025 on the m430 base (main 430eef4f). The copy was freshly prepared on Most, and this was its first windowed start after that preparation, the case in How to reproduce. - The bar's total is now the warm's 34,710 steps plus load at create's 4,568 (39,278). - Through load at create, the log's bar lines rose from "pipelines 35041 of 39278, 89%" (load at create 205 of 4568, 10 s) to "36533 of 39278, 93%" (1337 of 4568, 70 s). They reached the end of the count with "load at create: its pipelines took 88 s". On main 7daafa7a the same stretch logged "pipelines N of 4568, 100% of all" throughout. - The log prints "100% of all" at 39276 of 39278 (two steps left) because of its "%.0f" rounding; the screen floors to 99% until the work is done. - Screen captures, sampled about every 15 s, showed "Loading pipelines" at 90% (35,369 / 39,278) and 93% (36,554 / 39,278), then the title. They are kept on the PC. - The shaders took 101.6 s in total, against m430's 101.0 s. That's one sample each, as expected for a display-only change, not a speed comparison. - The game then played normally, with no GPU fault, timeout or reset. Game-free, on Windows (llvm-mingw clang) and Linux (WSL, g++): the new check fails on main and passes here. `test_bounded_wait`, `test_cold_cache_check`, `test_warm_bounded`, `test_fallback_loaded` and `test_doc_anchors` pass. The three teeth checks fail as expected. **Not tested:** the time-left estimate, which still jumps during load at create (about 15 s, then 1 to 4 min); that is outside this fix. The bar on a GPU with mesh shaders, where load at create has no fallback programs: the held step and `end()` keep the bar's end where it was, and the test covers that case (an empty second pass ends at 100%). The full `run_all.py` was not rerun after the rebases: `--changed` ran on 7daafa7a and again on 1055077d. The in-game run was on 5c835025 (main 430eef4f); the rebase onto 1055077d changed none of the fix **Must be tested:** None. ## Risks **What could break:** the bar's movement on the first start after a preparation. A count that differs from the second pass's own total can only make the bar move unevenly; it can't stop the start, change what is built, or touch later starts. **Turning it off:** revert the commit. **Compatibility:** Nothing changes: no caches, saves, options or the vk ABI. ## Issues See #1522 ## 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] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [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] 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] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. (Linux: the Deck's renderer build from this branch. Windows: `vk_draw.cpp` and `vk_progcache.cpp` compiled with the build's flags, `-fsyntax-only`, with the same diagnostics as main.)
Author
Contributor

Tested in game: Steam Deck OLED (AMD Custom GPU 0932, RADV VANGOGH, Mesa 26.2.0-devel git-5c65d4fc31, SteamOS Game Mode, 1280x800 at 90 Hz, 15 W), renderer built from 5c835025 on m430 (main 430eef4f), first windowed start after a fresh Most --prepare-shaders. The bar total is the warm plus load at create (34,710 + 4,568 = 39,278). Through load at create the start-up lines rose from "pipelines 35041 of 39278, 89%" (205 of 4568 steps, 10 s) to "36533 of 39278, 93%" (1337 of 4568, 70 s), and reached the end of the count with "load at create: its pipelines took 88 s". On main 7daafa7a the same stretch read "N of 4568, 100% of all" throughout. Screen captures showed "Loading pipelines" at 90% and 93%, then the title. Shaders took 101.6 s (m430: 101.0 s, one sample each). The game then played normally, with no GPU fault, timeout or reset. Run by our Deck agent.

Tested in game: Steam Deck OLED (AMD Custom GPU 0932, RADV VANGOGH, Mesa 26.2.0-devel git-5c65d4fc31, SteamOS Game Mode, 1280x800 at 90 Hz, 15 W), renderer built from 5c835025 on m430 (main 430eef4f), first windowed start after a fresh Most --prepare-shaders. The bar total is the warm plus load at create (34,710 + 4,568 = 39,278). Through load at create the start-up lines rose from "pipelines 35041 of 39278, 89%" (205 of 4568 steps, 10 s) to "36533 of 39278, 93%" (1337 of 4568, 70 s), and reached the end of the count with "load at create: its pipelines took 88 s". On main 7daafa7a the same stretch read "N of 4568, 100% of all" throughout. Screen captures showed "Loading pipelines" at 90% and 93%, then the title. Shaders took 101.6 s (m430: 101.0 s, one sample each). The game then played normally, with no GPU fault, timeout or reset. Run by our Deck agent.
dukenheimer force-pushed fix/start-bar-at-create from 5c835025b4
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
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
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
to d13bdcbf81
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
2026-11-19 01:49:57 +00:00
Compare
HumanBean left a comment

From the code and the evidence, this looks ready. I found nothing blocking.

I went through the bar's arithmetic against PrepareBar (gpu/vk/vk_progress.h) and both load modes:

  • Past 100% / backwards: warm reports done of total + after, and after is at least 1 whenever a second pass follows, so the warm can't fill the bar. create reports w + done of w + total, and done <= total. If the count taken before the warm is off, the bar's total changes when load at create starts. A count that was too high makes the bar jump forward. A count that was too low makes it wait. PrepareBar::fraction keeps the highest value shown and holds at 0.999 until every part is over, so it never moves backwards or past 100%.
  • Division by zero: end() reports nothing when the count is 0. create gets no call with a total of 0, because precompile_at_create starts no workers when it has nothing to do (bounded_wait::End::kDone). The console path's done * 100 / total (vk_main.cpp) therefore never sees a new (x, 0).
  • Threads: both passes report from the thread that waits (the report callbacks of warm_bounded::run and bounded_wait::wait), so the new atomics are not contended. program_cache_fallback_steps takes disk_mu and then shader_mu, never both at once. The warm uses program_cache_borrow, which leaves the records in place, so the snapshot taken before the warm still matches what program_cache_load_some({}, ..., false, true) takes afterwards.
  • RX_VK_LOAD=start: programs_load_at_create() is false, so the new code never runs. A --prepare-shaders run (then false, nothing held) and a start whose notes are already covered (after = 0, load at create alone from 0) behave as on main. A warm that leaves no marker falls through to the start path, which still gets its own progress.
  • Cost: one copy of the kind-4 records' index and one pass over programs, once per start, and only on the first start after a preparation.

Suggestions (none block):

  • On a GPU with mesh shaders, load at create has no fallback programs, so the warm now holds its one step. Between the end of the warm and end(), the bar reads 99% with the time-left text, where main read 100% with "Getting the game ready" (waiting_text). That stretch covers the cache save, which shows its own text, and load at create's setup. It should be short, but a desktop NVIDIA or RDNA2+ start would confirm it doesn't sit at "a few seconds left".
  • The description has a garbled line in "What changed" (+'+s old call text. ..., printed twice).

Measurements: a display-only change with nothing to time is the right verdict. The evidence is valid: the new check fails on main 1055077d and passes here, on Windows clang and Linux g++. The Deck OLED log before and after covers the same first start following a Most preparation: main logged "N of 4568, 100% of all" for about 90 s, and this PR logs 89% climbing to 93% through load at create. The shader time is 101.6 s against 101.0 s, one run each, which is not presented as a speed claim.

Testing: run in the game on a Steam Deck OLED (RADV), the hardware where the bug shows. Not run: a GPU with mesh shaders (NVIDIA RTX, AMD RX 6000+), for the held-step case above. That only affects how the bar looks.

Merge order: the new line in gpu/vk/vk_pipelines.h sits next to the line #345 rewords (load_fallback_path's comment). Whichever merges second gets a conflict there that is resolved by keeping both lines.

From the code and the evidence, this looks ready. I found nothing blocking. I went through the bar's arithmetic against `PrepareBar` (`gpu/vk/vk_progress.h`) and both load modes: - **Past 100% / backwards:** `warm` reports `done` of `total + after`, and `after` is at least 1 whenever a second pass follows, so the warm can't fill the bar. `create` reports `w + done` of `w + total`, and `done <= total`. If the count taken before the warm is off, the bar's total changes when load at create starts. A count that was too high makes the bar jump forward. A count that was too low makes it wait. `PrepareBar::fraction` keeps the highest value shown and holds at 0.999 until every part is over, so it never moves backwards or past 100%. - **Division by zero:** `end()` reports nothing when the count is 0. `create` gets no call with a total of 0, because `precompile_at_create` starts no workers when it has nothing to do (`bounded_wait::End::kDone`). The console path's `done * 100 / total` (`vk_main.cpp`) therefore never sees a new `(x, 0)`. - **Threads:** both passes report from the thread that waits (the report callbacks of `warm_bounded::run` and `bounded_wait::wait`), so the new atomics are not contended. `program_cache_fallback_steps` takes `disk_mu` and then `shader_mu`, never both at once. The warm uses `program_cache_borrow`, which leaves the records in place, so the snapshot taken before the warm still matches what `program_cache_load_some({}, ..., false, true)` takes afterwards. - **`RX_VK_LOAD=start`:** `programs_load_at_create()` is false, so the new code never runs. A `--prepare-shaders` run (`then` false, nothing held) and a start whose notes are already covered (`after = 0`, load at create alone from 0) behave as on main. A warm that leaves no marker falls through to the start path, which still gets its own `progress`. - **Cost:** one copy of the kind-4 records' index and one pass over `programs`, once per start, and only on the first start after a preparation. Suggestions (none block): - On a GPU with mesh shaders, load at create has no fallback programs, so the warm now holds its one step. Between the end of the warm and `end()`, the bar reads 99% with the time-left text, where main read 100% with "Getting the game ready" (`waiting_text`). That stretch covers the cache save, which shows its own text, and load at create's setup. It should be short, but a desktop NVIDIA or RDNA2+ start would confirm it doesn't sit at "a few seconds left". - The description has a garbled line in "What changed" (`+'+s old call text. ...`, printed twice). Measurements: a display-only change with nothing to time is the right verdict. The evidence is valid: the new check fails on main 1055077d and passes here, on Windows clang and Linux g++. The Deck OLED log before and after covers the same first start following a Most preparation: main logged "N of 4568, 100% of all" for about 90 s, and this PR logs 89% climbing to 93% through load at create. The shader time is 101.6 s against 101.0 s, one run each, which is not presented as a speed claim. Testing: run in the game on a Steam Deck OLED (RADV), the hardware where the bug shows. Not run: a GPU with mesh shaders (NVIDIA RTX, AMD RX 6000+), for the held-step case above. That only affects how the bar looks. Merge order: the new line in `gpu/vk/vk_pipelines.h` sits next to the line https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/345 rewords (`load_fallback_path`'s comment). Whichever merges second gets a conflict there that is resolved by keeping both lines.
@ -0,0 +38,4 @@
/// The passes of this start reported to progress. then: a second pass follows the warm, of `steps` (create_steps)
inline void begin(Progress progress, bool then, size_t steps) {
warmed = 0, created = 0, after = then ? (steps ? steps : 1) : 0;
Owner

On a GPU with mesh shaders create_steps is 0 (no kind-4 records), so this holds one step. The bar then reads 99% with the time-left text from the end of the warm to end(), where main read 100% and "Getting the game ready". It should be brief, but it's worth a look on a desktop GPU.

On a GPU with mesh shaders `create_steps` is 0 (no kind-4 records), so this holds one step. The bar then reads 99% with the time-left text from the end of the warm to `end()`, where main read 100% and "Getting the game ready". It should be brief, but it's worth a look on a desktop GPU.
HumanBean deleted branch fix/start-bar-at-create 2026-11-19 07:14:55 +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
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!1575
No description provided.