Merged
fix(pypto_pro): use ASC printf for debug output #6385
yzfAdd on Sep 16
fix(pypto_pro): use ASC printf for debug output #6385
Merged
yzfAdd on Sep 16
yzf
yzf
Sep 16

PR 应该避免没有描述信息,描述信息的最重要的作用是描述修改意图,应该清晰明了。例如:标题中包含了 fix 标签,如果没有描述信息,就需要Review人员猜测PR具体修复了哪些内容,或者怀疑修改的必要性。如果PR和特定的Issue相关,可以单独包含一行 Related Issue: 放到描述信息最后。

下面是一个典型的PR描述信息:

The origin issue template brings too many noise, it's not suitable for git message. eg: comments
are not removed, labels are redundant as the PR tile already contains the tag.

The guide gives a clear suggestion on how to write the PR body.

Related Issue: #1234,#5678

更多描述信息见:Commit Message 规范

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for yzf's contribution.)
yzfyzf
Sep 16 Created pull request, commit fa1062fe
atomgit-bot
atomgit-bot
Sep 16 Comments:

变更摘要

本 PR 将 pypto_pro 的调试输出(debug.printf、debug.assert、TPRINT/dump 系列)从 cce::printf 切换到 ASC printf 实现(统一走 pypto_tprint.h 中定义的 pypto_printf 模板,内部封装 __asc_aicore::scalar_printf_impl 并清空 dump header),同时删除了原先为绕过 cce::printf 限制而引入的 UINT64 手工拆分打印逻辑和 OPC 侧的源码改写流程,并同步调整了 JIT/OPC 编译配置与相关测试。

主要改动

  • 调试输出统一改用 pypto_printf:backend_cce_ops.cpp 中所有调试输出(location header、dump tensor/tile、debug.assert 等)由 cce::printf(...) 改为 pypto_printf(...);pypto_tprint.h 内用 __ENABLE_ASC_PRINTF__ 宏包裹 pypto_printf 模板定义(调 enable_asc_diagnostics() 与 set_atomic_none() 后调用 scalar_printf_impl),未启用时 TPRINT(x) 退化为 ((void)0) 空操作。

  • 删除 64 位无符号整数的拆分展开,改用 %llu/%llx 直接打印:移除 AppendCcePrintfUnsignedDecimalU64、AppendCcePrintfUnsignedHexU64 及 SplitPrintfSegment/PrintfFormatParts 等按 low/mid/high 分段输出的逻辑,MakeCcePrintfStatements 简化为单次生成的 BuildAscPrintfCall;格式重写规则扩展为 lld/lli/llu/llx,指针参数不再强转,直接以 %p 传入。

  • 不再支持 flags、width、precision:backend_utils.cpp 的 FindPrintfConversionIndex 与 debug_ops.py 的 _scan_printf_format 删除了对 -+ #0、宽度、精度及 %#08x 之类格式的解析,遇到此类字符直接报错;对应 ST 测试中的 %+08.3f、%#08x 等格式改为 %f、%x。

  • JIT/OPC 编译配置切换:compile_config.py 的 print_debug_flags 由 --cce-enable-print/-D_DEBUG/-DPTOAS_ENABLE_CCE_PRINT=1 改为 -isystem {toolkit_home}/asc/include 与 -isystem {toolkit_home}/asc;jit.py 在检测到 pypto_printf 调用时向内核头追加 #define __ENABLE_ASC_PRINTF__ 1,打印调用检测由 cce::printf 改为 pypto_printf。

  • OPC 编译流程简化:pypto_compile.py 删除 _needs_tprint_support、_write_ascendc_tprint_header 及 impl 源码中 cce::printf → __pypto_aicore_printf 的字符串替换与 infer 源码 stub 注入,改为直接 shutil.copyfile 拷贝 impl 源码,并在编译选项中追加 -I{pypto_include}。

likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 16 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 16 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 16 Comments:

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
docs ✅ lyz0328, wangbing110, gaoxiang618 (3/2) ✅ lyz0328 (1/1)
framework/include/pypto_pro ✅ wangbing110, gaoxiang618 (2/2) ✅ wangbing110, gaoxiang618 (2/1)
framework/src/interface/pypto_pro ✅ gaoxiang618, wangbing110 (2/2) ✅ gaoxiang618, wangbing110 (2/1)
python/pypto_pro ✅ gaoxiang618, wangbing110 (2/2) ✅ gaoxiang618, wangbing110 (2/1)
repo-cann/pypto ✅ wangbing110, gaoxiang618 (2/2) ✅ wangbing110, gaoxiang618 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 16 Set xinweiliu,lyz0328,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 16 Set xinweiliu,lyz0328,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
yzf
yzf
Sep 16 Comments:

compile

likedislike
yzfyzf
Sep 16 Pre merge succeeded (commit_id: 3fd84ccacaa90c7a9dac682a93e9d252b4c73154)
CANN-robot
CANN-robotCollaborators
Sep 16 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 16 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 16 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 16 Added label: ci-pipeline-passed
poorwill
poorwillCollaborators
Sep 16 Comments:

/approve
/lgtm

likedislike
lyz0328
lyz0328Collaborators
Sep 16 Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
Sep 16 Added label: approved
gaoxiang618
gaoxiang618Collaborators
Sep 16 Comments:

/approve
/lgtm

likedislike
CANN-robotCANN-robotCollaborators
Sep 16 Added label: lgtm
CANN-robotCANN-robotCollaborators
Sep 16 Merged pull request