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
8 changes: 8 additions & 0 deletions csrc/include/custom_all_reduce.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,7 @@ __global__ void __launch_bounds__(512, 1) allgather_naive(
int write_idx = warp_id * size + idx;
result[write_idx] = ptrs[warp_id][idx];
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

template <typename T, int ngpus>
Expand Down Expand Up @@ -736,6 +737,7 @@ __global__ void __launch_bounds__(512, 1) allgather_vec(
int write_idx = warp_id * size + idx;
*(reinterpret_cast<P*>(&result[0]) + write_idx) = ptrs[warp_id][idx];
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

template <typename T, int ngpus>
Expand Down Expand Up @@ -772,6 +774,7 @@ __global__ void __launch_bounds__(512, 1) allgather_lastdim(RankData* _dp,
int write_idx = (ngpus * y + warp_id) * last_dim_size + x;
*(reinterpret_cast<P*>(&result[0]) + write_idx) = ptrs[warp_id][idx];
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

// ========== reduce_scatter kernel start ==========
Expand Down Expand Up @@ -813,6 +816,7 @@ __global__ void __launch_bounds__(512, 1) reduce_scatter_split_first_dim(
*(reinterpret_cast<P*>(result) + store_index) =
packed_reduce<P, ngpus, A>(ptrs, load_index);
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

// reduce_scatter, scatter on last dim — naive (non-vectorized) fallback.
Expand Down Expand Up @@ -850,6 +854,7 @@ __global__ void __launch_bounds__(256, 1) reduce_scatter_split_lastdim_naive(
}
result[i] = downcast_s<T>(rslt_reg);
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

// reduce_scatter, scatter on last dim — vectorized (16B / thread).
Expand Down Expand Up @@ -883,6 +888,7 @@ __global__ void __launch_bounds__(256, 1) reduce_scatter_split_lastdim(
int load_index = index_y * packed_dim_n + rank * splited_n + index_x;
*(reinterpret_cast<P*>(result) + i) = packed_reduce<P, ngpus, A>(ptrs, load_index);
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

// reduce_scatter, scatter on middle dim — naive (non-vectorized) fallback.
Expand Down Expand Up @@ -920,6 +926,7 @@ __global__ void __launch_bounds__(256, 1) reduce_scatter_split_middim_naive(
}
result[i] = downcast_s<T>(rslt_reg);
}
end_sync<ngpus, true>(sg, self_sg, rank);
}

// reduce_scatter, scatter on middle dim — vectorized (16B / thread along k).
Expand Down Expand Up @@ -954,6 +961,7 @@ __global__ void __launch_bounds__(256, 1) reduce_scatter_split_middim(
int load_index = index_m * (n * packed_dim_k) + (rank * splited_n + index_n) * packed_dim_k + index_k;
*(reinterpret_cast<P*>(result) + i) = packed_reduce<P, ngpus, A>(ptrs, load_index);
}
end_sync<ngpus, true>(sg, self_sg, rank);
}
// ========== reduce_scatter kernel end ==========

Expand Down
Loading