diff --git a/csrc/include/custom_all_reduce.cuh b/csrc/include/custom_all_reduce.cuh index ee304c132c..d1545e3cb8 100644 --- a/csrc/include/custom_all_reduce.cuh +++ b/csrc/include/custom_all_reduce.cuh @@ -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(sg, self_sg, rank); } template @@ -736,6 +737,7 @@ __global__ void __launch_bounds__(512, 1) allgather_vec( int write_idx = warp_id * size + idx; *(reinterpret_cast(&result[0]) + write_idx) = ptrs[warp_id][idx]; } + end_sync(sg, self_sg, rank); } template @@ -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(&result[0]) + write_idx) = ptrs[warp_id][idx]; } + end_sync(sg, self_sg, rank); } // ========== reduce_scatter kernel start ========== @@ -813,6 +816,7 @@ __global__ void __launch_bounds__(512, 1) reduce_scatter_split_first_dim( *(reinterpret_cast(result) + store_index) = packed_reduce(ptrs, load_index); } + end_sync(sg, self_sg, rank); } // reduce_scatter, scatter on last dim — naive (non-vectorized) fallback. @@ -850,6 +854,7 @@ __global__ void __launch_bounds__(256, 1) reduce_scatter_split_lastdim_naive( } result[i] = downcast_s(rslt_reg); } + end_sync(sg, self_sg, rank); } // reduce_scatter, scatter on last dim — vectorized (16B / thread). @@ -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(result) + i) = packed_reduce(ptrs, load_index); } + end_sync(sg, self_sg, rank); } // reduce_scatter, scatter on middle dim — naive (non-vectorized) fallback. @@ -920,6 +926,7 @@ __global__ void __launch_bounds__(256, 1) reduce_scatter_split_middim_naive( } result[i] = downcast_s(rslt_reg); } + end_sync(sg, self_sg, rank); } // reduce_scatter, scatter on middle dim — vectorized (16B / thread along k). @@ -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(result) + i) = packed_reduce(ptrs, load_index); } + end_sync(sg, self_sg, rank); } // ========== reduce_scatter kernel end ==========