Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Prompt loan: say when a chunk's loan is larger than the auto chunk's (#2090)

Niko12214468e0e62c68
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 1695b0e93..f7f1b1672 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -10932,6 +10932,10 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata serve: prompt chunk %lld -> %lld tokens for this request: its "
"buffers do not fit the slots that can be lent (#2090)\n", (long long) want,
(long long) want_p);
+ if (need_p > p.cache->slots() - p.first) // the case that ended the engine before (#2090)
+ std::fprintf(stderr, "strata serve: the loan for a chunk of %lld tokens (%lld slots) is larger than the "
+ "auto chunk's (%lld slots): starting it earlier (#2090)\n", (long long) want_p,
+ (long long) need_p, (long long) (p.cache->slots() - p.first));
const int32_t first = (int32_t) (p.cache->slots() - need_p);
if (want_p != p.sp->chunk() || first != p.first_now) {
if (!p.sp->relayout(want_p, p.cache->device_slot(first), part_bytes(p, first), e)) return false;