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: gfx1200/gfx1201 get the six exact prompt switches of the gfx1151 table (decode half stays off); STRATA_GFX12_DEFAULTS=0 opts out (#1478)

Niko1221dd106e7de536
diff --git a/include/strata/kernels/gfx_arch.hpp b/include/strata/kernels/gfx_arch.hpp
index 64bc78dd3..ad7ee6273 100644
--- a/include/strata/kernels/gfx_arch.hpp
+++ b/include/strata/kernels/gfx_arch.hpp
@@ -27,4 +27,7 @@ inline bool gfx_arch_is_gfx11_wmma(const char* gcn) {
/// Strix Halo (Ryzen AI Max, RDNA3.5): the part the gfx1151 defaults (docs/STRIX_HALO.md) are measured on.
inline bool gfx_arch_is_gfx1151(const char* gcn) { return gfx_arch_is(gcn, "gfx1151"); }
+/// RDNA4 (Radeon AI PRO R9700 = gfx1201, RX 9070 / 9070 XT = gfx1201, RX 9060 = gfx1200).
+inline bool gfx_arch_is_gfx12(const char* gcn) { return gfx_arch_is(gcn, "gfx1200") || gfx_arch_is(gcn, "gfx1201"); }
+
} // namespace strata::kernels
diff --git a/src/core/arch_defaults.cpp b/src/core/arch_defaults.cpp
index fd69870f1..7691834cc 100644
--- a/src/core/arch_defaults.cpp
+++ b/src/core/arch_defaults.cpp
@@ -11,6 +11,23 @@ namespace strata::core {
std::vector<std::pair<std::string, std::string>> arch_default_env(const char* gcn_arch) {
std::vector<std::pair<std::string, std::string>> t;
+ if (strata::kernels::gfx_arch_is_gfx12(gcn_arch)) {
+ // gfx1200 / gfx1201 (RDNA4): only the PROMPT half of the gfx1151 table. Reported exact (identical answers) on an R9700
+ // in #1478 and re-checked bitwise here (notes-142-amd.md); the decode half measured slower on that card, so it stays out.
+ // STRATA_GDN_CONVL2 is AMD-only on purpose: it is not bitwise on CUDA 13.3 sm_120 (#1522), and this table is never
+ // consulted by a CUDA build.
+ const char* off12 = std::getenv("STRATA_GFX12_DEFAULTS");
+ if (off12 != nullptr && off12[0] == '0') return t;
+ t = {
+ {"STRATA_GDN_HEAD", "1"},
+ {"STRATA_GDN_PP", "2"},
+ {"STRATA_GDN_CONVL2", "1"},
+ {"STRATA_GDN_NOY", "1"},
+ {"STRATA_CVEC_FUSE", "1"},
+ {"STRATA_HCD_EXACT", "1"},
+ };
+ return t;
+ }
if (!strata::kernels::gfx_arch_is_gfx1151(gcn_arch)) return t;
const char* off = std::getenv("STRATA_GFX1151_DEFAULTS");
if (off != nullptr && off[0] == '0') return t;
@@ -52,8 +69,11 @@ std::vector<std::string> apply_arch_defaults(const char* gcn_arch) {
set.push_back(kv.first);
}
if (!set.empty()) {
- std::fprintf(stderr, "strata: gfx1151 (Strix Halo): %zu exact speed switches on by default (STRATA_GFX1151_DEFAULTS=0 turns "
- "them off; a switch you set is kept): ", set.size());
+ const bool g12 = strata::kernels::gfx_arch_is_gfx12(gcn_arch);
+ std::fprintf(stderr, "strata: %s: %zu exact speed switches on by default (%s=0 turns "
+ "them off; a switch you set is kept): ",
+ g12 ? "gfx12 (RDNA4)" : "gfx1151 (Strix Halo)", set.size(),
+ g12 ? "STRATA_GFX12_DEFAULTS" : "STRATA_GFX1151_DEFAULTS");
for (size_t i = 0; i < set.size(); ++i) std::fprintf(stderr, "%s%s", i ? " " : "", set[i].c_str() + 7);
std::fprintf(stderr, "\n");
}
diff --git a/src/core/arch_defaults_test.cpp b/src/core/arch_defaults_test.cpp
index f4ce0098b..7158e7e5b 100644
--- a/src/core/arch_defaults_test.cpp
+++ b/src/core/arch_defaults_test.cpp
@@ -28,7 +28,6 @@ int main() {
unset("STRATA_GFX1151_DEFAULTS");
// other architectures (and CUDA, which passes an empty name): nothing
CHECK(arch_default_env("gfx1100").empty());
- CHECK(arch_default_env("gfx1201:sramecc-:xnack-").empty());
CHECK(arch_default_env("gfx1150").empty());
CHECK(arch_default_env("gfx11510").empty()); // not a prefix match
CHECK(arch_default_env("").empty());
@@ -44,6 +43,20 @@ int main() {
CHECK(kv.first != bits);
}
}
+ // gfx12: the six prompt switches only, no decode switch, no bit-changing one
+ unset("STRATA_GFX12_DEFAULTS");
+ for (const char* a : {"gfx1200", "gfx1201", "gfx1201:sramecc-:xnack-"}) {
+ const auto t = arch_default_env(a);
+ CHECK(t.size() == 6);
+ for (const auto& kv : t) {
+ CHECK(kv.first != "STRATA_Q8_PACKED" && kv.first != "STRATA_SH_STREAM" && kv.first != "STRATA_PF_GEMM" &&
+ kv.first != "STRATA_PF_FUSED");
+ }
+ }
+ CHECK(arch_default_env("gfx12010").empty());
+ put("STRATA_GFX12_DEFAULTS", "0");
+ CHECK(arch_default_env("gfx1201").empty());
+ unset("STRATA_GFX12_DEFAULTS");
// a user's setting wins, whatever it is; the rest are set
put("STRATA_TSUM", "0");
unset("STRATA_QFUSE");