8000 kv-cells : fix tracking of "used" cells · ggml-org/llama.cpp@0dc4804 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0dc4804

Browse files
committed
kv-cells : fix tracking of "used" cells
ggml-ci
1 parent f71e737 commit 0dc4804

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/llama-kv-cells.h

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,13 @@ class llama_kv_cells_unified {
162162
return seq[i].test(seq_id);
163163
}
164164

165-
// note: call only if the cell is not empty
166-
bool seq_add(uint32_t i, llama_seq_id seq_id) {
165+
// note: call only if the cell is not empty and the seq_id is not in the cell
166+
void seq_add(uint32_t i, llama_seq_id seq_id) {
167167
assert(i < pos.size());
168168
assert(pos[i] != -1);
169+
assert(!seq[i].test(seq_id));
169170

170-
if (seq[i].none()) {
171-
seq[i].set(seq_id);
172-
173-
used++;
174-
175-
return true;
176-
}
177-
178-
return false;
171+
seq[i].set(seq_id);
179172
}
180173

181174
// note: call only if the cell is not empty
@@ -252,7 +245,7 @@ class llama_kv_cells_unified {
252245
}
253246

254247
private:
255-
uint32_t used = 0; // used cells (i.e. at least one seq_id)
248+
uint32_t used = 0; // used cells (i.e. at pos[i] != -1, allowd to not have any sequence)
256249

257250
bool has_shift = false;
258251

0 commit comments

Comments
 (0)
0