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
Merged fromchai-hw/pypto_chaipyptolog_fixintocann/pyptomaster
chaizhengtongCollaborators
Aug 25
Aug 25


Pull Request has been successfully merged by CANN-robot.
(Thank you for chaizhengtong's contribution.)Aug 25 Created pull request, commit ca1df75a
atomgit-bot
Aug 25 Comments:
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,使关键告警与异常信息能按正确级别输出。


Incorrect?
atomgit-bot
Aug 25 Comments:
Aug 25 Comments:
Aug 25 Added label: stat/needs-squash
Aug 25 Added label: cann-cla/yes
103 messages are collapsed here。 See more
袁野
Aug 26 Comments:
Aug 26 Comments:
/approve


Aug 26 Added label: approved
gaoxingwang
Aug 26 Comments:
Aug 26 Comments:
/lgtm


Aug 26 Added label: lgtm
Aug 26 Merged pull request