diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index 770e5636e..dbc6bcda4 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -1159,8 +1159,12 @@ private: SRV_INF("%s", "server entering sleeping state (VRAM-only: releasing device weights, keeping KV cache)\n"); vram_go_cold(); } else { - SRV_INF("%s", "server exiting sleeping state (VRAM-only: weights restored on next decode)\n"); - // token is acquired and weights restored by vram_ensure_warm() before decode + SRV_INF("%s", "server exiting sleeping state (VRAM-only: restoring device weights/KV)\n"); + // Restore NOW, on wake, before update_slots runs. update_slots touches the KV cache + // (e.g. SWA checkpoint creation reads it via ggml_backend_tensor_get) before the + // decode-time vram_ensure_warm(), so with KV eviction the KV must already be resident + // here or those reads hit a freed (null) buffer. + vram_ensure_warm(); } sleeping = new_state; return;