已合并
megamoe优化,改成主E模式 #1466
zy_tt创建于 17 天前
megamoe优化,改成主E模式 #1466
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 zy_tt 的贡献)17 天前 添加了label:cann-cla/yes
CANN-robot
17 天前 评论:
17 天前 评论:
CANN-robot
17 天前 评论:
17 天前 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| docs | ✅ echo_stone, HuangXingYuan_777 (2/2) | ✅ echo_stone (1/1) |
| repo-cann/pto-isa | ✅ echo_stone, HuangXingYuan_777 (2/2) | ✅ echo_stone (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
zy_tt, thanks for your pull request. All authors of the commits have signed the CLA. 👍


17 天前 将zhangjian_hz11,csjlchen,bluesky901,changxianyu,Zhanghaijian,syfeng,yinjie27_,zhoubotcam,HuangXingYuan_777,linjiashu,WenboCodes,qukelin,ChanKaLok,kerwinair,echo_stone设为评审人
17 天前 将zhangjian_hz11,csjlchen,bluesky901,changxianyu,Zhanghaijian,syfeng,yinjie27_,zhoubotcam,HuangXingYuan_777,linjiashu,WenboCodes,qukelin,ChanKaLok,kerwinair,echo_stone设为评审人
此处折叠了87条消息 查看更多
16 天前 添加了label:approved
代码行星
16 天前 评论:
16 天前 评论:
/lgtm


16 天前 添加了label:lgtm
16 天前 合入了pull request
描述
本 PR 将 A3 MegaMoE 从阶段主序的 expert 间 overlap,改为 Expert 主序的阶段间 overlap,对 AIC/AIV 做固定分组 + 动态扩缩组,减少 AIV 搬运对 AIC 计算的带宽抢占。
原因: 基线 overlap 下 AIC 已接近满载,但 Dispatch/Combine 的 AIV 搬运仍与 GMM 争用 HBM;Unpermute 还要等全部 rank Combine 结束,尾部流水被拉长。大 M(512+)空间更大。
方法:
AIC 分组动态调度
物理核 0..15(16 个 AIC)做 GMM1,16..23(8 个 AIC)做 GMM2。前
fullAicGmm1ExpertCount=2个 expert 用满 24 个 AIC 打 GMM1;之后 GMM1 缩到 16 核。GMM1 结束后,16 个 AIC 并入 GMM2,尾部 expert 由 24 核一起算。合组时刻由 GMM1 实际结束时间决定,不是写死最后几个 expert。AIV 分组与延后 Combine
核 0..15 的 AIV0 做 Dispatch、AIV1 做 SwiGLU;核 16..23 的 AIV0 做 Combine(8 核)。Combine 数据量约为 Dispatch 的 2 倍,用
combineStartAfterGmm2Expert按 shape 延后启动(M=16/128 等 3,M=1024/2048 等 2,M=32/64/512 不等待),避免和 Dispatch 抢同一段带宽。Unpermute 两阶段启动
各 source rank Combine 达到
unpermutePhase1ReadyExpertCount后,前 32 个 AIV 先处理已就绪数据;本卡 Combine 完成后,再加入 16 个 AIV,48 核处理剩余部分。不再整体等待所有 rank Combine 结束。阶段同步
组内用单向 software doorbell(arrival → coordinator 取共同进度 → ready)。
epoch按 expert 单调递增,支持 GMM124→16、GMM28→24扩缩组。跨 rank 同样只等自己需要的 DataReady,不做全 rank barrier。目标 shape:
K=7168、N=4096、topK=8、expertPerRank=16,EP8/EP16。测试
在 A3 上对 canonical shape 做了 EP8 / EP16、M=16~2048 的精度 + 性能对比(相对基线 overview.md 版本)。
A3 EP8
小 case 略有收益,大 case 约 10%~12%。
A3 EP16
小 case 基本持平或略优,大 case 约 11%~15%。
文档更新
kernels/manual/a2a3/dispatch_mega_combine/overview_v1.md:V1 overlap 原则、AIC/AIV 分组、expert 流水、tiling 参数表、同步模型及 EP8/EP16 性能对比docs/figures/megamoe/v1_2048_overlap_pipeline.png(对比基线2048_16rank_overlap_pipeline.png)类型标签