Merged
fix(interface): Fix log wording and unify logging interface #5764
HuYiShengAdd on Aug 28
fix(interface): Fix log wording and unify logging interface #5764
Merged
HuYiShengAdd on Aug 28
HuYiSheng
HuYiShengCollaborators
Aug 28

在 CANN 日志质量评测中发现 framework/src/interface 及 python/src/bindings 多处日志问题:部分日志文案存在英文拼写错误或语法错误,影响排障时按关键字检索;部分业务代码绕过统一日志接口,直接使用 std::cout / std::cerr / printf / py::print / fprintf 输出,不符合统一日志规范(3.1.9 统一英文、3.1.10 统一日志接口)。本 PR 在不改变任何计算逻辑的前提下,对上述日志问题统一收敛修复。

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for HuYiSheng's contribution.)
HuYiShengHuYiShengCollaborators
Aug 28 Created pull request, commit c8a31edd
atomgit-bot
atomgit-bot
Aug 28 Comments:

变更摘要

本 PR 针对 CANN 日志质量评测中发现的 framework/src/interface 与 python/src/bindings 日志问题做统一收敛修复,不改变任何计算逻辑。核心工作有两类:一是将业务代码中绕过统一日志接口的 std::cout / std::cerr / printf / py::print / fprintf 输出替换为 FE_LOGI、INTERPRETER_LOGI、INTERPRETER_LOGE_FULL、PYPTO_LOGW 等统一日志宏;二是修正多处日志文案的英文拼写与语法错误,提升按关键字检索排障的准确性,并新增覆盖相关日志分支的单元测试。

主要改动

  • 统一日志接口,收敛旁路输出:calc_vector.cpp 中将 std::cout 打印 diagonal 改为 INTERPRETER_LOGI;flow_verifier.cpp 中将多处写入 execDumpErrorFile 的 fprintf 改为 INTERPRETER_LOGE_FULL(VerifyResultScene::VERIFY_RESULT_MISMATCH, ...);float.h 中将 PrintMetadata 的 printf 改为 FE_LOGI(并补充 tilefwk/pypto_fwk_log.h 头文件);controller.cpp 中将 py::print 警告输出改为 PYPTO_LOGW;error.h 中移除 TerminateHandler 内的两处 std::cerr 输出,保留等效的 PYPTO_LOGE_FULL 日志。
  • 修正日志文案拼写与语法错误:config_manager_ng.cpp 中 "has been not loaded form" 改为 "has not been loaded from";interpreter/function.cpp 中 "is not equal actual size" 改为 "is not equal to actual size";tensor.cpp 中 "disCount" 改为 "dimCount";logical_tensor.cpp 中两处 "its'" 改为 "its";program.cpp 中为 funcMagic 补充缺失的逗号;function.cpp 中为 GetMagicName() 与后续文案补充缺失的空格。
  • 增强断言错误信息可排查性:calc_torch.cpp 中 Gather 的断言信息从笼统的 "axis out of range" 改为输出实际 axis 值与合法范围 [0, paramsRank)。
  • 新增单元测试覆盖日志分支:新增 framework/tests/ut/interface/src/interpreter/test_inc_cov_branches.cpp,覆盖 RawTensor::GetRawDataSize 负 shape(动态轴)分支、FunctionInterpreter::DumpBinary 短写分支,以及 UpdateGetTensorDataIOIndex 中 IOTYPE / IOTYPE_INDEX 为非立即数时的 FE_ASSERT 分支。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 28 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 28 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Aug 28 Added label: cann-cla/yes
73 messages are collapsed here。 See more
lidongsheng
lidongshengCollaborators
Aug 29 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Aug 29 Added label: lgtm
lidongsheng
lidongshengCollaborators
Aug 29 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 29 Added label: approved
CANN-robotCANN-robotCollaborators
Aug 29 Merged pull request