Skip to content
Closed
Show file tree
Hide file tree
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
18 changes: 17 additions & 1 deletion ep/bench/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,18 @@ def internode_dispatch(
dtype=torch.int32,
device=x.device,
)
# Device-visible per-expert counts for CUDA-graph mode: the
# host list is unavailable without a sync when num_worst_tokens
# is set, so the notify kernel also writes a device tensor.
recv_expert_counts = (
torch.zeros(
(int(num_tokens_per_expert.size(0)) // self.group_size,),
dtype=torch.int32,
device=x.device,
)
if num_worst_tokens > 0
else None
)
(
num_recv_tokens,
num_rdma_recv_tokens,
Expand All @@ -1588,6 +1600,7 @@ def internode_dispatch(
int(num_tokens_per_expert.size(0)),
int(expert_alignment),
int(num_worst_tokens),
0 if recv_expert_counts is None else recv_expert_counts.data_ptr(),
config,
rdma_channel_prefix_matrix.data_ptr(),
recv_rdma_rank_prefix_sum.data_ptr(),
Expand Down Expand Up @@ -1752,7 +1765,9 @@ def internode_dispatch(
(recv_x, recv_x_scales) if x_scales is not None else recv_x,
recv_topk_idx,
recv_topk_weights,
num_recv_tokens_per_expert_list,
recv_expert_counts
if recv_expert_counts is not None
else num_recv_tokens_per_expert_list,
handle,
EventOverlap(
event,
Expand Down Expand Up @@ -1841,6 +1856,7 @@ def internode_combine(
rdma_channel_prefix_matrix.data_ptr(),
rdma_rank_prefix_sum.data_ptr(),
gbl_channel_prefix_matrix.data_ptr(),
gbl_rank_prefix_sum.data_ptr(),
send_rdma_head.data_ptr(),
send_nvl_head.data_ptr(),
config,
Expand Down
Loading