Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ __device__ void vectorized_combine_impl(T* dst_typed_base, int size_per_token, i
{
int target_rank = ptrs.topk_target_ranks[local_token_idx * TOP_K + k];
int dst_idx = ptrs.topk_send_indices[local_token_idx * TOP_K + k];
if (dst_idx < 0)
if (dst_idx < 0 || !is_rank_active(ptrs.active_rank_mask, target_rank))
{
acc[k].fill(0.0f);
continue;
Expand All @@ -766,8 +766,12 @@ __device__ void vectorized_combine_impl(T* dst_typed_base, int size_per_token, i
#pragma unroll
for (int k = 0; k < TOP_K; ++k)
{
if (ptrs.topk_send_indices[local_token_idx * TOP_K + k] < 0)
int target_rank = ptrs.topk_target_ranks[local_token_idx * TOP_K + k];
int dst_idx = ptrs.topk_send_indices[local_token_idx * TOP_K + k];
if (dst_idx < 0 || !is_rank_active(ptrs.active_rank_mask, target_rank))
{
continue; // acc[k] already holds 0.0f from fill() above
}
#pragma unroll
for (int j = elems_per_vec - 1; j >= 0; --j)
acc[k][j] = static_cast<float>(reinterpret_cast<InT const*>(&acc[k])[j]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ struct CombineKernelPointers
int const* topk_send_indices; // dst index per k, -1 for duplicates

// Active-rank bitmask: see DispatchKernelPointers::active_rank_mask. Combine skips flag
// writes/waits to/from masked peers; per-token accumulation uses topk_send_indices[k] < 0
// (set by dispatch) to skip dead-targeted slots, so no explicit mask check is needed there.
// writes/waits to/from masked peers and also skips per-token accumulation for ranks that
// become inactive between dispatch and combine.
uint64_t active_rank_mask[kRankMaskWords];
Comment thread
chienchunhung marked this conversation as resolved.
};

Expand Down
Loading
Loading