Skip to content

Commit 7e924a8

Browse files
foreverrookiecodex
andcommitted
Fix BF16 MegaMoE readiness on CUDA graph replay
Reset peer-ready flags before the existing pull barrier, matching the FP8/FP4 path and preventing stale completion tags on graph replay. Co-authored-by: OpenAI Codex <[email protected]> Signed-off-by: foreverrookie <[email protected]>
1 parent d7442af commit 7e924a8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎deep_gemm/include/deep_gemm/impls/sm100_bf16_mega_moe.cuh‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,13 @@ sm100_bf16_mega_moe_impl(void* y,
346346

347347
// Write expert count
348348
if (sm_idx == 0) {
349-
// Push this launch's grid index to every peer for tagging combine readiness; +1 differs from a zeroed workspace
349+
// CUDA graph replay can reuse grid IDs. Clear local readiness before the pull barrier,
350+
// which separates these resets from every peer's current L2 completion notification.
350351
DG_STATIC_ASSERT(kNumRanks <= kNumDispatchThreads, "Insufficient threads for the grid index push");
351-
if (thread_idx < kNumRanks)
352+
if (thread_idx < kNumRanks) {
353+
ptx::st_rel_sys(workspace.get_combine_ready_grid_idx_ptr(thread_idx), uint64_t(0));
352354
*sym_buffer.map(workspace.get_peer_grid_idx_ptr(sym_buffer.rank_idx), thread_idx) = ptx::get_grid_idx() + 1;
355+
}
353356
__syncwarp();
354357

355358
#pragma unroll

0 commit comments

Comments
 (0)