Merged
feat(moe_ep_combine): 拆分combine为moe_ep_combine和moe_ep_combine_epilogue #10249
jvjvzhilianAdd on Aug 18
feat(moe_ep_combine): 拆分combine为moe_ep_combine和moe_ep_combine_epilogue #10249
Merged
Pull Request has been successfully merged by CANN-robot.
(Thank you for jvjvzhilian's contribution.)Aug 18 Created pull request, commit a555ce4d
atomgit-bot
Aug 18 Comments:
Aug 18 Comments:
变更摘要
本 PR 将原有 moe_ep_combine 算子拆分为两个独立的算子:moe_ep_combine 仅负责发送阶段(将本卡专家输出 token 发送到远端 rank 的 HCCL Window 缓冲区),新算子 moe_ep_combine_epilogue 负责收包与规约阶段(从 Window 读取专家输出、按 token 累加 topK 结果并写出 combined_x / combined_topk_weights)。拆分后算子边界更清晰,发送与收包规约可分别编译与调度。
主要改动
- 算子接口拆分:
MoeEpCombineGetWorkspaceSize/aclnnMoeEpCombineGetWorkspaceSize移除combinedX、combinedTopkWeights输出参数,同时moe_ep_combine_def.cpp删除combined_x与combined_topk_weights输出定义,改为仅由新算子MoeEpCombineEpilogue(含context、topk_idx输入及combined_x、combined_topk_weights输出)承接收包规约。 - 新增
moe_ep_combine_epilogue算子全套实现:新增aclnn_moe_ep_combine_epilogue.cpp(aclnnMoeEpCombineEpilogue、aclnnMoeEpCombineEpilogueGetWorkspaceSize)、moe_ep_combine_epilogue_def.cpp、moe_ep_combine_epilogue_tiling.cpp(含 Window 布局计算与参数/形状/数据类型校验)、moe_ep_combine_epilogue.cpp/.h内核(MoeEpCombineEpilogue类,实现SplitToCore、WaitDispatch、ProcessTopKToken、RecvPhaseReduce等收包规约逻辑)及对应tiling.h、tiling_key.h。 - 内核职责裁剪:
moe_ep_combine.h移除RecvPhaseReduce、WaitDispatch、ProcessTopKToken、BuffInit、MaskAlign、MaskCheck等收包阶段实现及相关成员变量/缓冲区,保留发送逻辑SendPhaseExpertToToken/SendSlot/SendLocalToken,并将双缓冲常量更名为SEND_DOUBLE_BUFFER_NUM,Process()仅执行发送阶段。 - 框架/前端适配:
elastic_buffer.cpp中MoeEpCombine返回值改为void(不再在 C++ 侧分配输出张量),新增MoeEpCombineEpilogue返回CombineEpilogueTensorList并在 pybind11 注册moe_ep_combine_epilogue;elastic_buffer.py在 Python 侧先分配combined_x/combined_topk_weights,再依次调用moe_ep_combine与moe_ep_combine_epilogue完成两阶段流程。 - 规则/路径更新:
classify_rule.yaml将fused_infer_attention_score的 kernel 路径从arch22/arch35子目录改为平铺路径,并新增moe_ep_combine_epilogue的op_host、op_api、op_kernel与CMakeLists.txt归集规则。


Incorrect?
Aug 18 Added label: cann-cla/yes
CANN-robot
Aug 18 Comments:
Aug 18 Comments:
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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| */*/op_host/*_def.cpp | ✅ 王永光, 俞郑中, 刘丹 (3/2) | ✅ 王永光 (1/1) |
| classify_rule.yaml | ✅ 刘丹, 俞郑中 (2/2) | ✅ 刘丹, 俞郑中 (2/1) |
| mc2 | ✅ tgwsakiko_, 俞郑中, chenjunjian11, 刘丹 (4/2) | ✅ 俞郑中, chenjunjian11, 刘丹 (3/1) |
| sig-ops-transformer | ✅ 俞郑中, 刘丹 (2/2) | ✅ 俞郑中, 刘丹 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
l00858142, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Aug 18 Set captainmiaow,monologue815,jiang-lirui,Allan_Yu,wang-minbo,tgwsakiko_,tang-lei01,xtqh,liudan12,chenjunjian11,yangzeheng,liuboxi,luobaiqing,libohao6,mabing1118,wangyongguang,macech as approver
Aug 18 Set captainmiaow,monologue815,jiang-lirui,Allan_Yu,wang-minbo,tgwsakiko_,tang-lei01,xtqh,liudan12,chenjunjian11,yangzeheng,liuboxi,luobaiqing,libohao6,mabing1118,wangyongguang,macech as approver
136 messages are collapsed here。 See more
Aug 24 Added label: lgtm
wangyongguang
Aug 24 Comments:
Aug 24 Comments:
/approve


Aug 24 Added label: approved
Aug 24 Closed associated issue
Aug 24 Merged pull request
描述
moe_ep_combine(发送阶段):
moe_ep_combine_epilogue(接收+归约阶段,新增):
elastic_buffer.cpp:
elastic_buffer.py:
关联的Issue
测试
文档更新
类型标签