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
tangkaidiAdd on Sep 1
Merged fromDeleted :mla-headnumintocann/ops-transformermaster
tangkaidi
tangkaidiCollaborators
Sep 1

描述

修复MLA decode 非量化场景支持headNum1-128值任意泛化。

关联的Issue

[Requirement|需求建议]: 修复A2A3 fused_infer_attention_score算子MLA模板支持headNum 1-128任意值的泛化 #4869

测试

文档更新

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for tangkaidi's contribution.)
tangkaiditangkaidiCollaborators
Sep 1 Created pull request, commit b6101ba3
atomgit-bot
atomgit-bot
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,统一所有非量化场景的 headNum 1–128 泛化支持。
  • 同步更新 RopeChecker::CheckNSize 校验逻辑:将 rope_checker.cpp 中 CheckNSize 的 N1 取值 [1, 128] 校验由 arch35 非量化扩展为全部非量化场景,并更新注释说明非量化支持 N1:[1,128]、全量化仅支持 1/2/4/8/16/32/64/128。
likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 1 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
CANN-robotCANN-robotCollaborators
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
CANN-robotCANN-robotCollaborators
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
tangkaidiCollaborators
Sep 1 Comments:

compile

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

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 1 Added label: approved
Han-Xiaobin
Han-XiaobinCollaborators
Sep 1 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 1 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 1 Closed associated issue
CANN-robotCANN-robotCollaborators
Sep 1 Merged pull request