diff --git a/src/core/arch_defaults.cpp b/src/core/arch_defaults.cpp index 7f2a89fd..9d6a447b 100644 --- a/src/core/arch_defaults.cpp +++ b/src/core/arch_defaults.cpp @@ -102,6 +102,13 @@ bool igpu_prompt_set_enabled(const char* gcn_arch, bool windows) { const char* e = std::getenv("STRATA_IGPU_PROMPT_SET"); if (e != nullptr && e[0] == '1') return true; if (e != nullptr && e[0] == '0') return false; + // 0.2.8: Strix Halo (gfx1151) gets the matrix-core prompt set on Windows by default. Measured on the strix box + // (Qwen3.8-Flash-Next IQ3_S, engine 0.1.52, ids prompts of 4,095 / 8,191 tokens, interleaved pairs, one engine at a + // time): 4K 690 -> 1,090 and 8K 785 -> 1,183 on the f-024-strix-pp branch (0.2.3 engine, the same switches as + // environment variables), i.e. x1.58 / x1.51; the first-token KL against the accepted HC_Q8 bar was 0.0088 mean + // (0.0228 allowed), top-1 the same on every prompt. Linux gfx1151 stays opt-in until it is measured there; gfx1103 + // keeps its own rule below. + if (windows && strata::kernels::gfx_arch_is(gcn_arch, "gfx1151")) return true; return kIgpuPromptSetDefaultOn && !windows && strata::kernels::gfx_arch_is(gcn_arch, "gfx1103"); } @@ -135,6 +142,18 @@ std::vector> igpu_default_env(const char* gc {"STRATA_SELECT_WMMA", "1"}, // the block scorer on matrix cores {"STRATA_HC_UPMIX", "1"}, // the hyper-connection up projection with its epilogue }; + // gfx1151 (Strix Halo) on Windows: SELECT_WMMA measured x1.003 at 8K on the branch and is left out, and PF_FUSED (the + // fused int8 gate/up prompt experts, #136) measured x1.12 there and joins the set. The 780M and the 890M keep the + // table above exactly as measured on them. + if (win && strata::kernels::gfx_arch_is(gcn_arch, "gfx1151")) { + t = { + {"STRATA_HIP_WMMA", "1"}, + {"STRATA_PF_GEMM", "1"}, + {"STRATA_PA_FAST", "1"}, + {"STRATA_HC_UPMIX", "1"}, + {"STRATA_PF_FUSED", "1"}, + }; + } return t; } diff --git a/src/core/arch_defaults_test.cpp b/src/core/arch_defaults_test.cpp index e13e76b1..7a4d9cb7 100644 --- a/src/core/arch_defaults_test.cpp +++ b/src/core/arch_defaults_test.cpp @@ -182,7 +182,10 @@ int main() { for (const Mock& m : mocks) { const bool want = m.expect_on && std::string(m.gcn).rfind("gfx1103", 0) == 0; #if defined(_WIN32) - CHECK(igpu_default_env(m.gcn, m.integrated).empty()); + // 0.2.8: Strix Halo (gfx1151, integrated) gets the matrix-core prompt set on Windows; the 780M and the 890M are + // not measured there and stay off + const bool win_on = m.expect_on && m.integrated && std::string(m.gcn).rfind("gfx1151", 0) == 0; + CHECK(igpu_default_env(m.gcn, m.integrated).size() == (win_on ? 5u : 0u)); #else CHECK(igpu_default_env(m.gcn, m.integrated).size() == (want ? 5u : 0u)); #endif @@ -213,13 +216,20 @@ int main() { CHECK(t.empty() == !m.expect_on); if (m.expect_on) { CHECK(t.size() == 5); - const char* want[] = {"STRATA_HIP_WMMA", "STRATA_PF_GEMM", "STRATA_PA_FAST", "STRATA_SELECT_WMMA", "STRATA_HC_UPMIX"}; + bool halo_win = false; +#if defined(_WIN32) + halo_win = std::string(m.gcn).rfind("gfx1151", 0) == 0; +#endif + std::vector want = {"STRATA_HIP_WMMA", "STRATA_PF_GEMM", "STRATA_PA_FAST", "STRATA_HC_UPMIX"}; + want.push_back(halo_win ? "STRATA_PF_FUSED" : "STRATA_SELECT_WMMA"); for (const char* w : want) { bool found = false; for (const auto& kv : t) found = found || (kv.first == w && kv.second == "1"); CHECK(found); } - for (const auto& kv : t) CHECK(kv.first != "STRATA_PF_FUSED" && kv.first != "STRATA_HC_Q8" && kv.first != "STRATA_PF_HCDOWN"); + for (const auto& kv : t) CHECK(kv.first != "STRATA_HC_Q8" && kv.first != "STRATA_PF_HCDOWN"); + if (halo_win) { for (const auto& kv : t) CHECK(kv.first != "STRATA_SELECT_WMMA"); } + else { for (const auto& kv : t) CHECK(kv.first != "STRATA_PF_FUSED"); } } if (!m.expect_on) std::printf(" (not on) %s\n", m.name); } @@ -260,6 +270,62 @@ int main() { CHECK(std::getenv("STRATA_HC_UPMIX") != nullptr && std::string(std::getenv("STRATA_HC_UPMIX")) == "0"); for (const char* k : five) unset(k); unset("STRATA_IGPU_PROMPT_SET"); +#if defined(_WIN32) + // 0.2.8: Strix Halo (gfx1151) on Windows gets the matrix-core prompt set with nothing asked. Measured on the strix + // box (Qwen3.8-Flash-Next IQ3_S, engine 0.1.52, 4K / 8K ids prompts): 4K 690 -> 1,090, 8K 785 -> 1,183 (x1.58 / + // x1.51), KL 0.0088 mean against the HC_Q8 bar of 0.0228. The set is HIP_WMMA + PF_GEMM + PA_FAST + HC_UPMIX + + // PF_FUSED; SELECT_WMMA (x1.003) is left out, and the 780M / 890M keep exactly what was measured on them. + unset("STRATA_IGPU_DEFAULTS"); + unset("STRATA_GFX1151_DEFAULTS"); // the 19-switch gfx1151 table is live in this block (the checks above turned it off) + CHECK(igpu_prompt_set_enabled("gfx1151", true)); + CHECK(igpu_prompt_set_enabled("gfx1151:sramecc-:xnack-", true)); + CHECK(!igpu_prompt_set_enabled("gfx1151", false)); // Linux gfx1151: still opt-in + CHECK(!igpu_prompt_set_enabled("gfx1150", true)); + CHECK(!igpu_prompt_set_enabled("gfx1103", true)); + { + const auto t = igpu_default_env("gfx1151", true); + CHECK(t.size() == 5); + auto has = [&t](const char* k) { + for (const auto& kv : t) if (kv.first == k) return kv.second == "1"; + return false; + }; + CHECK(has("STRATA_HIP_WMMA") && has("STRATA_PF_GEMM") && has("STRATA_PA_FAST") && has("STRATA_HC_UPMIX") && + has("STRATA_PF_FUSED")); + CHECK(!has("STRATA_SELECT_WMMA")); + CHECK(igpu_default_env("gfx1151", false).empty()); // a gfx1151 reported as a discrete card + CHECK(igpu_default_env("gfx1150", true).empty()); // 890M: unchanged + CHECK(igpu_default_env("gfx1103", true).empty()); // 780M on Windows: unchanged + } + { + const char* halo[] = {"STRATA_HIP_WMMA", "STRATA_PF_GEMM", "STRATA_PA_FAST", "STRATA_HC_UPMIX", "STRATA_PF_FUSED"}; + for (const char* k : halo) unset(k); + unset("STRATA_SELECT_WMMA"); + const auto set = apply_arch_defaults("gfx1151", true); + for (const char* k : halo) { + bool in = false; + for (const auto& n : set) in = in || n == k; + CHECK(in); + CHECK(std::getenv(k) != nullptr && std::string(std::getenv(k)) == "1"); + } + for (const auto& n : set) CHECK(n != "STRATA_SELECT_WMMA"); + // a switch the user set (even to 0) is kept, and the whole set turns off with either switch + for (const char* k : halo) unset(k); + put("STRATA_HC_UPMIX", "0"); + const auto set2 = apply_arch_defaults("gfx1151", true); + CHECK(std::getenv("STRATA_HC_UPMIX") != nullptr && std::string(std::getenv("STRATA_HC_UPMIX")) == "0"); + for (const auto& n : set2) CHECK(n != "STRATA_HC_UPMIX"); + CHECK(std::getenv("STRATA_PF_FUSED") != nullptr); + unset("STRATA_HC_UPMIX"); + for (const char* k : halo) unset(k); + put("STRATA_IGPU_PROMPT_SET", "0"); + CHECK(igpu_default_env("gfx1151", true).empty()); + unset("STRATA_IGPU_PROMPT_SET"); + put("STRATA_IGPU_DEFAULTS", "0"); + CHECK(igpu_default_env("gfx1151", true).empty()); + unset("STRATA_IGPU_DEFAULTS"); + put("STRATA_GFX1151_DEFAULTS", "0"); // back to the state this block found (the 026 checks below rely on it) + } +#endif // 021-minipc: UMA mode is NOT a default (slower, resets not fixed): off with nothing asked; the logic below runs with on=true CHECK(!kIgpuUmaArenaDefaultOn); CHECK(!igpu_uma_arena_default("gfx1103", true, false)); diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 824bd19d..7bc782a7 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -706,6 +706,10 @@ struct Options { int64_t prefill_auto_cap = 0; /// a bare `--prefill auto` (no ":N", no STRATA_PREFILL_AUTO_MAX): the gfx12 Linux rule below may raise its ceiling bool prefill_auto_bare = false; + /// 0.2.8 (Strix Halo on Windows): the prompt path keeps its own buffers by default (no lending), so `--prefill auto` + /// must not fall back to 2048 ("reserved buffers, keep them small") - the gfx1151 rule above has already chosen a + /// chunk that fits this box's carve-out. + bool prefill_own_keep_chunk = false; bool prefill_gfx12_16k = false; ///< the gfx12 default raised the auto chunk ceiling to 16384 (a layer split takes 8192 back, 0.1.44) /// --prefill-pipe (opt-in): a layer split's prompt chunks sized for its pipeline (Prefill::pipeline_chunk): 0 off, /// 1 today's chunk count evened out, a number > 1 the rig's b/a in tokens (setup's --calibrate measures it). @@ -3372,6 +3376,21 @@ int main(int argc, char** argv) { o.prefill_chunk = std::max(o.prefill_chunk, 8192); } } + // 0.2.8: the Strix Halo prompt path keeps its own buffers instead of lending cache slots. A lent slot's expert + // is re-read from the host arena during every chunk, and on this box that copy runs at ~0.5 GB/s (the arena is + // unregistered in UMA mode): measured on strix, engine 0.1.52, IQ3_S, 2026-10-27 - 823 slots = 2.75 s of a + // 3.3 s 4K prompt, 1,408 slots = 5.5 s of a 6.1 s 8K prompt. Without lending every expert stays in the cache + // (24,576 slots) and the prompt reads VRAM only; the buffers' VRAM is reserved up front instead (the cache + // still fits: 46.84 GiB of experts against a 63.6 GB carve-out). STRATA_PREFILL_BORROW=1 keeps 0.2.7's + // lending, STRATA_GFX1151_DEFAULTS=0 turns the whole gfx1151 block off. + if (win_host && all_igpu && std::strncmp(ad.gcnArchName, "gfx1151", 7) == 0) { + const char* pb = std::getenv("STRATA_PREFILL_BORROW"); + const char* pd = std::getenv("STRATA_GFX1151_DEFAULTS"); + if (!(pb != nullptr && pb[0] == '1') && !(pd != nullptr && pd[0] == '0')) { + o.no_prefill_borrow = true; + o.prefill_own_keep_chunk = true; + } + } } else (void) cudaGetLastError(); } #endif @@ -3703,7 +3722,9 @@ int main(int argc, char** argv) { #endif if (o.prefill_auto && (o.no_prefill_borrow || o.expert_profile.empty())) { o.prefill_auto = false; // nothing to lend from: the buffers are reserved for the session, so keep them small - o.prefill_chunk = 2048; + // 0.2.8 Strix Halo: the gfx1151 rule above chose a chunk that fits this box; the "keep them small" 2048 would throw + // the whole 8K prompt back into 4 chunks (measured: 2048 against 8192 costs ~26% of an 8K prompt on this box). + o.prefill_chunk = o.prefill_own_keep_chunk ? o.prefill_chunk : 2048; } if (!have_tokens && o.serve) { // plan v0.3 P8: requests bring their own tokens o.tokens = {248045};