Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenmyk 的贡献)变更摘要
本 PR 主要修复 WriteGmByPassDCache 与 ReadGmByPassDCache 接口命名不规范("ByPass" 应为 "Bypass")的问题:新增命名正确的接口 WriteGmBypassDCache、ReadGmBypassDCache 作为替代,并将原接口通过 [[deprecated]] 属性标记为废弃,提示将于 2028 版本移除;同时对底层实现函数进行相应重命名,并针对 2201 架构补充写操作的地址对齐调试断言。
主要改动
- 新增正确命名接口:在
kernel_operator_scalar_intf.h中声明、在kernel_operator_scalar_intf_impl.h中实现新接口WriteGmBypassDCache与ReadGmBypassDCache,作为原接口的替代方案。 - 标记原接口废弃:为
WriteGmByPassDCache、ReadGmByPassDCache增加[[deprecated]]属性并提示于 2028 版本移除,其内部实现改为调用新的WriteGmBypassDCacheImpl/ReadGmBypassDCacheImpl。 - 实现函数重命名:在
kernel_scalar.h中将实现函数WriteGmByPassDCacheImpl、ReadGmByPassDCacheImpl分别重命名为WriteGmBypassDCacheImpl、ReadGmBypassDCacheImpl。 - 新增地址对齐调试断言:在
WriteGmBypassDCacheImpl中针对__NPU_ARCH__ == 2201增加ASCENDC_DEBUG_ASSERT,校验addr在 128 字节对齐范围内的偏移小于 32(写入仅在该范围前 32 字节生效),并输出对应的错误日志。


代码审查
关闭总结
各变更文件审查确认
- impl/basic_api/kernel_operator_scalar_intf_impl.h — 已审查。发现 1 个 P0 问题:新增的
WriteGmBypassDCache函数(第 97 行)缺失template <typename T>声明,直接导致 2201/3510/5102 架构编译失败;另含 1 处[[deprecated]]放在template之前的属性位置问题(并入 include 头的 P3 发现)。 - impl/basic_api/kernel_scalar.h — 已审查。改名(
WriteGmByPassDCacheImpl→WriteGmBypassDCacheImpl、ReadGmByPassDCacheImpl→ReadGmBypassDCacheImpl)在可检索范围内引用一致、无残留旧名调用;新增的 2201 架构ASCENDC_DEBUG_ASSERT断言块(地址 128 字节对齐范围内偏移 <32)语义与宏用法均正确,%u格式符与uint32_t实参匹配。发现 1 个 P3 低风险问题:static_assert 错误信息仍引用旧接口名。 - include/basic_api/kernel_operator_scalar_intf.h — 已审查。新接口声明完整、签名与 impl 定义匹配。发现 1 个 P3 问题:两处
[[deprecated]]均置于template <typename T>之前(偏离仓库既有惯例,ReadGmByPassDCache的废弃告警可能不生效)。
审查结论
共报告 3 个问题:P0 × 1、P3 × 2。
总体风险评估:本 PR 存在一个 P0 级构建失败缺陷——WriteGmBypassDCache 缺少模板声明,所有在 2201/3510/5102 架构下包含该公共头的算子代码将无法编译,必须修复后才能合入。两个 P3 问题(deprecated 属性位置导致 ReadGmByPassDCache 废弃提示不生效、static_assert 信息残留旧名)属于次要一致性问题,不影响运行正确性,但建议一并修正以达成 PR「提示原接口废弃」的目标。改名后的新老接口调用链(wrapper → *BypassDCacheImpl)在可检索范围内保持一致,无其他正确性风险。
| 类型 | 数量 |
|---|---|
| 🔴 阻塞 | 1 |
| 🟡 建议 | 0 |
⛔ 需要修改


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 |
|---|---|---|
| docs | ✅ bianque, munanhw, wuyang_hw (3/2) | ✅ munanhw, bianque (2/1) |
| examples | ✅ bianque, munanhw, wuyang_hw (3/2) | ✅ bianque, munanhw (2/1) |
| impl/basic_api | ✅ wuyang_hw, bianque (2/2) | ✅ wuyang_hw (1/1) |
| include/basic_api | ✅ wuzhaolin, wuyang_hw, bianque (3/2) | ✅ wuzhaolin (1/1) |
| repo-cann/asc-devkit | ✅ bianque, wuyang_hw (2/2) | ✅ wuyang_hw, bianque (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chenmyk, thanks for your pull request. All authors of the commits have signed the CLA. 👍


描述
WriteGmByPassDCache和ReadGmByPassDCache接口名称问题修改
提供新接口并提示原接口废弃
关联的Issue
测试
文档更新
类型标签