Cleanup DeviceInterface in triton test (#152409)

- Remove inherited functions
- Return valid device_count (1 device: idx=0)
- Remove unused function `triton_supported`

Followup to #144399

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152409
Approved by: https://github.com/jansel
This commit is contained in:
Alexander Grund 2025-05-02 20:25:29 +00:00 committed by PyTorch MergeBot
parent 44f29a3669
commit 74b496e54c

View File

@ -76,7 +76,7 @@ class DeviceInterface(device_interface.DeviceInterface):
@staticmethod
def device_count() -> int:
raise NotImplementedError
return 1
@staticmethod
def maybe_exchange_device(device: int) -> int:
@ -92,14 +92,6 @@ class DeviceInterface(device_interface.DeviceInterface):
), f"Only device index 0 is supported, tried to set index to {device}"
return 0 # previous device is always 0
@staticmethod
def current_stream():
raise NotImplementedError
@staticmethod
def set_stream(stream) -> None:
raise NotImplementedError
@staticmethod
def get_raw_stream(device_index: int):
return None
@ -108,10 +100,6 @@ class DeviceInterface(device_interface.DeviceInterface):
def synchronize(device) -> None:
pass
@classmethod
def get_device_properties(cls, device=None) -> DeviceProperties:
return cls.Worker.get_device_properties(device)
# Can be mock patched by @patch decorator.
@staticmethod
def is_available() -> bool:
@ -120,7 +108,3 @@ class DeviceInterface(device_interface.DeviceInterface):
@staticmethod
def get_compute_capability(device) -> int:
return 0
@staticmethod
def triton_supported() -> bool:
return True