llama : change name to llama_kv_cache_update()
This commit is contained in:
parent
79e276175e
commit
18da970e1c
3 changed files with 10 additions and 10 deletions
|
@ -148,7 +148,7 @@ int main(int argc, char ** argv) {
|
|||
|
||||
llama_kv_cache_seq_add(ctx, 0, n_past - n_batch, n_past, ib*bd);
|
||||
llama_kv_cache_seq_div(ctx, 0, n_past - n_batch + ib*bd, n_past + ib*bd, n_grp);
|
||||
llama_kv_cache_apply (ctx);
|
||||
llama_kv_cache_update (ctx);
|
||||
|
||||
n_past -= bd;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ int main(int argc, char ** argv) {
|
|||
|
||||
llama_kv_cache_seq_rm (ctx, 0, n_keep , n_keep + n_discard);
|
||||
llama_kv_cache_seq_add(ctx, 0, n_keep + n_discard, n_ctx, -n_discard);
|
||||
llama_kv_cache_apply (ctx);
|
||||
llama_kv_cache_update (ctx);
|
||||
|
||||
n_past -= n_discard;
|
||||
|
||||
|
@ -212,7 +212,7 @@ int main(int argc, char ** argv) {
|
|||
|
||||
llama_kv_cache_seq_rm (ctx, 0, n_keep , n_keep + n_discard);
|
||||
llama_kv_cache_seq_add(ctx, 0, n_keep + n_discard, n_ctx, -n_discard);
|
||||
llama_kv_cache_apply (ctx);
|
||||
llama_kv_cache_update (ctx);
|
||||
|
||||
n_past -= n_discard;
|
||||
}
|
||||
|
|
|
@ -7851,7 +7851,7 @@ static int llama_decode_internal(
|
|||
|
||||
//printf("kv_self.n = %5d, kv_self.used = %5d, kv_self.head = %5d\n", kv_self.n, kv_self.used, kv_self.head);
|
||||
|
||||
llama_kv_cache_apply(&lctx);
|
||||
llama_kv_cache_update(&lctx);
|
||||
|
||||
ggml_backend_sched_reset(lctx.sched);
|
||||
ggml_backend_sched_set_eval_callback(lctx.sched, lctx.cparams.cb_eval, lctx.cparams.cb_eval_user_data);
|
||||
|
@ -7989,7 +7989,7 @@ static int llama_decode_internal(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void llama_kv_cache_apply_internal(struct llama_context & lctx) {
|
||||
static void llama_kv_cache_update_internal(struct llama_context & lctx) {
|
||||
// apply K-shift if needed
|
||||
if (lctx.model.hparams.rope_type != LLAMA_ROPE_TYPE_NONE && lctx.kv_self.has_shift) {
|
||||
llama_set_k_shift(lctx);
|
||||
|
@ -12056,8 +12056,8 @@ void llama_kv_cache_seq_div(struct llama_context * ctx, llama_seq_id seq_id, lla
|
|||
llama_kv_cache_seq_div(ctx->kv_self, seq_id, p0, p1, d);
|
||||
}
|
||||
|
||||
void llama_kv_cache_apply(struct llama_context * ctx) {
|
||||
llama_kv_cache_apply_internal(*ctx);
|
||||
void llama_kv_cache_update(struct llama_context * ctx) {
|
||||
llama_kv_cache_update_internal(*ctx);
|
||||
}
|
||||
|
||||
|
||||
|
|
6
llama.h
6
llama.h
|
@ -524,7 +524,7 @@ extern "C" {
|
|||
// Adds relative position "delta" to all tokens that belong to the specified sequence and have positions in [p0, p1)
|
||||
// If the KV cache is RoPEd, the KV data is updated accordingly:
|
||||
// - lazily on next llama_decode()
|
||||
// - explicitly with llama_kv_cache_apply()
|
||||
// - explicitly with llama_kv_cache_update()
|
||||
// p0 < 0 : [0, p1]
|
||||
// p1 < 0 : [p0, inf)
|
||||
LLAMA_API void llama_kv_cache_seq_add(
|
||||
|
@ -537,7 +537,7 @@ extern "C" {
|
|||
// Integer division of the positions by factor of `d > 1`
|
||||
// If the KV cache is RoPEd, the KV data is updated accordingly:
|
||||
// - lazily on next llama_decode()
|
||||
// - explicitly with llama_kv_cache_apply()
|
||||
// - explicitly with llama_kv_cache_update()
|
||||
// p0 < 0 : [0, p1]
|
||||
// p1 < 0 : [p0, inf)
|
||||
LLAMA_API void llama_kv_cache_seq_div(
|
||||
|
@ -548,7 +548,7 @@ extern "C" {
|
|||
int d);
|
||||
|
||||
// Apply the KV cache updates (such as K-shifts) to the KV data
|
||||
LLAMA_API void llama_kv_cache_apply(struct llama_context * ctx);
|
||||
LLAMA_API void llama_kv_cache_update(struct llama_context * ctx);
|
||||
|
||||
//
|
||||
// State / sessions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue