From dd63f88fdd84a6121b8a1f4f0e46e80bb3c03234 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 30 Oct 2026 19:12:21 +0100 Subject: [PATCH] Qwen3.6 engine: the warm-up reads only cells that exist and starts its small probes in a fresh sequence, so a prompt chunk equal to the context no longer writes past the KV cache (#4708) --- src/qwen35/q36_engine.cu | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qwen35/q36_engine.cu b/src/qwen35/q36_engine.cu index 6a773837..971be981 100644 --- a/src/qwen35/q36_engine.cu +++ b/src/qwen35/q36_engine.cu @@ -2759,9 +2759,12 @@ struct Engine { const auto t0 = Clock::now(); warming = true; const int32_t filler = 198; // a newline: any token works - std::vector toks((size_t) tmax, filler); + // #4708: the prompt chunk may equal or exceed the context (--context 2048 with a 2048-token chunk): warm only cells that + // exist, and start the small-prompt, decode and speculative probes in a fresh sequence instead of appending past the cache. + std::vector toks((size_t) std::max(1, std::min(tmax, ctx)), filler); process(toks.data(), (int64_t) toks.size(), [](int64_t) {}); - if (tmax > kGemmT + 1) process(toks.data(), kGemmT + 1, [](int64_t) {}); // the smallest GEMM chunk too + reset(); + if (tmax > kGemmT + 1 && ctx > kGemmT + 1) process(toks.data(), kGemmT + 1, [](int64_t) {}); // the smallest GEMM chunk too process(&filler, 1, [](int64_t) {}); if (mtp_d > 0) { std::vector fix, drafts;