fix(vk): the start's driver cache check asks our pipeline cache: AMD's and Intel's drivers no longer warm again at every start #3246
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
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!3246
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/cold-check-asks-our-cache"
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 AMD's and Intel's Windows drivers every start rebuilds the shaders before the title (70-90 s on an RX 580), even straight after a clean close. The log says
the driver's shader cache has 0 of 60 noted pipelines asked ...: it lost them (a driver update, or evicted): they are built again before the title, but nothing was lost.The check (
notes_lost_by_driver, from #1188) asks a sample of the noted pipelines of an empty scratch pipeline cache, so it reads only the driver's own disk cache. That is the whole answer on NVIDIA, where our pipeline cache only refers to the driver's. AMD's and Intel's drivers keep the built pipelines in our pipeline cache file itself (750 MB to 5.5 GB in these logs), and the load at create calls is made from that cache. So the check says "lost" there whatever the driver's own cache holds. The warm pass it starts then finds every pipeline in our cache and compiles none:Seen the same way in two RX 580 players' logs (AMD 25.8.1 and 26.11.2,
0 of 60and0 of 49, one in a run right after a clean close of the previous one), and in the logs on #1894 and #2613 (Radeon 780M, 26.20.15.14), #1990 (RX 7600, 26.11.2) and #2499 (Arc B580, 101.9175): eachlost, each followed by a warm pass of 30-40 s for about 38,000 pipelines that left our cache the size it was read at (the pipeline cache not written: nothing new since it was read). AMD's driver stores a pipeline it compiles in the cache it is handed, so the cache would have grown had any been compiled; a real rebuild takes minutes (342.6 s on an RTX 5080 below). With AMD's own cache warm it answers48 of 48(#2754, #2565), so the driver is asked correctly; it is the wrong cache to ask.This asks the sample of the cache the load at create calls are made from instead: ours (
pcache), with the driver's own behind it, still without a compile (VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT). On NVIDIA with its cache emptied ours answers nothing alone, and the check still says lost (run below). No pipeline cache made at a start: the driver alone answers, as before.Read first:
notes_lost_by_driveringpu/vk/vk_draw.cpp;tests/test_cold_check_asks_our_cache.py.See #2577 (found while reading its RX 580 logs; the blue screens there are another problem).
Testing
Tested: Windows 11 Pro, RTX 5080 (NVIDIA 621.47), 62 GB RAM, this branch's runtime over the shared base,
dev.py smokefromkokiri-start:the driver's shader cache has 63 of 63 noted pipelines asked (a sample, in 583 ms), nothing built again, PASS.__GL_SHADER_DISK_CACHE_PATH):the driver's shader cache has 0 of 63 noted pipelines asked (a sample, in 138 ms): it lost them ..., asked through our 1.3 GB pipeline cache; every noted pipeline built again before the title (44,712 and 5,087 compute in 342.6 s on 16 threads; the empty folder filled to 1.1 GB), then PASS. So on NVIDIA asking our cache answers as asking the driver alone did.Checks:
tests/test_cold_check_asks_our_cache.py(new) fails on main (!ask(false, true): our cache holding every pipeline, the driver's none, read as lost) and passes here, with g++ (MSYS2 UCRT64) and clang++ (llvm-mingw); with the fix's key line undone it fails again.tests/test_cold_cache_check.pyupdated to the new cache (not weakened).mise run teston7bc53f841plus this branch (Windows, llvm-mingw clang): 846 passed, 52 skipped, 14 failed. Not this change:test_present_geometry_trace,test_present_image_free,test_present_held_image,test_present_acquire_ahead(their fixtures do not compile),test_dlssg,test_no_map_reload,test_sync_watch_event,test_turf_budget,test_ui_renderer,test_no_game_title, all failing on main3a0f7d8f7too;test_longshot_ctl,test_renderer_new_handlerandtest_stack_commitfailed under the suite's load and pass run alone.test_liftertimed out under load; run alone it fails only on host-sys's clippylarge_const_arrays(settings_abi.rs) and the api testa_walked_reshade_folder_counts_a_change_once_two_walks_agree, both failing on main too (this change touches no Rust).This PC has no AMD or Intel GPU: the fix has not run on the drivers it is for.
Still to test:
the driver's shader cache has N of N noted pipelines askedwith N of N and noprecompile: ... built into the pipeline cache and let gobefore the title (by hand, a player from #2577; or @Beanstalk on an AMD Windows PC)__GL_SHADER_DISK_CACHE_PATHat an empty folder, expecting0 of N ... it lost themand the build before the title (@Beanstalk linux nvidia, or by hand)Measurements
Nothing to measure on this PC: on NVIDIA the check answers as before (63 of 63 warm, lost with the cache emptied). On the PCs it is for, the players' logs give the cost it removes, 70-90 s of warm pass at every start on an RX 580 (69.7 s and 89.6 s in the two logs, 30-40 s on the 780M and RX 7600 in the issues). Before and after on AMD are owed by Still to test.
Risks
pcache_drop_staleand a refused file (another driver's) still remove the marker first.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.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
notes_lost_by_driver asked its sample of the notes of an empty scratch pipeline cache, so it read what the driver's own disk cache holds. On NVIDIA that is the whole answer, our cache only referring to the driver's; AMD's and Intel's drivers keep the pipelines in ours itself. An RX 580 (AMD 25.8.1 and 26.11.2) read "0 of 60 ... it lost them" at every start, a run after a clean close included, and every start ran the warm pass again for 70-90 s, which found every noted pipeline in our cache ("the pipeline cache not written: nothing new since it was read"). A Radeon 780M, an RX 7600 and an Arc B580 the same. The sample is now asked, still without a compile, of pcache, the cache the load at create calls are made from, with the driver's own behind it. On NVIDIA with its cache emptied ours answers nothing and the check still says lost. Co-Authored-By: Claude Opus 5.5 <[email protected]>Tested in game: Windows 11 Pro, RTX 5080, NVIDIA 621.47, this branch's runtime, dev.py smoke from kokiri-start: with NVIDIA's cache as it is the check read 63 of 63 and nothing was built again (PASS); with NVIDIA's cache pointed at an empty folder (__GL_SHADER_DISK_CACHE_PATH) it read 0 of 63 through our 1.3 GB pipeline cache, said lost, built every noted pipeline again before the title (342.6 s) and played (PASS). Not run on AMD or Intel: this PC has neither.
@Beanstalk on Windows with AMD's driver (any Radeon; Polaris/GCN such as an RX 580 most of all, and an RDNA 3 card or a Radeon 780M on LLPC), and on Windows with an Intel Arc: start the game twice from this PR's build, closing it cleanly in between. Expected on the second start: the log's
the driver's shader cache has N of N noted pipelines askedwith N of N and no "it lost them", and noprecompile: ... built into the pipeline cache and let goline before the title. On main the same cards print0 of N ... it lost themat every start and run that pass again (70-90 s on an RX 580). Also on Linux with RADV: the same two starts, expecting N of N as before. Please attach the second start's log lines for the check and the precompile.Beanstalk test farm · an earlier run: commit
01a6ec4(the newer results are in a comment below)Commit
01a6ec4· approved by llun (reviewed) · dashboard⚠️ Note: The farm cannot guarantee that the Windows starts begin with a populated game pipeline cache or isolate the second start for judging; a legitimate first-start precompile can therefore fail this plan.
⚠️ Note: The log matcher cannot require the two pipeline counts to be equal or restrict the precompile check to before the title, and the plan cannot explicitly attach only the second start's matching log lines.
⚠️ Note: This does not reproduce a genuinely emptied NVIDIA driver cache or verify that lost pipelines are rebuilt; startup times are reported but no fixed speedup is asserted.
Started at 12:41 UTC.
Estimate: done in about 2 h 30 min, from the queue and the testers online now; some jobs can't start yet.
⚠ No tester has a PC for
windows+amd+gpu-780m(none seen in 14 days): it waits until one signs in.⚠ No tester has a PC for
windows+amd+gpu-rx-5xx(none seen in 14 days): it waits until one signs in.windows+amdwindows+amd+gpu-rx-5xx(GPU "rx 5xx")windows+amd+gpu-rx-7xxx(GPU "rx 7xxx")windows+amd+gpu-780m(GPU "780m")windows+intel+gpu-arc-*(GPU "arc *")linux+radvWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)The plan compares startup on Windows Radeon and Intel Arc systems and Linux RADV, using three starts per build to sample the cache check and startup time. It fails the PR for a crash, a reported lost shader cache, or a repeated precompile pass; an absent cache-check line is left unjudged. The requested Polaris, RDNA 3 or 780M, and Arc targets may wait for matching Windows testers. No tester online now matches windows+amd+gpu-rx-5xx, windows+amd+gpu-780m, windows+intel+gpu-arc-*: those targets wait for one.
HOS_FPS_MAX=30,HOS_OUTPUT_RES=1280x720); 3 runs on each side.@review
Recommendation: Approve. The change should avoid a needless warm pass when the application cache contains the pipelines, but it has not yet been demonstrated on the AMD or Intel drivers it targets. Linux coverage and the required before-and-after startup measurements are also outstanding. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
The startup sample now asks the pipeline cache used for pipeline creation, so a populated application cache can prevent an unnecessary rebuild pass. The change is small and reuses the existing cache creation path, but its benefit and driver-specific behavior remain unverified on the affected hardware.
Should fix (1): not blocking, but worth doing before merging.
tests/test_cold_check_asks_our_cache.py:154: The standalone test ignores the configured C++ compiler and defaults directly to g++. (more on the line) Do: Use CXX as the default when set, while retaining the explicit --cxx override and a portable fallback.Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_draw.cpp:13800: The intended startup improvement has not been measured on the drivers it targets. (more on the line) Do: Compare the base and this head on AMD Windows, including RX 580 and RDNA 3, and Intel Arc with repeated warm starts; record startup time, probe results, and cold and warm cache sizes.gpu/vk/vk_draw.cpp:13800: The changed probe also runs on Linux drivers, where its behavior has not been checked. (more on the line) Do: Run repeated starts on Linux RADV, including Steam Deck where available, and Linux NVIDIA; check warm-cache behavior and recovery after the driver cache is emptied.@fixcan do L3.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. Existing AMD logs report unnecessary warm passes of 69.7–89.6 seconds on RX 580 and 30–40 seconds on other Radeon systems; there are no comparable runs of this branch on those systems. The reported RTX 5080 run found 63 of 63 pipelines with a warm driver cache and 0 of 63 with an emptied cache, as intended.
Other systems: The change affects startup cache probing on all Vulkan drivers when load-at-create is enabled. Windows NVIDIA was tested with warm and emptied driver caches; AMD Windows, Intel Arc, Linux RADV and Linux NVIDIA remain unverified. The existing guarded graphics path protects cache use against concurrent cache-data fetches. No save, input, audio or renderer API changes were found.
Switches: None added, changed or removed.
Reviewed:
01a6ec4b75against7bc53f8413: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, both changed tests, the diff and commit messages. Read the changed function and surrounding cache initialization, creation, locking and startup code in vk_draw.cpp; the rest of that 15,645-line file was skimmed rather than read in full. docs/review-checklist.md and the adjacent Tooling checkout were absent. Reviewed the supplied comments and CI status; no recorded runs, translations or generated files changed.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run during this read-only review. The author reports Windows NVIDIA game runs and game-free checks; the supplied CI checks are still running.
Overlaps and merge order: Not checked; network access is unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -13798,0 +13797,4 @@} restore{f};// (driver_cache_only: nothing counted as built into pcache, pcache_built_since_save. No pcache at this start: the driver// alone)driver_cache_only = true, driver_ask_cache = pcache;L1 (should fix): The intended startup improvement has not been measured on the drivers it targets.
When: On AMD Windows and Intel Arc, the new probe must find pipelines in the application cache and skip the warm pass; the supplied target-driver logs only show behavior before this change.
Do: Compare the base and this head on AMD Windows, including RX 580 and RDNA 3, and Intel Arc with repeated warm starts; record startup time, probe results, and cold and warm cache sizes.
L2 (should fix): The changed probe also runs on Linux drivers, where its behavior has not been checked.
When: A Linux driver may answer a probe through the loaded application cache differently from the former empty-cache probe, changing whether startup repeats the warm pass.
Do: Run repeated starts on Linux RADV, including Steam Deck where available, and Linux NVIDIA; check warm-cache behavior and recovery after the driver cache is emptied.
@ -0,0 +151,4 @@def main():p = argparse.ArgumentParser(description=__doc__.split("\n")[0])p.add_argument("--cxx", default="g++")L3 (should fix): The standalone test ignores the configured C++ compiler and defaults directly to g++.
When: On a machine with CXX set to clang++ but no g++ executable, the documented direct invocation fails before the fixture can run, although the configured compiler is available.
Do: Use CXX as the default when set, while retaining the explicit --cxx override and a portable fallback.
BeanBot's review:
4be23df9e: run by hand, the check takes$CXXwhen it is set, else g++, else clang++ where only clang++ is there (the form of tests/test_bc_copy_layer_pitch.py);--cxxand the runner's{cxx}still win. Run with CXX=clang++, with no CXX, with --cxx g++ and through run_all.py: PASS each time.01a6ec4covers them (windows+amd, rx-5xx, rx-7xxx, 780m, arc); its results go into Tested when they are in. The commits since touch only the test file.@review
Recommendation: Approve. The code is ready: only testing is left. The target-driver startup gain and Linux behavior remain unverified. The compiler selection issue is fixed, but the requested hardware results have not yet been reported. Recommend approval; not approved on the forge.
The startup probe now asks the pipeline cache used by pipeline creation, aiming to avoid unnecessary shader warm-up on AMD and Intel drivers. The change is small, but its intended startup gain and cross-driver behavior still need hardware results.
Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)
gpu/vk/vk_draw.cpp:13800: The intended startup improvement has not been measured on the drivers it targets. When: On AMD Windows and Intel Arc, the new probe must find pipelines in the application cache and skip the warm pass; the supplied target-driver logs only show behavior before this change. Do: Compare the base and this head on AMD Windows, including RX 580 and RDNA 3, and Intel Arc with repeated warm starts; record startup time, probe results, and cold and warm cache sizes.gpu/vk/vk_draw.cpp:13800: The changed probe also runs on Linux drivers, where its behavior has not been checked. When: A Linux driver may answer a probe through the loaded application cache differently from the former empty-cache probe, changing whether startup repeats the warm pass. Do: Run repeated starts on Linux RADV, including Steam Deck where available, and Linux NVIDIA; check warm-cache behavior and recovery after the driver cache is emptied.Since the last review (on
01a6ec4b75)Resolved: L3 (The standalone test ignores the configured C++ compiler and defaults directly to g++.)
Still open: L1 (The intended startup improvement has not been measured on the drivers it targets.); L2 (The changed probe also runs on Linux drivers, where its behavior has not been checked.)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. Existing AMD logs report 69.7–89.6 seconds spent in the repeated warm pass, but there are no before-and-after runs on the target drivers. The reported Windows NVIDIA run preserved warm-cache and emptied-cache behavior.
Other systems: The probe also affects Linux RADV and NVIDIA drivers; Linux results are pending. Windows NVIDIA was tested with both a warm and an emptied driver cache. AMD and Intel Test Farm runs have been requested but no results were supplied.
Switches: None.
Reviewed:
4be23df9e0against7bc53f8413: Read the full diff, the new test, AGENTS.md, CONTRIBUTING.md and the pull request template. Read the changed renderer and existing test sections through the diff; the full renderer and existing test files were not read. The review checklist file is absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The author reports the game-free checks and Windows NVIDIA game runs; CI is still running.
Overlaps and merge order: Not checked.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@Beanstalk
Beanstalk test farm · 🔄 testing (0 of 8 reports so far)
Commit
4be23df· approved by llun (reviewed) · dashboard⚠️ Note: The repeated starts use existing caches rather than a guaranteed pre-populated warm cache; missing sample logs do not fail the run, and the counts cannot establish that every sampled pipeline was found.
⚠️ Note: Driver-cold scenarios run only on Linux; the plan does not measure cache-file sizes or reproduce a Windows driver-cache eviction.
⚠️ Note: The startup-time comparison can reveal the claimed saving but does not require a minimum improvement, since the original unnecessary warm pass may not occur.
Done (started 12:47 UTC). Comment
@Beanstalkto run it again.windows+amdwindows+amd+gpu-rx-5xx(GPU "rx 5xx")windows+amd+gpu-rx-7xxx(GPU "rx 7xxx")windows+intel+gpu-arc-*(GPU "arc *")windows+nvidialinux+radvlinux+nvidiasteamdeckWhat was tested
What will be tested · AI plan (
gpt-6.1-terra)The plan compares repeated starts of main and the PR, then captures the Market and Hyrule Field to detect picture differences. It records startup time, shader preparation, cache-loss messages and warm-pass messages; Linux runs also start with an emptied driver cache. A crash, a startup-time regression over 20%, or a picture difference over 0.25 fails the PR. The requested RX 580, RDNA 3 and Intel Arc targets wait if matching Windows PCs are unavailable. No tester online now matches windows+amd+gpu-rx-5xx, windows+intel+gpu-arc-*: those targets wait for one.
market-entrance(settings resolution=1, quality_preset=0; switchesHOS_OUTPUT_RES=1280x720,RX_VK_AUTO_TUNE=0), then teleport to Market, take the picture market to compare with main, teleport to Hyrule Field, take the picture field to compare with main; 3 runs on each side.market-entrance(settings resolution=1, quality_preset=0; switchesHOS_OUTPUT_RES=1280x720,RX_VK_AUTO_TUNE=0; each start with an empty driver shader cache, Linux only for now), then teleport to Market, take the picture cold-market to compare with main; 2 runs on each side.