Add platform method to enable custom collective ops registration (#34760)
Signed-off-by: Naina Kuruballi Mahesh <nainakm@meta.com>
This commit is contained in:
@@ -574,9 +574,13 @@ class CudaPlatformBase(Platform):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def num_compute_units(cls, device_id=0):
|
||||
def num_compute_units(cls, device_id: int = 0) -> int:
|
||||
return torch.cuda.get_device_properties(device_id).multi_processor_count
|
||||
|
||||
@classmethod
|
||||
def use_custom_op_collectives(cls) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
# NVML utils
|
||||
# Note that NVML is not affected by `CUDA_VISIBLE_DEVICES`,
|
||||
|
||||
@@ -654,6 +654,15 @@ class Platform:
|
||||
"""
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def use_custom_op_collectives(cls) -> bool:
|
||||
"""
|
||||
Whether this platform should use torch.ops.vllm.* custom ops for collectives.
|
||||
|
||||
Returns False by default - platforms must explicitly opt-in.
|
||||
"""
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def use_sync_weight_loader(cls) -> bool:
|
||||
"""
|
||||
|
||||
@@ -820,5 +820,9 @@ class RocmPlatform(Platform):
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def num_compute_units(cls, device_id=0):
|
||||
def num_compute_units(cls, device_id: int = 0) -> int:
|
||||
return torch.cuda.get_device_properties(device_id).multi_processor_count
|
||||
|
||||
@classmethod
|
||||
def use_custom_op_collectives(cls) -> bool:
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user