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)

This commit is contained in:
Niko1221 committed 2026-10-30 19:12:21 +01:00
1 parent 4a75fa2b62
commit dd63f88fdd
1 file changed
+5 -2
+5 -2
View File
@@ -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<int32_t> 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<int32_t> 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<int32_t> fix, drafts;