Skip to content

Commit 4299891

Browse files
committed
kv-cells : add comments
ggml-ci
1 parent f78dace commit 4299891

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/llama-kv-cells.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ class llama_kv_cells_unified {
213213
seq_pos[seq_id].insert(pos[i]);
214214
}
215215

216+
// the minimum position of sequence seq_id currently present in any of the cells
217+
// return -1 if the sequence is not present
216218
llama_pos seq_pos_min(llama_seq_id seq_id) const {
217219
assert(seq_id >= 0);
218220
assert(seq_id < LLAMA_MAX_PARALLEL_SEQUENCES);
@@ -224,6 +226,8 @@ class llama_kv_cells_unified {
224226
return *seq_pos[seq_id].begin();
225227
}
226228

229+
// the maximum position of sequence seq_id currently present in any of the cells
230+
// return -1 if the sequence is not present
227231
llama_pos seq_pos_max(llama_seq_id seq_id) const {
228232
assert(seq_id >= 0);
229233
assert(seq_id < LLAMA_MAX_PARALLEL_SEQUENCES);
@@ -349,7 +353,7 @@ class llama_kv_cells_unified {
349353
// the bitset seq[i] tells us which sequences are currently occupying the i-th cell
350354
std::vector<bits_t> seq;
351355

352-
// the set seq_pos[s] tells us which positions are currently occupied by the s-th sequence
356+
// the set seq_pos[s] tells us which positions are currently present for sequence s
353357
// this way seq_pos[s].begin() and seq_pos[s].rbegin() give us the min/max positions currently in the cache
354358
std::set<llama_pos> seq_pos[LLAMA_MAX_PARALLEL_SEQUENCES];
355359

0 commit comments

Comments
 (0)