Pull Request已成功合入, 合并人@CANN-robot
(感谢 终于成 的贡献)变更摘要
此 PR 主要移除了框架代码中散布的内部时间戳打印点(PrintTimeStamp),并对核心时间戳底层实现 asc_time_stamp_impl 进行重构:将时间戳捕获动作(asc_capture_time_stamp_cycle)从函数内部提前到调用侧,使时间戳获取与打印解耦。同时清理了多个 Python 代码生成脚本中向生成源码注入时间戳代码的逻辑,以及测试桩头文件中 GET_TILING_DATA 系列宏内的 PrintTimeStamp 调用。
主要改动
- 移除 HcclImpl DfxScopeGuard 中的时间戳打印:在
hccl_impl_dfx.h的DfxScopeGuard构造函数与析构函数中移除所有PrintTimeStamp调用,消除了通信操作入口/出口的内部打点。 - 移除 KFC 和 Matmul 注册宏中的时间戳打印:在
kfc_register_obj.h的多个REGIST_CUBE_OBJ宏变体中移除PrintTimeStamp调用,涉及 server 初始化、client KFC 注册、矩阵 KFC 设置等关键路径。 - 重构时间戳底层实现:在
asc_aicore_time_impl.h中重构asc_time_stamp_impl,增加time参数由调用方传入;新增asc_capture_time_stamp_cycle()函数供调用方提前获取系统周期数;DumpTimeStampImpl改为先捕获周期再调用新接口。 - 移除 TPipe 初始化中的时间戳打印:在
kernel_tpipe_impl.h和kernel_tpipe_impl_c310.h的TPipe构造函数与多个InitBuffer重载中移除所有PrintTimeStamp调用。 - 移除 Python 代码生成脚本和测试宏中的时间戳注入:在
compile_op.py、get_op_tiling.py、extract_host_stub.py中移除add_time_stamp_codes调用逻辑;在多个测试桩头文件(add_custom_tiling.h、cube_custom_tiling.h等)的GET_TILING_DATA/GET_TILING_DATA_WITH_STRUCT/GET_TILING_DATA_MEMBER宏中移除时间戳打印。


代码审查
审查总结
本次 PR(fix: remove internal timestamp points)的核心变更是:从算子代码的各个调用点移除 PrintTimeStamp 打点调用,并重构 asc_aicore_time_impl.h 中的时间戳基础设施——将时间戳捕获提前到 dcci 操作之前,以提高打点精度。
共发现 3 个问题,按优先级分布:
| 优先级 | 数量 | 说明 |
|---|---|---|
| P2 | 1 | asc_time_stamp_impl 的 time 参数在 ASCENDC_TIME_STAMP_ON 关闭时未使用,可能触发编译警告/错误 |
| P3 | 2 | 移除 PrintTimeStamp 后遗留的死代码(#ifdef 条件编译守卫和空操作宏分支) |
整体风险评估:低风险。所有 PrintTimeStamp 调用移除均一致且正确,时间戳基础设施重构逻辑正确,未发现正确性或安全性问题。P2 问题取决于编译器的警告策略,P3 问题为代码整洁性改进。
各文件审查确认:
| 文件 | 结果 |
|---|---|
cmake/asc/legacy_modules/util/extract_host_stub.py |
无问题 |
impl/adv_api/detail/hccl/common/hccl_impl_dfx.h |
P3:DFX_MAKE_GUARD 的 ASCENDC_TIME_STAMP_ON 分支现为空操作 |
impl/adv_api/detail/kfc/kfc_register_obj.h |
无问题 |
impl/basic_api/dav_3510/kernel_operator_dump_tensor_impl.h |
无问题 |
impl/basic_api/dav_3510/kernel_tpipe_impl_c310.h |
无问题 |
impl/basic_api/dav_c220/kernel_operator_dump_tensor_impl.h |
无问题 |
impl/basic_api/kernel_tpipe_impl.h |
无问题 |
impl/utils/debug/asc_aicore_time_impl.h |
P2:time 参数在宏关闭时未使用 |
tests/python/adapter/stub_kernels/add_custom_tiling.h |
P3:#ifdef 守卫现为死代码 |
tests/python/adapter/stub_kernels/add_custom_unalign_tiling.h |
P3:#ifdef 守卫现为死代码 |
tests/python/adapter/stub_kernels/cube_custom_tiling.h |
P3:#ifdef 守卫现为死代码 |
tests/python/asc_op_compiler/stub_kernels/add_custom_tiling.h |
P3:#ifdef 守卫现为死代码 |
tests/python/asc_op_compiler/stub_kernels/add_custom_unalign_tiling.h |
P3:#ifdef 守卫现为死代码 |
tests/python/asc_op_compiler/stub_kernels/cube_custom_tiling.h |
P3:#ifdef 守卫现为死代码 |
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


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 |
|---|---|---|
| cmake | ✅ 诸葛洵, hujiawen_kaven, chenyiyuan (3/2) | ✅ 诸葛洵 (1/1) |
| impl/basic_api | ✅ hujiawen_kaven, 诸葛洵, chenyiyuan (3/2) | ✅ chenyiyuan, hujiawen_kaven (2/1) |
| repo-cann/asc-devkit | ✅ chenyiyuan, 诸葛洵, hujiawen_kaven (3/2) | ✅ chenyiyuan, 诸葛洵, hujiawen_kaven (3/1) |
| tools/build | ✅ hujiawen_kaven, chenyiyuan, 诸葛洵 (3/2) | ✅ hujiawen_kaven (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
kyzyc, thanks for your pull request. All authors of the commits have signed the CLA. 👍


kyzyc,感谢您的提交,建议在完成PR充分自验证后,再触发线上构建任务。
若您的PR已具备检视条件,可根据下表的责任田,@对应的committer进行代码检视,我们会在第一时间对您的提交进行处理。
代码责任田:
| module | committer |
|---|---|
| adv_api | chenyiyuan, wuyang_hw |
| basic_api | chenyiyuan, wuyang_hw |
| c_api | pangfd, haipingmao |
| cmake | xun_zhuge, DragonBornHD84 |
| docs | munanhw, ai_xin |
| examples | changxianyu, bianque |
| simt_api | wulinyu, zhanghao_0689 |
| scripts | xun_zhuge, kevin365 |
| tools | YANXI_ZHAO, XuebinYang, sjtulxh |
💡 如您不确定可以@谁,可以直接@我或者ascend-c sig的maintainer,xun_zhuge和ascendhjh,我们会为您分配合适的committer进行代码检视。
再次感谢您参与CANN的社区贡献。


compile


流水线任务触发成功
任务链接 [b6c65d6d68ce4ce1a47d1930b20fc36d][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ❌ FAILED | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck | ❌ FAILED | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_md | ✅ SUCCESS |


流水线任务触发成功
任务链接 [5d18a14eda814a7abbb6c3b36d1c83e7][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-28 08:29:50] CI执行结束


流水线任务触发成功
任务链接 [59a540cdb33d49f08b809244d28105ac][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_adv_test_one | ✅ SUCCESS | ||
| UT_Test_adv_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_one | ✅ SUCCESS | ||
| UT_Test_basic_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_three | ✅ SUCCESS | ||
| UT_Test_basic_test_four | ✅ SUCCESS | ||
| UT_Test_basic_test_five | ✅ SUCCESS | ||
| UT_Test_arm | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| UT_Test_report | ✅ SUCCESS | >>>>> |
[2026-07-28 08:44:51] CI执行结束


HCCL的先不动


compile


流水线任务触发成功
任务链接 [70e013ebcc7d4721b933331b4f8ad97d][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| codecheck | ✅ SUCCESS | >>>>> | |
| codecheck_Pr | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| StaticCheck_codespell | ✅ SUCCESS | ||
| StaticCheck_link_validity | ✅ SUCCESS | ||
| StaticCheck_resource_existence | ✅ SUCCESS | ||
| StaticCheck_tag_closed | ✅ SUCCESS | ||
| StaticCheck_markdownlint | ✅ SUCCESS | ||
| codecheck_codestyle | ✅ SUCCESS | >>>>> | |
| codecheck_precommit | ✅ SUCCESS | >>>>> | |
| StaticCheck_md | ✅ SUCCESS |
[2026-07-28 10:35:37] CI执行结束


流水线任务触发成功
任务链接 [5c3d52d66c1143809bd4b95422d50ade][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| Compile_Ascend_ARM_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| PreSmoke_A900_npupool | ✅ SUCCESS | >>>>> |
[2026-07-28 10:43:13] CI执行结束


流水线任务触发成功
任务链接 [dd07e85aab594bb2ae5879ee03c264f6][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| Compile_Ascend_X86_ubuntu24 | ✅ SUCCESS | >>>>> | >>>>> |
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_adv_test_one | ✅ SUCCESS | ||
| UT_Test_adv_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_one | ✅ SUCCESS | ||
| UT_Test_basic_test_two | ✅ SUCCESS | ||
| UT_Test_basic_test_three | ✅ SUCCESS | ||
| UT_Test_basic_test_four | ✅ SUCCESS | ||
| UT_Test_basic_test_five | ✅ SUCCESS | ||
| UT_Test_arm | ✅ SUCCESS | ||
| API_Check | ✅ SUCCESS | >>>>> | |
| UT_Test_report | ✅ SUCCESS | >>>>> |
[2026-07-28 10:55:45] CI执行结束


/lgtm
/approve


/lgtm
/approve


/lgtm
/approve


描述
关联的Issue
测试
文档更新
类型标签