@@ -194,12 +194,15 @@ class llama_kv_cells_unified {
194194 return shift[i];
195195 }
196196
197+ // check if a cell is not empty and its position is within [p0, p1)
197198 bool pos_in (uint32_t i, llama_pos p0, llama_pos p1) const {
198199 assert (i < pos.size ());
199200
200201 return pos[i] >= p0 && pos[i] < p1;
201202 }
202203
204+ // set the position of an empty cell
205+ // does not modify "has_shift"
203206 // note: call only if the cell is empty
204207 void pos_set (uint32_t i, llama_pos p) {
205208 assert (i < pos.size ());
@@ -210,6 +213,7 @@ class llama_kv_cells_unified {
210213 }
211214
212215 // pos[i] = pos[i] + d
216+ // sets "has_shift" to true
213217 // note: call only if the cell is not empty
214218 bool pos_add (uint32_t i, llama_pos d) {
215219 assert (i < pos.size ());
@@ -233,6 +237,7 @@ class llama_kv_cells_unified {
233237 }
234238
235239 // pos[i] = pos[i] / d
240+ // sets "has_shift" to true
236241 // note: call only if the cell is not empty
237242 void pos_div (uint32_t i, int d) {
238243 assert (i < pos.size ());
@@ -267,7 +272,6 @@ class llama_kv_cells_unified {
267272 //
268273 std::vector<llama_pos> shift;
269274
270- // TODO: assert n_seq_max <= 64
271275 std::vector<std::bitset<LLAMA_MAX_PARALLEL_SEQUENCES>> seq;
272276};
273277
0 commit comments