Merged
Add mhcPre for A2、A3 #10035
Add mhcPre for A2、A3 #10035
Merged
liuyun_njAdd on Aug 13
liuyun_nj
liuyun_njCollaborators
Aug 13

描述

Add mhcPre for A2、A3

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for liuyun_nj's contribution.)
liuyun_njliuyun_njCollaborators
Aug 13 Created pull request, commit 31afcf74
atomgit-bot
atomgit-bot
Aug 13 Comments:

变更摘要

该 PR 主要围绕 MhcPre 算子进行功能扩展与实现重构:在原有 n^2+2n 残差分支基础上新增 n!+2n 的「阶乘」残差分支,并针对非 DAV_3510 平台(如 ascend910b、ascend910_93)补充独立的形状校验与对齐规则;同时将 tiling 与 kernel 实现迁移为新的 membase 版本,移除旧 arch35 注册,新增 Stage1/Stage2 两阶段计算与按 TILING_KEY 分发的 kernel 入口。

主要改动

  • 新增阶乘残差分支及推断支持: mhc_pre_infershape.cpp 与 aclnn_mhc_pre.cpp 新增 Factorial,将 phi 首维扩展为支持 n!+2n、n^2+2n、2n 三种形态,hRes 输出形状也相应支持 [..., n!] 或 [..., n, n]。
  • 按平台拆分参数校验: aclnn_mhc_pre.cpp 中通过 GetCurNpuArch() 区分 DAV_3510 与其他平台,非 DAV_3510 平台要求 n=4、d 按 128 对齐(D_ALIGNMENT_A2),并支持阶乘形态的 phi/bias/hRes/hMixOptional 校验。
  • 接口文档与算子配置更新: aclnn_mhc_pre.h 补充 phi、bias、hRes、hMixOptional 的 n!+2n 形状说明;mhc_pre_def.cpp 为算子增加 ascend910b 与 ascend910_93 的 AICore 配置。
  • 重构 tiling 实现: 删除 arch35/mhc_pre_tiling.cpp 中原有的 TilingFunc4mHCPre 等实现,新增 mhc_pre_tiling.cpp/mhc_pre_tiling.h,引入 MhcPreMembaseTiling、MhcPreMembaseTilingData,按平台选择 arch35 或 membase 路径,并实现 CalcMKSplitCoreMembasePart2Tiling、CalcStage1Tiling 等 tiling 计算。
  • 新增 kernel 计算流程: 新增 mhc_pre.cpp 作为 kernel 入口,按 TILING_KEY_IS(0/10/11) 分发;新增 mhc_pre_base.h、mhc_pre_cube_compute.h、mhc_pre_m_split_core.h,实现 MhcPreStage1/MhcPreStage2 两阶段计算、HcCubeCompute 矩阵乘以及向量侧搬运/规约/激活等基础算子。
likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 13 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Aug 13 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 13 Comments:

CLA Signature Pass

liuyun_nj, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
283 messages are collapsed here。 See more
CANN-robot
CANN-robotCollaborators
Aug 27 Comments:

The following label is not ready.

lgtm: Please wait for reviewers to review the code.

likedislike
jiang-lirui
jiang-liruiCollaborators
Aug 27 Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Aug 27 Added label: lgtm
CANN-robotCANN-robotCollaborators
Aug 27 Closed associated issue
CANN-robotCANN-robotCollaborators
Aug 27 Merged pull request