@@ -194,12 +194,15 @@ class llama_kv_cells_unified {
194
194
return shift[i];
195
195
}
196
196
197
+ // check if a cell is not empty and its position is within [p0, p1)
197
198
bool pos_in (uint32_t i, llama_pos p0, llama_pos p1) const {
198
199
assert (i < pos.size ());
199
200
200
201
return pos[i] >= p0 && pos[i] < p1;
201
202
}
202
203
204
+ // set the position of an empty cell
205
+ // does not modify "has_shift"
203
206
// note: call only if the cell is empty
204
207
void pos_set (uint32_t i, llama_pos p) {
205
208
assert (i < pos.size ());
@@ -210,6 +213,7 @@ class llama_kv_cells_unified {
210
213
}
211
214
212
215
// pos[i] = pos[i] + d
216
+ // sets "has_shift" to true
213
217
// note: call only if the cell is not empty
214
218
bool pos_add (uint32_t i, llama_pos d) {
215
219
assert (i < pos.size ());
@@ -233,6 +237,7 @@ class llama_kv_cells_unified {
233
237
}
234
238
235
239
// pos[i] = pos[i] / d
240
+ // sets "has_shift" to true
236
241
// note: call only if the cell is not empty
237
242
void pos_div (uint32_t i, int d) {
238
243
assert (i < pos.size ());
@@ -267,7 +272,6 @@ class llama_kv_cells_unified {
267
272
//
268
273
std::vector<llama_pos> shift;
269
274
270
- // TODO: assert n_seq_max <= 64
271
275
std::vector<std::bitset<LLAMA_MAX_PARALLEL_SEQUENCES>> seq;
272
276
};
273
277
0 commit comments