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

gfx1151: the shared-expert stream fork is an arch default there (decode +1.8% UD-IQ4_XS, +6.7% UD-Q4_K_XL at 8K, ids identical)

Niko1221ae93de626146
diff --git a/src/core/arch_defaults.cpp b/src/core/arch_defaults.cpp
index 8cdf3cf92..fd69870f1 100644
--- a/src/core/arch_defaults.cpp
+++ b/src/core/arch_defaults.cpp
@@ -35,6 +35,7 @@ std::vector<std::pair<std::string, std::string>> arch_default_env(const char* gc
{"STRATA_GDN_SPLIT", "1"}, // the GDN step over 4 blocks per head (S25/S26)
{"STRATA_QFUSE", "1"}, // activation q8_1 images written by their producers (S26)
{"STRATA_PLE_BATCH", "1"}, // the verify window's PLE key / value projections at once (S25)
+ {"STRATA_SH_STREAM", "1"}, // the shared expert on its own stream: decode +1.8% / +6.7% (UD-Q4_K_XL) (140-m)
};
return t;
}
diff --git a/src/core/verify.cpp b/src/core/verify.cpp
index f3365acdf..9b00e6eba 100644
--- a/src/core/verify.cpp
+++ b/src/core/verify.cpp
@@ -96,14 +96,19 @@ const bool g_trace = env_on("STRATA_VERIFY_TRACE");
// Radeon AI PRO R9700 (gfx1201, ROCm 6.4.3), the fork off decodes at 62.9 t/s against 43.4 t/s with it on. The
// profiler turns the fork off to time the stages, so a profiled run never showed that. #816 reports the same fall on a
// gfx1030 (RX 6800, Windows, 42.5 -> 56.4 t/s). STRATA_SH_STREAM overrides either default: `=1` forks, `=0` does not.
-const bool g_sh_stream = [] {
- if (const char* v = std::getenv("STRATA_SH_STREAM")) return v[0] != '0';
+// Strix Halo (gfx1151, unified memory) is the exception: the fork pays there (+1.8% UD-IQ4_XS, +6.7% UD-Q4_K_XL decode
+// at 8K, ids identical), so the gfx1151 arch table sets STRATA_SH_STREAM=1. Read on first use, after that table ran.
+bool sh_stream_on() {
+ static const bool on = [] {
+ if (const char* v = std::getenv("STRATA_SH_STREAM")) return v[0] != '0';
#if defined(STRATA_USE_HIP)
- return false;
+ return false;
#else
- return true;
+ return true;
#endif
-}();
+ }();
+ return on;
+}
// A one-token window always keeps its token, so its graph advances the sequence state itself (the GDN conv history
// and recurrence state) and Verifier::commit launches no commit graph after it (eddoursul's fork, F7). CUDA only:
@@ -1035,7 +1040,7 @@ bool Verifier::record_window(int T, cudaStream_t cs, std::string& err) {
}
stamp(l, 16, grp);
const bool q8_ffn = gr_read_group(1, true, inj_, inj2_); // true: nat_xq_ holds the MoE input's q8_1 (STRATA_QFUSE)
- const bool sh_fork = g_sh_stream && !prof_on_ && sh_cs_ != nullptr && ev_fork_ != nullptr && ev_join_ != nullptr;
+ const bool sh_fork = sh_stream_on() && !prof_on_ && sh_cs_ != nullptr && ev_fork_ != nullptr && ev_join_ != nullptr;
cudaStream_t sh_stream = sh_fork ? sh_cs_ : cs;
if (sh_fork) {
cudaEventRecord(ev_fork_, cs);
@@ -1229,7 +1234,7 @@ bool Verifier::record_window(int T, cudaStream_t cs, std::string& err) {
}
// Same condition as `sh_fork` above, which is per group and out of scope here: wait only when the fork
// actually ran (a wait on an event never recorded is a no-op, but saying it outright reads better).
- if (g_sh_stream && !prof_on_ && sh_cs_ != nullptr && ev_fork_ != nullptr && ev_join_ != nullptr) {
+ if (sh_stream_on() && !prof_on_ && sh_cs_ != nullptr && ev_fork_ != nullptr && ev_join_ != nullptr) {
cudaStreamWaitEvent(cs, ev_join_, 0);
}
if (sg_gated_[grp]) { // STRATA_LFUSE: the shared expert's gate was not applied: the combine applies it (all rows are hits)