Skip to content
Open
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
7 changes: 4 additions & 3 deletions vllm/distributed/device_communicators/custom_all_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ def custom_all_reduce(self, input: torch.Tensor) -> torch.Tensor | None:
if torch.cuda.is_current_stream_capturing():
return self.all_reduce(input, registered=True)
else:
# If warm up, mimic the allocation pattern since custom
# allreduce is out-of-place.
return torch.empty_like(input)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could maybe accomplish the same thing if it was torch.zeros_like(input)? Initial tests seem promising, but I'm not sure how to interpret what that means as far as the root issue here and what this actually fixes.

# During warmup, we need to run the all_reduce operation so
# that the allocation, copy, and collective behaviors
# are consistent between warmup, capture, and replay.
return self.all_reduce(input, registered=False)
else:
# Note: outside of cuda graph context, custom allreduce incurs a
# cost of cudaMemcpy, which should be small (<=1% of overall
Expand Down
Loading