8000 server : fix prompt caching for repeated prompts (#5420) · mglambda/llama.cpp@7c777fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 7c777fc

Browse files
authored
server : fix prompt caching for repeated prompts (ggml-org#5420)
1 parent e5ca393 commit 7c777fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/server/server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,10 +1592,6 @@ struct llama_server_context
15921592
LOG_TEE("slot %d : in cache: %i tokens | to process: %i tokens\n", slot.id, slot.n_past, slot.num_prompt_tokens_processed);
15931593
}
15941594

1595-
LOG_TEE("slot %d : kv cache rm - [%d, end)\n", slot.id, (int) system_tokens.size() + slot.n_past);
1596-
1597-
llama_kv_cache_seq_rm(ctx, slot.id, system_tokens.size() + slot.n_past, -1);
1598-
15991595
slot.cache_tokens = prompt_tokens;
16001596

16011597
if (slot.n_past == slot.num_prompt_tokens && slot.n_past > 0)
@@ -1609,6 +1605,10 @@ struct llama_server_context
16091605
}
16101606
}
16111607

1608+
LOG_TEE("slot %d : kv cache rm - [%d, end)\n", slot.id, (int) system_tokens.size() + slot.n_past);
1609+
1610+
llama_kv_cache_seq_rm(ctx, slot.id, system_tokens.size() + slot.n_past, -1);
1611+
16121612
LOG_VERBOSE("prompt ingested", {
16131613
{"n_past", slot.n_past},
16141614
{"cached", tokens_to_str(ctx, slot.cache_tokens.cbegin(), slot.cache_tokens.cbegin() + slot.n_past)},

0 commit comments

Comments
 (0)
0