Skip to content

Commit 1486804

Browse files
committed
fix: Fix recurrent cache clear signature after rebase
Branch: GraniteFour Signed-off-by: Gabe Goodhart <[email protected]>
1 parent b44b5bd commit 1486804

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/llama-kv-cache-recurrent.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ llama_kv_cache_recurrent::llama_kv_cache_recurrent(
123123
}
124124
}
125125

126-
void llama_kv_cache_recurrent::clear() {
126+
void llama_kv_cache_recurrent::clear(bool data) {
127127
for (int32_t i = 0; i < (int32_t) size; ++i) {
128128
cells[i].pos = -1;
129129
cells[i].seq_id.clear();
@@ -133,8 +133,10 @@ void llama_kv_cache_recurrent::clear() {
133133
head = 0;
134134
used = 0;
135135

136-
for (auto & buf : bufs) {
137-
ggml_backend_buffer_clear(buf.get(), 0);
136+
if (data) {
137+
for (auto & buf : bufs) {
138+
ggml_backend_buffer_clear(buf.get(), 0);
139+
}
138140
}
139141
}
140142

@@ -725,7 +727,7 @@ void llama_kv_cache_recurrent::state_read(llama_io_read_i & io, llama_seq_id seq
725727

726728
if (!res) {
727729
if (seq_id == -1) {
728-
clear();
730+
clear(true);
729731
} else {
730732
seq_rm(seq_id, -1, -1);
731733
}
@@ -882,7 +884,7 @@ bool llama_kv_cache_recurrent::state_read_meta(llama_io_read_i & io, uint32_t ce
882884
return false;
883885
}
884886

885-
clear();
887+
clear(true);
886888

887889
for (uint32_t i = 0; i < cell_count; ++i) {
888890
kv_cell & cell = cells[i];

src/llama-kv-cache-recurrent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class llama_kv_cache_recurrent : public llama_memory_i {
4444

4545
llama_memory_state_ptr init_update(llama_context * lctx, bool optimize) override;
4646

47-
void clear() override;
47+
void clear(bool data) override;
4848

4949
bool seq_rm (llama_seq_id seq_id, llama_pos p0, llama_pos p1) override;
5050
void seq_cp (llama_seq_id seq_id_src, llama_seq_id seq_id_dst, llama_pos p0, llama_pos p1) override;

0 commit comments

Comments
 (0)