From 3e569de2744fe6b4a0dc304679973c472021ae41 Mon Sep 17 00:00:00 2001 From: NickLucche Date: Mon, 6 Oct 2025 09:06:45 +0000 Subject: [PATCH] import moe change Signed-off-by: NickLucche --- vllm/_custom_ops.py | 4 ++-- vllm/platforms/interface.py | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/vllm/_custom_ops.py b/vllm/_custom_ops.py index b8cbb1ad90a6..f2a66f608ad9 100644 --- a/vllm/_custom_ops.py +++ b/vllm/_custom_ops.py @@ -13,7 +13,7 @@ logger = init_logger(__name__) current_platform.import_core_kernels() -supports_moe_ops = current_platform.try_import_moe_kernels() +current_platform.import_moe_kernels() if TYPE_CHECKING: @@ -1921,7 +1921,7 @@ def moe_wna16_marlin_gemm( ) -if supports_moe_ops and hasattr(torch.ops._moe_C, "marlin_gemm_moe"): +if hasattr(torch.ops, "_moe_C") and hasattr(torch.ops._moe_C, "marlin_gemm_moe"): @register_fake("_moe_C::marlin_gemm_moe") def marlin_gemm_moe_fake( diff --git a/vllm/platforms/interface.py b/vllm/platforms/interface.py index 59bc9173958c..5227f80065d2 100644 --- a/vllm/platforms/interface.py +++ b/vllm/platforms/interface.py @@ -175,14 +175,11 @@ def import_core_kernels(cls) -> None: logger.warning("Failed to import from vllm._C: %r", e) @classmethod - def try_import_moe_kernels(cls) -> bool: + def import_moe_kernels(cls) -> None: """Import any platform-specific MoE kernels.""" with contextlib.suppress(ImportError): import vllm._moe_C # noqa: F401 - return True - return False - @classmethod def get_vit_attn_backend(cls, head_size: int, dtype: torch.dtype) -> "_Backend": from vllm.attention.backends.registry import _Backend