[hardware][misc] introduce platform abstraction (#6080)
This commit is contained in:
18
vllm/platforms/__init__.py
Normal file
18
vllm/platforms/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import Optional
|
||||
|
||||
import torch
|
||||
|
||||
from .interface import Platform, PlatformEnum
|
||||
|
||||
current_platform: Optional[Platform]
|
||||
|
||||
if torch.version.cuda is not None:
|
||||
from .cuda import CudaPlatform
|
||||
current_platform = CudaPlatform()
|
||||
elif torch.version.hip is not None:
|
||||
from .rocm import RocmPlatform
|
||||
current_platform = RocmPlatform()
|
||||
else:
|
||||
current_platform = None
|
||||
|
||||
__all__ = ['Platform', 'PlatformEnum', 'current_platform']
|
||||
Reference in New Issue
Block a user