diff --git a/python/sglang/multimodal_gen/runtime/distributed/group_coordinator.py b/python/sglang/multimodal_gen/runtime/distributed/group_coordinator.py index af577eba20..3d32e83b1d 100644 --- a/python/sglang/multimodal_gen/runtime/distributed/group_coordinator.py +++ b/python/sglang/multimodal_gen/runtime/distributed/group_coordinator.py @@ -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_)