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

HIP: keep the D-1 attention and QSA select tensor-core paths CUDA-only (AMD takes the portable kernels)

Niko122178a5bf70ddfb
diff --git a/src/kernels/cuda/qsa_prompt_attn.cu b/src/kernels/cuda/qsa_prompt_attn.cu
index b6036824b..10f4a676c 100644
--- a/src/kernels/cuda/qsa_prompt_attn.cu
+++ b/src/kernels/cuda/qsa_prompt_attn.cu
@@ -24,7 +24,9 @@ constexpr int QS = HD + 8; // q row stride in halves (bank-conflict-free
// The MMA and cp.async below need sm_80. Builds for older cards (the experimental sm_75 one) compile them to a trap;
// qsa_prompt_attn_batch refuses such a device at run time, so the old kernel runs there.
-#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
+#if defined(__HIPCC__) // AMD: no mma.sync / cp.async; the host keeps the old kernel (below)
+#define STRATA_PA_SM80 0
+#elif !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
#define STRATA_PA_SM80 1
#else
#define STRATA_PA_SM80 0
@@ -650,6 +652,9 @@ bool qsa_prompt_attn_batch(const float* q, const QsaAttnPools& pools, const int3
}
if (cc_major[dev] < 8) return false;
}
+#if defined(__HIPCC__)
+ return false; // the tensor-core kernel is compiled out on AMD (its major version is not a CUDA sm)
+#endif
if (pools.k_q4 != nullptr || s.head_dim != HD || s.n_head != (int64_t) G * s.n_head_kv || cap <= 0 || !ids ||
!steps || !pools.page_table)
return false;
diff --git a/src/kernels/cuda/qsa_select.cu b/src/kernels/cuda/qsa_select.cu
index 10eed5587..85b7342c1 100644
--- a/src/kernels/cuda/qsa_select.cu
+++ b/src/kernels/cuda/qsa_select.cu
@@ -161,7 +161,9 @@ constexpr int TC_QS = IDX_HEADS * IDX_DIM + 4; // query row stride in floats
constexpr int TC_KS = IDX_DIM + 4; // key row stride
// TF32 conversion and MMA need sm_80: below it they compile to a trap and qsa_block_scores_tc refuses the device
-#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
+#if defined(__HIPCC__) // AMD: no mma.sync / cp.async; the host keeps the warp kernel (below)
+#define STRATA_SEL_SM80 0
+#elif !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
#define STRATA_SEL_SM80 1
#else
#define STRATA_SEL_SM80 0
@@ -463,6 +465,9 @@ bool qsa_block_scores_tc(const float* pooled, const float* dead, const float* q_
}
if (cc_major[dev] < 8) return false;
}
+#if defined(__HIPCC__)
+ return false; // the tensor-core kernel is compiled out on AMD (its major version is not a CUDA sm)
+#endif
static bool attr[64] = {}; // the shared-memory opt-in is per device (a layer split runs it on several)
int adev = 0;
cudaGetDevice(&adev);