fix(vk): a load marker left by caches that lacked pipelines is not followed on PCs with 20 GB of RAM or less #2256
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2256
Loading…
Reference in a new issue
No description provided.
Delete branch "Apollyon/Longshot:fix/load-marker-small-ram"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
On a 16 GB PC, one settings change can leave a game folder unplayable for good. A changed graphics or audio setting
makes the game restart, and a session after a change like that can find over 500 listed pipelines in no cache. That
writes
cache/longshot_load_start.txt. From then on, every start of that folder loads every listed program before thetitle (start mode). The comment in
load_default.halready measures start mode at 19 GB of private memory at thetitle on a 16 GB PC. On an Arc A750 with 16 GB it took 25.8 GB, its working set was paged out to 3.3 GB, and the window
stayed on a dim "Starting the game" for over ten minutes. The marker never expires: only preparing the shaders again
(or a fresh copy of the folder) gives the game back. Players see this as "any setting change breaks the game until I
reinstall".
The marker has two writers. They mean different things:
marker_write): first uses waited seconds for their loads. That is the PC start mode is for (an RX 580,16 GB), and start is what makes it playable.
marker_write_lacked): loads found listed pipelines in no cache. On a small-RAM PC, compiling those inplay costs far less than start mode does.
This change:
load_default::marker_kindtells the two apart by the marker's text. Any other text (a marker by hand) counts aswaits, as every marker did before.
load_default::marker_counts: a lacked marker is not followed on a PC with 20 GB of RAM or less(
kStartRamMb, the same line aspcache_load.h'skSmallRamMb). A waits marker is followed on any RAM, and so isany marker where the RAM is not known.
RX_VK_LOADstill wins over both.programs_load_decide(vk_programs.cpp) reads the PC's RAM and logs once when it does not follow a lacked marker.programs_frames_note, which writes the lacked marker, no longer logs "the next start loads every listed programbefore the title again" on a PC with 20 GB of RAM or less, where that is no longer true (third commit).
Read first:
marker_kindandmarker_countsingpu/vk/load_default.h, thenprograms_load_decideingpu/vk/vk_programs.cpp.See #869 and #933 (start mode on a 16 GB RX 6600, cited in
load_default.h). Hookshot reported the same marker writtenafter NVIDIA's driver cache was evicted, then loading everything before the title at every start:
https://git.notrexed.dev/Hookshot/Hookshot/issues/3069. #2193 (open) also touches the marker's writers, but only under
RX_VK_PRECOMPILE=0; this change does not overlap it.Testing
Tested: Windows 11 (build 26300), Intel Arc A750 (driver 32.0.101.8974), i3-10105F, 16 GB RAM, on nightly-745
(
a2dc5385, this branch's parent). The in-game runs swap only the nightly's renderer:main's (a2dc5385) againstthis branch's, both built here. Four runs through the PC's job queue, alternating, 7 minutes each, each started with the
same real lacked marker ("517 listed pipelines were in no cache", left by a graphics settings change), no
longshot_env.txt, warm caches.main), both runs: "programs are loaded before the title (start): ... (longshot_load_start.txt)". Privatememory climbed to 24.1 GB on the 16 GB PC (24.6 GB in the game's own
vk: memoryline), so most of it was pagedout: the working set fell to 5.7 to 6.2 GB. Both reached the title within the run on this nightly.
20480 MB or less ...", then "programs are loaded when the game makes them (create)". Both reached the title; private
memory 9.5 GB.
window stayed on a dim "Starting the game" for over ten minutes, at every start after a settings change, until the
folder was replaced. That is how this was found; nightly-745 reaches the title, but still commits half again the
PC's RAM.
tests/test_load_marker_small_ram.pycutsprograms_load_decideout ofvk_programs.cppand runs it with stand-ins for the RAM, the marker and the host. Onmainit fails for the bug ("a marker left by loads that found listed pipelines in no cache took a 16 GB PC's startto start mode"); with the fix it passes.
load_default_test.cppadds the unit checks ofmarker_kindandmarker_counts. With the fix's key line switched off (if (false && ...)), both fail. On Windows (llvm-mingw) bothpass twice with the fix, and the new test fails on the test commit alone.
load_default.halone with clang++-Wall -Wextra. Both tests also with g++ 16.2 (-Wall -Wextra -Werror): the new test fails onmainwith the samereason and passes with the fix;
load_default_test.cpppasses.test_load_marker_small_ram.pyandtest_load_default.pypass on Windows, andthe renderer builds. One more 7-minute run on nightly-745 with the same marker: "not followed", create mode, 9.5 GB,
the title. That session found too few pipelines missing from the warm caches to write the marker again, so the new
line itself was not printed; the test checks that it asks
marker_counts.mise run teston Windows: 35 failures, every one also failing onmainon the same PC (main866 passed / 36failed, this branch 864 / 39; the extra ones were
test_prepare_stall,test_present_semaphoresandtest_stack_commit, which passed twice each on a rerun, and the new test, since fixed;main's extra one,test_display_startup_failure, passes on a rerun too). The shared failures:test_import_windows,test_auto_handheld,test_close_waits_for_save,test_compile_zero_byte,test_crash_dialog,test_damaged_rom_files,test_dev_ab,test_dev_build,test_dev_migrate,test_dev_packs,test_draw_stream_visibility,test_fs_save_commit,test_fsr_uniform_ownership,test_game_menu_mouse_buttons,test_guest_copies,test_hold_toggle,test_input_movie,test_linux_preflight,test_longshot_ctl,test_lower_atomg_cas,test_menu_i18n,test_menu_keys,test_menu_slider_ends,test_mise_build,test_pads_after_menu,test_perf_report,test_recording_admission,test_sampler_admission,test_sdiv_overflow,test_seed_reader,test_sim_turf_pools,test_switch_table,test_tls_objects,test_vibration_menu.mise run lintpasses on the changed files.Still to test:
(@Beanstalk steam-deck).
start mode (by hand).
Measurements
Verdict: private memory with a lacked marker on a 16 GB PC: 24.1 GB -> 9.5 GB, and the start no longer commits more
than the PC has. Not a performance change: the start-up's shader time is unchanged.
Setup: the PC above, nightly-745, the same folder and the same lacked marker each run, warm caches; two runs each of
main's renderer and this branch's, alternating (before, after, before, after), through the job queue in timing mode,7 minutes each, memory read every 20 s and the game's own log. Medians of two.
main@a2dc53857a8917d2Risks
pipelines in play: draws left out for a moment, not a folder that won't start. A PC where loads at create really
are slow writes the waits marker, which is still followed.
RX_VK_LOAD=startgives start mode as before. A revert is enough.where it is; nothing else changes.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.built here. The new
ram_total_mb's POSIX branch (sysconf) compiles and runs with clang++ and g++ 16.2 on macOS(
-Wall -Wextra -Werror); no paths changed.Assisted-by:/Co-Authored-By:trailers.🤖 Generated with Claude Code
https://claude.ai/code/session_01KzPJVjoMBCBdaoMa7qptMJ
Tested in game: Windows 11 (26300), Intel Arc A750 (32.0.101.8974), 16 GB RAM, nightly-745 with only the renderer swapped, a real lacked marker from a graphics settings change: main's renderer went to start mode and 24.1 GB private (2 of 2 runs); this branch's logged 'not followed: 16279 MB of RAM', ran in create mode at 9.5 GB private and reached the title (2 of 2). On v3.0.0 the same marker left the window on 'Starting the game' for 10+ minutes.
WIP: fix(vk): a load marker left by caches that lacked pipelines is not followed on PCs with 20 GB of RAM or lessto fix(vk): a load marker left by caches that lacked pipelines is not followed on PCs with 20 GB of RAM or lessPossibly related, for context:
@review
Recommendation: Request changes. The change reduces startup memory on the tested 16 GB Arc PC, but a lacked marker can suppress the waits marker that is supposed to restore start mode on slow-loading PCs. The affected Linux and Tier 1 hardware paths also need game runs.
A lacked-cache marker no longer forces start mode on PCs with 20 GB of RAM or less. This avoids the measured startup memory spike, at the cost of compiling missing pipelines during play; the two marker writers need separate handling so the existing slow-load safety net remains effective.
Blocking (2): must change before merging.
gpu/vk/vk_programs.cpp:489: The lacked writer shares its one-shot flag with the waits writer, although the two markers now have different effects. (more on the line) Do: Give the writers separate state and ensure a waits verdict can replace a lacked marker without a later lacked write overwriting it; test both ordering cases.@​fixor@​rebasetry first). (for the author)Should fix (1): not blocking, but worth doing before merging.
tests/test_load_marker_small_ram.py:72: The new test inherits the compressed-cache switch from the environment. (more on the line) Do: Clear RX_VK_PROGRAM_CACHE_ZSTD in the test process before the cases, and set it explicitly if testing compressed-cache behavior.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/load_default.h:99: The new default moves missing pipeline compilation into play on affected Tier 1 systems, but the reported runs stop at the title on an Arc PC. (more on the line) Do: Run the lacked-marker case through representative play on Steam Deck and affected Windows/Linux Tier 1 hardware, recording correctness, skipped draws and frame times against the base.gpu/vk/vk_programs.cpp:384: The waits-marker fallback has not been exercised in game on the low-RAM hardware it is intended to protect. (more on the line) Do: After fixing the writer ordering, run a slow-load case on the RX 580 or comparable PC and verify that the next launch selects start mode.@fixcan do L1 and L2.Checks: Failing on this head, which is behind its base, where it passes:
PR description / Description follows the template (pull_request_target).@rebase(or@fix) brings it up to date and runs it again; not held against it. Still running: 9 checks.More: does it help, other systems, switches, what was read
Does it help: Yes, for the tested startup case: two interleaved runs per side on Windows with an Arc A750 and 16 GB RAM showed peak private memory falling from 24.1 GB to 9.5 GB, with both versions reaching the title. The cost during play with cold or missing pipelines has not been measured.
Other systems: The decision affects Windows and Linux on every GPU when a lacked marker is present and RAM is at most 20 GB. Only Windows Arc startup was tested in game; Steam Deck, other affected Tier 1 GPUs and the slow-waits fallback remain untested.
Switches: No switches added, changed or removed. RX_VK_LOAD remains available; the compressed-cache setting also forces start mode.
Reviewed:
731cc5075fagainsta2dc538590: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the diff and commit messages, load_default.h, both changed tests, and vk_programs.cpp in sections. Read the marker writers, callers and related source checks; skimmed the reported runs. docs/review-checklist.md and the adjacent Tooling AGENTS.md were absent. No generated files or translations changed.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no builds, tests or project scripts were run. The author reports Windows game runs and game-free tests; Linux renderer build and the listed hardware runs remain outstanding. CI is still running.
Overlaps and merge order: The description identifies #2193 as touching the marker writers under RX_VK_PRECOMPILE=0; its diff was unavailable for independent comparison.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -71,0 +96,4 @@/// Whether the marker takes this start to start mode. ram_mb: the PC's RAM (0: not known, and the marker is followed as before)inline bool marker_counts(Marker m, uint32_t ram_mb) {if (m == Marker::kNone) return false;if (m == Marker::kLacked && ram_mb && ram_mb <= kStartRamMb) return false;L3 (should fix): The new default moves missing pipeline compilation into play on affected Tier 1 systems, but the reported runs stop at the title on an Arc PC.
When: A Steam Deck or a 16 GB NVIDIA or AMD PC with a lacked marker now enters create mode and can encounter missing pipelines during play; the extent of skipped draws and frame-time impact is unknown.
Do: Run the lacked-marker case through representative play on Steam Deck and affected Windows/Linux Tier 1 hardware, recording correctness, skipped draws and frame times against the base.
@ -367,0 +381,4 @@// (a marker left by loads that found listed pipelines in no cache is not followed where RAM cannot hold start: load_default.h)const load_default::Marker kind = load_default::marker_kind(load_fallback_path());const uint32_t ram_mb = ram_total_mb();const bool marker = load_default::marker_counts(kind, ram_mb);L4 (should fix): The waits-marker fallback has not been exercised in game on the low-RAM hardware it is intended to protect.
When: A low-RAM PC whose create loads wait seconds relies on a waits marker to select start mode after a session with slow loads; the reported testing has not verified that end-to-end behavior.
Do: After fixing the writer ordering, run a slow-load case on the RX 580 or comparable PC and verify that the next launch selects start mode.
@ -465,9 +488,13 @@ void programs_frames_note() {const long long lacked = census.load_pipes_cold.load(std::memory_order_relaxed) + census.load_computes_cold.load(std::memory_order_relaxed);if (!load_default::caches_lacked(lacked) || wait_marked.exchange(true)) return;L1 (blocking): The lacked writer shares its one-shot flag with the waits writer, although the two markers now have different effects.
When: On a PC with at most 20 GB RAM, if more than 500 missing pipelines are counted before long first-use waits reach the waits threshold, this function sets wait_marked and writes a lacked marker. load_wait_note then cannot replace it with a waits marker, so the next launch ignores the marker and repeats create mode despite the slow waits.
Do: Give the writers separate state and ensure a waits verdict can replace a lacked marker without a later lacked write overwriting it; test both ordering cases.
@ -0,0 +69,4 @@programs_load_decide(true);return load_mode.load() == 1; // (create)}int main(int argc, char** argv) {L2 (should fix): The new test inherits the compressed-cache switch from the environment.
When: With RX_VK_PROGRAM_CACHE_ZSTD=1, programs_load_decide forces start mode even with no marker, so the first create-mode assertion fails although the marker fix is correct.
Do: Clear RX_VK_PROGRAM_CACHE_ZSTD in the test process before the cases, and set it explicitly if testing compressed-cache behavior.
@fix
731cc5075fbadb8ad601Recommendation: Approve. The code is ready: only testing is left. The fix preserves a waits marker when both writers trigger, and the reported Arc runs show substantially lower startup memory use. Gameplay with missing pipelines and the waits fallback still need the runs requested in the ledger. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
badb8ad601. I rebased it ontomain(897d6d3fe7).Conflicts resolved
Changed
Nothing was built or run: the checks run again on the new head.
On PCs with 20 GB of RAM or less, a marker caused by missing cached pipelines no longer forces all listed programs to load before the title. This reduces startup memory use but moves compilation of missing pipelines into play; the writer fix also preserves the fallback for slow loads.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/load_default.h:99: The new default moves missing pipeline compilation into play on affected Tier 1 systems, but the reported runs stop at the title on an Arc PC. When: A Steam Deck or a 16 GB NVIDIA or AMD PC with a lacked marker now enters create mode and can encounter missing pipelines during play; the extent of skipped draws and frame-time impact is unknown. Do: Run the lacked-marker case through representative play on Steam Deck and affected Windows/Linux Tier 1 hardware, recording correctness, skipped draws and frame times against the base.gpu/vk/vk_programs.cpp:384: The waits-marker fallback has not been exercised in game on the low-RAM hardware it is intended to protect. When: A low-RAM PC whose create loads wait seconds relies on a waits marker to select start mode after a session with slow loads; the reported testing has not verified that end-to-end behavior. Do: After fixing the writer ordering, run a slow-load case on the RX 580 or comparable PC and verify that the next launch selects start mode.Checks: they run again on this head (
PR description / Description follows the template (pull_request_target)failed on the last one); a failure shows on the pull request.Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for startup memory on the tested Windows Arc A750 with 16 GB RAM: two alternating runs per version reported peak private memory of 24.1 GB before and 9.5 GB after. The effect during play remains unmeasured.
Other systems: The policy also affects low-RAM Linux and Steam Deck systems and other GPU vendors. The reported game runs cover Windows on Intel Arc; the ledger's gameplay and waits-fallback runs remain outstanding.
Switches: No switches added or removed. RX_VK_LOAD remains an override; compressed-cache and disabled-precompilation behavior remain controlled by their existing switches.
Reviewed:
badb8ad601against897d6d3fe7: Read AGENTS.md, CONTRIBUTING.md, load_default.h, test_load_marker_small_ram.py, the relevant writer and caller code, the fix diff, and the current PR diff for the renderer and unit test. Skimmed the remaining portions of vk_programs.cpp and test_saveload_warm_cache.py; the full changed code files were not all read in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run tests were executed. The author reports Windows renderer builds and game runs on the earlier implementation; CI has not run on this head.
Overlaps and merge order: PR #2193 also touches the marker writers under RX_VK_PRECOMPILE=0; the rebased code retains the precompile guard.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
Jer9 referenced this pull request2026-11-23 16:17:47 +00:00