Move __syncthread and fence into barrier.

This commit is contained in:
Shangyan Zhou
2025-06-26 10:03:37 +08:00
parent f1d7a7c89f
commit 3071a2cd37
3 changed files with 9 additions and 19 deletions

View File

@@ -438,11 +438,14 @@ __forceinline__ __device__ out_dtype_t extract_required_scale_format(float value
}
}
template <int kNumRanks>
template <int kNumRanks, bool fence=true>
__forceinline__ __device__ void
barrier_block(int** barrier_signal_ptrs, int rank) {
auto thread_id = static_cast<int>(threadIdx.x);
if (fence)
memory_fence();
// Add self-ranks, sub other ranks
if (thread_id < kNumRanks) {
atomicAdd_system(barrier_signal_ptrs[rank] + thread_id, FINISHED_SUM_TAG);