qsa_prompt_attn: Q4_0 KV prompt attention on Turing, opt-in STRATA_PROMPT_ATTN_Q4_TC=1 (#1581, the Q4 attention part only)
Ported from c3c's #1581 (the native-IQ and VRAM-loan parts are not in this commit). Default unchanged: Turing keeps returning false for q4_0. Co-authored-by: c3c <cedric@ce3c.be>
This commit is contained in:
1 parent
7f8e6f12f4
commit
285e90aee2
1 file changed
+7
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user