diff --git a/CMakeLists.txt b/CMakeLists.txt index 64de3baa9f..bb0f51b43e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1180,14 +1180,14 @@ if(VLLM_GPU_LANG STREQUAL "CUDA" OR VLLM_GPU_LANG STREQUAL "HIP") endif() # HIP counterpart of the FUSED_KDA_DECODE block above: same `fused_kda_decode` - # op, same VLLM_ENABLE_FUSED_KDA_DECODE guard in torch_bindings.cpp. Only - # measured on gfx950, so it is only built when gfx950 is in the arch list. - # A multi-arch build that includes gfx950 still emits this source for every - # arch in that list. The runtime gate in kda_decode.py keeps the kernel off - # non-gfx950 devices. + # op, same VLLM_ENABLE_FUSED_KDA_DECODE guard in torch_bindings.cpp. Built for + # the CDNA archs the kernel supports (gfx942 / gfx950), so it is only emitted + # when one of those is in the arch list. A multi-arch build that includes them + # still emits this source for every arch in that list. The runtime gate in + # kda_decode.py keeps the kernel off unsupported devices. if(VLLM_GPU_LANG STREQUAL "HIP") set(FUSED_KDA_DECODE_HIP_ARCHS ${VLLM_GPU_ARCHES}) - list(FILTER FUSED_KDA_DECODE_HIP_ARCHS INCLUDE REGEX "gfx950") + list(FILTER FUSED_KDA_DECODE_HIP_ARCHS INCLUDE REGEX "gfx942|gfx950") if(FUSED_KDA_DECODE_HIP_ARCHS) set(FUSED_KDA_DECODE_HIP_SRC "csrc/libtorch_stable/kimi_k3/fused_kda_decode_kernel_rocm.cu") diff --git a/tests/models/kimi_k3/test_amd_kda_decode.py b/tests/models/kimi_k3/test_amd_kda_decode.py index e39acc72f2..7978e4fa7b 100644 --- a/tests/models/kimi_k3/test_amd_kda_decode.py +++ b/tests/models/kimi_k3/test_amd_kda_decode.py @@ -14,17 +14,17 @@ import torch from vllm.platforms import current_platform -def _on_gfx950() -> bool: +def _on_supported_arch() -> bool: if not current_platform.is_rocm(): return False - from vllm.platforms.rocm import on_gfx950 + from vllm.platforms.rocm import on_gfx942, on_gfx950 - return on_gfx950() + return on_gfx950() or on_gfx942() pytestmark = pytest.mark.skipif( - not _on_gfx950(), - reason="The fused KDA decode kernel is only built for gfx950", + not _on_supported_arch(), + reason="The fused KDA decode kernel is only built for gfx942 / gfx950", ) # Kimi-K3 KDA: 96 heads x 128, conv width 4, gate_lower_bound -5.0. diff --git a/vllm/models/kimi_k3/amd/ops/kda_decode.py b/vllm/models/kimi_k3/amd/ops/kda_decode.py index eee6e3a0cf..132cd58cf8 100644 --- a/vllm/models/kimi_k3/amd/ops/kda_decode.py +++ b/vllm/models/kimi_k3/amd/ops/kda_decode.py @@ -35,7 +35,7 @@ def is_fused_kda_decode_supported( conv_state_dtype: torch.dtype, ) -> bool: """Whether the fused decode kernel can serve this layer on this device.""" - from vllm.platforms.rocm import on_gfx950 + from vllm.platforms.rocm import on_gfx942, on_gfx950 if ( num_heads not in SUPPORTED_NUM_HEADS @@ -48,8 +48,9 @@ def is_fused_kda_decode_supported( or not hasattr(torch.ops._C, "fused_kda_decode") ): return False - # TODO: Verify on other archs; only measured on gfx950 for now - return on_gfx950() + # gfx950 (MI355X) and gfx942 (MI325X): both CDNA, sharing the wave64 / DPP / + # bf16 primitives the kernel relies on. + return on_gfx950() or on_gfx942() def make_decode_conv1d_weight_loader(