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

arch_defaults: the integrated-GPU matrix-core prompt set is opt-in again (bit-changing, owner's call); the Radeon 780M keeps its expert arena unregistered by default on Linux (UMA mode); per-arch selection tests

Niko1221dab7ee72d0e2
diff --git a/include/strata/core/arch_defaults.hpp b/include/strata/core/arch_defaults.hpp
index 5749af9d0..404b29aa3 100644
--- a/include/strata/core/arch_defaults.hpp
+++ b/include/strata/core/arch_defaults.hpp
@@ -25,7 +25,18 @@ std::vector<std::pair<std::string, std::string>> arch_default_env(const char* gc
/// matrix-core prompt set is on by default (153-igpu). Pure architecture-name test; the caller adds the UMA test.
bool igpu_prompt_defaults_arch(const char* gcn_arch);
-/// The matrix-core prompt set an integrated GPU takes by default: STRATA_HIP_WMMA, STRATA_PF_GEMM, STRATA_PA_FAST,
+/// 021-minipc: the matrix-core prompt set changes bits, so it is OFF by default until the owner approves it. Flip this constant
+/// (one line) to make it the default of the integrated Radeons; STRATA_IGPU_PROMPT_SET=1 / =0 switches it per run either way,
+/// and STRATA_IGPU_DEFAULTS=0 turns it off whatever the constant says.
+inline constexpr bool kIgpuPromptSetDefaultOn = false;
+bool igpu_prompt_set_enabled();
+
+/// 021-minipc: does this device keep the expert arena unregistered (UMA mode) by default? Exact (no bit changes): only the
+/// Radeon 780M (gfx1103, integrated, Linux). gfx1150 / gfx1151 are not included: no hardware to measure on, and Strix Halo
+/// has a different firmware. STRATA_UMA_REGISTER=1 registers the arena as before.
+bool igpu_uma_arena_default(const char* gcn_arch, bool integrated, bool windows);
+
+/// The matrix-core prompt set an integrated GPU takes when `igpu_prompt_set_enabled()`: STRATA_HIP_WMMA, STRATA_PF_GEMM, STRATA_PA_FAST,
/// STRATA_SELECT_WMMA, STRATA_HC_UPMIX, all "1". Empty unless `integrated` (hipDeviceProp_t::integrated: the device
/// shares the host's memory) AND the architecture is one of `igpu_prompt_defaults_arch`: a discrete card of the same
/// architecture family (RX 7900 XTX gfx1100, R9700 gfx1201, ...) and every CUDA / SYCL build get nothing. These change
diff --git a/src/core/arch_defaults.cpp b/src/core/arch_defaults.cpp
index 7cdf4108a..7f10fb283 100644
--- a/src/core/arch_defaults.cpp
+++ b/src/core/arch_defaults.cpp
@@ -64,11 +64,25 @@ bool igpu_prompt_defaults_arch(const char* gcn_arch) {
strata::kernels::gfx_arch_is(gcn_arch, "gfx1151");
}
+bool igpu_prompt_set_enabled() {
+ const char* off = std::getenv("STRATA_IGPU_DEFAULTS");
+ if (off != nullptr && off[0] == '0') return false;
+ 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;
+ return kIgpuPromptSetDefaultOn;
+}
+
+bool igpu_uma_arena_default(const char* gcn_arch, bool integrated, bool windows) {
+ if (windows || !integrated || !strata::kernels::gfx_arch_is(gcn_arch, "gfx1103")) return false;
+ const char* reg = std::getenv("STRATA_UMA_REGISTER");
+ return !(reg != nullptr && reg[0] == '1');
+}
+
std::vector<std::pair<std::string, std::string>> igpu_default_env(const char* gcn_arch, bool integrated) {
std::vector<std::pair<std::string, std::string>> t;
if (!integrated || !igpu_prompt_defaults_arch(gcn_arch)) return t;
- const char* off = std::getenv("STRATA_IGPU_DEFAULTS");
- if (off != nullptr && off[0] == '0') return t;
+ if (!igpu_prompt_set_enabled()) return t;
// Measured on a Radeon 780M (gfx1103, P2006, Q2_0, notes-153-igpu.md / notes-148-amd.md): prompts 109.5 -> 214.7 tok/s
// with the first four, 233 with HC_UPMIX, decode unchanged. Dense projections are 63% of a prompt's GPU time there.
t = {
@@ -112,10 +126,10 @@ std::vector<std::string> apply_arch_defaults(const char* gcn_arch, bool integrat
igpu.push_back(kv.first);
}
if (!igpu.empty()) {
- std::fprintf(stderr, "strata: integrated GPU (%s): the matrix-core prompt set is on by default (about 2x faster prompts on a "
+ std::fprintf(stderr, "strata: integrated GPU (%s): the matrix-core prompt set is on (about 2x faster prompts on a "
"Radeon 780M, the answers differ in the last bits): ", gcn_arch);
for (size_t i = 0; i < igpu.size(); ++i) std::fprintf(stderr, "%s%s", i ? " " : "", igpu[i].c_str() + 7);
- std::fprintf(stderr, ". Turn one off with NAME=0 (for example STRATA_HC_UPMIX=0), all of them with STRATA_IGPU_DEFAULTS=0");
+ std::fprintf(stderr, ". Turn one off with NAME=0 (for example STRATA_HC_UPMIX=0), all of them with STRATA_IGPU_PROMPT_SET=0");
#if defined(_WIN32)
std::fprintf(stderr, ". Not yet tested on Windows");
#endif
diff --git a/src/core/arch_defaults_test.cpp b/src/core/arch_defaults_test.cpp
index 8bf9adc91..5a921de0e 100644
--- a/src/core/arch_defaults_test.cpp
+++ b/src/core/arch_defaults_test.cpp
@@ -100,6 +100,20 @@ int main() {
{"CUDA (no gcn name)", "", true, false},
};
unset("STRATA_IGPU_DEFAULTS");
+ unset("STRATA_IGPU_PROMPT_SET");
+ // 021-minipc: the set changes bits, so with nothing set it is OFF everywhere (the owner flips kIgpuPromptSetDefaultOn)
+ CHECK(!kIgpuPromptSetDefaultOn);
+ CHECK(!igpu_prompt_set_enabled());
+ for (const Mock& m : mocks) CHECK(igpu_default_env(m.gcn, m.integrated).empty());
+ for (const char* k : {"STRATA_HIP_WMMA", "STRATA_PF_GEMM", "STRATA_PA_FAST", "STRATA_SELECT_WMMA", "STRATA_HC_UPMIX"}) unset(k);
+ CHECK(apply_arch_defaults("gfx1103", true).empty());
+ CHECK(std::getenv("STRATA_HIP_WMMA") == nullptr);
+ // opt-in per run: STRATA_IGPU_PROMPT_SET=1; the rest of the checks below run with it on
+ put("STRATA_IGPU_PROMPT_SET", "1");
+ CHECK(igpu_prompt_set_enabled());
+ put("STRATA_IGPU_DEFAULTS", "0");
+ CHECK(!igpu_prompt_set_enabled()); // the whole-set off switch wins
+ unset("STRATA_IGPU_DEFAULTS");
for (const Mock& m : mocks) {
const auto t = igpu_default_env(m.gcn, m.integrated);
CHECK(t.empty() == !m.expect_on);
@@ -124,6 +138,9 @@ int main() {
put("STRATA_IGPU_DEFAULTS", "0");
CHECK(igpu_default_env("gfx1103", true).empty());
unset("STRATA_IGPU_DEFAULTS");
+ put("STRATA_IGPU_PROMPT_SET", "0");
+ CHECK(igpu_default_env("gfx1103", true).empty());
+ put("STRATA_IGPU_PROMPT_SET", "1");
// apply: a discrete card sets nothing, an iGPU sets the five, a switch the user set (even to 0) is kept
const char* five[] = {"STRATA_HIP_WMMA", "STRATA_PF_GEMM", "STRATA_PA_FAST", "STRATA_SELECT_WMMA", "STRATA_HC_UPMIX"};
for (const char* k : five) unset(k);
@@ -138,6 +155,19 @@ int main() {
CHECK(std::getenv(k) != nullptr && std::string(std::getenv(k)) == "1");
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");
+ // 021-minipc: UMA mode (the expert arena stays unregistered) is chosen for the Radeon 780M only: gfx1103 + integrated + not Windows
+ unset("STRATA_UMA_REGISTER");
+ CHECK(igpu_uma_arena_default("gfx1103", true, false));
+ CHECK(igpu_uma_arena_default("gfx1103:sramecc-:xnack-", true, false));
+ CHECK(!igpu_uma_arena_default("gfx1103", true, true)); // Windows: not measured
+ CHECK(!igpu_uma_arena_default("gfx1103", false, false)); // a gfx1103 that is not integrated
+ for (const char* g : {"gfx1150", "gfx1151", "gfx1152", "gfx1100", "gfx1101", "gfx1200", "gfx1201", "gfx1030", "gfx11030", "", "gfx90a"})
+ CHECK(!igpu_uma_arena_default(g, true, false));
+ CHECK(!igpu_uma_arena_default(nullptr, true, false));
+ put("STRATA_UMA_REGISTER", "1");
+ CHECK(!igpu_uma_arena_default("gfx1103", true, false)); // the user registers the arena as before
+ unset("STRATA_UMA_REGISTER");
// both platforms: no Windows guard on the iGPU set (the owner wants it there too; untested on Windows is only said in the log)
std::printf(fails ? "arch_defaults_test: %d FAILED\n" : "arch_defaults_test: OK\n", fails);
return fails ? 1 : 0;
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 2c0589f4f..212dfaa38 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -2685,6 +2685,16 @@ int main(int argc, char** argv) {
}
}
strata::core::apply_arch_defaults(ad.gcnArchName, all_igpu);
+#if defined(_WIN32)
+ const bool win_host = true;
+#else
+ const bool win_host = false;
+#endif
+ // UMA mode (021-minipc): the Radeon 780M's firmware (gc 11.0.1 MES) resets the GPU when the kernel evicts the queues of a
+ // process that has a dispatch in a barrier loop, and a registered host arena is what gets it evicted (notes-021-minipc.md).
+ // So its expert arena stays unregistered. STRATA_UMA_REGISTER=1 (or STRATA_ARENA_PIN_GIB=0) registers it as before.
+ if (strata::core::igpu_uma_arena_default(ad.gcnArchName, all_igpu, win_host))
+ strata::core::arena_uma_no_register_flag().store(true);
} else (void) cudaGetLastError();
}
#endif