Merged
DV121 DV122适配:ops-math 部分算子新增ascend960dt/960pr平台支持 #7033
DV121 DV122适配:ops-math 部分算子新增ascend960dt/960pr平台支持 #7033
Merged
huairuchenAdd on 15 days ago
huairuchen
huairuchenCollaborators
15 days ago

描述

DV122迭代:为下列算子新增 ascend960dt/ascend960pr 平台支持(四部分:CMakeLists / op def AddConfig / op_host config 目录 / binary 配置),并将涉及芯片的运行时与编译期判断放行 DAV_9201/DAV_9202:

四部分补充

  • CdistGrad、DropOutV3Grad、UnfoldGrad、TransformBiasRescaleQkv、AmpUpdateScale:补 ascend960dt/ascend960pr(config 目录照抄 ascend950 形态)
  • ChunkCat:补 ascend960pr(此前仅 960dt,本批补齐 pr 侧)
  • StatelessExponential:补 ascend960pr simplified_key.ini(def/CMake 注册部分已随 !6663 合入,不再重复携带)

芯片判断放行 DAV_9201/9202

  • ChunkCat:isAscend960dt_ 补 DAV_9202;kernel 编译宏 NPU_ARCH==9201 / CCE_AICORE==310||9201 补 9202
  • DropOutV3Grad:op_api 门禁放行 DAV_9201/9202
  • CdistGrad:SocVersion 判断改为 NpuArch(DAV_2201,行为等价)
  • UnfoldGrad:op_api isArch35 判断补 DAV_9201/9202
  • dsa_random_uniform/aclnn_uniform:3510 单判断改 IsRegBase
  • StatelessSampleMultinomial:IsArch35 补注释说明(DAV_9202 判断已随 !6663 合入,不再重复携带)

Polar 全套适配及 drop_out_v3 / truncated_normal_v2 / random_uniform_v2 三个 fusion pass 的 supportedArch 扩展,与 master 已合入内容(b58f9e3cf 及已有提交)完全重复,rebase 至最新 master 后不再携带。

写法与已合入的 DV121/DV122 适配(!6151/!6401/!6651/!6663 及 RandomStandardNormalV1 融合规则 !6608)保持一致,不涉及 UB/切分逻辑改动。

关联的Issue

https://gitcode.com/cann/ops-math/issues/4838

测试

泛化黄区ttk

文档更新

  • 不涉及

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for huairuchen's contribution.)
huairuchenhuairuchenCollaborators
15 days ago Created pull request, commit 9b7875cf
atomgit-bot
atomgit-bot
15 days ago Comments:

变更摘要

本 PR 为 ops-math 的 7 个算子(Polar、CdistGrad、StatelessExponential、StatelessSampleMultinomial、ChunkCat、DropOutV3Grad、UnfoldGrad)补充 ascend960dt/ascend960pr 平台支持,涉及算子定义中的 AddConfig 平台注册、op_host/config 下的 binary 配置与 simplified_key.ini,并把芯片架构判断统一放行 DAV_9201/DAV_9202,使 960 系列复用 Ascend950 的 arch35 实现路径,同时把部分 SocVersion/单值 NpuArch 判断替换为等价的范围判断。

主要改动

  • 平台注册扩展(算子定义): ChunkCat、StatelessExponential、StatelessSampleMultinomial 在 *_def.cpp 中新增 AddConfig("ascend960pr"),CdistGrad、Polar、DropOutV3Grad 则同时新增 ascend960dt 与 ascend960pr,复用既有 aicoreConfig。
  • 二进制造型与编译配置新增: 为 CdistGrad、ChunkCat、DropOutV3Grad 新增 ascend960dt/ascend960pr 目录下的 *_binary.json(描述 dtype/format/attr 组合,如 CdistGrad 的 fp16/bf16/fp32、DropOutV3Grad 的 uint8/uint1 mask 组合)与 *_simplified_key.ini(default=0),StatelessExponential 补充 ascend960pr 的 simplified_key.ini。
  • Kernel 编译宏与 tiling 判断放行 960: chunk_cat.cpp、chunk_cat_arch35.h、chunk_cat_common.h 中 __NPU_ARCH__ == 9201 条件统一扩展为 || __NPU_ARCH__ == 9202,ChunkCatTiling::GetPlatformInfo 的 isAscend960dt_ 同时匹配 DAV_9201/DAV_9202。
  • 接口门禁与 arch35 判定放宽: aclnnDropoutV3Grad 的 CheckSocVersion 由仅 DAV_3510 扩展为 DAV_3510/DAV_9201/DAV_9202;stateless_sample_multinomial 的 IsArch35、unfold_grad 的 isArch35、dsa_random_uniform 的 uniformDavidPath/uniformTensorDavidPath 改用含 9201/9202 的 arch 判断或 IsRegBase。
  • 判断方式统一与融合规则扩展: CdistGrad 的 BF16 转 FP32 条件由 SocVersion::ASCEND910B/ASCEND910_93 改为等价的 NpuArch::DAV_2201;drop_out_v3、random_uniform_v2、truncated_normal_v2 三个 fusion pass 的 supportedArch 集合新增 DAV_9201、DAV_9202。

🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
atomgit-bot
atomgit-bot
15 days ago Comments:

代码审查

审查结论

  • [建议] math/polar/CMakeLists.txt:11 fix: polar 新增 960dt/960pr 平台但缺少对应 binary 配置目录
类型 数量
🔴 阻塞 0
🟡 建议 1

💬 仅评论


🧩 本次 Review 已使用自定义 Skill:

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
15 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
15 days ago 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 ✅ 汤磊, xuejinghui, 宋恺 (3/2) ✅ 汤磊 (1/1)
conversion/unfold_grad ✅ xuejinghui, 宋恺 (2/2) ✅ xuejinghui (1/1)
math/transform_bias_rescale_qkv ✅ xuejinghui, 宋恺 (2/2) ✅ xuejinghui (1/1)
repo-cann/ops-math ✅ xuejinghui, 宋恺 (2/2) ✅ xuejinghui (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

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

likedislike
78 messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
19 hours ago Added label: lgtm
CANN-robot
CANN-robotCollaborators
19 hours ago Comments:

The MR can not be merged, because of CodeReview discussion not resolved

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike
huairuchenhuairuchenCollaborators
19 hours ago Resolved final issue
CANN-robotCANN-robotCollaborators
19 hours ago Closed associated issue
CANN-robotCANN-robotCollaborators
19 hours ago Merged pull request