Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tools/server/server-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2597,6 +2597,16 @@ struct server_context_impl {
slot->prompt.tokens.clear();
slot->prompt.tokens.insert(tokens);

// A restored slot has no context checkpoint, so the next
// request with cache_prompt finds no reuse anchor and
// reprocesses the entire restored prefix. Create a
// checkpoint spanning the restored span so the restored
// KV is actually reused.
if (params_base.n_ctx_checkpoints > 0) {
create_checkpoint(*slot, (int64_t) 0, 0,
(llama_pos) (token_count > 0 ? token_count - 1 : 0));
}

const int64_t t_end = ggml_time_us();
const double t_restore_ms = (t_end - t_start) / 1000.0;

Expand Down