已合并
examples 算子头文件修改 #4377
baixueyan创建于 7月15日
examples 算子头文件修改 #4377
已合并
baixueyan创建于 7月15日
baixueyan成员
7月15日

描述

修正examples文档中头文件包含格式问题

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 baixueyan 的贡献)
Bbaixueyan成员
7月15日 创建了 pull request,commit e4f9d6ab
atomgit-bot
atomgit-bot
7月15日 评论:

变更摘要

本次 PR 属于文档更新,主要修正了 examples/03_simt_api/ 目录下多个示例 .asc 文件中 #include 头文件的包含路径格式,将原先不带子目录前缀的简写路径统一改为带完整相对路径的格式,确保示例代码与项目实际的目录结构一致。

主要改动

  • asc_simt.h 包含路径修正: 在 hello_world.asc、printf.asc、assert.asc、clock.asc、log.asc 中,将 #include "asc_simt.h" 改为 #include "simt_api/asc_simt.h",补全了 simt_api/ 子目录前缀。
  • asc_printf.h 包含路径修正: 在 hello_world.asc、printf.asc、assert.asc、clock.asc 中,将 #include "asc_printf.h" 改为 #include "utils/debug/asc_printf.h",补全了 utils/debug/ 子目录前缀。
  • sincos_compute.asc 中头文件路径与格式修正: 将 #include <asc_simt.h> 改为 #include "simt_api/asc_simt.h",同时将尖括号改为双引号,并补全路径前缀。
  • log.asc 尾随空白清理: 删除了 log.asc 中多处行尾多余的空白字符(trailing whitespace),属于代码风格规范化。
likedislike
不准确?
atomgit-bot
atomgit-bot
7月15日 评论:

代码审查

经过全面审查,我已逐文件检查了所有 6 个变更文件以及周围的上下文。以下是最终分析:


审查结论

变更汇总

文件 变更内容 审查结果
hello_world.asc "asc_simt.h" → "simt_api/asc_simt.h"; "asc_printf.h" → "utils/debug/asc_printf.h" ✅ 无问题
printf.asc 同上 ✅ 无问题
assert.asc 同上(asc_assert.h 保持原样不变) ✅ 无问题
clock.asc 同上 ✅ 无问题
log.asc "asc_simt.h" → "simt_api/asc_simt.h";10 处行尾空白清理 ✅ 无问题
sincos_compute.asc <asc_simt.h> → "simt_api/asc_simt.h"(同时修正了尖括号→双引号及路径) ✅ 无问题

分析

  1. 头文件路径修正:所有 asc_simt.h 和 asc_printf.h 的 include 路径均从裸文件名更新为项目标准格式 simt_api/asc_simt.h 和 utils/debug/asc_printf.h。这与仓库中 01_simd_cpp_api/、05_simd_simt_hybrid/ 等其他示例目录以及 03_simt_api/ 已更新文件中的写法完全一致。

  2. sincos_compute.asc 的尖括号修正:将 #include <asc_simt.h>(系统头文件风格的尖括号)改为 #include "simt_api/asc_simt.h"(项目头文件风格的双引号),同时补全了路径。这是正确的修正,因为 asc_simt.h 是项目内部头文件而非系统头文件。

  3. log.asc 的尾随空白清理:10 处仅含空格的空行被清理为真正的空行,纯属格式修正,无功能影响。

  4. assert.asc 中 asc_assert.h 未更新:该文件中的 #include "asc_assert.h" 保持不变。这在项目中仅出现于两个文件(assert.asc 和 log.asc),且未找到对应的路径限定形式,因此保持不变属于合理范围。

  5. 未发现编译错误、逻辑错误、安全风险、可靠性问题或回归风险。

总体风险判断

零风险。 这是一次纯粹的文档/示例头文件包含格式修正,所有变更与项目既定规范一致,不涉及任何逻辑、安全或行为变更。


审查发现数量:0 — 未发现任何需要报告的问题。

类型 数量
🔴 阻塞 0
🟡 建议 2

💬 仅评论

likedislike
不准确?
CANN-robotCANN-robot成员
7月15日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7月15日 评论:

CLA Signature Pass

gcw_1m54gGxh, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robot
CANN-robot成员
7月15日 评论:

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
** ✅ gcw_kUomxQ2l, wulinyu (2/2) ✅ gcw_kUomxQ2l (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

gcw_1m54gGxh, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
7月15日 将zengjuan,zhanghao_0689,suqwe,wulinyu,kong0808,dengjing_aoe,YeZZzzz1,bluesky901,yangbinhua,zhudi22,chenyiyuan,xun_zhuge,XuebinYang,sjtulxh,bianque,houyuyang,Lycheeeee,chentianyu19,shi_nanxiang,wuyang_hw,jiangxinyu3,munanhw,ai_xin,ascendhjh,hujiawen_kaven,wangxiaozhi,DragonBornHD84,jiangtao_rts,hyolee,yukangchen,hanxiaolong,gcw_kUomxQ2l,Andy-lb设为评审人
CANN-robotCANN-robot成员
7月15日 将munanhw,ai_xin,jiangtao_rts,hanxiaolong,gcw_kUomxQ2l,Andy-lb设为审查人
gao_dafa成员
7月15日 评论:

gcw_1m54gGxh,感谢您的提交,建议在完成PR充分自验证后,再触发线上构建任务。

若您的PR已具备检视条件,可根据下表的责任田,@对应的committer进行代码检视,我们会在第一时间对您的提交进行处理。

代码责任田:

module committer
adv_api chenyiyuan, wuyang_hw
basic_api chenyiyuan, wuyang_hw
c_api pangfd, haipingmao
cmake xun_zhuge, DragonBornHD84
docs munanhw, ai_xin
examples changxianyu, bianque
simt_api wulinyu, zhanghao_0689
scripts xun_zhuge, kevin365
tools YANXI_ZHAO, XuebinYang, sjtulxh

💡 如您不确定可以@谁,可以直接@我或者ascend-c sig的maintainer,xun_zhuge和ascendhjh,我们会为您分配合适的committer进行代码检视。

再次感谢您参与CANN的社区贡献。

likedislike
Bbaixueyan成员
7月15日 预合并成功(commit_id: 735de1a9f2863c8ef2132457d86e62bb18b50869)
此处折叠了5条事件消息 查看更多
Bbaixueyan成员
7月15日 预合并成功(commit_id: 87fe69019d9c5358e60b707168c431d3678b83d2)
atomgit-bot
atomgit-bot7月15日进行代码检视2
examples/03_simt_api/01_utilities/09_log/log.asc
已过期
@@ -17,7 +17,7 @@
1717#include <vector>
1818#include "asc_assert.h"
atomgit-bot
atomgit-bot7月15日评论:

🟡 Medium Priority

与 assert.asc 中的问题相同。log.asc 第 18 行的 #include "asc_assert.h" 使用了裸文件名,而该头文件实际位于 include/utils/debug/asc_assert.h。本次 PR 已将同目录下的 asc_printf.h 从 "asc_printf.h" 修正为 "utils/debug/asc_printf.h",但遗漏了 asc_assert.h 的同步更新。如果构建系统不将 include/utils/debug/ 加入 include 路径,该文件将编译失败。

建议:将 #include "asc_assert.h" 改为 #include "utils/debug/asc_assert.h",与其他头文件路径修复保持一致。

改动建议
18
- #include "asc_assert.h"
18
+ #include "utils/debug/asc_assert.h"
应用建议
likedislike
不准确?
System
系统消息系统
7月15日 评论:

changed this line on 830e1f99 view diff detail

atomgit-bot
atomgit-bot7月15日进行代码检视2
examples/03_simt_api/01_utilities/01_assert/assert.asc
已过期
@@ -21,2 +20,3 @@
21-#include "asc_printf.h"
20+#include "simt_api/asc_simt.h"
21+#include "utils/debug/asc_printf.h"
2222#include "asc_assert.h"
atomgit-bot
atomgit-bot7月15日评论:

🟡 Medium Priority

本次 PR 将多处 #include "asc_printf.h" 修正为 #include "utils/debug/asc_printf.h",因为该头文件实际位于 include/utils/debug/asc_printf.h。然而,asc_assert.h 与 asc_printf.h 位于同一目录 include/utils/debug/asc_assert.h,且项目内部头文件(如 include/simt_api/common_functions.h、include/simt_api/cpp/kernel_simt_intf.h)均以完整路径 "utils/debug/asc_assert.h" 引用它。但以下两个文件中的 #include "asc_assert.h" 未被更新:

  • assert.asc 第 22 行:#include "asc_assert.h"
  • log.asc 第 18 行:#include "asc_assert.h"

变更行为:PR 修复了同类头文件路径格式问题,但遗漏了 asc_assert.h。
影响:如果构建系统的 include 路径配置不包含 include/utils/debug/ 目录,则这两个文件将因找不到 asc_assert.h 而编译失败。即使当前编译通过(可能靠其他配置),这种不一致会在后续维护中造成混淆。

建议:将 #include "asc_assert.h" 改为 #include "utils/debug/asc_assert.h",与同目录下 asc_printf.h 的修复保持一致。同时需要在 log.asc 第 18 行做相同修改。

改动建议
22
- #include "asc_assert.h"
22
+ #include "utils/debug/asc_assert.h"
应用建议
likedislike
不准确?
System
系统消息系统
7月15日 评论:

changed this line on 26932f05 view diff detail

Bbaixueyan成员
7月15日 修改标题为 “examples 算子头文件修改”,原标题为“算子头文件修改”
此处折叠了14条事件消息 查看更多
Bbaixueyan成员
7月15日 预合并成功(commit_id: 91655aa1aa5947b25ed7086a73d711aacbc6cedd)
baixueyan成员
7月15日 评论:

compile

likedislike
Bbaixueyan成员
7月15日 预合并成功(commit_id: cc858a5cc9e51f129ff5d630f5fdc197f6b3d83f)
CANN-robotCANN-robot成员
7月15日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
7月15日 评论:

流水线任务触发成功
任务链接 [2a707ecb9254489bb2a0e206d784e8bb][流水线指导]

任务名称状态日志下载链接
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
codecheck ✅ SUCCESS >>>>>
codecheck_Pr ✅ SUCCESS
pre_comment ✅ SUCCESS >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_codestyle ✅ SUCCESS >>>>>
codecheck_precommit ✅ SUCCESS >>>>>

[2026-07-15 14:56:15]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
7月15日 评论:

流水线任务触发成功
任务链接 [9dfb6e4be37040e1a8b46b987bb396d9][流水线指导]

任务名称状态日志下载链接
pre_comment ✅ SUCCESS >>>>>
UT_Test_adv_test_one ✅ SUCCESS
UT_Test_adv_test_two ✅ SUCCESS
UT_Test_basic_test_two ✅ SUCCESS
UT_Test_basic_test_three ✅ SUCCESS
UT_Test_basic_test_four ✅ SUCCESS
UT_Test_basic_test_five ✅ SUCCESS
UT_Test_arm ✅ SUCCESS
UT_Test_report ✅ SUCCESS >>>>>

[2026-07-15 15:03:21]    CI执行结束

likedislike
CANN-robot
CANN-robot成员
7月15日 评论:

流水线任务触发成功
任务链接 [7454e9ec101c42ad8808c1efe1bbb6cf][流水线指导]

任务名称状态日志下载链接
Compile_Ascend_X86 ✅ SUCCESS >>>>> >>>>>
Compile_Ascend_ARM ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
PreSmoke_A900_npupool ✅ SUCCESS >>>>>

[2026-07-15 14:56:10]    CI执行结束

likedislike
CANN-robotCANN-robot成员
7月15日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
7月15日 添加了label:ci-pipeline-passed
wulinyu成员
7月15日 评论:

/lgtm

likedislike
liulun0308成员
7月15日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
7月15日 添加了label:lgtmapproved
CANN-robotCANN-robot成员
7月15日 解决了最后一个问题
CANN-robotCANN-robot成员
7月15日 合入了pull request