Pull Request has been successfully merged by CANN-robot.
(Thank you for 景明's contribution.)变更摘要
本 PR 修复 A5 FullMesh dispatch 路径回读 expert_scales 时的步长换算问题。在 mc2/moe_distribute_dispatch_v2/op_kernel/arch35/moe_distribute_dispatch_v2_a5_full_mesh.h 中,MoeDistributeDispatchV2A5FullMesh::CopyInAndOut 构造 DataCopyExtParams expertScaleCopyInParams 时,srcStride 的单位应为 32B(UB_ALIGN),但此处直接填入了字节数,与同函数内 scales、token、expandIdx 三处搬移的处理方式不一致。改动将步长按 (hCommuSize_ - sizeof(float)) / UB_ALIGN 换算为 32B 块数,使 GM→UB 回读的相邻 token 间隔与实际槽位布局匹配,避免 arriveCount≥2 时越出本 expert 槽及已注册通信窗口导致的 device 侧 AI Core 异常。该修正仅涉及单行常量计算,不改变数据布局与语义,影响范围为 A5 FullMesh 且传入 expertScales 的场景。
主要改动
- 修正 expert_scales 回读步长单位:
expertScaleCopyInParams的srcStride由原始字节数hCommuSize_ - sizeof(float)改为(hCommuSize_ - sizeof(float)) / UB_ALIGN,按 32B 块数表示。 - 与同函数其余搬移的换算方式对齐: 使
expert_scales的srcStride与 scales、token、expandIdx等搬移一致采用/ UB_ALIGN,消除该分支的遗漏。 - 影响范围限定: 仅调整 A5 FullMesh +
expertScales(hasExpertScalesFlag_为真)路径的 GM→UB 回读步长常量,不改变数据布局与其他架构、量化路径。


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 |
|---|---|---|
| OAT.xml | ✅ 马兵, 蒋礼锐, wang-minbo (3/2) | ✅ 马兵, 蒋礼锐, wang-minbo (3/1) |
| */*/op_api/aclnn*.h | ✅ 马兵, 汤磊, 王永光, 蒋礼锐 (4/2) | ✅ 汤磊, 王永光 (2/1) |
| */*/op_host/*_def.cpp | ✅ 汤磊, 王永光, 马兵, kdy18482276080, 蒋礼锐 (5/2) | ✅ 汤磊, 王永光 (2/1) |
| attention | ✅ 马兵, kdy18482276080, 蒋礼锐 (3/2) | ✅ 蒋礼锐, 马兵, kdy18482276080 (3/1) |
| examples | ✅ 马兵, 蒋礼锐, wang-minbo (3/2) | ✅ wang-minbo, 马兵, 蒋礼锐 (3/1) |
| gmm | ✅ 蒋礼锐, 马兵, kdy18482276080 (3/2) | ✅ kdy18482276080, 蒋礼锐, 马兵 (3/1) |
| mc2 | ✅ 蒋礼锐, wang-minbo, 马兵 (3/2) | ✅ 蒋礼锐, wang-minbo, 马兵 (3/1) |
| mhc | ✅ kdy18482276080, 马兵, 蒋礼锐 (3/2) | ✅ kdy18482276080 (1/1) |
| moe | ✅ 马兵, kdy18482276080, 蒋礼锐 (3/2) | ✅ 马兵, kdy18482276080, 蒋礼锐 (3/1) |
| posembedding | ✅ 马兵, kdy18482276080, 蒋礼锐 (3/2) | ✅ 马兵, kdy18482276080, 蒋礼锐 (3/1) |
| scripts | ✅ 马兵, 蒋礼锐, wang-minbo (3/2) | ✅ 马兵, 蒋礼锐, wang-minbo (3/1) |
| sig-ops-transformer | ✅ 蒋礼锐, 马兵 (2/2) | ✅ 马兵, 蒋礼锐 (2/1) |
| tests | ✅ 马兵, 蒋礼锐, wang-minbo (3/2) | ✅ 马兵, 蒋礼锐, wang-minbo (3/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
gitcode_lijd, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve
/lgtm


关联Issue https://gitcode.com/cann/ops-transformer/issues/5885
描述
全仓 OAT 合规整改(
pre-commit run oat-check --all-files从 200 条问题清零):1. OAT.xml 豁免策略对齐(仅新增 6 行 filteritem,零删除):
experimental/.*:孵化目录豁免 license/copyright/binary 三类检查(含 swiglu_gated_mlp 等第三方 Apache-2.0 双版权贡献代码,策略上不归管)*.jpg:文档图片豁免二进制拦截(与已有*.png一致)LICENSE:许可证正文本身,豁免许可证头检查Third_Party_Open_Source_Software_Notice:第三方声明文件,豁免版权头检查2. 文件头修复(167 个源文件):
redistribute it and/or modify.句式,2026-03 入库、04-03 OAT 上线前时间差遗留)→ 标准 CANN V2 头Copyend (c)、You can not use、in in compliance、free software;分号、CANN 1.0 许可证等3. 历史遗留原因:存量问题多经网页端合并(不触发本地钩子)或 OAT 上线前入库积累。
验证
pre-commit run oat-check --all-files:9 个批次全部 0 issue,Passedgit pc HEAD~1+ 显式pre-commit run --files复核收敛,第 2 笔为 clang-format/ruff/end-of-files 自动修复基线 master:d9d81a50a