已合并
[bugfix]修复超长日志打印错误 #247
流栎创建于 18 天前
[bugfix]修复超长日志打印错误 #247
已合并
流栎创建于 18 天前
流栎
流栎成员
18 天前

1. 修改描述

  • 修改原因:
    当前日志打印逻辑错误,针对超长日志仅仅打印告警信息,没有warn告警,对日志也没有做截断处理
  • 修改方案:
    修改逻辑,超长日志是正确打印信息,且有相应的warn告警提示
  • 修改内容:
    csrc/utils/cpputils/log.h

2. 功能验证

INFO] Profiling running finished. All task success.
[INFO] Start analyze kernel on device: device0, kernel: _ZN7Catlass13KernelAdapterINS_4Gemm6Kernel13W4A8MatmulMSDINS1_5Block9Blo_3414736449211411322, name is: 0
[INFO] Save profiling data with metric [PipeUtilization] success.
[INFO] Save profiling data with metric [ArithmeticUtilization] success.
[INFO] Save profiling data with metric [L2Cache] success.
[INFO] Save profiling data with metric [Memory] success.
[INFO] Save profiling data with metric [ResourceConflictRatio] success.
[INFO] Save profiling data with metric [MemoryL0] success.
[INFO] Save profiling data with metric [MemoryUB] success.
[INFO] Performance Summary Report:

1) aicore MTE1 bandwidth utilization lower than 80% when active.
2) aicore MTE2 bandwidth utilization lower than 80% when active.
3) aicore MTE3 bandwidth utilization lower than 80% when active.
4) aivector MTE2 bandwidth utilization lower than 80% when active.
5) aivector MTE3 bandwidth utilization lower than 80% when active.
6) aivector compute usage lower than 20%.

[INFO] Operator Basic Information:

Op Name: _ZN7Catlass13KernelAdapterINS_4Gemm6Kernel13W4A8MatmulMSDINS1_5Block9BlockMmadINS1_31MmadAtlasA2W4A8GroupedMatmulMSDILj0ELj2ELj2ELj2ELj1ELb0ELb1EEENS_9GemmShapeILj128ELj256ELj256EEENS8_ILj128ELj256ELj128EEENS1_8GemmTypeI16integer_sub_typeILi4ELb1EENS_6layout8RowMajorELN7AscendC9TPositionE0EEENSB_ISD_NSE_2zNELSH_0EEENSB_IDhSF_LSH_0EEEvNS1_4Tile31QuantTileCopyPerChannelPerGroupINS_4Arch7AtlasA2ESI_SK_SL_vLNSM_16ScaleGranularityE2EEENSM_8TileMmadISP_SI_SK_vEEEENS_8Epilogue5Block13BlockEpilogueINSV_25EpilogueAtlasA2W4A8GmmMSDEJSL_NSB_IfNSE_12VectorLayoutELSH_0EEES10_NSB_Iu6__bf16SF_LSH_0EEENSV_4Tile19TileRowBroadcastAddISP_NSB_IfSF_LSH_0EEENS_11MatrixShapeILj64ELj256EEEEENS12_19TileBroadcastOneBlkISP_S14_Lj64EEENS12_28TileOneBlkColumnBroadcastMulISP_S14_S16_EENS12_18TileCopyW4A8GmmMSDISP_SL_S10_S10_S11_EENS12_29EpilogueHorizontalTileSwizzleEEEENS4_24GemmIdentityBlockSwizzleILj3ELj0EEELj4EmSF_EEEEvNT_6ParamsEm_mix_aic
Op Type: mix
Task Durat

[WARN] Log length reach limit, message truncated
[INFO] Profiling results saved in /home/zl/catlass-AML/output/bin/OPPROF_20260807024216_GYFLKIVUITHRZQNB
[INFO] Profiling data parse finished.
[INFO] Op profiling finish. Welcome to next use.


3. 代码检视

  • 要求:
    • 合入功能代码大于 200 行,需要sig会议申报代码检视议题,并在PR中标注会议。
    • committer评估是否需要在sig会议进行代码检视。
    • 参与检视的committer人员名单与检视时间。
    • 大于 1000 行代码原则上不允许合入,需进行备案。
  • 检视committer人员名单与检视时间:

4. 资料修改自检

  • 资料修改:

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 流栎 的贡献)
atomgit-bot
atomgit-bot
18 天前 评论:

变更摘要

本次变更修复了 Log::Printf 函数中针对超长日志的处理逻辑错误。原先当日志长度超过限制时,仅打印一条截断提示信息,且该提示使用了原始日志级别(lv)而非告警级别,同时被截断的日志内容本身并未输出。修改后,超长日志内容会被正确截断并打印,随后以 LogLv::WARN 级别输出截断告警提示,确保日志信息不丢失且告警语义明确。

主要改动

  • 超长日志内容现在会被打印:新增 fprintf(fp_, "%s\n", msg),确保被截断的日志内容在截断提示之前输出,避免原先仅打印告警而丢失日志信息的问题。
  • 截断字符串正确终止:新增 msg[MAX_PRINT - 1] = '\0',显式确保截断后的 msg 缓冲区以空字符结尾,防止 fprintf 读取越界。
  • 截断提示使用正确的告警级别:将 AddPrefixInfo 的日志级别参数从原始的 lv 改为 LogLv::WARN,使截断告警始终以 WARN 级别输出,而非跟随原始日志的级别。
likedislike
atomgit-bot
atomgit-bot
18 天前 评论:

代码审查

✅ 未发现问题

likedislike
ascend-robotascend-robot成员
18 天前 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
18 天前 评论:

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
repo-Ascend/msopprof 门飞飞, zsz_wlf (2/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

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

likedislike
流栎
流栎成员
18 天前 评论:

compile

likedislike
AtlasAccountAtlasAccount成员
18 天前 添加了label:ci-pipeline-running
ascend-robot
ascend-robot成员
18 天前 评论:

ascend docs pipeline is running...

likedislike
ascend-robotascend-robot成员
18 天前 添加了label:docs-ci-pipeline-running
ascend-robot
ascend-robot成员
18 天前 评论:

ascend docs pipeline is running...

likedislike
ascend-robot
ascend-robot成员
18 天前 评论:

✅ 跳过 docs ci 检查,没有需要检查的文档文件

likedislike
ascend-robotascend-robot成员
18 天前 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
18 天前 添加了label:docs-ci-pipeline-success
ascend-robot
ascend-robot成员
18 天前 评论:

✅ 跳过 docs ci 检查,没有需要检查的文档文件

likedislike
AtlasAccountAtlasAccount成员
18 天前 删除了label:ci-pipeline-running
AtlasAccountAtlasAccount成员
18 天前 添加了label:ci-pipeline-passed
AtlasAccount
AtlasAccount成员
18 天前 评论:
流水线 PR-pipeline_msopprof#533 [ commitID:793cdee5 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build_msopprof_x86 >>>
Build_msopprof_arm >>>
恶意代码检查 Antipoison_msopprof >>>
编码安全与规范检查 codecheck_pre-commit >>>
pre-commit >>>
开源片段检查 SCA_msopprof >>>
开发者测试 UT_msopprof_x86 >>>
流水线 PR-pipeline_msopprof >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[A1streomeria]评论有效
  • compile : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
流栎流栎成员
17 天前 修改了pull request 的描述
流栎流栎成员
17 天前 关联了issue:[Bug]: 采集catlass算子,算子名太长导致数据截断未打印Operator Basic Information信息,[INFO] Log length reach limit, message truncated日志级别不正确
流栎流栎成员
17 天前 关联了里程碑:MindStudio 26.2.0
zhaishangzhao
zhaishangzhao成员
17 天前 评论:

/lgtm

likedislike
went_code
went_code成员
17 天前 评论:

/approve

likedislike
ascend-robotascend-robot成员
17 天前 添加了label:approvedlgtm
ascend-robotascend-robot成员
17 天前 合入了pull request
xzm123成员
17 天前 评论:

🤖 AIDD 文档质量检测报告

PR #247 已关闭,相关检测任务已归档。

评论由 AIDD 自动生成。

likedislike