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

gdn chunk / Volta recurrence: name the kernels in every device pass (wmma body guarded inside the kernel), not behind __CUDA_ARCH__ at the call sites: the dea9b6de5 guard left the host stubs undefined in a 60;70;86 build (link error)

Niko12214c968e61999d
diff --git a/src/prefill/gdn_chunk.cu b/src/prefill/gdn_chunk.cu
index 1f18137cc..0db55020b 100644
--- a/src/prefill/gdn_chunk.cu
+++ b/src/prefill/gdn_chunk.cu
@@ -223,13 +223,14 @@ __global__ void __launch_bounds__(128) gdn_chunk_fwd_kernel(float* __restrict__
//
// Precision: the FP16 staging is the reference's "f32 -> f16 暂存" (10-bit mantissa on the operands);
// accumulations, the solve and the state are f32. FP32-level, not bit-exact - see gdn_chunk_parity.
-#if !defined(__HIPCC__) && (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700)
-namespace wmma = ::nvcuda::wmma;
+#if !defined(__HIPCC__)
__global__ void __launch_bounds__(128) gdn_chunk_wmma_kernel(float* __restrict__ state, float* __restrict__ oc,
const float* __restrict__ h,
const float* __restrict__ beta,
const float* __restrict__ gcum, int nchunks) {
+#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700 // named in every device pass of a multi-arch build; only sm_70+ has wmma
+ namespace wmma = ::nvcuda::wmma;
// smem (84.5 KB, opt-in): Ks/Qs the chunk's k and q rows f16; W16 the state slice f16 (U's operand);
// Ug[128][32] f32 aliasing the 64x64 Gram scratch and then U = [K;Q] W; As/Ps f16; dlt f32 + f16.
extern __shared__ __align__(1024) unsigned char smem[];
@@ -439,8 +440,9 @@ __global__ void __launch_bounds__(128) gdn_chunk_wmma_kernel(float* __restrict__
const int r = i / NS, j = i % NS;
state[(size_t) r * HV * S + (size_t) hh * S + j0 + j] = Ug[i];
}
+#endif
}
-#endif // !HIPCC && __CUDA_ARCH__ >= 700
+#endif // !HIPCC
// The grow-only workspace, one per (thread, device): a layer split runs the chunked recurrence on more than
// one card, and each card's pointers are only valid on that card - a single per-thread buffer would hand a
@@ -532,7 +534,7 @@ void gdn_chunk_recurrence(float* state, const float* h, const float* gate, const
(void) state; (void) h; (void) gate; (void) beta; (void) oc; (void) T; (void) stream;
std::fprintf(stderr, "gdn_chunk_recurrence: not built for HIP\n");
std::exit(1);
-#elif !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700 // the sm_60 device pass of a multi-arch build has no wmma kernel to name
+#else
if (T <= 0) return;
const int64_t T64 = T - T % CH;
if (T64 <= 0) return;
diff --git a/src/prefill/kernels.cu b/src/prefill/kernels.cu
index 598b94e89..d6c6b99a0 100644
--- a/src/prefill/kernels.cu
+++ b/src/prefill/kernels.cu
@@ -395,7 +395,7 @@ constexpr int RG = 4, RPG = S / RG;
constexpr int CB = 32, NCB = S / CB; // value columns per block kernel / blocks per head
// v100/gdn-chunk: Volta-only (sm_70), inside the experimental build. Main's recurrence kernels above are
// untouched for every other architecture; the chain-split is dispatched only when the device is cc 7.0.
-#if defined(STRATA_EXPERIMENTAL_SM60) && (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ == 700)
+#if defined(STRATA_EXPERIMENTAL_SM60)
// v100/gdn-chunk: the same recurrence with WARP-LOCAL reductions - no __syncthreads at all. gdn_rec_cols_*'
// per-token shape is two cross-warp reductions (k^T W and q^T W) behind two barriers each (six barriers per
// token in the pipelined kernel); here a warp owns 8 columns and the 4 row-groups are lanes within the warp,
@@ -613,7 +613,7 @@ __global__ void __launch_bounds__(CB * RG) gdn_rec_cols_pipe_kernel(float* __res
// cycles before the barriers); the split keeps the load pattern, the barriers and the (S, h_v, S) state
// layout untouched. FP32-level, NOT bit-exact - the four partial sums group the 32 products differently -
// so it is opt-in by measured benefit (STRATA_GDN_REC_WARP=2; gdn_chunk_parity bounds the error).
-#if defined(STRATA_EXPERIMENTAL_SM60) && (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ == 700)
+#if defined(STRATA_EXPERIMENTAL_SM60)
__global__ void __launch_bounds__(CB * RG) gdn_rec_cols_pipe_fast_kernel(float* __restrict__ state,
const float* __restrict__ h,
const float* __restrict__ gate,
@@ -2116,7 +2116,7 @@ void gdn_recurrence_variant(int variant, float* state, const float* h, const flo
(void) variant; // the quad recurrence kernels are AMD-only
#endif
static const bool serial = std::getenv("STRATA_GDN_REC_HEADS") != nullptr; // the one-block-per-head kernel (A/B)
-#if defined(STRATA_EXPERIMENTAL_SM60) && (!defined(__CUDA_ARCH__) || __CUDA_ARCH__ == 700) // the kernels exist in the host pass and the sm_70 device pass only
+#if defined(STRATA_EXPERIMENTAL_SM60)
// v100/gdn-chunk: the chunked recurrence (src/prefill/gdn_chunk.cu) on Volta, where the token chain is the
// cost. STRATA_GDN_CHUNK=0 forces the recurrence, =1 forces the chunked path (the parity test's A/B switch);
// unset: cc == 7.0 only, every other architecture keeps the recurrence bit-for-bit as before. Read per call