已合并
将asc_vf_call移到公共文件 #4733
pangfd创建于 28 天前
将asc_vf_call移到公共文件 #4733
已合并
pangfd创建于 28 天前
已删除 :master合入到cann/asc-devkitmaster
pangfd成员
28 天前

描述

将asc_vf_call移到公共文件

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 pangfd 的贡献)
Ppangfd成员
28 天前 创建了 pull request,commit 90616e04
atomgit-bot
atomgit-bot
28 天前 评论:

变更摘要

该PR将 AscVFCallImpl(实现层)和 asc_vf_call(接口层)从原先分散在 kernel_utils.hkernel_common.h 中的位置,统一迁移到新增的公共文件 helpers_impl.hhelpers.h 中,并在 asc::details 命名空间下重命名为 asc_vf_call_impl。此举实现了 SIMD VF 调用包装逻辑的集中管理,同时更新了相关引用路径和测试用例。

主要改动

  • 新增公共接口头文件 include/utils/base/helpers.h:定义 asc_vf_call 函数模板,内部通过 ASCEND_IS_AIV 条件调用 asc::details::asc_vf_call_impl,作为统一的对外入口。
  • 新增公共实现头文件 impl/utils/base/helpers_impl.h:将原 AscVFCallImpl 模板函数从 kernel_utils.h 迁移至此,重命名为 asc::details::asc_vf_call_impl,功能逻辑不变(包含调试初始化和溢出检测)。
  • impl/basic_api/kernel_utils.h 移除 AscVFCallImpl 定义:删除原有22行模板实现,改为 #include "../utils/base/helpers_impl.h" 引入新位置。
  • include/basic_api/kernel_common.h 移除 asc_vf_call 定义:删除原有8行函数定义,改为 #include "../utils/base/helpers.h" 引入新位置。
  • include/c_api/asc_simd.h 中新增 #include "utils/base/helpers.h":确保C API层也能访问迁移后的 asc_vf_call
  • 更新测试文件 test_kernel_vf_debug.cpp:将调用从 AscVFCallImpl 改为 asc::details::asc_vf_call_impl,测试名称也同步更新以匹配新函数名。
likedislike
atomgit-bot
atomgit-bot
28 天前 评论:

代码审查

总结

按优先级统计

优先级 数量
P0 0
P1 0
P2 0
P3 1

整体风险评估

低风险。此变更是一个结构良好的重构,将 asc_vf_call 和相关实现从 kernel_utils.h / kernel_common.h 移动到专用的 helpers.h / helpers_impl.h 文件。包含链经过仔细维护,CMake 安装已更新以包含新的 base 目录,测试调用站点已正确迁移到新的命名空间。发现的唯一缺陷是测试文件中的一个过时注释(P3)。

按文件审查

文件 审查状态
impl/basic_api/kernel_utils.h ✅ 无问题——正确移除了 AscVFCallImpl 并添加了 helpers_impl.h 的包含
impl/utils/CMakeLists.txt ✅ 无问题——在安装目录中正确添加了 base
impl/utils/base/helpers_impl.h(新文件) ✅ 无问题——在 asc::details 中正确定义了 asc_vf_call_impl
include/basic_api/kernel_common.h ✅ 无问题——正确移除了 asc_vf_call 并添加了 helpers.h 的包含
include/c_api/asc_simd.h ✅ 无问题——正确添加了 helpers.h 的包含
include/utils/base/helpers.h(新文件) ✅ 无问题——在全局作用域中正确定义了 asc_vf_call
tests/api/basic_api/ascendc_case_common/test_kernel_vf_debug.cpp ⚠️ 1 个 P3 问题:第 44 行过时的注释

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
CANN-robotCANN-robot成员
28 天前 添加了label:stat/needs-squash
CANN-robotCANN-robot成员
28 天前 添加了label:cann-cla/yes
此处折叠了41条消息 查看更多
CANN-robotCANN-robot成员
23 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
23 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
23 天前 添加了label:ci-pipeline-passed
CANN-robotCANN-robot成员
23 天前 合入了pull request
Ppangfd成员
22 天前 关联了issue:[Bug-Report|缺陷反馈]: asc_vf_call编译失败