From f07f060ae7817a38edec32776112299cd66c718f Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 5 Oct 2026 10:09:07 +0200 Subject: [PATCH] session files: RESTORE makes room in the elastic K/V (--kv-grow) before the device copy (review finding) --- src/program/generate.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index b3edcee7..573cf182 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -7756,6 +7756,11 @@ int main(int argc, char** argv) { refuse(err); continue; } + // the elastic K/V (--kv-grow) maps only the cells it has grown to: make room for the file's cells + if (!kvg_ensure((int64_t) image.live.ids.size() + 256, [&] { cudaDeviceSynchronize(); apply_pending(true); })) { + refuse("the K/V cannot grow to the saved conversation: no VRAM is left", strata::core::SessionError::memory); + continue; + } conversations.take_reuse(); // retained K/V described the outgoing session live_ok = false; // host -> device in synchronous copies of the whole state: one bounded allowance