Repository navigation
pipeline_cache_snapshot: read into a buffer with headroom so a busy cache doesn't fail every checkpoint - #1987
Conversation
…ache doesn't fail every checkpoint
vk_pipeline_check saves its pipeline cache every 10 minutes while workers keep compiling. The snapshot queried the
size and then read into a buffer of exactly that size, so any pipeline added between the two calls made the read
VK_INCOMPLETE. On a large, busy cache that can happen four times in a row, and the checkpoint is lost:
periodic pipeline cache save to ...\pipeline_cache.bin failed: vkGetPipelineCacheData returned VK_INCOMPLETE
on four attempts
(seen during a full `--jobs 12` pipelines stage, ~4 GB cache, RTX 5070 Ti / 621.24). A crash later in the stage,
as in ProjectLeonida#884, then loses more work than it needs to.
The read buffer now has room to spare: 1/16 of the queried size on the first attempt, doubling on each retry
(1/8, 1/4, 1/2). A larger buffer is valid for vkGetPipelineCacheData: the driver writes the whole cache and reports
the bytes written, and the snapshot is trimmed to that. A cache that still outgrows the last attempt ends in the same
error as before, and the byte-count checks are unchanged (more than the buffer given is still rejected).
pipeline_cache_snapshot_test: the scripted driver is now a cache that grows on every call, as a busy one does.
New cases: growth under 1/16 succeeds in one attempt, growth past the first headroom succeeds on the retry, and a
cache that doubles between calls still ends in the four-attempt error. With the old header the first case fails
(the four VK_INCOMPLETEs this fixes); a failing case is now reported by CHECK instead of an uncaught exception.
Tested on Windows 11 Pro 25H2, MSVC 14.51 + Ninja, RTX 5070 Ti / 621.24: pipeline_cache_snapshot_test passes
(fails at the new busy-cache case with the old header); vk_pipeline_check on 300 real modules from my own copy's
work folder wrote a 28.4 MB cache through the new path, and a second run loaded it (64 s, then 1 s). No warnings.
No game data. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flyander
left a comment
There was a problem hiding this comment.
Reviewed the cache snapshot retry path at the current head. The oversized capacity is valid, VK_INCOMPLETE restarts with a fresh size query, and the successful byte count is checked before trimming the snapshot. I found no concrete defect in the diff. CI is still pending.
|
Independent Windows 11 check of |
|
Independent Windows 11 / MSVC test of commit
This was a focused CPU-only unit test exercising the scripted Vulkan calls. No game data or GPU testing was involved. |
Claimed in the coordination issue as a new BUILD item: claim.
What and why
vk_pipeline_checkcheckpoints its pipeline cache every 10 minutes while the workers keep compiling. On a large, busy cache the checkpoint can fail outright:I hit this during a full
--jobs 12pipelines stage, with a ~4 GB cache, on an RTX 5070 Ti / 621.24.pipeline_cache_snapshot()(from #535) queries the size, then reads into a buffer of exactly that size. If a worker adds any pipeline between the two calls, the read returnsVK_INCOMPLETE, and on a big cache that can happen on all four retries. A lost checkpoint means a crash later in the stage, as in #884, loses more work than it needs to.The change
runtime/test/pipeline_cache_snapshot.h: the read buffer has room to spare, 1/16 of the queried size on the first attempt and doubling on each retry (1/8, 1/4, 1/2). A larger buffer is valid forvkGetPipelineCacheData: the driver writes the whole cache and reports the bytes written, and the snapshot is trimmed to that.runtime/test/pipeline_cache_snapshot_test.cpp: the scripted driver is now a cache that grows on every call, as a busy one does. New cases:CHECKinstead of an uncaught exception.Tested
Windows 11 Pro 25H2, MSVC 14.51 + Ninja (
scripts/build_runtime.ps1), NVIDIA RTX 5070 Ti, driver 621.24, onmain6a6704df:pipeline_cache_snapshot_test: passes. With the old header it fails at the first busy-cache case (line 57), which is the four-VK_INCOMPLETEfailure this fixes.vk_pipeline_check --start 0 --count 300 --jobs 12on modules from my own copy's work folder wrote a 28.4 MB cache through the new path (64 s). A second run loaded it and finished in 1 s, so the larger read buffer is accepted and the file is valid.ctest -R pipeline_cache: 2/2. No new warnings.No game data. AI-assisted.
🤖 Generated with Claude Code