]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : fix ctx checkpoint invalidation (#20671)
authorGeorgi Gerganov <redacted>
Tue, 17 Mar 2026 13:21:14 +0000 (15:21 +0200)
committerGitHub <redacted>
Tue, 17 Mar 2026 13:21:14 +0000 (15:21 +0200)
tools/server/server-context.cpp

index c47ad876cb8508a2adca1bd151b7225c22a3f218..05d6da10063f11ab94d607cfc0b290d460576e3e 100644 (file)
@@ -2402,11 +2402,11 @@ private:
                             }
 
                             {
-                                // erase any checkpoints with pos_min > pos_min_thold
+                                // erase any checkpoints with pos_max > pos_next
                                 for (auto it = slot.prompt.checkpoints.begin(); it != slot.prompt.checkpoints.end();) {
                                     const auto & cur = *it;
-                                    if (cur.pos_min > pos_min_thold) {
-                                        SLT_WRN(slot, "erased invalidated context checkpoint (pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", n_swa = %d, size = %.3f MiB)\n", cur.pos_min, cur.pos_max, cur.n_tokens, n_swa, (float) cur.data.size() / 1024 / 1024);
+                                    if (cur.pos_max > pos_next) {
+                                        SLT_WRN(slot, "erased invalidated context checkpoint (pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", n_swa = %d, pos_next = %d, size = %.3f MiB)\n", cur.pos_min, cur.pos_max, cur.n_tokens, n_swa, pos_next, (float) cur.data.size() / 1024 / 1024);
                                         it = slot.prompt.checkpoints.erase(it);
                                     } else {
                                         ++it;