From c61364fc8981304c272292268a1e1575a290c497 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Sat, 17 Oct 2026 13:49:20 +0200 Subject: [PATCH] qsa prompt attention: STRATA_QSA_WARP=1 only forces the Turing kernels on cards that have the Turing MMA (sm_75+) The switch made every card answer as sm_75, so a Tesla P100 (sm_60) launched the m16n8k8 prompt-attention kernels, whose sm_60 code is a __trap(): the engine died on the first long prompt with "prefill copy_i32: unspecified launch failure". A card below sm_75 now ignores the switch and runs the kernel it runs without it (the same tokens). --- src/kernels/cuda/qsa_prompt_attn.cu | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kernels/cuda/qsa_prompt_attn.cu b/src/kernels/cuda/qsa_prompt_attn.cu index b2b5480c..489a6d5f 100644 --- a/src/kernels/cuda/qsa_prompt_attn.cu +++ b/src/kernels/cuda/qsa_prompt_attn.cu @@ -2272,10 +2272,13 @@ bool qsa_prompt_attn_batch(const float* q, const QsaAttnPools& pools, const int3 cudaGetLastError(); return false; } - // STRATA_QSA_WARP=1|attn (an A/B arm): the pre-sm_80 kernels on any card, as RTX 20 runs them + // STRATA_QSA_WARP=1|attn (an A/B arm): the pre-sm_80 kernels on any card that has the Turing MMA (sm_75 + // and newer), as RTX 20 runs them. A card below sm_75 has no m16n8k8: its builds hold a __trap() in those + // kernels, so forcing them there killed the engine ("prefill copy_i32: unspecified launch failure" on a + // Tesla P100); such a card ignores the switch and keeps the kernel it runs without it. const char* w = std::getenv("STRATA_QSA_WARP"); - cc[dev] = w && (!std::strcmp(w, "1") || !std::strcmp(w, "attn")) ? 75 - : 10 * strata::cc_major_of(major) + strata::cc_minor_of(minor); + const int real_cc = 10 * strata::cc_major_of(major) + strata::cc_minor_of(minor); + cc[dev] = w && (!std::strcmp(w, "1") || !std::strcmp(w, "attn")) && real_cc >= 75 ? 75 : real_cc; } if (cc[dev] < 70) return false; volta = cc[dev] < 75; // sm_70: the m8n8k4 kernel (STRATA_PA_VOLTA); STRATA_QSA_WARP=1 still forces the old one