Pull Request已成功合入, 合并人@CANN-robot
(感谢 hahaha22 的贡献)变更摘要
本 PR 针对 sub、mul、pow 等 16 个算子(共 20 处判断)在 math 目录的 aclnn 接口实现中,为 GetSocVersion() >= ASCEND910B && GetSocVersion() <= ASCEND910E 的 SoC 版本区间判断统一追加 || IsRegBase() 条件,使 ascend350(RegBase/DAV_3510)平台在数据类型支持列表、bf16 支持校验及 AiCore 执行路径等判断上走 910B 支持分支;同时为 sub.cpp、aclnn_pow_tensor_tensor.cpp、aclnn_logical_xor.cpp、aclnn_equal.cpp 补充 #include "op_api/aclnn_check.h" 以引入 IsRegBase() 声明。experimental 目录与 tests 不在本次修改范围。
主要改动
- SoC 区间判断追加
IsRegBase(): 在math/less(aclnn_lt_scalar.cpp、aclnn_lt_tensor.cpp)、math/less_equal、math/mul、math/pow、math/sub、math/minimum、math/maximum、math/signbit、math/not_equal、math/logical_or、math/tensor_equal等文件中,将GetSocVersion()位于ASCEND910B~ASCEND910E区间的判断改为(区间判断) || IsRegBase(),使 ascend350/RegBase 平台命中 910B 支持分支。 - 数据类型支持列表判断调整:
GetDtypeSupportList、GetInputDtypeSupportList、GetOutputDtypeSupportList等函数中,RegBase 平台将返回ASCEND910B_DTYPE_SUPPORT_LIST、ASCEND910B_OUT_DTYPE_SUPPORT_LIST、REGBASE_OUT_DTYPE_SUPPORT_LIST等 910B 支持列表,而非 910 列表。 - bf16 支持与 AiCore 路径判断同步适配:
CheckSocVersionIsSupportBf16、CheckSocVersionGe910B、IsAiCoreSupport(pow 与 sub)等函数追加IsRegBase()条件,确保 RegBase 平台通过 bf16 校验并走 910B 的 AiCore/AICPU 执行路径。 - 补充头文件引入
IsRegBase():math/sub/op_api/sub.cpp、math/pow/op_api/aclnn_pow_tensor_tensor.cpp、math/not_equal/op_api/aclnn_logical_xor.cpp、math/tensor_equal/op_api/aclnn_equal.cpp新增#include "op_api/aclnn_check.h"。


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 |
|---|---|---|
| math/add | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/div | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/equal | ✅ 宋恺, 王瑞 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
| math/floor_div | ✅ 王瑞, 宋恺 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
| math/floor_mod | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/less | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/less_equal | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/logical_or | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/maximum | ✅ 王瑞, 宋恺 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
| math/minimum | ✅ 王瑞, 宋恺 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
| math/mul | ✅ 王瑞, 宋恺 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
| math/not_equal | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/pow | ✅ 王瑞, 宋恺 (2/2) | ✅ 宋恺, 王瑞 (2/1) |
| math/sub | ✅ 宋恺, 王瑞 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| math/tanh_grad | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
| repo-cann/ops-math | ✅ 王瑞, 宋恺 (2/2) | ✅ 王瑞, 宋恺 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
hahaha22, thanks for your pull request. All authors of the commits have signed the CLA. 👍


描述
以 RegBase 架构(NpuArch = DAV_3510,含 Ascend950 及后续 Regbase 芯片)兼容为目标,统一两类芯片判断写法:
GetSocVersion() >= ASCEND910B && GetSocVersion() <= ASCEND910E区间判断追加|| IsRegBase(),使 RegBase 平台在 SocVersion 区间之外时也复用 910B 支持分支(放开 BF16 dtype 校验)case NpuArch::DAV_3510:硬编码判断改为IsRegBase()谓词,后续 Regbase 芯片(IsRegBase 集合扩展新 arch 值时)无需逐文件修改即可自动命中修改内容一:区间判断追加(13 个文件,15 处)
其中 sub.cpp、aclnn_pow_tensor_tensor.cpp、aclnn_logical_xor.cpp、aclnn_equal.cpp 补充
#include "op_api/aclnn_check.h"。pow.cpp 的 IsAiCoreSupport、aclnn_ne_scalar.cpp、aclnn_ne_tensor.cpp:区间判断前已有
if (IsRegBase())提前返回分支(追加会造成死条件),经评审不修改。修改内容二:硬编码判断统一(11 个文件,13 处)
A类:switch 双 case(DAV_3510 与 DAV_2201 同分支,8处)
switch 前置
if (IsRegBase(curArch))返回原 DAV_3510 分支列表,删除case NpuArch::DAV_3510:fall-through 行:B类:switch 独立 case(DAV_3510 单独返回 REGBASE 专用列表,3处)
switch 前置
if (IsRegBase(curArch))返回 REGBASE 列表,删除独立 case 块:关联的Issue
测试
文档更新
无
类型标签
关联issue