diff --git a/engine/src/kernels/cuda/mla_latent_attn.cu b/engine/src/kernels/cuda/mla_latent_attn.cu index 964609a026..3e1a3262f4 100644 --- a/engine/src/kernels/cuda/mla_latent_attn.cu +++ b/engine/src/kernels/cuda/mla_latent_attn.cu @@ -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(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(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(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;