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

pf_wmma: set the tiles shared-memory attribute on each card, not once per process (a layer split stopped on its second card: "the WMMA expert tiles could not launch")

Warabii12484dc32064022d
diff --git a/src/kernels/cuda/iq_kernels.cu b/src/kernels/cuda/iq_kernels.cu
index 47ee1513b..701f433d2 100644
--- a/src/kernels/cuda/iq_kernels.cu
+++ b/src/kernels/cuda/iq_kernels.cu
@@ -3977,12 +3977,16 @@ bool gemm_iq_f16_grouped(int ty, const void* W, size_t expert_bytes, int n_out,
const dim3 grid((unsigned) (n_out / WG_BN), (unsigned) (n_experts * mt));
cudaStream_t s = (cudaStream_t) stream;
auto smem = [](int wk) { return (size_t) WG_BN * (wk + 8) * 2 + (size_t) WG_BM * (WG_XK + 8) * 2; };
- static bool attr = false;
- if (!attr) {
+ // the shared-memory attribute belongs to the current device, so it is set on each card: with one flag for the
+ // process a layer split's second card launched without it and the prompt stopped ("the WMMA expert tiles could not launch")
+ static bool attr[64];
+ int dev = 0;
+ if (cudaGetDevice(&dev) != cudaSuccess || dev < 0 || dev >= 64) return false;
+ if (!attr[dev]) {
cudaFuncSetAttribute(gemm_iq_f16_grouped_kernel<256, false>, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem(256));
cudaFuncSetAttribute(gemm_iq_f16_grouped_kernel<128, true>, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem(128));
cudaFuncSetAttribute(gemm_iq_f16_grouped_kernel<128, false, true>, cudaFuncAttributeMaxDynamicSharedMemorySize, (int) smem(128));
- attr = true;
+ attr[dev] = true;
}
if (q20)
gemm_iq_f16_grouped_kernel<128, true><<<grid, WG_THREADS, smem(128), s>>>(ty, (const uint8_t*) W, expert_bytes, row_bytes, K,