Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def custom_all_reduce(self, input: torch.Tensor) -> Optional[torch.Tensor]:
if self._IS_CAPTURING:
if torch.cuda.is_current_stream_capturing():
if _is_hip:
if self.tms_cudagraph:
return self.all_reduce_unreg(input)
return self.all_reduce_reg(input)
Comment on lines +414 to 416
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and conciseness, you can use a conditional expression (ternary operator) to simplify this logic.

                    return self.all_reduce_unreg(input) if self.tms_cudagraph else self.all_reduce_reg(input)

else:
return self.all_reduce(input, registered=not self.tms_cudagraph)
Expand Down
Loading