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

--prefill auto:32768 lends 6,000 cache slots to the prompt path; on 31 GB of RAM only 3,700 of their experts stay in
RAM and the rest are read from the SSD on every chunk (prompts ~3x slower than --prefill auto). The engine now says
so at start, with the counts. A warning, never a cap: with the RAM for them the big chunk is 21-35% faster.
This commit is contained in:
Niko1221 committed 2026-10-06 16:35:09 +02:00
1 parent 5628e280fb
commit e155cf8fc4
1 file changed
+11
+11
View File
@@ -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)