prompt path: never write into the borrowable cache slots while laying out (a resident expert was corrupted)

When serving, the prompt path lays its buffers out at start in the expert-cache slots it may borrow, but those
slots hold resident experts until a request lends them. Writing the MMQ row table at layout time overwrote part
of a resident expert: decode later computed it on the GPU, and the first window that routed to it turned every
logit into NaN ("!!!!" from mid-answer, e.g. at position 138 of an 86-token prompt, even with the prompt read
through the windows). The table is written at the start of every prompt read, while the slots are lent.
STRATA_DBG_NAN=1 also reports the first verify window with non-finite logits and the state a prompt leaves.
This commit is contained in:
Niko1221 committed 2026-09-28 04:56:25 +02:00
1 parent 9ee557f781
commit 2838cbae46
2 files changed
+36 -1

No files matched your search

+16
View File
@@ -854,6 +854,22 @@ bool Verifier::run(int T, const int32_t* tokens, int64_t pos0, PoolMultiFn pool,
}
}
for (int t = 0; t < T; ++t) out[t] = ((volatile int32_t*) h_out_)[t];
if (static const bool dbg = std::getenv("STRATA_DBG_NAN") != nullptr; dbg) { // debug: the first non-finite head
static bool reported = false;
if (!reported) {
std::vector<float> h((size_t) T * (size_t) n_vocab_);
cudaMemcpy(h.data(), head_logits_, h.size() * 4, cudaMemcpyDeviceToHost);
for (int t = 0; t < T && !reported; ++t) {
int64_t bad = 0;
for (int64_t v = 0; v < n_vocab_; ++v) bad += !std::isfinite(h[(size_t) t * n_vocab_ + v]);
if (bad) {
reported = true;
std::fprintf(stderr, "strata dbg: verify window at position %lld, row %d: %lld of %lld logits non-finite "
"(token out %d)\n", (long long) pos0, t, (long long) bad, (long long) n_vocab_, out[t]);
}
}
}
}
VDBG("window done\n");
++windows;
progress_at("decode");