[Fix] [AMD] diffusion: Compare ReduceOp by identity so the compiled TP all-reduce stays one graph (#43770)
Co-authored-by: jacky.cheng <yichiche@amd.com>
This commit is contained in:
@@ -375,7 +375,9 @@ class GroupCoordinator:
|
||||
torch.compiler.is_compiling()
|
||||
and self.srt_custom_allreduce is not None
|
||||
and not async_op
|
||||
and op == torch.distributed.ReduceOp.SUM
|
||||
# Compare by identity: Dynamo before torch 2.14 cannot trace
|
||||
# RedOpType.__eq__ and breaks the graph on `==`.
|
||||
and op is torch.distributed.ReduceOp.SUM
|
||||
and not input_.is_cpu
|
||||
):
|
||||
return diffusion_all_reduce(input_, group_name=self.unique_name)
|
||||
@@ -384,7 +386,7 @@ class GroupCoordinator:
|
||||
if (
|
||||
not async_op
|
||||
and custom_ar is not None
|
||||
and op == torch.distributed.ReduceOp.SUM
|
||||
and op is torch.distributed.ReduceOp.SUM
|
||||
and not input_.is_cpu
|
||||
and not custom_ar.disabled
|
||||
and custom_ar.should_custom_ar(input_)
|
||||
|
||||
Reference in New Issue
Block a user