[Kimi K3][Kernel] Support DS conv-state layout in fused KDA decode kernel (#53396)

Signed-off-by: Canlin Guo <canlinguosdu@gmail.com>
This commit is contained in:
Canlin Guo
2026-08-26 23:54:50 -07:00
committed by GitHub
parent 833fa6233c
commit aa640684cc
5 changed files with 213 additions and 106 deletions
+2 -1
View File
@@ -153,6 +153,8 @@ def is_fused_kda_decode_supported(
input_dtype: torch.dtype,
conv_state_dtype: torch.dtype,
) -> bool:
# The fused kernel handles both conv-state cache layouts (SD and DS); the
# inner strides are selected from the tensor at launch time.
if (
num_heads not in (12, 24, 48, 96)
or head_dim != 128
@@ -160,7 +162,6 @@ def is_fused_kda_decode_supported(
or num_spec != 0
or input_dtype != torch.bfloat16
or conv_state_dtype != torch.bfloat16
or is_conv_state_dim_first()
or not hasattr(torch.ops._C, "fused_kda_decode")
):
return False