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

gfx12: the 96-slot prompt ring follows the matrix-core attention's real state (STRATA_HIP_WMMA=1/auto on a card that has it, not failed)

Niko1221961d37cd5506
diff --git a/include/strata/kernels/qsa_prompt_attn.hpp b/include/strata/kernels/qsa_prompt_attn.hpp
index 046cd6fca..6b2e879cd 100644
--- a/include/strata/kernels/qsa_prompt_attn.hpp
+++ b/include/strata/kernels/qsa_prompt_attn.hpp
@@ -38,5 +38,8 @@ bool qsa_decode_attn_split(const float* q, const QsaAttnPools& pools, const int3
void* stream);
/// Tests: the int8-KV kernel on INT8 tensor cores (1), v2 (0), or as STRATA_PROMPT_ATTN_IMMA says (-1).
void qsa_prompt_attn_set_imma(int on);
+/// HIP: STRATA_HIP_WMMA asks for the matrix-core prompt attention (=1 or =auto) and this device is a gfx11 / gfx12 matrix-core part
+/// that has not switched it off after a failed launch. The prompt path's 96-slot expert ring follows it. False off HIP.
+bool qsa_prompt_attn_matrix_cores_requested();
} // namespace strata::kernels
diff --git a/src/kernels/cuda/qsa_prompt_attn.cu b/src/kernels/cuda/qsa_prompt_attn.cu
index 3583f834a..66e09ecd0 100644
--- a/src/kernels/cuda/qsa_prompt_attn.cu
+++ b/src/kernels/cuda/qsa_prompt_attn.cu
@@ -2313,6 +2313,15 @@ bool qsa_decode_attn_split(const float* q, const QsaAttnPools& pools, const int3
#endif
}
void qsa_prompt_attn_set_imma(int on) { g_pa_imma = on < 0 ? -1 : (on ? 1 : 0); }
+bool qsa_prompt_attn_matrix_cores_requested() {
+#if defined(__HIPCC__)
+ int dev = 0;
+ if (hipGetDevice(&dev) != hipSuccess) { (void) hipGetLastError(); return false; }
+ return hip_wmma_mode_env() != 0 && hip_wmma_arch(dev) != 3 && !g_wmma_failed.load(std::memory_order_relaxed);
+#else
+ return false;
+#endif
+}
bool qsa_prompt_attn_batch(const float* q, const QsaAttnPools& pools, const int32_t* ids, const int32_t* steps,
int64_t cap, const QsaShapes& s, float* attn, int64_t n_q, void* stream) {
diff --git a/src/prefill/prefill.cpp b/src/prefill/prefill.cpp
index de22ffb0f..df1909c91 100644
--- a/src/prefill/prefill.cpp
+++ b/src/prefill/prefill.cpp
@@ -308,12 +308,9 @@ inline int ring_budget_slots() {
inline int ring_slots(size_t T) {
const char* v = std::getenv("STRATA_PREFILL_RING");
#if defined(STRATA_USE_HIP)
- // S6: with the opt-in RDNA4 matrix-core attention (STRATA_HIP_WMMA=1) a 96-slot ring: measured with it, 9070 XT
+ // S6: with the matrix-core attention (STRATA_HIP_WMMA=1 or auto, on a card that has it) a 96-slot ring: measured with it, 9070 XT
// 4K prompts 718 -> 1,211 tok/s (16K 1,949 -> 2,032), R9700 4K 2,426 -> 2,483 (16K the same)
- static const bool wmma = [] {
- const char* e = std::getenv("STRATA_HIP_WMMA");
- return e != nullptr && (e[0] == '1' || std::strcmp(e, "auto") == 0);
- }();
+ static const bool wmma = strata::kernels::qsa_prompt_attn_matrix_cores_requested();
if (!v && g_ring_override <= 0 && wmma) return (int64_t) T >= stream_all_min() ? 96 : STAGE;
#endif
// the byte budget as this pack's slots: 1024 fused / 384 not on Q2_0, fewer on a pack with bigger blobs. The