engine: keep the picture reader's room in the reserve in the resident RAM mode

In the resident RAM mode (--resident-experts, --resident-budget-gib, which
setup writes for Unsloth's UD-Q4_K_XL below about 71 GB of RAM and for the
low-RAM mode, or the start's own fallback when RAM is short for the arena)
the expert cache refuses the server's VRAM command ("VRAM: not with the
resident low-RAM mode"). With the on-demand reader and only setup's 700 MiB
reserve, the reader then found about 425 MiB free and every picture went to
the processor reader: 7.67 / 6.15 / 1.49 / 1.43 s against 2.06 / 0.93 /
0.41 / 0.37 s with the room held back (l620, IQ3_S, card held to 32 GB,
--resident-budget-gib 40).

The engine knows that mode before it sizes the cache, so there it keeps the
reader's 2,048 MiB in the reserve (strata/core/reader_room.hpp, applied
once after the arena / file pass loop, before the cache is sized; the mode
is not entered later). Only an engine with --vision, --vram-elastic,
--serve and the resident RAM mode changes; a larger reserve is never
lowered. One engine log line says it; no setting, nothing for the user.

Gate on l620 (same setup, 3 starts each, alternating):
- new default with the rule: the reader on the card in 3 of 3 starts
  (1,509 MiB), 12,068 slots, pictures 2.06-2.45 / 0.91-1.08 / 0.39-0.59 /
  0.37-0.55 s, text 1,714-1,722 / 3,867-3,882 tok/s at 2K / 8K;
- old default: the reader on the card in 3 of 3, 12,068 slots, pictures
  2.07-2.37 / 0.91-1.09 / 0.39-0.59 / 0.37-0.55 s, text 1,719-1,740 /
  3,873-3,889 tok/s.
Without the resident mode nothing changes: the same 12,719 slots, the same
answers to the same prompts and pictures, the shrink path as before, the
rule's line absent (one start each, engine before and after).

Test: reader_room_test (ctest; the rule's eight input combinations and the
larger-reserve case).
This commit is contained in:
Niko1221 committed 2026-11-11 17:04:23 +01:00
1 parent 4efb5e8cbb
commit 4c8faae99d
4 files changed
+74

No files matched your search

+11
View File
@@ -19,6 +19,7 @@
#include "strata/platform/io_priority.hpp"
#include "strata/core/adapt_async_default.hpp"
#include "strata/core/arch_defaults.hpp"
#include "strata/core/reader_room.hpp"
#include "strata/core/gfx12_chunk.hpp"
#include "strata/core/nv_chunk.hpp"
#include "strata/core/nv_defaults.hpp"
@@ -7844,6 +7845,16 @@ int main(int argc, char** argv) {
srcp = &arena_src;
}
} // the arena / file pass loop (#4846)
// The picture reader's room in the resident RAM mode (strata/core/reader_room.hpp): there the cache refuses the server's VRAM
// command, so an on-demand reader keeps its room in the reserve, as before the reader went on demand. Decided here, once, before
// the cache is sized; the mode is not entered later.
if (const int keep = strata::core::reader_room_reserve_mib(o.vram_reserve_mib, o.vision, o.vram_elastic && o.serve,
o.resident_cpu_experts);
keep != o.vram_reserve_mib) {
std::fprintf(stderr, "strata generate: the resident RAM mode cannot resize the expert cache, so the picture reader's %d MiB "
"stay in the reserve (%d MiB asked)\n", keep, o.vram_reserve_mib);
o.vram_reserve_mib = keep;
}
#if defined(__linux__)
// 0.1.43.1: on by default (STRATA_ADAPT_CALLBACK_WARMUP=0 turns it off). Linux threads inherit the creator's CPU mask, and
// the host pins itself to one CPU later; a callback thread the driver creates lazily after that would run on the