llama-server: fix k-shift when output overlength

This commit is contained in:
Li, Zonghang
2025-07-17 21:03:41 +08:00
parent f032680cab
commit bdf9d8e74b
3 changed files with 21 additions and 14 deletions
+8 -8
View File
@@ -19108,19 +19108,19 @@ static void llama_kv_cache_update_internal(struct llama_context & lctx) {
GGML_ABORT("Deepseek2 does not support K-shift");
}
for (size_t i = 0; i < lctx.sched.size(); ++i) {
ggml_backend_sched_reset(lctx.sched[i]);
auto * sched = lctx.sched.at(0);
ggml_cgraph * gf = llama_build_graph_k_shift(lctx);
ggml_backend_sched_reset(sched);
ggml_backend_sched_alloc_graph(lctx.sched[i], gf);
ggml_cgraph * gf = llama_build_graph_k_shift(lctx);
llama_set_k_shift(lctx);
ggml_backend_sched_alloc_graph(sched, gf);
llama_graph_compute(lctx, gf, lctx.sched[i], lctx.cparams.n_threads, lctx.threadpool);
llama_set_k_shift(lctx);
need_reserve = true;
}
llama_graph_compute(lctx, gf, sched, lctx.cparams.n_threads, lctx.threadpool);
need_reserve = true;
{
auto & kv_self = lctx.kv_self;