Repository navigation
Conversation
Four fixes to the mori dispatch/combine path (stage1_fused/stage2_fused off), each from driving mori's plans without its op layer: - dispatch: since ROCm/mori#726 the plan takes tok_off_ext and derives selfFirst itself; self_first_enabled() is gone, so importing it fails. - tuning lookup: key it on the dispatch wire the way mori's op layer does ("fp4_disp_bf16_comb" for fp4). Under the hard-coded "bf16" key topk 9 matched no entry and both dispatch and the fp4 combine fell back to the single-shot default. - comb_inp: add the overlapped fp4 combine's u64 flag per landing row (four ranks up). Its 24-warp geometries write them past the region, i.e. past the arena: a page fault at 16384 tokens a rank. - close(): synchronize first, so a launch still in flight does not read a window that has been freed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With stage2_fused off, fused_moe's rows went into a fresh tensor and then into mori's staging rows (comb_inp): the bf16 combine copied them in its own kernel, the fp4 one through a host-issued copy whenever the recv bound was below max_recv -- every decode step under ATOM. Have fused_moe write them there directly. fused_moe(output=) already existed but the gfx1250 grouped path ignored it and copied at the end; thread it down to the gather-reduce. mori's bf16 combine then sees its input at the staging base and skips the copy, and the fp4 send reads the staging rows in place. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
amd-ruitang3
force-pushed
the
yanbo/mega
branch
2 times, most recently
from
October 20, 2026 03:15
8b70816 to
d264026
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes and one optimization for MegaMoE's mori path (
stage1_fused/stage2_fusedoff), found running DSR1 (EP4, topk 9 with the fused shared expert) against mori main.Fixes (each from driving mori's plans without its op layer):
self_firstwithtok_off_ext, andself_first_enabled()is gone, so building the dispatch fails with anImportError. Passtok_off_extwhen mori takes it; older mori keeps its current path."bf16"whatever the wire. mori keys an fp4 dispatch as"fp4_disp_bf16_comb"(its op layer'sdtype_str), so topk 9 matched nothing and dispatch and the fp4 combine both fell back to the single-shot default. The key now lives on_DispatchWire.Zero-copy: with
stage2_fusedoff, fused_moe's rows went to a fresh tensor and were then copied into mori's staging (inside the bf16 combine kernel, or by a host-issued copy for fp4 whenever the recv bound is belowmax_recv, i.e. every decode step under ATOM). fused_moe now writes them there directly:fused_moe(output=)is threaded down the gfx1250 grouped path to the gather-reduce, which it previously ignored.Test
4x gfx1250, mori main (066fd10e), DSR1 shape (
-e 256 -k 8 --fused_shared_experts 1):bench_mega_moe.py, all-mori mode, tokens/rank 512/1536/4096, bf16 and mxfp4 combine: accuracy PASS; bf16 combine kernel faster with the copy gonebench_mega_moe.py, all three modes at 1536 / mxfp4: PASS (fused paths unchanged)🤖 Generated with Claude Code