已合并
fix(cpu_engine): 按 CANN 日志规范修正日志文案 #4568
fix(cpu_engine): 按 CANN 日志规范修正日志文案 #4568
已合并
Ding_Jing创建于 7 天前
Ding_Jing
Ding_Jing成员
7 天前

描述

依据《CANN 日志规范》修正 develop 分支 compiler/engines/cpu_engine、runtime/v2/engine/aicpu
下的运行时日志文案,共 233 处:语法错误 163、拼写错误 37、错误描述不完整 17、
缺少度量单位 15、魔鬼数字 1。

  • 拼写:neod defnode def(13 处)、TranConvertprobufprotobufadgeedgefuntionfunctionsmaller thensmaller than
  • 语法:when calculatewhen calculatingis not need updatedoes not need to updatehas already existalready existsfailed result ofbecause ...
  • 描述与实参不符:Call UpdateInputDesc ... 实际调用的是 UpdateOutputDescAddInputDesc "x""perm" 两处共用同一句文案;ffts 属性名打印成 ATTR_NAME_UNKNOWN_SHAPE_TYPE,改为真实属性名
  • 单位:workspace / 文件大小类数值补 bytesunknown type 4 改为 unknown shape type[DEPEND_COMPUTE]

修改边界:只改日志格式串及其实参,不改动任何控制流、返回值和业务逻辑
部分行因文案变长按 120 列做了折行。

关联的Issue

关联Issue #541(master 分支对应 Issue:#528)

测试

1. develop 侧新增 2 处的单独验证

两处均为纯字符串字面量修改(占位符与实参未动)。用 format(printf) 属性最小复现,
对改前/改后两组格式串在 -Werror=format 下编译:均通过,占位符与实参完全对应。
其中 AICPU_REPORT_INNER_ERR_MSG 最终落到带 FORMAT_PRINTF(5, 6)
error_message::ReportInnerErrMsg,是真正受 -Wformat 检查的链路。

2. 仓内 pre-commit 全量复跑(43 个改动文件)

trailing-whitespace / end-of-file-fixer / check-merge-conflict / detect-private-key /
clang-format / codespell / OAT Compliance —— 全部 Passed

3. 脚本化校验

  1. 占位符/实参一致性:43 个文件 / 1620 个日志调用,改前/改后 占位符数 - 实参数 一致 —— 通过;
  2. 结构不变:43 个文件花括号、分号数量完全一致,圆括号/方括号自平衡 —— 通过;
  3. 规范复扫:改动行不含非 ASCII,"禁止中文""内部敏感词"零命中,同类缺陷模式残留 0 处 —— 通过;
  4. 行宽:新增/修改行均不超过 120 列。

注:本仓多数日志宏(GELOGEdlog_errorDlogRecord)未落到带 format 属性的函数上,
GCC 的 -Wformat 无法对其做格式串类型校验,因此这类调用的类型匹配依赖上述第 1 项的脚本核对。
建议门禁补充完整编译 + 相关模块 UT/ST 冒烟。

文档更新

无,不涉及对外接口与文档。

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Ding_Jing 的贡献)
Ding_JingDing_Jing成员
7 天前 创建了 pull request,commit 8e8c20c6
atomgit-bot
atomgit-bot
7 天前 评论:

变更摘要

该 PR 聚焦于 CPU 引擎及 AI CPU 运行时日志文案的规范化:按 CANN 日志规范统一日志措辞、语法、拼写、格式符与单位表述,涉及 compiler/engines/cpu_engineaicpu_graph_optimizerkernel_buildertf_enginecpu_optimizer 等模块的 AICPUE_* 日志,以及 runtime/v2/engine/aicpu 下 converter、graph_builder、kernel 等模块的 GELOG* 日志,改动不涉及业务逻辑,仅影响日志输出内容。

主要改动

  • 规范语法与措辞:将 Don't need to ...is not neednot supporthas already existis not valid 等改为规范表述(如 It does not need to ...is not supportedalready exists),并将配置转换失败日志由 Tran ... to integer failed. default value is ... 统一为 Convert ... to integer failed, use default value ...,涉及 optimizer.cccpu_optimizer.cpptf_optimizer.cc 等文件。
  • 修正拼写与错误引用:修复 neodnodeadgeedgeprobufprotobufenmuenummulitmulti 等拼写错误;同时纠正日志中错误的接口/函数名引用,如 UpdateInputDescUpdateOutputDescgraph_optimizer_utils.cc)、SetIntSetListInttf_kernel_builder.cc)、CreateAndInsertCacheUpdatefCreateAndInsertCacheUpdatefuntionfunction
  • 统一尺寸类日志的单位与格式符:为 workspace、task、kernel run param、tensor size 等数值日志补充 bytes 单位,并修正与参数类型不匹配的格式符(如 %d%ld%u%zu%ld%zu),涉及 kernel_builder.cccpu_kernel_builder.cpptf_util.ccaicpu_bin_handler.cc 等。
  • 修正运行时错误原因与序数表述:将失败原因表述由 result of ... 改为 because ...Not find ... 改为 Cannot find ...does not finished 改为 has not finished3th3rd,并统一 must less thanmust be less thanexceed ...exceeds ... 等措辞。
  • sequence 相关日志格式修复tensor_sequence.hint64_tindex/size 打印改用 PRId64 格式符并新增 #include <cinttypes> 头文件,确保 64 位整数正确输出;bg_aicpu_arg.ccthenthan 并统一空格分隔。
likedislike
atomgit-bot
atomgit-bot
7 天前 评论:

代码审查

✅ 未发现问题

likedislike
CANN-robotCANN-robot成员
7 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7 天前 评论:

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
compiler/engines/cpu_engine tangqunzhang, lining23666, 刘伟, 张德鹏 (4/2) 刘伟, 张德鹏 (2/1)
repo-cann/ge lining23666, 张德鹏, tangqunzhang (3/2) 张德鹏 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
此处折叠了74条消息 查看更多
CANN-robotCANN-robot成员
6 天前 添加了label:lgtm
张德鹏成员
5 天前 评论:

/approve

likedislike
CANN-robotCANN-robot成员
5 天前 添加了label:approved
CANN-robotCANN-robot成员
5 天前 关闭了关联的issue
CANN-robotCANN-robot成员
5 天前 合入了pull request