[12/n] final _C library kernel migration (#45415)
This commit is contained in:
+21
-1
@@ -19,7 +19,6 @@ from torch.distributed.distributed_c10d import is_nccl_available
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
# import custom ops, trigger op registration
|
||||
import vllm._C # noqa
|
||||
import vllm._C_stable_libtorch # noqa
|
||||
import vllm.envs as envs
|
||||
from vllm.logger import init_logger
|
||||
@@ -40,6 +39,11 @@ else:
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
try:
|
||||
import vllm._qutlass_C # noqa: F401
|
||||
except ImportError as e:
|
||||
logger.warning("Failed to import from vllm._qutlass_C: %r", e)
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
_R = TypeVar("_R")
|
||||
|
||||
@@ -187,6 +191,22 @@ class CudaPlatformBase(Platform):
|
||||
"RAY_EXPERIMENTAL_NOSET_CUDA_VISIBLE_DEVICES",
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def import_kernels(cls) -> None:
|
||||
"""Import CUDA kernel extensions (_C_stable_libtorch, optional _qutlass_C)."""
|
||||
try:
|
||||
import vllm._C_stable_libtorch # noqa: F401
|
||||
except ImportError as e:
|
||||
logger.warning("Failed to import from vllm._C_stable_libtorch: %r", e)
|
||||
try:
|
||||
import vllm._moe_C_stable_libtorch # noqa: F401
|
||||
except ImportError as e:
|
||||
logger.warning("Failed to import from vllm._moe_C_stable_libtorch: %r", e)
|
||||
try:
|
||||
import vllm._qutlass_C # noqa: F401
|
||||
except ImportError as e:
|
||||
logger.warning("Failed to import from vllm._qutlass_C: %r", e)
|
||||
|
||||
@property
|
||||
def supported_dtypes(self) -> list[torch.dtype]:
|
||||
if self.has_device_capability(80):
|
||||
|
||||
Reference in New Issue
Block a user