diff --git a/src/kernels/cuda/qsa_prompt_attn.cu b/src/kernels/cuda/qsa_prompt_attn.cu index 10a061da..54f40e9a 100644 --- a/src/kernels/cuda/qsa_prompt_attn.cu +++ b/src/kernels/cuda/qsa_prompt_attn.cu @@ -1623,8 +1623,13 @@ bool qsa_prompt_attn_batch(const float* q, const QsaAttnPools& pools, const int3 const char* v = std::getenv("STRATA_PROMPT_ATTN_Q4"); return v != nullptr && v[0] == '0'; }(); - // sm_80+ only: on Turing mode 4 would run as pairs of m16n8k8 MMAs, which no parity run has checked yet - if (q4_off || turing || pools.v_q4 == nullptr) return false; + // Turing runs mode 4 as pairs of m16n8k8 MMAs (another summation order than the FP32 kernel it replaces): manual + // opt-in STRATA_PROMPT_ATTN_Q4_TC=1 (#1581, c3c: qsa_prompt_attn_parity at 4096/512 and 1500/512 on an RTX 2080 Super). + static const bool q4_tc = [] { + const char* v = std::getenv("STRATA_PROMPT_ATTN_Q4_TC"); + return v != nullptr && v[0] == '1'; + }(); + if (q4_off || volta || (turing && !q4_tc) || pools.v_q4 == nullptr) return false; return launch<4>(q, pools, ids, steps, cap, s, attn, n_q, st); } if (pools.k_q != nullptr && pools.v_q4 != nullptr) { // hybrid K8V4: int8 K + dequantized-q4 V