Skip to content

Commit 3e68df8

Browse files
committed
llama : pad KV cache size to 32
1 parent 5a7d312 commit 3e68df8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llama.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5744,8 +5744,7 @@ static int llama_decode_internal(
57445744
// a heuristic, to avoid attending the full cache if it is not yet utilized
57455745
// after enough generations, the benefit from this heuristic disappears
57465746
// if we start defragmenting the cache, the benefit from this will be more important
5747-
//kv_self.n = std::max(32, GGML_PAD(llama_kv_cache_cell_max(kv_self), 32)); // TODO: this might be better for CUDA?
5748-
kv_self.n = std::min((int32_t) cparams.n_ctx, std::max(32, llama_kv_cache_cell_max(kv_self)));
5747+
kv_self.n = std::min((int32_t) cparams.n_ctx, std::max(32, GGML_PAD(llama_kv_cache_cell_max(kv_self), 32)));
57495748

57505749
//printf("kv_self.n = %5d, kv_self.used = %5d, kv_self.head = %5d\n", kv_self.n, kv_self.used, kv_self.head);
57515750

0 commit comments

Comments
 (0)