已合并
feat: 新增 Add 算子 C API(asc_simd)风格示例工程 #2708
songkai111创建于 5月12日
feat: 新增 Add 算子 C API(asc_simd)风格示例工程 #2708
已合并
Pull Request已成功合入, 合并人@CANN-robot
(感谢 songkai111 的贡献)5月12日 创建了 pull request,commit d43ece8b
CANN-robot
5月12日 评论:
5月12日 评论:
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 |
|---|---|---|
| */*/README.md | ✅ 陈娇, wangrui_, 张磊 (3/2) | ✅ 陈娇 (1/1) |
| */*/op_graph/*_proto.h | ✅ 王永光, wangrui_, 张磊 (3/2) | ✅ 王永光 (1/1) |
| */*/op_host/*_def.cpp | ✅ 王永光, wangrui_, 张磊 (3/2) | ✅ 王永光 (1/1) |
| repo-cann/ops-math | ✅ 张磊, wangrui_ (2/2) | ✅ 张磊 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
songkai111, thanks for your pull request. All authors of the commits have signed the CLA. 👍


5月12日 添加了label:cann-cla/yes
5月12日 将zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,gitcode-chenjiao,llimwang,gubaocheng设为评审人
5月12日 将zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,gitcode-chenjiao,llimwang,gubaocheng设为评审人
5月12日 将zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,gitcode-chenjiao,llimwang,gubaocheng设为审查人
5月12日 将zhou-qilong,gitee-duhuiping,wangrui_,rxtfeng,loov1,zhangzijie,jia0liang,gitcode-chenjiao,llimwang,gubaocheng设为审查人
songkai111
5月12日 评论:
5月12日 评论:
compile


Ssongkai111
5月12日 update merge request[project id: 7649531, iid: 2708, commit_id: 56a38c1c61cefb09b381acfe8b0d0d37e63a7134] virtual merging success
5月12日 update merge request[project id: 7649531, iid: 2708, commit_id: 56a38c1c61cefb09b381acfe8b0d0d37e63a7134] virtual merging success
5月12日 添加了label:ci-pipeline-running
CANN-robot
5月12日 评论:
5月12日 评论:
流水线任务触发成功
任务链接 [a533bfd001b04834829d19bee38bbb36][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| 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 | >>>>> | |
| ATK_Test_A2 | ✅ SUCCESS |
[2026-05-12 23:10:53] CI执行结束


CANN-robot
5月12日 评论:
5月12日 评论:
流水线任务触发成功
任务链接 [10ead3e90e2c48bfa4b80bbe9532cf28][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ❌ FAILED | ||
| SCA | ✅ SUCCESS | >>>>> | |
| anti_virus | ✅ 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 | ⚠️ WARNING | >>>>> | >>>>> |


5月12日 修改标题为 “feat: 新增 Add 算子 C API(asc_simd)风格示例工程”,原标题为“增加c api风格example”
此处折叠了5条事件消息 查看更多
5月13日 添加了label:ci-pipeline-running
CANN-robot
5月13日 评论:
5月13日 评论:
流水线任务触发成功
任务链接 [f92a79b625964d6ab52109264232f880][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | ||
| anti_virus | ✅ 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 | ⚠️ WARNING | >>>>> | >>>>> |
[2026-05-13 14:58:10] CI执行结束


5月13日 删除了label:ci-pipeline-running
5月13日 添加了label:ci-pipeline-passed
wangyongguang
5月13日 评论:
5月13日 评论:
/approve


5月13日 添加了label:lgtm
5月13日 添加了label:approved
5月13日 关闭了关联的issue
5月13日 合入了pull request
描述
新增 Add 算子的 C API(asc_simd)风格示例工程
add_example_c_api,展示使用 C API 方式开发 AI Core 算子的完整流程,区别于传统 C++ 类方式的 AscendC API。改动原因
现有示例仅包含 C++ 类方式(AscendC API)和 AI CPU 方式的算子开发样例,缺少 C API(asc_simd)风格的示例。本 PR 补充了该开发方式的端到端示例,方便开发者参考。
改动方法
examples/add_example_c_api/目录,包含完整的算子工程结构:op_kernel/:使用 C API(asc_simd)实现加法 kernel,核心接口包括asc_init()、asc_copy_gm2ub_sync()、asc_add_sync()、asc_copy_ub2gm_sync()op_host/:Tiling 实现、算子定义(OpDef)、InferShape 实现op_graph/:图推理(InferShape/InferDataType)及 proto 定义examples/:aclnn 调用样例(test_aclnn_add_example_c_api.cpp)examples/README.md添加新示例目录说明和样例表格条目关联的Issue
测试
提供 aclnn 调用样例(test_aclnn_add_example_c_api.cpp),使用 32×4×4×4 的 FLOAT 张量进行端到端验证,计算 x1 + x2 = y 并打印结果。
文档更新
examples/add_example_c_api/README.md,说明产品支持情况、功能说明、参数说明、约束说明、调用方式和 Kernel 开发方式examples/README.md添加 add_example_c_api 目录结构和样例表格类型标签