Pull Request has been successfully merged by CANN-robot.
(Thank you for yzf's contribution.)变更摘要
本 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}。


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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


/approve
/lgtm


/approve


/approve
/lgtm


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