[hardware][misc] introduce platform abstraction (#6080)

This commit is contained in:
youkaichao
2024-07-02 20:12:22 -07:00
committed by GitHub
parent 9d6a8daa87
commit 482045ee77
16 changed files with 113 additions and 29 deletions
+21
View File
@@ -0,0 +1,21 @@
import enum
from typing import Tuple
class PlatformEnum(enum.Enum):
CUDA = enum.auto()
ROCM = enum.auto()
class Platform:
_enum: PlatformEnum
def is_cuda(self) -> bool:
return self._enum == PlatformEnum.CUDA
def is_rocm(self) -> bool:
return self._enum == PlatformEnum.ROCM
@staticmethod
def get_device_capability(device_id: int = 0) -> Tuple[int, int]:
raise NotImplementedError