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++
Merge f-140 into the Aurora port; verify: halo's STRATA_VERIFY_RESIDENT is 0.1.39's all-resident graph
Niko12211fb37cf81078
diff --cc include/strata/core/verify.hppindex 3fbfe6a17,51c5972f0..bf572f398--- a/include/strata/core/verify.hpp+++ b/include/strata/core/verify.hpp@@@ -256,10 -259,17 +259,18 @@@ privateint device_ = -1; ///< the device `init` ran on: run/commit switch to it (layer split)std::atomic<bool> released_{false}; ///< #267: release_gpu_waits ran (maybe on the watchdog thread): no more windowsbool all_resident_ = false; ///< 100% of experts in [lb_, le_) resident in VRAM: zero-doorbell graph+ /// #871: the zero-doorbell graph plans from the device residency table alone, so it is only right while every+ /// expert of the stage is in VRAM. A prompt loan, a VRAM shrink or an adaptive swap marks some -1 for a while:+ /// every window then runs the doorbell graph (exec_nr_ / the batch key's top bit), the same as a stage that never+ /// was all-resident. refresh_ar() looks at the host table before each window.+ bool ar_off_ = false;+ bool ar_on() const { return all_resident_ && !ar_off_; }+ void refresh_ar();+ uint32_t* h_plan_err_ = nullptr; uint32_t* m_plan_err_ = nullptr; // set by resident_plan on a -1 (all-resident graph)+ const int32_t* h_res_ = nullptr; ///< the host residency table (VerifyHits::h_res)bool device_plan_ = false; ///< E-6: resident-only layers planned on the device (STRATA_VERIFY_DEVICE_PLAN)- bool resident_ = false; ///< STRATA_VERIFY_RESIDENT: every expert resident, no host step per layeruint32_t* skip_ = nullptr; ///< E-6: per group, the ring whose plan the device built (0: the host's)+ unsigned* qcnt_ = nullptr; ///< S26 STRATA_QFUSE: the HC read's q8_1 group counters (n_embd / 32)unsigned long long* slot_off_d_ = nullptr; ///< E-6: the slot offsets on the deviceint64_t lb_ = 0, le_ = -1; ///< set_stage: the layers this verifier runs (-1: to the last)const float* hand_in_ = nullptr;diff --cc src/core/verify.cppindex d7f47e919,113c1a4af..77cc4b4ab--- a/src/core/verify.cpp+++ b/src/core/verify.cpp@@@ -521,34 -519,6 +527,15 @@@ bool Verifier::init(const WeightTable&const char* v = std::getenv("STRATA_VERIFY_DEVICE_PLAN");device_plan_ = !all_resident_ && (v != nullptr && std::atoi(v) != 0);}- // STRATA_VERIFY_RESIDENT=1 (opt-in): when EVERY routed expert of every layer is resident in the VRAM/UMA tier- // (checked here, once; a full cache never evicts), the window graph is recorded without the host round trip:- // no doorbell, no flag waits, no plan copy from mapped memory, no PCIe/CPU share (fetch, rebase, its grouped- // launch, the mapped-row copy); the device plans each group (the host's exact loop, E-6) and the combine reads- // the hit rows as `0.0f + hit` (what the zeroed CPU rows + moe_hit_add gave). Same tokens, same arithmetic.- {- const char* v = std::getenv("STRATA_VERIFY_RESIDENT");- if (v != nullptr && std::atoi(v) != 0 && lb_ == 0 && le_ == g.n_layers && next_ == nullptr &&- remote_opt_ == nullptr && hits.d_res != nullptr) {- std::vector<int32_t> res((size_t) (g.n_layers * g.n_expert));- bool all = cudaMemcpy(res.data(), hits.d_res, res.size() * sizeof(int32_t), cudaMemcpyDeviceToHost) ==- cudaSuccess;- for (size_t i = 0; all && i < res.size(); ++i) all = res[i] >= 0;- if (all) { device_plan_ = true; all_resident_ = false; } // (this window's own resident path)- resident_ = all;- std::fprintf(stderr, "strata verify: STRATA_VERIFY_RESIDENT=1: %s\n",- all ? "every expert resident, the window runs without the host round trip"- : "not every expert is resident - the host-planned window stays");- }- }++ // (halo's STRATA_VERIFY_RESIDENT=1 is this window's all_resident_ graph above, which 0.1.39 has on by default)+ if (g_qfuse) { // S26: the HC read's q8_1 group counters, zeroed once (each launch leaves them zero)+ if (cudaMalloc((void**) &qcnt_, sizeof(unsigned) * (size_t) (g.n_embd / 32)) != cudaSuccess ||+ cudaMemset(qcnt_, 0, sizeof(unsigned) * (size_t) (g.n_embd / 32)) != cudaSuccess) {+ cudaGetLastError();+ if (qcnt_) cudaFree(qcnt_);+ qcnt_ = nullptr;+ }+ }if (all_resident_ || device_plan_) {bool ok2 = true;if (device_plan_)@@@ -601,12 -571,6 +588,12 @@@ bool Verifier::record_window(int T, cudif (trace_m_ != nullptr) gpu_stamp(trace_m_, (int) ((l * kProfPer + i) * 2 + grp), cs); // #649};const int tb_[2] = {0, (T + 1) / 2}, te_[2] = {G == 2 ? (T + 1) / 2 : T, T};+ // S26 STRATA_LFUSE=1: where the shared expert's gate / scale fusions apply (the paths they replace are the ones taken)+ auto lfuse_on = [&](int n) {- return g_lfuse && resident_ && native_moe_combine_enabled() && dec_batch && n > 1 && n <= 8 &&++ return g_lfuse && ar_on() && native_moe_combine_enabled() && dec_batch && n > 1 && n <= 8 &&+ shared_expert_native_bf16_enabled();+ };+ bool sg_gated_[2] = {false, false}; // per group: the combine applies the shared gateif (!batch_rec_) groups_[T] = G;const int64_t nQall = g.n_qsa_layers();// a batch window: row t is slot t, whose state lives in its own session@@@ -1201,7 -1084,6 +1161,11 @@@if (!prof_on_ && sh_cs_ != nullptr && ev_fork_ != nullptr && ev_join_ != nullptr) {cudaStreamWaitEvent(cs, ev_join_, 0);}- if (!combined) {++ if (sg_gated_[grp]) { // STRATA_LFUSE: the shared expert's gate was not applied: the combine applies it (all rows are hits)++ try {++ native_moe_combine_multi_hits_gated(parts_out, w_ + tb * K, shared_ + tb * N, sh_g_ + tb, bo_ + tb * N, N, K, n, cs);++ } catch (const std::exception& e) { err = "verify combine: " + std::string(e.what()); return false; }++ } elseif (dec_batch && n > 1 && native_moe_combine_enabled()) { // one launch for the window's rowstry {native_moe_combine_multi(parts_ + (size_t) tb * K * N, w_ + tb * K, shared_ + tb * N, bo_ + tb * N, N, K, n, cs);