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

Warn when the prompt path's lend coverage is short; document STRATA_RESIDENT_HEADROOM_GIB and the long-prompt method (#1389)

Niko122114d9d2e1a5d0
diff --git a/docs/AMD_HIP.md b/docs/AMD_HIP.md
index 39446f038..a8a6951f1 100644
--- a/docs/AMD_HIP.md
+++ b/docs/AMD_HIP.md
@@ -216,6 +216,23 @@ of decode (one card 47.5 / 46.9 / 48.3 -> 50.5 / 48.5 / 51.3 tok/s with it on).
`bench/results/2026-10-04-community-rx-6800-windows`): on was 12-22% slower. 4x R9700: fork off was 13-45% faster.
Linux RX 6000 users can try `STRATA_SH_STREAM=1`; the output is identical either way.
+**Long prompts on a big card: check the lend-coverage line (#1389, measured by the reporter on an RX 7900 XTX, gfx1100,
+v0.1.40.2, 50 GB RAM).** With `--resident-experts` the prompt path borrows cache slots, and the experts of those slots
+must also sit in RAM. After the first request of a start the engine prints
+`FileExpertSource: N of M of the prompt path's lendable slots keep their experts in RAM too`. When N is not M, the
+experts not covered are read from the pack during the prompt (now also a `WARNING` line). A 74K prompt routes through
+nearly all experts, so the misses repeat: the reporter saw `wait copy` at 0.2% and 2,583 tok/s with 6201 of 6201, and
+36.8% and 1,810 tok/s with 5093 of 6202 (same binary, only the start differed). Short prompts (25K) read the same either
+way. The resident set is sized from `MemAvailable` at start, minus `STRATA_RESIDENT_HEADROOM_GIB` (default 4, in GiB; the
+`--resident-experts` switch and `--resident-budget-gib` read it). If the line is short, lower the headroom a little and
+restart; if the machine then swaps or stalls, raise it again. Re-check the line after a ROCm update: the reporter's newer
+runtime kept about 1 GiB more host RAM, which moved the best value from 8 to 7. Other levers from the same report (his
+numbers, not re-measured here): `STRATA_PF_FUSED=1 STRATA_PF_GEMM=1 STRATA_PF_SWITCH_MIN_T=4096` 925 -> 1,092 tok/s,
+`--resident-experts` 1,092 -> 2,503 tok/s, `--prefill auto:32768` +23% at 74K. The engine uses a hipBLASLt tuning table
+only when its version matches the installed library; otherwise it prefills on plain hipBLAS (about 45% slower for a 131K
+prompt), so keep the table and the library paired. Not worth trying (measured flat): `--kv-resident` changes, a prefill
+chunk above 32768, `--spec` above 4.
+
## Linux: verify timeouts while the kernel reclaims host memory (experimental workarounds)
A `verify: timed out at layer N` or "no progress for 60 s" message does not by itself mean a kernel or handshake bug. Two
diff --git a/src/core/expert_source.cpp b/src/core/expert_source.cpp
index fcf8b71e8..cf8a14773 100644
--- a/src/core/expert_source.cpp
+++ b/src/core/expert_source.cpp
@@ -2568,6 +2568,18 @@ bool FileExpertSource::pin_cache_complement(
"too%s\n", (long long) complement_lent_slots_, (long long) (n_slots - lend_from_slot),
complement_lent_slots_ < n_slots - lend_from_slot
? " (the others are read from the file when lent: not enough RAM for them)" : "");
+ if (lend && complement_lent_slots_ < n_slots - lend_from_slot) {
+ // #1389: below full coverage the uncovered experts are read from the pack during a long prompt (a 74K prompt
+ // routes through nearly all experts, so the misses repeat). The reporter measured 18% uncovered = -26% prompt
+ // speed on a gfx1100; short prompts barely touch them. A warning, not a refusal.
+ const long long lendable = (long long) (n_slots - lend_from_slot);
+ const long long missing = lendable - (long long) complement_lent_slots_;
+ std::fprintf(stderr, "FileExpertSource: WARNING: %lld of %lld lendable slots (%.0f%%) will read their experts from the pack "
+ "during a long prompt; expect a slower prompt read on 50K+ token prompts (one measurement: 18%% uncovered "
+ "cost 26%%). Free RAM or lower STRATA_RESIDENT_HEADROOM_GIB (now the RAM left free at start) and restart; "
+ "the line above should read N of N.
+", missing, lendable, 100.0 * (double) missing / (double) std::max<long long>(1, lendable));
+ }
if (!additional_gpu_pairs.empty()) {
std::fprintf(stderr, "FileExpertSource: %zu verified additional-GPU experts remain on the mmap fallback\n",
additional_gpu_pairs.size());
diff --git a/sycl/src/core/expert_source.cpp b/sycl/src/core/expert_source.cpp
index 6103866fd..250547980 100644
--- a/sycl/src/core/expert_source.cpp
+++ b/sycl/src/core/expert_source.cpp
@@ -2149,6 +2149,18 @@ bool FileExpertSource::pin_cache_complement(
"too%s\n", (long long) complement_lent_slots_, (long long) (n_slots - lend_from_slot),
complement_lent_slots_ < n_slots - lend_from_slot
? " (the others are read from the file when lent: not enough RAM for them)" : "");
+ if (lend && complement_lent_slots_ < n_slots - lend_from_slot) {
+ // #1389: below full coverage the uncovered experts are read from the pack during a long prompt (a 74K prompt
+ // routes through nearly all experts, so the misses repeat). The reporter measured 18% uncovered = -26% prompt
+ // speed on a gfx1100; short prompts barely touch them. A warning, not a refusal.
+ const long long lendable = (long long) (n_slots - lend_from_slot);
+ const long long missing = lendable - (long long) complement_lent_slots_;
+ std::fprintf(stderr, "FileExpertSource: WARNING: %lld of %lld lendable slots (%.0f%%) will read their experts from the pack "
+ "during a long prompt; expect a slower prompt read on 50K+ token prompts (one measurement: 18%% uncovered "
+ "cost 26%%). Free RAM or lower STRATA_RESIDENT_HEADROOM_GIB (now the RAM left free at start) and restart; "
+ "the line above should read N of N.
+", missing, lendable, 100.0 * (double) missing / (double) std::max<long long>(1, lendable));
+ }
if (!additional_gpu_pairs.empty()) {
std::fprintf(stderr, "FileExpertSource: %zu verified additional-GPU experts remain on the mmap fallback\n",
additional_gpu_pairs.size());