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
6 changes: 6 additions & 0 deletions csrc/include/custom_all_reduce.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -5130,6 +5130,12 @@ template <typename T>
void dispatchAllGather(
hipStream_t stream, T* input, T* output, int size, int last_dim_size, int gather_dim)
{
// Idle DP-attention groups can have empty shards. There is no payload to exchange,
// and launching zero blocks would leave an error for the next operator to report.
if(size == 0)
{
return;
}
RankData* ptrs = get_buffer_RD(stream, input);
auto d = 16 / sizeof(T);
dim3 block(512);
Expand Down
7 changes: 5 additions & 2 deletions csrc/kernels/custom_all_reduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,11 @@ void all_gather_unreg(fptr_t _fa,

if(data_bytes > reg_bytes)
throw std::runtime_error("registered buffer is too small to contain the input");
HIP_CALL(hipMemcpyAsync((void*)reg_buffer, inp.data_ptr(), data_bytes,
hipMemcpyDeviceToDevice, stream));
if(data_bytes != 0)
{
HIP_CALL(hipMemcpyAsync(
(void*)reg_buffer, inp.data_ptr(), data_bytes, hipMemcpyDeviceToDevice, stream));
}
_all_gather(_fa, (void*)reg_buffer, out.data_ptr(), inp.numel(), inp.dtype(),
last_dim_size, dim);
}
Expand Down
Loading