four-rank ar_gather_hc_write: the MoE gather in front of the exact one-shot write

At --tp 4 each MoE connection ran moe_gather and the fused write as two
launches, three or four with the inverse table. ar_gather_hc_write_4rank
runs r4d_ar_gather_word as the prologue of ar_hc_write_4rank, with the
two-rank slot table and grid rule. The arithmetic is moe_gather's plus
ar_hc_write_4rank's, so the bytes are unchanged. One and two ranks unchanged.
This commit is contained in:
keptn42 authored and StillDeadcode committed 2026-10-05 12:52:54 +02:00
1 parent c36e6fa2b3
commit 2f56e3c477
12 files changed
+415 -36

No files matched your search

+9
View File
@@ -474,6 +474,15 @@ int r4d_ar_gather_hc_write(long peer_scratch, long my_scratch, long peer_flags,
return (int)hipGetLastError();
}
/* The inverse slot table alone, on `stream`, for the wide fused gather (r4d_ar_oneshot_Nrank_exact.hip):
* the same kernel and the same launch as above, so both widths read one table. */
int r4d_ar_gather_inv(long inv, long sorted, long T, long stream_i) {
if (!inv || !sorted || T < 1) return -1;
r4d_ar_gather_inv_kernel<<<1, 1024, 0, (hipStream_t)stream_i>>>((int*)inv, (const int*)sorted,
(int)T);
return (int)hipGetLastError();
}
void r4d_ar_ipc_free(long p) { if (p) (void)hipFree((void*)p); }
void r4d_ar_ipc_memzero(long p, long size) { if (p) HIPOK(hipMemset((void*)p, 0, size)); }