Skip to content

Commit 714bef0

Browse files
committed
cont : add comment
1 parent 7f14ac1 commit 714bef0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/llama-kv-cache.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,12 @@ void llama_kv_cache_unified::defrag_sched(float thold) {
441441

442442
void llama_kv_cache_unified::set_full() {
443443
n = size;
444+
445+
// when simulating a full KV cache, the specific value of the "head" pointer is not important because we are not
446+
// going to write any data - we just want to measure the memory needed by the graph in such state.
447+
// we should only guarantee that the head position won't cause out-of-bounds view of the K, V tensors, so
448+
// setting it to 0 is the simplest way to achieve that
449+
// ref: https://github.com/ggml-org/llama.cpp/issues/13359
444450
head = 0;
445451
}
446452

0 commit comments

Comments
 (0)