Merged
废弃asc_get_block_num和asc_get_block_idx #5216
废弃asc_get_block_num和asc_get_block_idx #5216
Merged
CruiterAdd on Aug 20
Cruiter
CruiterCollaborators
Aug 20

描述

废弃asc_get_block_num和asc_get_block_idx

关联的Issue

未关联 Issue。

测试

使用接口时正常打印警告

文档更新

不涉及

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for Cruiter's contribution.)
CruiterCruiterCollaborators
Aug 20 Created pull request, commit 788361aa
atomgit-bot
atomgit-bot
Aug 20 Comments:

变更摘要

本 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__ 指针偏移。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 20 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 20 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Aug 20 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
impl/c_api ✅ pangfd, houyuyang (2/2) ✅ pangfd (1/1)
include/c_api ✅ wuzhaolin, houyuyang (2/2) ✅ wuzhaolin (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
100 messages are collapsed here。 See more
CANN-robot
CANN-robotCollaborators
Aug 24 Comments:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robotCollaborators
Aug 24 Added label: api-check-pass
CANN-robotCANN-robotCollaborators
Aug 24 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Aug 24 Added label: ci-pipeline-passed
CANN-robotCANN-robotCollaborators
Aug 24 Merged pull request