[TPU] optimize the all-reduce performance (#15903)
Signed-off-by: Chengji Yao <chengjiyao@google.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user