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
6 changes: 4 additions & 2 deletions vllm/distributed/device_communicators/all2all.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ def naive_multicast(

rank = self.rank if is_sequence_parallel else self.dp_rank
world_size = self.world_size if is_sequence_parallel else self.dp_world_size
dist_group = get_ep_group() if is_sequence_parallel else get_dp_group()

start = 0 if rank == 0 else cu_tokens_across_sp_cpu[rank - 1]
end = cu_tokens_across_sp_cpu[rank]
buffer[start:end, :].copy_(x)
for idx in range(world_size):
start = 0 if idx == 0 else cu_tokens_across_sp_cpu[idx - 1]
end = cu_tokens_across_sp_cpu[idx]
get_ep_group().broadcast(buffer[start:end, :], idx)
dist_group.broadcast(buffer[start:end, :], idx)

return buffer

Expand Down Expand Up @@ -125,7 +126,8 @@ def combine(
start = 0 if ep_rank == 0 else cu_tokens_across_sp_cpu[ep_rank - 1]
end = cu_tokens_across_sp_cpu[ep_rank]

all_hidden_states = get_ep_group().all_reduce(hidden_states)
dist_group = get_ep_group() if is_sequence_parallel else get_dp_group()
all_hidden_states = dist_group.all_reduce(hidden_states)
hidden_states = all_hidden_states[start:end, :]
return hidden_states

Expand Down