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