Merged
feat(opbase): 补齐 AddConfigByArch 架构与 SoC 映射并同步双语文档 #1115
esok11Add on 13 days ago
feat(opbase): 补齐 AddConfigByArch 架构与 SoC 映射并同步双语文档 #1115
Merged
esok11Add on 13 days ago
esok11Collaborators
13 days ago

描述

opbase::ArchConfigHelper::AddConfigByArch 通过 src/op_common/op_host/util/op_arch_helper.cpp 中的 g_archToSocNames 映射表,把一次 NpuArch 注册展开为该架构下的所有 socVersion。改动前映射表只覆盖 DAV_1001、DAV_2002、DAV_2201、DAV_3002、DAV_3102、DAV_3510、DAV_5162 七条,调用其它架构时 find 不到映射会直接 return,不注册任何 socVersion(与文档“约束说明”中“入参 arch 不在映射表内时,不注册任何 SoC 版本”一致)。同时中英文文档中的映射表与代码不同步:DAV_3510 只写了 ascend950(漏 ascend350),也未列出 DAV_5162。本 PR 补齐缺失架构映射并同步双语文档。

改动方法

  • src/op_common/op_host/util/op_arch_helper.cpp:g_archToSocNames 新增 7 条映射,按 NpuArch 数值升序插入:
    • DAV_3003 → kirinx90
    • DAV_3004 → ascend031
    • DAV_3113 → kirin9030
    • DAV_3505 → ascend035
    • DAV_5102 → mc62、ascend630
    • DAV_9201 → ascend960dt
    • DAV_9202 → ascend960pr
      映射表由 7 条增至 14 条;使用的 DAV_* 常量均已在 include/op_common/op_host/util/op_const_def.h 中定义,未新增常量。
  • docs/zh/api/op_common/op_host/AddConfigByArch.md、docs/en/api/op_common/op_host/AddConfigByArch.md:映射表同步补充上述条目,并修正 DAV_3510 为 ascend950、ascend350,补上 DAV_5162 → ascend5162;中英文条目保持一致(中文用顿号、英文用逗号分隔)。
  • 未改动:接口签名与 include/op_common/op_host/util/op_arch_helper.h、文档中的函数原型/参数/返回值/约束/调用示例均不变;映射表仍是 .cpp 内匿名 namespace 的静态表,无对外接口变化。

关联的Issue

测试

本 PR 为静态映射表数据补齐 + 文档同步,未改变 AddConfigByArch 的控制流(仍是查表命中则逐项 AddConfig、未命中则直接返回),仓库内也没有 op_arch_helper 的既有 UT,因此未新增用例。建议验证:

  • 对新增架构调用 ArchConfigHelper::AddConfigByArch(this->AICore(), Ops::Base::DAV_5102, cfg),确认 OpDef 中同时注册 mc62 与 ascend630;对 DAV_3003、DAV_3004、DAV_3113、DAV_3505、DAV_9201、DAV_9202 分别确认注册到对应 socVersion;
  • 对不在表内的 arch 调用,确认行为保持为不注册任何 socVersion;
  • 校验中英文文档映射表与 g_archToSocNames 逐条一致。

文档更新

  • 更新 docs/zh/api/op_common/op_host/AddConfigByArch.md:NpuArch→SoC 映射表由 6 行补齐为 14 行。
  • 更新 docs/en/api/op_common/op_host/AddConfigByArch.md:同上,与中文版对齐。

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for esok11's contribution.)
Eesok11Collaborators
13 days ago Created pull request, commit a6907355
atomgit-bot
atomgit-bot
13 days ago Comments:

变更摘要

本 PR 主要扩充了 src/op_common/op_host/util/op_arch_helper.cpp 中的 NPU 架构到 SoC 名称的映射表 g_archToSocNames,为多个新增的 NpuArch 枚举值补充对应的芯片型号,使算子公共层能够识别这些新平台标识。

主要改动

  • 新增麒麟系列平台映射: 在映射表中加入 DAV_3003 → kirinx90 与 DAV_3113 → kirin9030 两项,使麒麟芯片架构可被 g_archToSocNames 查询到。
  • 新增 031/035 平台映射: 加入 DAV_3004 → ascend031 与 DAV_3505 → ascend035,扩展对这两款 SoC 名称的架构识别能力。
  • 新增 630 及 960 系列平台映射: 加入 DAV_5102 → mc62/ascend630(一个架构对应多个 SoC 名称),以及 DAV_9201 → ascend960dt、DAV_9202 → ascend960pr。
  • 保持原有映射结构不变: 新增条目沿用原有 std::map<NpuArch, std::vector<std::string>> 的「架构 → SoC 名称列表」形式,未改变表的数据结构与查询方式。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
13 days ago Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
13 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
13 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
repo-cann/opbase ✅ 宋恺, 汤平川 (2/2) ✅ 宋恺, 汤平川 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
13 days ago Set pengjiahao96,zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng as approver
CANN-robotCANN-robotCollaborators
13 days ago Set pengjiahao96,zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng as approver
Eesok11Collaborators
13 days ago Change title to "feat(opbase): 补齐 AddConfigByArch 架构与 SoC 映射并同步双语文档", originally titled "npuarch".
Eesok11Collaborators
13 days ago Modify description of pull request
esok11Collaborators
13 days ago Comments:

/compile

likedislike
Eesok11Collaborators
13 days ago Pre merge succeeded (commit_id: 6634943906d3cbc5d89a26fd756d5091e3db79d8)
CANN-robot
CANN-robotCollaborators
13 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
13 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
13 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
13 days ago Added label: ci-pipeline-passed
songkai111Collaborators
13 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
13 days ago Added label: approved
TangPC
TangPCCollaborators
13 days ago Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
13 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
13 days ago Closed associated issue
CANN-robotCANN-robotCollaborators
13 days ago Merged pull request