From cc7cf71fc819df579664adc2e944438d464dbc30 Mon Sep 17 00:00:00 2001 From: pmanczak Date: Mon, 17 Aug 2026 11:21:34 +0200 Subject: [PATCH] [XPU] Enable Kimi K3 KDA kernel tests on XPU (#51809) Signed-off-by: pmanczak --- tests/models/kimi_k3/test_kda.py | 8 +++++++- .../layers/mamba/ops/gather_initial_states.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/models/kimi_k3/test_kda.py b/tests/models/kimi_k3/test_kda.py index 9fae1c2bcd..8ea5744f3b 100644 --- a/tests/models/kimi_k3/test_kda.py +++ b/tests/models/kimi_k3/test_kda.py @@ -30,9 +30,15 @@ from vllm.models.kimi_k3.nvidia.ops.third_party.kda import ( fused_recurrent_kda_fwd, fused_recurrent_kda_packed_decode, ) +from vllm.platforms import current_platform from vllm.third_party.flash_linear_attention.ops.l2norm import l2norm_fwd -DEVICE = "cuda" +DEVICE = current_platform.device_type + +pytestmark = pytest.mark.skipif( + not (current_platform.is_cuda_alike() or current_platform.is_xpu()), + reason="The KDA kernels require a CUDA-alike or XPU device.", +) # The AMD and NVIDIA copies of the KDA kernels are vendored separately and are # free to diverge, so the shared-semantics tests below run against both. diff --git a/vllm/model_executor/layers/mamba/ops/gather_initial_states.py b/vllm/model_executor/layers/mamba/ops/gather_initial_states.py index b952e3ebbc..02c89823ee 100644 --- a/vllm/model_executor/layers/mamba/ops/gather_initial_states.py +++ b/vllm/model_executor/layers/mamba/ops/gather_initial_states.py @@ -49,7 +49,7 @@ def gather_initial_states( ) -> torch.Tensor: """Gather dense state rows, replacing uninitialized rows with zeros.""" assert state.ndim >= 2 - assert state.is_cuda + assert state.is_cuda or state.is_xpu assert indices.ndim == 1 and has_initial_state.ndim == 1 assert indices.shape == has_initial_state.shape assert indices.device == state.device