[TPU] optimize the all-reduce performance (#15903)

Signed-off-by: Chengji Yao <chengjiyao@google.com>
This commit is contained in:
Chengji Yao
2025-04-03 00:25:14 +00:00
committed by GitHub
parent 1b84eff03a
commit 01b6113659
3 changed files with 16 additions and 2 deletions
+4 -1
View File
@@ -119,11 +119,13 @@ def all_reduce_fake(tensor: torch.Tensor, group_name: str) -> torch.Tensor:
if supports_custom_op():
from vllm.platforms import current_platform
direct_register_custom_op(
op_name="all_reduce",
op_func=all_reduce,
mutates_args=[],
fake_impl=all_reduce_fake,
dispatch_key=current_platform.dispatch_key,
)
@@ -219,7 +221,8 @@ class GroupCoordinator:
self.cpu_group, 1 << 22, 6)
from vllm.platforms import current_platform
self.use_custom_op_call = current_platform.is_cuda_alike()
self.use_custom_op_call = (current_platform.is_cuda_alike()
or current_platform.is_tpu())
@property
def first_rank(self):