Pull Request has been successfully merged by CANN-robot.
(Thank you for Cruiter's contribution.)变更摘要
本 PR 的核心目的是废弃 C API 中的 asc_get_block_num 和 asc_get_block_idx 两个接口,通过在声明与实现上添加 [[deprecated]] 属性并附上迁移提示,引导用户改用内置变量 block_num 以及 block_idx * asc_get_sub_block_num() + asc_get_sub_block_id() 的组合;同时同步更新了相关示例代码,将其中的函数调用替换为新的写法。本次改动不涉及功能逻辑变化,仅属接口弃用与示例适配。
主要改动
- 头文件声明标记废弃:在
include/c_api/sys_var/sys_var.h中为asc_get_block_num与asc_get_block_idx的声明添加[[deprecated]]属性,其中asc_get_block_num提示改用block_num,asc_get_block_idx提示改用block_idx * asc_get_sub_block_num() + asc_get_sub_block_id()。 - 实现文件同步标记废弃:在
impl/c_api/instr_impl/npu_arch_2201/sys_var_impl.h与impl/c_api/instr_impl/npu_arch_3510/sys_var_impl.h中为对应内联实现函数添加相同的[[deprecated]]属性及弃用说明,保证头文件与实现一致。 - 示例代码迁移:将
examples/02_simd_c_api下 5 个示例(01_add/c_api_delicacy_async_add、01_add/c_api_sync_add、00_vector_compute/00_sync_add、00_vector_compute/01_async_add、00_vector_compute/02_c_api_delicacy_async_add中的c_api_add.asc)中的asc_get_block_num()全部替换为block_num,asc_get_block_idx()全部替换为block_idx,用于计算blockLength及各__gm__指针偏移。


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 |
|---|---|---|
| impl/c_api | ✅ pangfd, houyuyang (2/2) | ✅ pangfd (1/1) |
| include/c_api | ✅ wuzhaolin, houyuyang (2/2) | ✅ wuzhaolin (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
printfscanfmain, thanks for your pull request. All authors of the commits have signed the CLA. 👍


流水线任务触发成功
任务链接 [a76da17b94534296830f55b4d921312b][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-08-24 10:10:10] CI执行结束


描述
废弃asc_get_block_num和asc_get_block_idx
关联的Issue
未关联 Issue。
测试
使用接口时正常打印警告
文档更新
不涉及
类型标签