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++

engine: a big prompt chunk whose lent slots do not fit in RAM is warned about (#669, #765)

Niko1221e155cf8fc4ab
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 7300a9dec..920eeda7a 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -5499,6 +5499,17 @@ int main(int argc, char** argv) {
else
err = whole_err + "; " + err;
}
+ // #669 / #765: a big chunk lends many cache slots to the prompt path, and each lent slot's expert is read back
+ // from the SSD whenever the RAM could not keep its copy (31 GB: auto:32768 read prompts ~3x slower than auto).
+ // Said, never capped: --prefill is the user's, and with the RAM for them it is the faster one (+21-35%).
+ if (resident_ok && lend_from >= 0 && o.prefill_chunk > 8192 && xcache.slots() > lend_from &&
+ src.resident_lent_slots() < xcache.slots() - lend_from)
+ std::fprintf(stderr, "strata generate: WARNING: a prompt chunk of %lld tokens lends %lld cache slots to the "
+ "prompt path, but only %lld of their experts fit in RAM: the others are read from the "
+ "SSD on every chunk, and prompts can read ~3x slower than with --prefill auto (#669). "
+ "A smaller --prefill, or auto, keeps them all in RAM\n",
+ (long long) o.prefill_chunk, (long long) (xcache.slots() - lend_from),
+ (long long) src.resident_lent_slots());
if (resident_ok) {
// --adapt-async: twice the exchange buffers - the second half bounces the copies in whose source is not
// page-locked (an asynchronous copy instead of the driver's staged, synchronous one)