已合并
update aicpu op tile register func to v2. #2844
liu-wei创建于 5月20日
update aicpu op tile register func to v2. #2844
已合并
liu-wei创建于 5月20日
liu-wei
liu-wei成员
5月20日

描述

本 PR 调整 Tile AICPU kernel 的注册方式,补充 host constant folding 场景下的 V2 注册兼容封装。

主要改动如下:

  • 新增 common/inc/aicpu/math_aicpu_register.h,封装 OPS_MATH_REGISTER_CPU_KERNELV2 注册宏。
  • math/tile/op_kernel_aicpu/tile_aicpu.cpp 改为通过封装宏注册 Tile AICPU kernel。
  • host constant folding 编译目标增加 OPS_MATH_AICPU_HOST_KERNEL 宏;该路径在 host 库存在 RegistCpuKernelV2 时注册到 V2,旧版本 libaicpu_context_host.a 不提供 V2 注册符号时注册到 V1。
  • 非 host AICPU 编译路径继续展开为原 REGISTER_CPU_KERNEL,保持 device/custom AICPU 注册行为不变。
  • AICPU_INCLUDE 补充 ${OPS_MATH_DIR}/common/inc,保证新增公共头文件可被 AICPU 编译目标引用。

改动目的:

  • 支持 Tile 在 host constant folding 产物中优先接入 V2 注册能力,配合新版 opbase的“V2 优先、V1 兜底”调度逻辑:Tile 若成功注册到 V2,则运行时命中 V2;未注册到 V2 时仍走 V1。
  • 兼容新旧 AICPU host context 库:当 host 库存在 RegistCpuKernelV2 时注册到 V2;旧库缺少该符号时注册到 V1,配合 opbase 的 V1 兜底路径保持可运行。

关联的Issue

关联Issue #1634:https://gitcode.com/cann/ops-math/issues/1634

测试

  • 已执行静态 diff 检查:git diff --check 7fac2495 96de8df2,结果通过。
  • 已检查变更范围和引用关系:
    • aicpu/math_aicpu_register.h 可通过新增的 AICPU_INCLUDE 被 AICPU 目标引用。
    • Tile AICPU 源码仅调整注册入口,未改动参数校验、数据类型分发、广播计算和并行拷贝逻辑。
    • host constant folding 路径通过 OPS_MATH_AICPU_HOST_KERNEL 触发 V2 优先注册逻辑。
    • 已结合 opbase 注册/调度逻辑检查:新版 opbase 通过 IsRegisteredV2 判断是否走 V2 路径;V2 查询未命中时由调度层选择 V1 路径,RunCpuKernelV2 内部不再回退 V1。
  • 未在本地执行完整 CMake 配置和编译验证,需结合 CI 流水线继续确认 host constant folding 产物链接结果。

文档更新

无文档更新。

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 liu-wei 的贡献)
liu-weiliu-wei成员
5月20日 创建了 pull request,commit dc8d6a78
CANN-robot
CANN-robot成员
5月20日 评论:

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


PR Approval Progress

Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
math/tile 宋凯, wangrui_ (2/2) 宋凯, wangrui_ (2/1)
repo-cann/ops-math 宋凯, wangrui_ (2/2) wangrui_, 宋凯 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
5月20日 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
5月20日 将FelixTang7,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,songkai111,zhangyuxiang0119,llimwang,gubaocheng设为评审人
CANN-robotCANN-robot成员
5月20日 将FelixTang7,zhou-qilong,wangrui_,rxtfeng,loov1,zhangzijie,songkai111,zhangyuxiang0119,llimwang,gubaocheng设为审查人
liu-wei
liu-wei成员
5月21日 评论:

compile

likedislike
liu-weiliu-wei成员
5月21日 update merge request[project id: 7649531, iid: 2844, commit_id: 5e9c44b2e1b03de3044962f64c3eb31f23fd51c3] virtual merging success
CANN-robotCANN-robot成员
5月21日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
5月21日 评论:

流水线任务触发成功
任务链接 [9bcd5af8546a42b5bab0ca1d2d851c5f][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ❌ FAILED >>>>>
Compile_Ascend_X86_mobile_station ❌ FAILED >>>>>
Compile_Ascend_ARM ❌ FAILED >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ❌ FAILED >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>>
harmony-infer ✅ SUCCESS
Compile_Ascend_ARM_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_single_ubuntu24 ❌ FAILED >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>>
Compile_X86_monitor_910b ❌ FAILED >>>>>
Compile_X86_monitor_910c ❌ FAILED >>>>>
Compile_X86_monitor_950 ❌ FAILED >>>>>
likedislike
CANN-robot
CANN-robot成员
5月21日 评论:

流水线任务触发成功
任务链接 [4da19fa862cd436da90f3087f8b75e4b][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ⚠️ WARNING
codecheck_precommit ✅ SUCCESS >>>>>

[2026-05-21 08:33:05]    CI执行结束

likedislike
CANN-robotCANN-robot成员
5月21日 删除了label:ci-pipeline-running
此处折叠了5条事件消息 查看更多
liu-weiliu-wei成员
5月21日 修改了pull request 的描述
liu-wei
liu-wei成员
5月21日 评论:

compile

likedislike
liu-weiliu-wei成员
5月21日 update merge request[project id: 7649531, iid: 2844, commit_id: a45a273898bc0b92a81016a06aab3f1451f384c6] virtual merging success
CANN-robotCANN-robot成员
5月21日 删除了label:ci-pipeline-failed
CANN-robotCANN-robot成员
5月21日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
5月21日 评论:

流水线任务触发成功
任务链接 [6fa1e1b65fe844258eba68a4e8a9a547][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>>
harmony-infer ✅ SUCCESS
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>

[2026-05-21 12:03:10]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
5月21日 评论:

流水线任务触发成功
任务链接 [5cedd5f967ce40949aa0590e2afece16][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ⚠️ WARNING
codecheck_precommit ✅ SUCCESS >>>>>

[2026-05-21 11:55:18]    CI执行结束

likedislike
liu-weiliu-wei成员
5月21日 修改了pull request 的描述
此处折叠了5条事件消息 查看更多
liu-weiliu-wei成员
5月21日 update merge request[project id: 7649531, iid: 2844, commit_id: a744052b832a008d49d9e8863099e3b4f0efa56c] virtual merging success
liu-wei
liu-wei成员
5月21日 评论:

compile

likedislike
liu-weiliu-wei成员
5月21日 update merge request[project id: 7649531, iid: 2844, commit_id: 0a1c896098896543bf3cefe76c077d1fad94674d] virtual merging success
CANN-robotCANN-robot成员
5月21日 删除了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
5月21日 评论:

Notification

This pull request source branch has changed, so removes the following label(s): ci-pipeline-passed.

likedislike
CANN-robotCANN-robot成员
5月21日 删除了label:api-check-pass
CANN-robotCANN-robot成员
5月21日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
5月21日 评论:

流水线任务触发成功
任务链接 [526a191f1b694e65a1701713f14f632b][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_mobile_station ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_experimental ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_single ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_X86_A5 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM_A5 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_mobile_station_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_X86_A5_ubuntu24 ✅ SUCCESS >>>>>
Compile_harmony-infer ✅ SUCCESS >>>>>
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_experimental_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_single_ubuntu24 ✅ SUCCESS >>>>>
Compile_Ascend_ARM_A5_ubuntu24 ✅ SUCCESS >>>>>
Compile_X86_monitor_910b ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_910c ✅ SUCCESS >>>>> >>>>>
Compile_X86_monitor_950 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
UT_Test_experimental ✅ SUCCESS
UT_Test_kernel ✅ SUCCESS
PreSmoke_A900 ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>
PreSmoke_ATK_Test_A2 ✅ SUCCESS >>>>>

[2026-05-21 14:14:15]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
5月21日 评论:

流水线任务触发成功
任务链接 [0155db23216b4d44b5f261c99e73ba65][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
StaticCheck_codespell_check ✅ SUCCESS
StaticCheck_link_validity_check ✅ SUCCESS
StaticCheck_resource_existence_check ✅ SUCCESS
StaticCheck_tag_closed_check ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ⚠️ WARNING
codecheck_precommit ✅ SUCCESS >>>>>

[2026-05-21 14:06:42]    CI执行结束

likedislike
CANN-robotCANN-robot成员
5月21日 添加了label:api-check-pass
CANN-robotCANN-robot成员
5月21日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
5月21日 添加了label:ci-pipeline-passed
liu-weiliu-wei成员
5月21日 修改了pull request 的描述
liu-weiliu-wei成员
5月21日 修改了pull request 的描述
songkai111成员
5月22日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
5月22日 添加了label:approved
RuiWang_成员
5月22日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
5月22日 添加了label:lgtm
CANN-robot
CANN-robot成员
5月22日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: wangrui_, 宋凯.
Reviewers who wrote a comment of /lgtm are: wangrui_, 宋凯.

likedislike
CANN-robotCANN-robot成员
5月22日 关闭了关联的issue
CANN-robotCANN-robot成员
5月22日 合入了pull request