File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -624,14 +624,15 @@ llama_kv_cache_unified::slot_info llama_kv_cache_unified::find_slot(const llama_
624
624
}
625
625
}
626
626
627
- uint32_t n_found = 0 ;
628
627
uint32_t n_tested = 0 ;
629
628
630
629
const uint32_t n_test = cont ? n_tokens : 1 ;
631
630
632
631
slot_info res;
633
632
634
- res.idxs .resize (n_tokens);
633
+ auto & idxs = res.idxs ;
634
+
635
+ idxs.reserve (n_tokens);
635
636
636
637
while (true ) {
637
638
if (head_cur + n_test > cells.size ()) {
@@ -677,20 +678,18 @@ llama_kv_cache_unified::slot_info llama_kv_cache_unified::find_slot(const llama_
677
678
n_tested++;
678
679
679
680
if (can_use) {
680
- res.idxs [n_found] = idx;
681
-
682
- n_found++;
681
+ idxs.push_back (idx);
683
682
} else {
684
683
break ;
685
684
}
686
685
}
687
686
688
- if (n_found == n_tokens) {
687
+ if (idxs. size () == n_tokens) {
689
688
break ;
690
689
}
691
690
692
691
if (cont) {
693
- n_found = 0 ;
692
+ idxs. clear () ;
694
693
}
695
694
696
695
if (n_tested >= cells.size ()) {
@@ -700,7 +699,7 @@ llama_kv_cache_unified::slot_info llama_kv_cache_unified::find_slot(const llama_
700
699
}
701
700
702
701
// we didn't find a suitable slot - return empty result
703
- if (n_found < n_tokens) {
702
+ if (idxs. size () < n_tokens) {
704
703
res.clear ();
705
704
}
706
705
You can’t perform that action at this time.
0 commit comments