Skip to content

Commit eb572f9

Browse files
committed
squash! llama : add early return for empty range
Remove the setting of cache.head to 0 when the range is empty. Signed-off-by: Daniel Bevenius <[email protected]>
1 parent 4eb8073 commit eb572f9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/llama.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,10 +3259,7 @@ static void llama_kv_cache_seq_add(
32593259
if (p0 < 0) p0 = 0;
32603260
if (p1 < 0) p1 = std::numeric_limits<llama_pos>::max();
32613261
// If there is no range then return early to avoid looping over the cache.
3262-
if (p0 == p1) {
3263-
cache.head = 0;
3264-
return;
3265-
}
3262+
if (p0 == p1) return;
32663263

32673264
if (cache.recurrent) {
32683265
// for Mamba-like models, only the pos needs to be shifted

0 commit comments

Comments
 (0)