File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -3879,11 +3879,17 @@ static bool llama_cache_find_slot(
3879
3879
if (cell.tail_rc == 0) {
3880
3880
cache.rs.clear_cell(cell);
3881
3881
} else {
3882
- // TODO: does this always work correctly
3883
- // even if there are more than one seq_node in this cell?
3882
+ // Find the seq_id of the first tail of this cell
3883
+ llama_seq_id seq_id = -1;
3884
+ for (llama_rs_seq_node & seq_node : cell.seq_nodes) {
3885
+ if (seq_node.is_tail()) {
3886
+ seq_id = seq_node.seq_id;
3887
+ break;
3888
+ }
3889
+ }
3890
+ GGML_ASSERT(seq_id != -1);
3884
3891
3885
3892
// Which seq_id of the batch is it?
3886
- llama_seq_id seq_id = cell.seq_nodes[0].seq_id;
3887
3893
int32_t nth_seq_id = -1;
3888
3894
for (int32_t s = 0; (uint32_t) s < n_seqs; ++s) {
3889
3895
if (seq_id == batch.seq_id[s][0]) {
You can’t perform that action at this time.
0 commit comments