@@ -133,11 +133,11 @@ int main(int argc, char ** argv) {
133
133
const int ib = i/n_batch - 1 ;
134
134
const int bd = n_batch_grp*(n_grp - 1 );
135
135
136
- llama_kv_cache_seq_add (ctx, 0 , n_past - n_batch, n_past, ib*bd);
137
- llama_kv_cache_seq_div (ctx, 0 , n_past - n_batch + ib*bd, n_past + ib*bd, n_grp);
138
- llama_kv_cache_update (ctx);
136
+ llama_kv_self_seq_add (ctx, 0 , n_past - n_batch, n_past, ib*bd);
137
+ llama_kv_self_seq_div (ctx, 0 , n_past - n_batch + ib*bd, n_past + ib*bd, n_grp);
138
+ llama_kv_self_update (ctx);
139
139
140
- n_past = llama_kv_cache_seq_pos_max (ctx, 0 ) + 1 ;
140
+ n_past = llama_kv_self_seq_pos_max (ctx, 0 ) + 1 ;
141
141
}
142
142
143
143
common_batch_clear (batch);
@@ -167,12 +167,12 @@ int main(int argc, char ** argv) {
167
167
168
168
LOG_INF (" %s: shifting KV cache with %d\n " , __func__, n_discard);
169
169
170
- llama_kv_cache_seq_rm (ctx, 0 , n_keep , n_keep + n_discard);
171
- llama_kv_cache_seq_add (ctx, 0 , n_keep + n_discard, n_ctx, -n_discard);
172
- // llama_kv_cache_defrag (ctx);
173
- llama_kv_cache_update (ctx);
170
+ llama_kv_self_seq_rm (ctx, 0 , n_keep , n_keep + n_discard);
171
+ llama_kv_self_seq_add (ctx, 0 , n_keep + n_discard, n_ctx, -n_discard);
172
+ // llama_kv_self_defrag (ctx);
173
+ llama_kv_self_update (ctx);
174
174
175
- n_past = llama_kv_cache_seq_pos_max (ctx, 0 ) + 1 ;
175
+ n_past = llama_kv_self_seq_pos_max (ctx, 0 ) + 1 ;
176
176
177
177
common_batch_clear (batch);
178
178
@@ -198,12 +198,12 @@ int main(int argc, char ** argv) {
198
198
if (n_discard > 0 ) {
199
199
LOG_INF (" %s: shifting KV cache with %d to free space for the answer\n " , __func__, n_discard);
200
200
201
- llama_kv_cache_seq_rm (ctx, 0 , n_keep , n_keep + n_discard);
202
- llama_kv_cache_seq_add (ctx, 0 , n_keep + n_discard, n_ctx, -n_discard);
203
- // llama_kv_cache_defrag (ctx);
204
- llama_kv_cache_update (ctx);
201
+ llama_kv_self_seq_rm (ctx, 0 , n_keep , n_keep + n_discard);
202
+ llama_kv_self_seq_add (ctx, 0 , n_keep + n_discard, n_ctx, -n_discard);
203
+ // llama_kv_self_defrag (ctx);
204
+ llama_kv_self_update (ctx);
205
205
206
- n_past = llama_kv_cache_seq_pos_max (ctx, 0 ) + 1 ;
206
+ n_past = llama_kv_self_seq_pos_max (ctx, 0 ) + 1 ;
207
207
}
208
208
}
209
209
0 commit comments