kernels: mla_latent_attn: 32-head tile for Q8_0 decode at 128 heads on cards with 96+ SMs

Q8_0 dequantisation repeats for every 16-head tile; at 128 heads that is 8 times. Measured: +13 % on the 110-SM sm_120 card, -12 % on the 48-SM sm_86 card, hence the SM-count condition.
This commit is contained in:
Niko1221 committed 2026-11-30 23:27:45 +01:00
1 parent b7e7f8d856
commit f6235e80da
1 file changed
+1 -1
+1 -1
View File
@@ -780,7 +780,7 @@ Chosen choose(const MlaLatentArgs& a) {
const bool want_tc = a.precision == MlaPrecision::kTcFast || a.precision == MlaPrecision::kTcSplit || (a.precision == MlaPrecision::kAuto && tc_by_default(a, d));
if (force == 0 && want_tc && mma_allowed(a) && d.cc >= 80 && d.smem_optin >= static_cast<int>(tc_smem_bytes(false, 2, false))) {
c.variant = (a.precision == MlaPrecision::kTcFast) ? kVarTcFast : kVarTcSplit;
c.rm = (c.variant == kVarTcFast && a.n_head % 32 == 0 && static_cast<long>(a.n_tok) * (a.n_head / 32) >= 16 && !a.bit_exact_per_query) ? 32 : 16; // 32 heads a block pays off with 16+ tiles of 32 heads (verify windows of 8+, prompts); decode and the per-query mode keep 16 (2 blocks per SM, more parallelism)
c.rm = (c.variant == kVarTcFast && a.n_head % 32 == 0 && (static_cast<long>(a.n_tok) * (a.n_head / 32) >= 16 || (a.type == MlaCacheType::kQ8_0 && a.n_head >= 128 && d.sm >= 96)) && !a.bit_exact_per_query) ? 32 : 16; // Q8_0 decode at 128 heads: the dequantisation repeats for every 16-head tile; measured: +13 % on the 110-SM sm_120 card, -12 % on the 48-SM sm_86 card // 32 heads a block pays off with 16+ tiles of 32 heads (verify windows of 8+, prompts); decode and the per-query mode keep 16 (2 blocks per SM, more parallelism)
}
}
const int max_idx = a.sel ? a.n_sel : a.max_kv;