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++
prompt path: never write into the borrowable cache slots while laying out (a resident expert was corrupted)
Niko12212838cbae46fb
diff --git a/src/core/verify.cpp b/src/core/verify.cppindex 683ae3545..e0f80a9ad 100644--- a/src/core/verify.cpp+++ b/src/core/verify.cpp@@ -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");diff --git a/src/prefill/prefill.cpp b/src/prefill/prefill.cppindex 9f7b20d2d..297b70aa8 100644--- a/src/prefill/prefill.cpp+++ b/src/prefill/prefill.cpp@@ -555,7 +555,8 @@ bool Prefill::carve(size_t T, void* alloc) {m.bounds_dev = o.take<int32_t>((size_t) (2 * (NE + NE / MMQ_GROUP + 2)), ok);m.grp_gu = o.take<uint8_t>(MMQ_GROUP * mp.gu_max + MMQ_TAIL, ok);m.grp_d = o.take<uint8_t>(MMQ_GROUP * mp.d_max + MMQ_TAIL, ok);- if (ok) mmq::iota(m.ids_identity, (int64_t) (T * K), m.cs);+ // (written at every run's start, not here: when serving, these are live expert-cache slots until a request+ // lends them - a write now would corrupt a resident expert)if (!m.mmq_ctx) m.mmq_ctx = std::make_unique<mmq::Context>();}m.ring = ring_slots(T);@@ -1363,6 +1364,24 @@ bool Prefill::run(const int64_t* tokens, int64_t n, int64_t pos0, std::string& e}ss.ple_prev[0] = prev[0];ss.ple_prev[1] = prev[1];+ if (std::getenv("STRATA_DBG_NAN") != nullptr) { // debug: the state the prompt leaves for the token path+ cudaStreamSynchronize(m.cs);+ auto bad = [&](const float* d, int64_t n) {+ std::vector<float> h((size_t) n);+ cudaMemcpy(h.data(), d, (size_t) n * 4, cudaMemcpyDeviceToHost);+ int64_t c = 0;+ double mx = 0;+ for (float v : h) { c += !std::isfinite(v); if (std::isfinite(v)) mx = std::max(mx, (double) std::fabs(v)); }+ std::fprintf(stderr, " %lld non-finite (max |x| %.3g)", (long long) c, mx);+ };+ const int64_t last = (n - 1) % m.T;+ std::fprintf(stderr, "strata dbg: prompt end: last residual row");+ bad(m.R + last * D, D);+ if (ss.ple.ready()) { std::fprintf(stderr, "; PLE history"); bad(ss.ple.hist, (int64_t) strata::kernels::NG_HIST * strata::kernels::NG_HC_DIM); }+ std::fprintf(stderr, "; GDN state 0");+ bad(ss.gdn_state, 64 * 1024);+ std::fprintf(stderr, "\n");+ }if (cudaStreamSynchronize(m.cs) != cudaSuccess) {err = std::string("prefill: ") + cudaGetErrorString(cudaGetLastError());return false;