2 Commits

Author SHA1 Message Date
6f9ec5c4f9 pipeline_cache_snapshot: read into a buffer with headroom so a busy cache 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 #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>
2026-11-22 10:21:49 -05:00
e27749fcaf Preserve the last complete Vulkan pipeline cache checkpoint 2026-11-21 17:29:54 -07:00