Merged
fix(machine): fix log quality issues in machine module. #5679
chaizhengtongAdd on Aug 25
fix(machine): fix log quality issues in machine module. #5679
Merged
chaizhengtongAdd on Aug 25
chaizhengtong
chaizhengtongCollaborators
Aug 25
PyPTO machine 模块日志整改
likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for chaizhengtong's contribution.)
chaizhengtongchaizhengtongCollaborators
Aug 25 Created pull request, commit ca1df75a
atomgit-bot
atomgit-bot
Aug 25 Comments:

变更摘要

该 PR 旨在对 PyPTO machine 模块的日志进行整改,统一并提升日志质量。核心改动集中在 framework/src/machine 下的 device、runtime 及 utils 模块,主要包含三类调整:批量修正日志文案中的拼写与语法错误;统一内存/二进制大小类日志的单位标注(如补充 bytes);并对若干日志的级别与错误码使用进行校正(如将 PMU 性能报告的 DEV_ERROR 降为 DEV_INFO、将错误码由魔数 0 改为具名错误码)。本 PR 属于纯日志质量优化,未改变业务逻辑。

主要改动

  • 性能报告日志级别降级:在 perf_event_sampler.cpp 的 DumpReport、DumpElapsedCycles、DumpSectionHeader、DumpRawCounters、DumpDerivedMetrics、DumpCacheDerivedMetric 及 AicpuPerfScopedSampler 析构中,将原本以 DEV_ERROR(MachineError::UNKNOWN, ...) 输出的 PMU 统计内容统一改为 DEV_INFO,并将"PMU events disabled"提示由 DEV_ERROR 改为 DEV_WARN,使性能统计不再以错误级别日志呈现;同时在 device_perf.h 中将 DEV_ERROR(0, ...) 校正为 DEV_ERROR(MachineError::UNKNOWN, ...),在 load_aicpu_op.cpp 中将 MACHINE_LOGE(0, ...) 改为 MACHINE_LOGE(DevCommonErr::INIT_FAILED, ...),用具名错误码替代魔数 0。
  • 内存/二进制大小日志补充单位:在 backend.cpp("Dev prog binary size"、"KernelBinary size")、device_execute_context.cpp("Image size")、memory_pool.cpp、dev_encode.cpp("StitchPool"、"aicoreSpilled")、dev_encode_workspace.cpp、dev_workspace.cpp 等日志中为各类 size 信息统一补充 bytes 单位,提升日志可读性。
  • 越界告警补充关键参数:在 dev_callop_attribute.h 的 CheckOffsetAndValidShapeInRawShape 中,将 offset_out_of_range 与 validShape_out_of_range 两条告警由仅输出固定文案,扩展为带上 i、offset、validShape、rawShape 的具体取值,便于问题定位。
  • 日志文案批量纠错:对 machine 模块(含 aicore_manager.h、aicore_prof.cpp、device_sche.h、device_trace.cpp、slab_ws_allocator.h、kernel_binary.cpp、pmu_common.cpp、device_exception_dump.cpp、dump_device_perf.cpp、log_manager.cpp 等)及少量外围脚本(build_ci.py、executable.py、test_case_loader.py、_build_online.py)中的拼写与语法错误进行修正,例如 rungning→running、prallel→parallel、has been load→has been loaded、Contrust→Construct、arigsize→argsize 等,同时统一 cann't/cannot、don't/Dont 等表达。
  • 日志级别校正:在 build_ci.py 中将 CMake Build 失败日志由 logging.info 提升为 logging.error;在 device_exception_dump.cpp 中将 argsizie not from pto info 由 MACHINE_LOGI 提升为 MACHINE_LOGW,使关键告警与异常信息能按正确级别输出。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Aug 25 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Aug 25 Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
Aug 25 Added label: cann-cla/yes
103 messages are collapsed here。 See more
袁野
袁野Collaborators
Aug 26 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Aug 26 Added label: approved
gaoxingwang
gaoxingwangCollaborators
Aug 26 Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Aug 26 Added label: lgtm
CANN-robotCANN-robotCollaborators
Aug 26 Merged pull request