[Kernel] Centralize platform kernel import in current_platform.import_kernels (#26286)
Signed-off-by: NickLucche <nlucches@redhat.com>
This commit is contained in:
@@ -170,22 +170,15 @@ class Platform:
|
||||
return device_id
|
||||
|
||||
@classmethod
|
||||
def import_core_kernels(cls) -> None:
|
||||
def import_kernels(cls) -> None:
|
||||
"""Import any platform-specific C kernels."""
|
||||
try:
|
||||
import vllm._C # noqa: F401
|
||||
except ImportError as e:
|
||||
logger.warning("Failed to import from vllm._C: %r", e)
|
||||
|
||||
@classmethod
|
||||
def try_import_moe_kernels(cls) -> bool:
|
||||
"""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
|
||||
|
||||
Reference in New Issue
Block a user