Merged
【A2A3A5】【fused_infer_attention_score】修复MLA decode 非量化场景支持headNum1-128值任意泛化 #11069
tangkaidiAdd on Sep 1
【A2A3A5】【fused_infer_attention_score】修复MLA decode 非量化场景支持headNum1-128值任意泛化 #11069
Merged
Merged fromDeleted :mla-headnumintocann/ops-transformermaster
Pull Request has been successfully merged by CANN-robot.
(Thank you for tangkaidi's contribution.)atomgit-bot
Sep 1 Comments:
Sep 1 Comments:
变更摘要
本 PR 修复 fused_infer_attention_score 中 MLA decode 非量化场景下 headNum(即 N1)对 1–128 任意值泛化支持不完整的问题。核心改动是将原先仅针对 arch35(DAV_3510)非量化场景的 N1/G 轴取值范围 [1, 128] 校验,扩展为对所有非量化(enableNonQuant_)场景生效,从而让任意架构的非量化 MLA decode 都能支持 headNum 1–128 的任意取值。
主要改动
- 扩展
CommonChecker::CheckAxis的 G 轴范围校验范围:将CheckAxis中 G 轴[1, 128]的校验条件由isArch35NonQuant改为isNonQuant,使非量化 MLA decode 场景的 G 轴支持范围不再局限于 arch35,任意架构均支持 1–128 任意值。 - 保留 arch35 专属限制:
num_heads非 2 的幂次方时sparse_mode 0带自定义 mask 不支持的判断,仍仅对isArch35NonQuant(arch35 非量化)生效,其他非量化场景不受此限制约束。 - 扩展
CommonChecker::CheckHeadNum的 headNum 范围校验:将CheckHeadNum中num_heads的[1, 128]校验条件由isArch35NonQuant改为isNonQuant,统一所有非量化场景的headNum1–128 泛化支持。 - 同步更新
RopeChecker::CheckNSize校验逻辑:将rope_checker.cpp中CheckNSize的N1取值[1, 128]校验由 arch35 非量化扩展为全部非量化场景,并更新注释说明非量化支持N1:[1,128]、全量化仅支持1/2/4/8/16/32/64/128。


Incorrect?
Sep 1 Added label: cann-cla/yes
CANN-robot
Sep 1 Comments:
Sep 1 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 |
|---|---|---|
| attention | ✅ L_Euler, 黄俊健 (2/2) | ✅ L_Euler, 黄俊健 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
tangkaidi, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Sep 1 Set guijianwei,hz36amy_00,coder_linx,juyangokok,monologue815,xuanyuandy,crystalhu,yu-xinjie62,huangwei791,jiang-lirui,yang-binrong,Allan_Yu,liudan12,shasha_an,wangzhe123456789,luwei_1104,cc-z,shen_weiling,gaoxiang618,songjionghui,wenxin_fight,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,yuhao_,L_Euler,wangxun21 as approver
Sep 1 Set guijianwei,hz36amy_00,coder_linx,juyangokok,monologue815,xuanyuandy,crystalhu,yu-xinjie62,huangwei791,jiang-lirui,yang-binrong,Allan_Yu,liudan12,shasha_an,wangzhe123456789,luwei_1104,cc-z,shen_weiling,gaoxiang618,songjionghui,wenxin_fight,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,yuhao_,L_Euler,wangxun21 as approver
Sep 1 Set guijianwei,hz36amy_00,coder_linx,juyangokok,monologue815,xuanyuandy,crystalhu,yu-xinjie62,huangwei791,jiang-lirui,yang-binrong,Allan_Yu,liudan12,shasha_an,wangzhe123456789,luwei_1104,cc-z,shen_weiling,gaoxiang618,songjionghui,wenxin_fight,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,yuhao_,L_Euler,wangxun21 as approver
Sep 1 Set guijianwei,hz36amy_00,coder_linx,juyangokok,monologue815,xuanyuandy,crystalhu,yu-xinjie62,huangwei791,jiang-lirui,yang-binrong,Allan_Yu,liudan12,shasha_an,wangzhe123456789,luwei_1104,cc-z,shen_weiling,gaoxiang618,songjionghui,wenxin_fight,miaofangzheng,mabing1118,tang-hao-hw-gitcode,haijie_699874,zzy__,yuhao_,L_Euler,wangxun21 as approver
tangkaidi
Sep 1 Comments:
Sep 1 Comments:
compile


Sep 1 Pre merge succeeded (commit_id: b72906f1536d3822a605453be481787964c6bcda)
Sep 1 Added label: ci-pipeline-running
Sep 1 Associated issue: [Requirement|需求建议]: 修复A2A3 fused_infer_attention_score算子MLA模板支持headNum 1-128任意值的泛化
Sep 1 Associated issue: [Requirement|需求建议]: 修复A2A3 fused_infer_attention_score算子MLA模板支持headNum 1-128任意值的泛化
Sep 1 Modify description of pull request
Sep 1 Removed label: ci-pipeline-running
Sep 1 Added label: ci-pipeline-passed
monologue815
Sep 1 Comments:
Sep 1 Comments:
/lgtm
/approve


Sep 1 Added label: approved
Han-Xiaobin
Sep 1 Comments:
Sep 1 Comments:
/lgtm
/approve


Sep 1 Added label: lgtm
Sep 1 Closed associated issue
Sep 1 Merged pull request
描述
修复MLA decode 非量化场景支持headNum1-128值任意泛化。
关联的Issue
[Requirement|需求建议]: 修复A2A3 fused_infer_attention_score算子MLA模板支持headNum 1-128任意值的泛化 #4869
测试
文档更新
类型标签