WIP: perf(vk): a program load no draw asked for is published when the game frees its programs (RX_VK_LOAD_RETIRE=0 to disable) #2031

Draft
siantm wants to merge 3 commits from siantm/Longshot:perf/vk-load-retire into main
Contributor

Summary

With programs loaded at create (RX_VK_LOAD=create), a load job leaves job_by_key, and the count that
programs_load_wait's first test reads goes down, only when a draw's pick asks for one of its keys (load_publish).
The game makes programs it never draws: their jobs stayed for the session, holding what they read, and with one such job
the count never came back to 0, so every slow pick took jobs_mu and looked its key up for nothing.

With this, the game's free call of the last program of a unit notes the unit's job under that call's
serial, only if a job no pick has published exists (programs_freed; no lock a pick holds while it translates), and
the replay's part of that same call (do_program_released, in the stream's order, through the synchronous, queued and
held paths alike: every draw recorded before the free has been replayed, none after it) takes that note only and
publishes the job if it is done, under shader_mu, exactly as a pick of one of its keys would have
(programs_retire_freed). A job not done then is kept once, with no cap, and published at the replay's next present
or release once its worker is done (load_done tells the replay; programs_retire_ready, 64 at most a pass).
load_publish no longer takes the job's own lock (every caller holds shader_mu and has seen the job done), so a
worker set aside after it finished holds no pick or release up. With the switch off nothing is indexed by unit, looked
up or noted. programs_life_flag is an atomic stored once. With RX_VK_LOG_PROGRAM_LIFE=1 the census counts the
slow picks that looked a key up (and found none) and the retire passes and their time. gpu/vk/vk_shader.cpp is
unchanged, so the translator's stamp is too. The result expected: the slow picks no longer take the jobs' lock once
the unused loads are gone; not measured yet.

The switch: RX_VK_LOAD_RETIRE (new, a kill switch, bool, its row in gpu/vk/switches.def), on by default as
docs/dev/standards.md (Switches) asks of a switch's first push; read once at the first load queued at create or free
call; =0 notes nothing and such loads wait for a pick, as on main.

From bd3ea307 on exp/x86-asm-sync (there the call was made from program_released in vk_shader.cpp; here from
do_program_released).

Read first: load_queue, programs_freed, programs_retire_freed and programs_retire_ready in
gpu/vk/vk_programs.cpp, do_program_released and log_frame_stats in gpu/vk/vk_replay.cpp, then
tests/test_program_load_wait.py.

Testing

Tested: Windows 11, i7-9700, RTX 4060, the builder's llvm-mingw clang 23; head 5149692a on main 9dd41326. The checks ran at bfac5c28 on main b62932a9, the same commits before a rebase onto 9dd41326, which added only lift files (#1905) that none of these checks reads. Light queue jobs fb-2029-3 and fb-2029-4 of this PC's job queue (the first found compile errors in the new fixtures, fixed before the second), each check in a hidden console through tests/run_all.py --strict --exact --timeout 1200 --jobs 2: tests/test_program_load_wait.py (the fixture with the switch set, unset and 0, the switch's read included), tests/test_program_life_clock.py and tests/test_switch_table.py: 3 passed. At the test commit bd1607fd tests/test_program_load_wait.py fails, as expected (it does not build against the earlier code: no load_queue, no serial on the release). The Windows game build's own compile of gpu/vk/vk_programs.cpp and gpu/vk/vk_replay.cpp (syntax only) passes. Not run this round: every check --changed picks (a heavy batch), the Linux-target compile (the local tool could not read its build profile), tests/test_vbytes.py (hangs on this PC).

It has NOT run in the game on this PC yet.

Still to test:

  • Windows 11, i7-9700, RTX 4060 (this PC), RX_VK_LOAD=create, RX_VK_LOG_PROGRAM_LIFE=1: cold and warm scene
    transitions (Kokiri Forest into Hyrule Field and back, Hyrule Field into Castle Town Market), on main @ 9dd41326, this branch with RX_VK_LOAD_RETIRE=0 and this branch unset (on), each warmed a minute, interleaved (ABC ABC ABC), expecting
    the same picture and no FATAL, loads published at free calls counted unset, fewer slow-pick lookups unset than with =0
    in the census line, no longer transition hitches, and average fps, 1% lows, median and p99 frame times and RAM and
    VRAM of this branch unset at least those of the other two; a difference beyond the runs' spread is a gain or a loss,
    one within it is no difference measured (by hand)
  • Linux NVIDIA and AMD, Windows AMD and Intel, Steam Deck: the same transitions, main, this branch with RX_VK_LOAD_RETIRE=0 and unset, warmed and interleaved, expecting the same picture and no FATAL (the test farm: linux+nvidia,
    linux+amd, windows+amd, windows+intel, steamdeck: Kokiri Forest into Hyrule Field and back and into Castle Town
    Market, RX_VK_LOAD=create, main @ 9dd41326, this branch with RX_VK_LOAD_RETIRE=0 and unset, warmed up, interleaved,
    the log, frame times and a screenshot)
  • Linux: run python3 -I -B tests/test_program_load_wait.py --cxx g++, expecting PASS (by hand)
  • A PC with pre-commit and ruff installed: mise run test and mise run lint at this head, expecting every failure to
    fail on main too and lint to pass (by hand; neither tool is installed on this PC)

Measurements

Verdict: not measured in play yet: no micro-benchmark of this port and no run in the game on this PC yet. RX_VK_LOAD_RETIRE
ships on, as docs/dev/standards.md (Switches) asks of a switch's first push (=0 is main's way); the in-game A/B
(unset against =0 and main) in Still to test decides whether it stays.

Risks

What could break (on, the default): a job published while a draw still needs it would make that draw's pick load the program
again (a hitch), or, published before it is done, a missing program (a FATAL or a wrong draw); the job is published only
when done, at its own free call's release or later, under shader_mu, as a pick would. The test runs the source's
load_queue, programs_freed, programs_retire_freed, programs_retire_ready, load_done and load_publish on
stand-ins, set, unset and 0: two programs of one unit, two units freed before either release, final frees with no job,
a burst of 65 jobs not done, and a job whose lock its worker still holds. With =0, what changes from main:
load_publish takes no job lock, programs_life_flag is atomic, the census counts with the life log on, and a load
flag read at each replay present and release. Turn it off with RX_VK_LOAD_RETIRE=0. Renderer code: the
runtime is rebuilt; the translator's stamp is unchanged, so players' programs are not translated again.

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.
## Summary With programs loaded at create (`RX_VK_LOAD=create`), a load job leaves `job_by_key`, and the count that `programs_load_wait`'s first test reads goes down, only when a draw's pick asks for one of its keys (`load_publish`). The game makes programs it never draws: their jobs stayed for the session, holding what they read, and with one such job the count never came back to 0, so every slow pick took `jobs_mu` and looked its key up for nothing. With this, the game's free call of the last program of a unit notes the unit's job under that call's serial, only if a job no pick has published exists (`programs_freed`; no lock a pick holds while it translates), and the replay's part of that same call (`do_program_released`, in the stream's order, through the synchronous, queued and held paths alike: every draw recorded before the free has been replayed, none after it) takes that note only and publishes the job if it is done, under `shader_mu`, exactly as a pick of one of its keys would have (`programs_retire_freed`). A job not done then is kept once, with no cap, and published at the replay's next present or release once its worker is done (`load_done` tells the replay; `programs_retire_ready`, 64 at most a pass). `load_publish` no longer takes the job's own lock (every caller holds `shader_mu` and has seen the job done), so a worker set aside after it finished holds no pick or release up. With the switch off nothing is indexed by unit, looked up or noted. `programs_life_flag` is an atomic stored once. With `RX_VK_LOG_PROGRAM_LIFE=1` the census counts the slow picks that looked a key up (and found none) and the retire passes and their time. `gpu/vk/vk_shader.cpp` is unchanged, so the translator's stamp is too. The result expected: the slow picks no longer take the jobs' lock once the unused loads are gone; not measured yet. The switch: `RX_VK_LOAD_RETIRE` (new, a kill switch, bool, its row in `gpu/vk/switches.def`), on by default as docs/dev/standards.md (Switches) asks of a switch's first push; read once at the first load queued at create or free call; `=0` notes nothing and such loads wait for a pick, as on main. From bd3ea307 on `exp/x86-asm-sync` (there the call was made from `program_released` in `vk_shader.cpp`; here from `do_program_released`). Read first: `load_queue`, `programs_freed`, `programs_retire_freed` and `programs_retire_ready` in `gpu/vk/vk_programs.cpp`, `do_program_released` and `log_frame_stats` in `gpu/vk/vk_replay.cpp`, then `tests/test_program_load_wait.py`. ## Testing **Tested:** Windows 11, i7-9700, RTX 4060, the builder's llvm-mingw clang 23; head `5149692a` on main `9dd41326`. The checks ran at `bfac5c28` on main `b62932a9`, the same commits before a rebase onto `9dd41326`, which added only lift files (#1905) that none of these checks reads. Light queue jobs `fb-2029-3` and `fb-2029-4` of this PC's job queue (the first found compile errors in the new fixtures, fixed before the second), each check in a hidden console through `tests/run_all.py --strict --exact --timeout 1200 --jobs 2`: `tests/test_program_load_wait.py` (the fixture with the switch set, unset and 0, the switch's read included), `tests/test_program_life_clock.py` and `tests/test_switch_table.py`: 3 passed. At the test commit `bd1607fd` `tests/test_program_load_wait.py` fails, as expected (it does not build against the earlier code: no `load_queue`, no serial on the release). The Windows game build's own compile of `gpu/vk/vk_programs.cpp` and `gpu/vk/vk_replay.cpp` (syntax only) passes. Not run this round: every check `--changed` picks (a heavy batch), the Linux-target compile (the local tool could not read its build profile), `tests/test_vbytes.py` (hangs on this PC). **It has NOT run in the game on this PC yet.** **Still to test:** - Windows 11, i7-9700, RTX 4060 (this PC), `RX_VK_LOAD=create`, `RX_VK_LOG_PROGRAM_LIFE=1`: cold and warm scene transitions (Kokiri Forest into Hyrule Field and back, Hyrule Field into Castle Town Market), on main @ 9dd41326, this branch with `RX_VK_LOAD_RETIRE=0` and this branch unset (on), each warmed a minute, interleaved (ABC ABC ABC), expecting the same picture and no FATAL, loads published at free calls counted unset, fewer slow-pick lookups unset than with `=0` in the census line, no longer transition hitches, and average fps, 1% lows, median and p99 frame times and RAM and VRAM of this branch unset at least those of the other two; a difference beyond the runs' spread is a gain or a loss, one within it is no difference measured (by hand) - Linux NVIDIA and AMD, Windows AMD and Intel, Steam Deck: the same transitions, main, this branch with `RX_VK_LOAD_RETIRE=0` and unset, warmed and interleaved, expecting the same picture and no FATAL (the test farm: linux+nvidia, linux+amd, windows+amd, windows+intel, steamdeck: Kokiri Forest into Hyrule Field and back and into Castle Town Market, RX_VK_LOAD=create, main @ 9dd41326, this branch with RX_VK_LOAD_RETIRE=0 and unset, warmed up, interleaved, the log, frame times and a screenshot) - Linux: run `python3 -I -B tests/test_program_load_wait.py --cxx g++`, expecting PASS (by hand) - A PC with pre-commit and ruff installed: `mise run test` and `mise run lint` at this head, expecting every failure to fail on main too and lint to pass (by hand; neither tool is installed on this PC) ## Measurements **Verdict:** not measured in play yet: no micro-benchmark of this port and no run in the game on this PC yet. `RX_VK_LOAD_RETIRE` ships on, as docs/dev/standards.md (Switches) asks of a switch's first push (`=0` is main's way); the in-game A/B (unset against `=0` and main) in Still to test decides whether it stays. ## Risks What could break (on, the default): a job published while a draw still needs it would make that draw's pick load the program again (a hitch), or, published before it is done, a missing program (a FATAL or a wrong draw); the job is published only when done, at its own free call's release or later, under `shader_mu`, as a pick would. The test runs the source's `load_queue`, `programs_freed`, `programs_retire_freed`, `programs_retire_ready`, `load_done` and `load_publish` on stand-ins, set, unset and `0`: two programs of one unit, two units freed before either release, final frees with no job, a burst of 65 jobs not done, and a job whose lock its worker still holds. With `=0`, what changes from main: `load_publish` takes no job lock, `programs_life_flag` is atomic, the census counts with the life log on, and a load flag read at each replay present and release. Turn it off with `RX_VK_LOAD_RETIRE=0`. Renderer code: the runtime is rebuilt; the translator's stamp is unchanged, so players' programs are not translated again. ## Checklist ### Ready for review - [x] 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. - [x] 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`. - [x] 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. - [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.
perf(vk): a program load no draw asked for is published when the game frees its programs (RX_VK_LOAD_RETIRE)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 29s
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
CI / Website build and checks (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
cd54e46a73
With programs loaded at create (RX_VK_LOAD=create), a load job leaves job_by_key, and the count programs_load_wait's first
test reads goes down, only when a pick asks for one of its keys (load_publish). The game makes programs it never draws:
their jobs stayed for the session, holding what they read, and with one such job the count never came back to 0, so
every slow pick (program_cache_load) took jobs_mu and looked its key up for nothing.

Now the game's free call of the last program of a unit notes the unit (programs_freed, under no lock a pick holds), and
the replay's part of that call (do_program_released, in the stream's order: every draw recorded before the free has been
replayed) publishes the unit's job if it is done, under shader_mu, exactly as a pick of one of its keys would have
(programs_retire_freed). A job still queued or running is looked at again at the next free call; one a pick publishes
first is simply gone from the new job_by_unit. The census line counts the loads published this way.

Adapted to main: the branch made the call from program_released in vk_shader.cpp, under the shader_mu it holds there;
here do_program_released (vk_replay.cpp) makes it and programs_retire_freed takes shader_mu itself, only when a free
call left a unit to look at. vk_shader.cpp is unchanged, so the translator's stamp is too.

From bd3ea307 on exp/x86-asm-sync. Not measured, neither on the branch nor in play.

Test: tests/test_program_load_wait.py cuts programs_retire_freed with the load job's code and runs it on stand-ins
(tests/program_load_wait_test.cpp: a done job published at its free call, one that read nothing leaving the lists, one not
begun kept for the next call or a pick, no lock taken with nothing noted), and reads programs_freed, load_retire_on and
do_program_released for the order of the note, the lock and the call.

Switch: RX_VK_LOAD_RETIRE (kill), on; =0 nothing is noted and such loads wait for a pick, as before.

Switch reads: the test also runs RX_VK_LOAD_RETIRE as the source reads it, in fresh processes (unset, 0, 1, 2, off, each twice, the variable flipped after the first read: read once). It reads 0, off, false and no as off (env_on_or), as the other switches do.

Assisted-by: Claude Code
Member

Possibly related, for context:

  • issue #1509 Shader programs, modules and pipelines are never released while the game runs, and the rule that would release a program has no caller — Tracks unused shader-program lifetimes; this changes publication at free calls
Possibly related, for context: - issue #1509 Shader programs, modules and pipelines are never released while the game runs, and the rule that would release a program has no caller — Tracks unused shader-program lifetimes; this changes publication at free calls
BeanBot left a comment

Recommendation: Request changes. A burst can permanently drop retirement candidates, and a worker that finishes after the last free call can leave the slow-pick lock active for the rest of the session. The new path can also stall replay behind a low-priority worker, and the PR has no in-game evidence of a gain.

The change moves completed load-on-create results into the shader cache when the game frees a program, aiming to spare later slow picks a jobs-lock lookup. It adds a per-unit index and moves cache insertion onto the release path. Publishing keeps the loaded programs and their Vulkan resources available for reuse.

@fix will do (11)

  1. L1 gpu/vk/vk_programs.cpp:706: The 64-entry retry cap silently drops every remaining unfinished candidate. (more on the line)
  2. L2 gpu/vk/vk_programs.cpp:718: An unfinished candidate is retried only on another program release. (more on the line)
  3. L3 gpu/vk/vk_programs.cpp:710: Seeing state 2 does not guarantee job->mu is free. (more on the line)
  4. L4 gpu/vk/vk_replay.cpp:6633: The release callback drains a global list of guest-side notices, so the callback's stream position does not establish the position of the jobs it publishes. (more on the line)
  5. L5 (minor) gpu/vk/vk_programs.cpp:665: The final free of a tracked unit queues a notice even if it never had a load job or a pick already published it. (more on the line)
  6. L6 (minor) gpu/vk/vk_programs.cpp:548: The kill switch leaves the new unit index active. (more on the line)
  7. L7 gpu/vk/vk_programs.cpp:712: The new replay read of programs_life_flag races with programs_life_on, which assigns the plain bool on each guest create or free. (more on the line)
  8. L8 tests/program_load_wait_test.cpp:189: The fixture writes the retirement notice and fills job_by_unit itself, so it passes if the production queue stops indexing jobs or if programs_freed stops pushing notices. (more on the line)
  9. L9 (minor) tests/test_program_load_wait.py:32: Compiler selection differs between standalone and suite runs. (more on the line)
  10. L10 (minor) tests/test_program_load_wait.py:61: ATTEMPT_OFF and the optional fixture stubs are unused by the only caller. (more on the line)
  11. L11 (its part an edit can do): Add opt-in counts for slow picks entering jobs_mu and for retirement batches, plus batch time, so the A/B can attribute a gain or hitch.

For the author (1) (a run, a measurement or a decision)

  • L11 (minor): The planned median-only comparison cannot show whether extra release work worsens scene-transition hitches or whether the retired jobs actually remove slow-pick lookups. After the fixes, report repeated matched base, enabled, and disabled runs on the author's PC and Tier 1 Windows, Linux, and Steam Deck hardware. Include average FPS, 1% lows, median and p99 frame times, lookup counts, and RAM and VRAM through cold and warm transitions. The author-side in-game run required before opening is still missing.

Checks: Still running: PR description / Description follows the template (pull_request_target), CI / Conventional Commit title (pull_request), CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request), CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request), CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request), CI / Workflow lint (actionlint) (pull_request), CI / Website build and checks (pull_request).

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

Does it help: Unproven. There are zero in-game runs or timing comparisons for cd54e46a against 75317e1f. The reported Windows batch had 128 passes in 156 checks, with 27 failures also seen on base and one timeout that passed on retry. Those results exercise code paths but give no frame-time, lock-avoidance, or memory numbers.

Other systems: The retirement path affects synchronous replay, threaded replay, and releases deferred behind queue events. It covers graphics, native mesh, mesh fallback, and compute loads on all vendors in create mode. Start mode gets the new pending-flag check on replay releases. The change can shift CPU work into scene transitions and change host heap use and replay pacing. Windows and Linux builds and Tier 1 GPU behavior remain unverified in game. The host API, translator stamp, cache file formats, saves, audio, and input have no direct changes.

Switches: RX_VK_LOAD_RETIRE is a developer kill switch, on when unset and read once at the first tracked free in create mode. 0, off, false, no, and an empty value disable retirement. The sorted switch-table row is present. The on default still needs Tier 1 A/B evidence, and the off path currently retains new bookkeeping. No other runtime switch changes.

Reviewed: cd54e46a73 against 75317e1f31: Read AGENTS.md, CONTRIBUTING.md, the Forgejo template, developer standards, vk_programs.cpp, vk_programs.h, and both changed test files in full. Read every diff hunk and the surrounding switch-table and replay sections. Traced release callers, queue deferral, shader picks, cache ownership, unit state, switch parsing, and test-runner compiler selection. Read the commit and supplied test report, comments, reviews, and CI status. Unrelated replay and switch-table sections and source checks were skimmed. No local review checklist or neighboring Tooling checkout was present.; nothing run (a code review).

Checked and fine:

  • Completed results are published under shader_mu. The state release/acquire protects the result handoff, and both job indices erase entries by identity.
  • The new census counter is atomic. The switch fixture sets or clears the target variable explicitly in each child and checks that a second read keeps the first value.
  • The switch row is sorted and uses the existing boolean parser. The change stays on one topic and the commit carries an Assisted-by trailer.
  • The diff contains no game-derived files, generated artifacts, vendor SDKs, or third-party changes. No renderer API version or translator stamp bump is needed.

Testing: Read-only review. No project code, builds, or tests were run. Git diff whitespace check passed. The PR reports a Windows LLVM-MinGW pass for the focused test. Linux GCC and Clang results, in-game runs, and CI results are pending.

Overlaps and merge order: No competing PR found in the available checkout. Local main touches the replay file and switch table in separate hunks. The cited source commit bd3ea307 was unavailable locally.


Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** A burst can permanently drop retirement candidates, and a worker that finishes after the last free call can leave the slow-pick lock active for the rest of the session. The new path can also stall replay behind a low-priority worker, and the PR has no in-game evidence of a gain. The change moves completed load-on-create results into the shader cache when the game frees a program, aiming to spare later slow picks a jobs-lock lookup. It adds a per-unit index and moves cache insertion onto the release path. Publishing keeps the loaded programs and their Vulkan resources available for reuse. **`@fix` will do (11)** 1. **L1** `gpu/vk/vk_programs.cpp:706`: The 64-entry retry cap silently drops every remaining unfinished candidate. (more on the line) 2. **L2** `gpu/vk/vk_programs.cpp:718`: An unfinished candidate is retried only on another program release. (more on the line) 3. **L3** `gpu/vk/vk_programs.cpp:710`: Seeing state 2 does not guarantee job->mu is free. (more on the line) 4. **L4** `gpu/vk/vk_replay.cpp:6633`: The release callback drains a global list of guest-side notices, so the callback's stream position does not establish the position of the jobs it publishes. (more on the line) 5. **L5** (minor) `gpu/vk/vk_programs.cpp:665`: The final free of a tracked unit queues a notice even if it never had a load job or a pick already published it. (more on the line) 6. **L6** (minor) `gpu/vk/vk_programs.cpp:548`: The kill switch leaves the new unit index active. (more on the line) 7. **L7** `gpu/vk/vk_programs.cpp:712`: The new replay read of programs_life_flag races with programs_life_on, which assigns the plain bool on each guest create or free. (more on the line) 8. **L8** `tests/program_load_wait_test.cpp:189`: The fixture writes the retirement notice and fills job_by_unit itself, so it passes if the production queue stops indexing jobs or if programs_freed stops pushing notices. (more on the line) 9. **L9** (minor) `tests/test_program_load_wait.py:32`: Compiler selection differs between standalone and suite runs. (more on the line) 10. **L10** (minor) `tests/test_program_load_wait.py:61`: ATTEMPT_OFF and the optional fixture stubs are unused by the only caller. (more on the line) 11. **L11** (its part an edit can do): Add opt-in counts for slow picks entering jobs_mu and for retirement batches, plus batch time, so the A/B can attribute a gain or hitch. **For the author (1)** (a run, a measurement or a decision) - **L11** (minor): The planned median-only comparison cannot show whether extra release work worsens scene-transition hitches or whether the retired jobs actually remove slow-pick lookups. After the fixes, report repeated matched base, enabled, and disabled runs on the author's PC and Tier 1 Windows, Linux, and Steam Deck hardware. Include average FPS, 1% lows, median and p99 frame times, lookup counts, and RAM and VRAM through cold and warm transitions. The author-side in-game run required before opening is still missing. **Checks:** Still running: `PR description / Description follows the template (pull_request_target)`, `CI / Conventional Commit title (pull_request)`, `CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request)`, `CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request)`, `CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request)`, `CI / Workflow lint (actionlint) (pull_request)`, `CI / Website build and checks (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven. There are zero in-game runs or timing comparisons for cd54e46a against 75317e1f. The reported Windows batch had 128 passes in 156 checks, with 27 failures also seen on base and one timeout that passed on retry. Those results exercise code paths but give no frame-time, lock-avoidance, or memory numbers. **Other systems:** The retirement path affects synchronous replay, threaded replay, and releases deferred behind queue events. It covers graphics, native mesh, mesh fallback, and compute loads on all vendors in create mode. Start mode gets the new pending-flag check on replay releases. The change can shift CPU work into scene transitions and change host heap use and replay pacing. Windows and Linux builds and Tier 1 GPU behavior remain unverified in game. The host API, translator stamp, cache file formats, saves, audio, and input have no direct changes. **Switches:** `RX_VK_LOAD_RETIRE` is a developer kill switch, on when unset and read once at the first tracked free in create mode. `0`, `off`, `false`, `no`, and an empty value disable retirement. The sorted switch-table row is present. The on default still needs Tier 1 A/B evidence, and the off path currently retains new bookkeeping. No other runtime switch changes. **Reviewed:** cd54e46a7396 against 75317e1f31ff: Read AGENTS.md, CONTRIBUTING.md, the Forgejo template, developer standards, vk_programs.cpp, vk_programs.h, and both changed test files in full. Read every diff hunk and the surrounding switch-table and replay sections. Traced release callers, queue deferral, shader picks, cache ownership, unit state, switch parsing, and test-runner compiler selection. Read the commit and supplied test report, comments, reviews, and CI status. Unrelated replay and switch-table sections and source checks were skimmed. No local review checklist or neighboring Tooling checkout was present.; nothing run (a code review). **Checked and fine:** - Completed results are published under shader_mu. The state release/acquire protects the result handoff, and both job indices erase entries by identity. - The new census counter is atomic. The switch fixture sets or clears the target variable explicitly in each child and checks that a second read keeps the first value. - The switch row is sorted and uses the existing boolean parser. The change stays on one topic and the commit carries an Assisted-by trailer. - The diff contains no game-derived files, generated artifacts, vendor SDKs, or third-party changes. No renderer API version or translator stamp bump is needed. **Testing:** Read-only review. No project code, builds, or tests were run. Git diff whitespace check passed. The PR reports a Windows LLVM-MinGW pass for the focused test. Linux GCC and Clang results, in-game runs, and CI results are pending. **Overlaps and merge order:** No competing PR found in the available checkout. Local main touches the replay file and switch table in separate hunks. The cited source commit bd3ea307 was unavailable locally. </details> --- <sub>Automated code review by BeanBot (gpt-6.2-sol), on the pull request's opening. Nothing was run; a maintainer decides.</sub>
@ -540,6 +545,7 @@ void load_at_create(const nvn_prog& prog, const CreatedProgram& made) {
census.units_queued++;
std::lock_guard lk(jobs_mu);
for (const uint64_t key : job->keys) job_by_key[key] = job;
job_by_unit[unit] = job;
Member

L6 (minor): The kill switch leaves the new unit index active. With RX_VK_LOAD_RETIRE=0, every queued job still inserts into job_by_unit, every publishing pick checks it, and every tracked free still looks up the unit before removing its serial. This leaves extra work in the rollback and A/B control. Gate retirement-only bookkeeping on the latched switch and align the table and test with when it is read.

**L6** (minor): The kill switch leaves the new unit index active. With RX_VK_LOAD_RETIRE=0, every queued job still inserts into job_by_unit, every publishing pick checks it, and every tracked free still looks up the unit before removing its serial. This leaves extra work in the rollback and A/B control. Gate retirement-only bookkeeping on the latched switch and align the table and test with when it is read.
@ -627,0 +662,4 @@
// (longshot) the last program of those stages: its unit's job, should no pick have asked for it, is retired at the replay's
// part of this call (programs_retire_freed)
if (unit && load_retire_on())
if (const program_life::Unit* u = table.find(unit); u && !u->live) {
Member

L5 (minor): The final free of a tracked unit queues a notice even if it never had a load job or a pick already published it. In synchronous play, a series of such frees can allocate and free a vector per release and take shader_mu and jobs_mu for each miss. Filter using pending-job state before queuing retirement and reuse the existing release's shader lock where possible.

**L5** (minor): The final free of a tracked unit queues a notice even if it never had a load job or a pick already published it. In synchronous play, a series of such frees can allocate and free a vector per release and take shader_mu and jobs_mu for each miss. Filter using pending-job state before queuing retirement and reuse the existing release's shader lock where possible.
@ -642,0 +703,4 @@
}
if (!job) continue; // (a pick published it, or nothing was queued for those stages)
if (job->state.load(std::memory_order_acquire) != 2) { // (queued or running: nothing to publish yet)
if (later.size() < kRetireLater) later.push_back(unit);
Member

L1: The 64-entry retry cap silently drops every remaining unfinished candidate. If replay falls behind a burst of 65 last-program frees while the workers are busy, the 65th job can finish later and stay indexed for the rest of play, keeping slow picks on the jobs-lock path. Bound the work per pass while preserving the remaining distinct candidates, or hand pending jobs off through completion. Cover a burst above 64.

**L1**: The 64-entry retry cap silently drops every remaining unfinished candidate. If replay falls behind a burst of 65 last-program frees while the workers are busy, the 65th job can finish later and stay indexed for the rest of play, keeping slow picks on the jobs-lock path. Bound the work per pass while preserving the remaining distinct candidates, or hand pending jobs off through completion. Cover a burst above 64.
@ -642,0 +707,4 @@
continue;
}
// (a program of the same stages made since the free is no reason to wait: publishing is what its first pick would do)
load_publish(job);
Member

L3: Seeing state 2 does not guarantee job->mu is free. load_done stores 2 while holding the mutex, and load_publish then blocks on it. A below-normal-priority worker preempted between the store and unlock can stall a free for a shader nobody needs while replay holds both replay_mu and shader_mu. Make completed-job publication nonblocking. The release/acquire state already publishes the finished results, and publication itself is serialized by shader_mu.

**L3**: Seeing state 2 does not guarantee job->mu is free. load_done stores 2 while holding the mutex, and load_publish then blocks on it. A below-normal-priority worker preempted between the store and unlock can stall a free for a shader nobody needs while replay holds both replay_mu and shader_mu. Make completed-job publication nonblocking. The release/acquire state already publishes the finished results, and publication itself is serialized by shader_mu.
@ -642,0 +709,4 @@
// (a program of the same stages made since the free is no reason to wait: publishing is what its first pick would do)
load_publish(job);
census.units_retired++;
if (programs_life_flag)
Member

L7: The new replay read of programs_life_flag races with programs_life_on, which assigns the plain bool on each guest create or free. In threaded replay, release A can reach this read while the game handles free B. Assigning the same value still races in C++. Publish the flag once before threads use it, or make all accesses atomic.

**L7**: The new replay read of programs_life_flag races with programs_life_on, which assigns the plain bool on each guest create or free. In threaded replay, release A can reach this read while the game handles free B. Assigning the same value still races in C++. Publish the flag once before threads use it, or make all accesses atomic.
@ -642,0 +715,4 @@
}
if (later.empty()) return;
std::lock_guard lk(retire_mu);
retire_units.insert(retire_units.end(), later.begin(), later.end());
Member

L2: An unfinished candidate is retried only on another program release. If a transition frees the last unused program and its worker finishes just afterward, unrelated slow picks can keep taking jobs_mu throughout the next area even though the load has completed. Have completion mark eligible work ready for a bounded replay drain that runs without another free, keeping publication off the worker.

**L2**: An unfinished candidate is retried only on another program release. If a transition frees the last unused program and its worker finishes just afterward, unrelated slow picks can keep taking jobs_mu throughout the next area even though the load has completed. Have completion mark eligible work ready for a bounded replay drain that runs without another free, keeping publication off the worker.
@ -6630,1 +6630,4 @@
program_released(p);
// (longshot, RX_VK_LOAD_RETIRE) and the load its create call queued, if no draw ever asked for it (vk_programs.cpp): what it
// read goes to the programs' lists here, in the stream's order as this call is, under the lock a pick would publish it under
programs_retire_freed();
Member

L4: The release callback drains a global list of guest-side notices, so the callback's stream position does not establish the position of the jobs it publishes. With release A, draw B, release B queued in that order, the game can add B's notice before replay handles A. A can then publish B and count it as unused before the earlier draw gets its pick. Carry the retirement candidate with its matching release through the synchronous, queued, and held-release paths. Make a candidate eligible for retry only after that release reaches replay.

**L4**: The release callback drains a global list of guest-side notices, so the callback's stream position does not establish the position of the jobs it publishes. With release A, draw B, release B queued in that order, the game can add B's notice before replay handles A. A can then publish B and count it as unused before the earlier draw gets its pick. Carry the retirement candidate with its matching release through the synchronous, queued, and held-release paths. Make a candidate eligible for retry only after that release reaches replay.
@ -183,0 +186,4 @@
// a job no draw ever asked for, retired when the game frees the last program of its unit (programs_retire_freed, which the
// replay's part of the free call runs; it takes shader_mu itself). Done: published as a pick would publish it. d, which read
// nothing, only leaves the lists, and the count a pick's first test reads comes back to 0
const auto freed = [](uint64_t unit) { // (programs_freed's part: the unit left with no program is noted)
Member

L8: The fixture writes the retirement notice and fills job_by_unit itself, so it passes if the production queue stops indexing jobs or if programs_freed stops pushing notices. The Python checks still find their expected strings in both cases. Exercise the real queue bookkeeping and free-to-replay handoff with two serials sharing a unit, asserting the first free does nothing and the final free publishes only at its replay position. Run that behavior with the switch both on and off.

**L8**: The fixture writes the retirement notice and fills job_by_unit itself, so it passes if the production queue stops indexing jobs or if programs_freed stops pushing notices. The Python checks still find their expected strings in both cases. Exercise the real queue bookkeeping and free-to-replay handoff with two serials sharing a unit, asserting the first free does nothing and the final free publishes only at its replay position. Run that behavior with the switch both on and off.
@ -20,0 +29,4 @@
"""The C++ compiler with no --cxx: CXX, then the configured llvm-mingw (LONGSHOT_MINGW), then clang++, g++ or c++"""
if os.environ.get("CXX"):
return os.environ["CXX"]
mingw = os.environ.get("LONGSHOT_MINGW")
Member

L9 (minor): Compiler selection differs between standalone and suite runs. On Windows with LLVM-MinGW configured through LONGSHOT_MINGW alone, run_all can skip the check or pick a different clang++ before default_cxx runs. On Linux with LLVM-MinGW configured for cross-builds, the standalone test can select it and try to launch a Windows executable. Share native compiler selection between both entry points, honor --cxx and CXX, and limit the LLVM-MinGW fallback to Windows.

**L9** (minor): Compiler selection differs between standalone and suite runs. On Windows with LLVM-MinGW configured through LONGSHOT_MINGW alone, run_all can skip the check or pick a different clang++ before default_cxx runs. On Linux with LLVM-MinGW configured for cross-builds, the standalone test can select it and try to launch a Windows executable. Share native compiler selection between both entry points, honor --cxx and CXX, and limit the LLVM-MinGW fallback to Windows.
@ -20,0 +58,4 @@
}
"""
KILL_ON = ((None, 1), ("0", 0), ("1", 1), ("2", 1), ("off", 0)) # (unset: on; 0 or off: off; any other value: on)
ATTEMPT_OFF = ((None, 0), ("0", 0), ("1", 1), ("2", 1), ("off", 0)) # (unset: off)
Member

L10 (minor): ATTEMPT_OFF and the optional fixture stubs are unused by the only caller. Remove them and use the existing block import for the switch reader too.

**L10** (minor): ATTEMPT_OFF and the optional fixture stubs are unused by the only caller. Remove them and use the existing block import for the switch reader too.
siantm force-pushed perf/vk-load-retire from cd54e46a73
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 29s
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
CI / Website build and checks (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 5149692a16
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
CI / Website build and checks (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 8s
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
2026-11-21 10:46:40 +00:00
Compare
Author
Contributor

Thank you for the review (#2031 (comment)). The branch is rebased on main @ 9dd41326 (the PR's own commit unchanged by the rebase, now 7b8a597c), with a test commit bd1607fd and a fix commit 5149692a; head 5149692a. Point by point:

  • L1 (#2031 (comment)): right. A job not done at its release is now kept with no cap, once (retire_wanted), and published 64 at most a pass, the rest at the next (5149692a). The fixture frees 65 units whose jobs no worker has done, replays their releases (all 65 kept), finishes the workers, and requires 64 published at the first present and the 65th at the second (bd1607fd).
  • L2 (#2031 (comment)): right. load_done now tells the replay when a job it waits for is done (retire_ready; fences pair the flag with the done state), and programs_retire_ready publishes it at the replay's next present or release, never on the worker (5149692a); the burst above is published with no further free call.
  • L3 (#2031 (comment)): right. load_publish no longer takes the job's lock: every caller holds shader_mu and has seen the job done with acquire, and published is shader_mu's (5149692a). The fixture holds the job's lock after storing done, as a worker set aside there would, and requires the release to finish and publish within 5 s (bd1607fd).
  • L4 (#2031 (comment)): right. The final free call notes its unit's job under that call's serial, and do_program_released passes the serial of the release it replays, so a release takes only its own call's note, through the synchronous, queued and held paths alike (they all carry the program) (5149692a). The fixture frees two units before the replay reaches either release: the first release publishes its own job only, a pick between them publishes the second, and the second release then finds it published (bd1607fd).
  • L5 (#2031 (comment)): right. A final free notes the job only if its unit has one no pick has published (looked up under jobs_mu at that free only), so a release without a note takes no lock and allocates nothing (5149692a); the fixture checks the final frees of a unit a pick published and of one never queued note nothing (bd1607fd). The release's own shader_mu is taken in program_released (vk_shader.cpp); sharing it would move that lock out of the translator's file, so the retirement takes its own, only for a release that carries a note.
  • L6 (#2031 (comment)): right. With the switch off nothing is indexed by unit (load_queue), erased from that index (load_publish), looked up at a free or noted (programs_freed); the row says it is read once at the first load queued at create or free call, whichever comes first (5149692a). The fixture runs with it set, unset and 0, and off requires the unit index to stay empty and nothing noted (bd1607fd).
  • L7 (#2031 (comment)): right, and the plain store was on main's every create and free. programs_life_flag is now a std::atomic<bool> stored once, in programs_life_on's initializer (5149692a).
  • L8 (#2031 (comment)): right. The jobs are queued by the source's load_queue (the tail of load_at_create, now a function of its own), freed by the source's programs_freed and released by programs_retire_freed(serial); two serials of one unit: the first free notes nothing and its release publishes nothing, the second is noted at the game's call and published only at its own release; set, unset and 0 (bd1607fd).
  • L9 (#2031 (comment)): right. With no --cxx the check finds the compiler as run_all.py does (CXX, then clang++, g++, c++ on PATH, through tests/compiler_command.py); the LONGSHOT_MINGW fallback is gone (bd1607fd).
  • L10 (#2031 (comment)): the unused stubs are gone and the switch reader is cut with the same block import; ATTEMPT_OFF is gone too: the switch reads as a kill switch (KILL_ON, unset on) (bd1607fd).
  • L11 (review): with RX_VK_LOG_PROGRAM_LIFE=1 the census line now counts the slow picks that took jobs_mu and those that found no job, and the retire passes and their time (5149692a). The in-game comparison you describe (main, =0, unset; cold and warm transitions; average fps, 1% lows, median and p99 frame times, the lookup counts, RAM and VRAM; Tier 1 Windows, Linux, Deck) is pending: it has not run in the game on this PC, and it is in Still to test.

RX_VK_LOAD_RETIRE stays on by default (a kill switch, =0 is main's way), as docs/dev/standards.md (Switches) asks of a switch's first push; it is not measured in play yet, and the in-game A/B (unset against =0 and main) in Still to test decides whether it stays.

At the test commit the check does not build against the PR's earlier code (no load_queue, and the release passes no serial: the interface L4 and L8 ask for), so it fails there; job fb-2029-4.

Tested here (Windows 11, i7-9700, RTX 4060, llvm-mingw clang 23; queue jobs fb-2029-3, fb-2029-4, light): tests/test_program_load_wait.py (the fixture with the switch set, unset and 0, the switch's read included), tests/test_program_life_clock.py and tests/test_switch_table.py: 3 passed. At the test commit bd1607fd tests/test_program_load_wait.py fails, as expected (it does not build against the earlier code: no load_queue, no serial on the release). The Windows game build's own compile of gpu/vk/vk_programs.cpp and gpu/vk/vk_replay.cpp (syntax only) passes. (Run at bfac5c28 on b62932a9; the push is the same commits rebased onto 9dd41326, which added only lift files.) Not run this round: every check --changed picks (a heavy batch), the Linux-target compile (the local tool could not read its build profile), tests/test_vbytes.py (hangs on this PC). The change has NOT run in the game on this PC yet. The description is updated.

Thank you for the review (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64406). The branch is rebased on main @ 9dd41326 (the PR's own commit unchanged by the rebase, now 7b8a597c), with a test commit bd1607fd and a fix commit 5149692a; head 5149692a. Point by point: - **L1** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64390): right. A job not done at its release is now kept with no cap, once (`retire_wanted`), and published 64 at most a pass, the rest at the next (5149692a). The fixture frees 65 units whose jobs no worker has done, replays their releases (all 65 kept), finishes the workers, and requires 64 published at the first present and the 65th at the second (bd1607fd). - **L2** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64391): right. `load_done` now tells the replay when a job it waits for is done (`retire_ready`; fences pair the flag with the done state), and `programs_retire_ready` publishes it at the replay's next present or release, never on the worker (5149692a); the burst above is published with no further free call. - **L3** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64393): right. `load_publish` no longer takes the job's lock: every caller holds `shader_mu` and has seen the job done with acquire, and `published` is `shader_mu`'s (5149692a). The fixture holds the job's lock after storing done, as a worker set aside there would, and requires the release to finish and publish within 5 s (bd1607fd). - **L4** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64395): right. The final free call notes its unit's job under that call's serial, and `do_program_released` passes the serial of the release it replays, so a release takes only its own call's note, through the synchronous, queued and held paths alike (they all carry the program) (5149692a). The fixture frees two units before the replay reaches either release: the first release publishes its own job only, a pick between them publishes the second, and the second release then finds it published (bd1607fd). - **L5** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64396): right. A final free notes the job only if its unit has one no pick has published (looked up under `jobs_mu` at that free only), so a release without a note takes no lock and allocates nothing (5149692a); the fixture checks the final frees of a unit a pick published and of one never queued note nothing (bd1607fd). The release's own `shader_mu` is taken in `program_released` (vk_shader.cpp); sharing it would move that lock out of the translator's file, so the retirement takes its own, only for a release that carries a note. - **L6** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64398): right. With the switch off nothing is indexed by unit (`load_queue`), erased from that index (`load_publish`), looked up at a free or noted (`programs_freed`); the row says it is read once at the first load queued at create or free call, whichever comes first (5149692a). The fixture runs with it set, unset and `0`, and off requires the unit index to stay empty and nothing noted (bd1607fd). - **L7** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64399): right, and the plain store was on main's every create and free. `programs_life_flag` is now a `std::atomic<bool>` stored once, in `programs_life_on`'s initializer (5149692a). - **L8** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64401): right. The jobs are queued by the source's `load_queue` (the tail of `load_at_create`, now a function of its own), freed by the source's `programs_freed` and released by `programs_retire_freed(serial)`; two serials of one unit: the first free notes nothing and its release publishes nothing, the second is noted at the game's call and published only at its own release; set, unset and `0` (bd1607fd). - **L9** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64403): right. With no `--cxx` the check finds the compiler as `run_all.py` does (`CXX`, then clang++, g++, c++ on PATH, through `tests/compiler_command.py`); the LONGSHOT_MINGW fallback is gone (bd1607fd). - **L10** (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2031#issuecomment-64405): the unused stubs are gone and the switch reader is cut with the same `block` import; `ATTEMPT_OFF` is gone too: the switch reads as a kill switch (`KILL_ON`, unset on) (bd1607fd). - **L11** (review): with `RX_VK_LOG_PROGRAM_LIFE=1` the census line now counts the slow picks that took `jobs_mu` and those that found no job, and the retire passes and their time (5149692a). The in-game comparison you describe (main, `=0`, unset; cold and warm transitions; average fps, 1% lows, median and p99 frame times, the lookup counts, RAM and VRAM; Tier 1 Windows, Linux, Deck) is pending: it has not run in the game on this PC, and it is in Still to test. `RX_VK_LOAD_RETIRE` stays **on by default** (a kill switch, `=0` is main's way), as docs/dev/standards.md (Switches) asks of a switch's first push; it is not measured in play yet, and the in-game A/B (unset against `=0` and main) in Still to test decides whether it stays. At the test commit the check does not build against the PR's earlier code (no `load_queue`, and the release passes no serial: the interface L4 and L8 ask for), so it fails there; job fb-2029-4. Tested here (Windows 11, i7-9700, RTX 4060, llvm-mingw clang 23; queue jobs fb-2029-3, fb-2029-4, light): `tests/test_program_load_wait.py` (the fixture with the switch set, unset and 0, the switch's read included), `tests/test_program_life_clock.py` and `tests/test_switch_table.py`: 3 passed. At the test commit `bd1607fd` `tests/test_program_load_wait.py` fails, as expected (it does not build against the earlier code: no `load_queue`, no serial on the release). The Windows game build's own compile of `gpu/vk/vk_programs.cpp` and `gpu/vk/vk_replay.cpp` (syntax only) passes. (Run at `bfac5c28` on b62932a9; the push is the same commits rebased onto 9dd41326, which added only lift files.) Not run this round: every check `--changed` picks (a heavy batch), the Linux-target compile (the local tool could not read its build profile), `tests/test_vbytes.py` (hangs on this PC). The change has NOT run in the game on this PC yet. The description is updated.
Author
Contributor

@Beanstalk This retires programs loaded at create (gpu/vk/vk_programs.cpp), when programs load at create (RX_VK_LOAD=create), on by default; RX_VK_LOAD_RETIRE=0 is main's way. This head is on main 9dd41326: please compare with main at that merge base. Please play with RX_VK_LOAD=create and RX_VK_LOG_PROGRAM_LIFE=1 on both sides: Kokiri Forest into Hyrule Field and back, then Castle Town Market started from the market-entrance save, the PR against main on the same PC, on the PR's side with RX_VK_LOAD_RETIRE unset and with RX_VK_LOAD_RETIRE=0, with a picture in each scene compared with main's, on Linux with NVIDIA, Linux with AMD (RADV), Windows with Intel and the Steam Deck. The same picture (no missing program), no crash or FATAL line; unset, the census line counts loads published at free calls and fewer slow-pick lookups than with it off; no longer hitches at the transitions than main. Please report the census line.

@Beanstalk This retires programs loaded at create (gpu/vk/vk_programs.cpp), when programs load at create (RX_VK_LOAD=create), on by default; RX_VK_LOAD_RETIRE=0 is main's way. This head is on main 9dd41326: please compare with main at that merge base. Please play with RX_VK_LOAD=create and RX_VK_LOG_PROGRAM_LIFE=1 on both sides: Kokiri Forest into Hyrule Field and back, then Castle Town Market started from the market-entrance save, the PR against main on the same PC, on the PR's side with RX_VK_LOAD_RETIRE unset and with RX_VK_LOAD_RETIRE=0, with a picture in each scene compared with main's, on Linux with NVIDIA, Linux with AMD (RADV), Windows with Intel and the Steam Deck. The same picture (no missing program), no crash or FATAL line; unset, the census line counts loads published at free calls and fewer slow-pick lookups than with it off; no longer hitches at the transitions than main. Please report the census line.
Member

@siantm only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@siantm only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
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
CI / Website build and checks (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 8s
beanstalk/approval waiting for a BigBean's 👍 on the request
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request is marked as a work in progress.
Some workflows are waiting to be reviewed.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/vk-load-retire:siantm-perf/vk-load-retire'
git switch 'siantm-perf/vk-load-retire'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!2031
No description provided.