已合并
fix: remove internal timestamp points #4665
fix: remove internal timestamp points #4665
已合并
终于成创建于 28 天前
终于成
终于成成员
28 天前

描述

  1. 删除框架内部打点
  2. 将获取当前cycle的调用点提前,规避 tlb miss 导致的头开销过大

关联的Issue

测试

文档更新

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 终于成 的贡献)
终于成终于成成员
28 天前 创建了 pull request,commit 9985b552
atomgit-bot
atomgit-bot
28 天前 评论:

变更摘要

此 PR 主要移除了框架代码中散布的内部时间戳打印点(PrintTimeStamp),并对核心时间戳底层实现 asc_time_stamp_impl 进行重构:将时间戳捕获动作(asc_capture_time_stamp_cycle)从函数内部提前到调用侧,使时间戳获取与打印解耦。同时清理了多个 Python 代码生成脚本中向生成源码注入时间戳代码的逻辑,以及测试桩头文件中 GET_TILING_DATA 系列宏内的 PrintTimeStamp 调用。

主要改动

  • 移除 HcclImpl DfxScopeGuard 中的时间戳打印:在 hccl_impl_dfx.hDfxScopeGuard 构造函数与析构函数中移除所有 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.hkernel_tpipe_impl_c310.hTPipe 构造函数与多个 InitBuffer 重载中移除所有 PrintTimeStamp 调用。
  • 移除 Python 代码生成脚本和测试宏中的时间戳注入:在 compile_op.pyget_op_tiling.pyextract_host_stub.py 中移除 add_time_stamp_codes 调用逻辑;在多个测试桩头文件(add_custom_tiling.hcube_custom_tiling.h 等)的 GET_TILING_DATA / GET_TILING_DATA_WITH_STRUCT / GET_TILING_DATA_MEMBER 宏中移除时间戳打印。
likedislike
atomgit-bot
atomgit-bot
28 天前 评论:

代码审查

审查总结

本次 PR(fix: remove internal timestamp points)的核心变更是:从算子代码的各个调用点移除 PrintTimeStamp 打点调用,并重构 asc_aicore_time_impl.h 中的时间戳基础设施——将时间戳捕获提前到 dcci 操作之前,以提高打点精度。

共发现 3 个问题,按优先级分布:

优先级 数量 说明
P2 1 asc_time_stamp_impltime 参数在 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_GUARDASCENDC_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 守卫现为死代码

⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。

likedislike
CANN-robotCANN-robot成员
28 天前 添加了label:cann-cla/yes
CANN-robotCANN-robot成员
28 天前 添加了label:stat/needs-squash
CANN-robot
CANN-robot成员
28 天前 评论:

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 /approve or /lgtm
  • Commenting /approve implies 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. 👍

likedislike
CANN-robotCANN-robot成员
28 天前 将zengjuan,zhanghao_0689,suqwe,wulinyu,kong0808,dengjing_aoe,YeZZzzz1,bluesky901,yangbinhua,zhudi22,chenyiyuan,xun_zhuge,XuebinYang,sjtulxh,bianque,houyuyang,Lycheeeee,chentianyu19,shi_nanxiang,wuyang_hw,jiangxinyu3,ascendhjh,hujiawen_kaven,wangxiaozhi,DragonBornHD84,louyuxuan,hyolee,yukangchen设为评审人
CANN-robotCANN-robot成员
28 天前 将zengjuan,zhanghao_0689,suqwe,wulinyu,kong0808,dengjing_aoe,YeZZzzz1,bluesky901,yangbinhua,zhudi22,chenyiyuan,xun_zhuge,XuebinYang,sjtulxh,bianque,houyuyang,Lycheeeee,chentianyu19,shi_nanxiang,wuyang_hw,jiangxinyu3,ascendhjh,hujiawen_kaven,wangxiaozhi,DragonBornHD84,louyuxuan,hyolee,yukangchen设为审查人
gao_dafa成员
28 天前 评论:

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_zhugeascendhjh,我们会为您分配合适的committer进行代码检视。

再次感谢您参与CANN的社区贡献。

likedislike
终于成
终于成成员
27 天前 评论:

compile

likedislike
终于成终于成成员
27 天前 update merge request[project id: 8547062, iid: 4665, commit_id: 40980607434725de1b91de8b7c043f821dda3c5f] virtual merging success
CANN-robotCANN-robot成员
27 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [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
likedislike
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
终于成终于成成员
27 天前 修改了pull request 的描述
CANN-robotCANN-robot成员
27 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
27 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
27 天前 添加了label:ci-pipeline-failed
chenyiyuan成员27 天前进行代码检视2
impl/adv_api/detail/hccl/common/hccl_impl_dfx.h
已过期
@@ -55,7 +55,6 @@ class DfxScopeGuard {
5555public:
5656 __aicore__ inline DfxScopeGuard(HcclApiOperType operType) : operType_(operType)
5757 {
58- PrintTimeStamp(static_cast<uint32_t>(operType_));
chenyiyuan27 天前评论:

HCCL的先不动

likedislike
System
系统消息系统
27 天前 评论:

changed this line on d200e273 view diff detail

终于成终于成成员
27 天前 update merge request[project id: 8547062, iid: 4665, commit_id: af352f603978e8508e0cc847c202592ad3cf5bcf] virtual merging success
终于成终于成成员
27 天前 强制推送  1 个提交:d200e273-fix: remove internal timestamp points
终于成终于成成员
27 天前 update merge request[project id: 8547062, iid: 4665, commit_id: 5623776ec4b641cc7d4b68d138e527be9588a753] virtual merging success
终于成终于成成员
27 天前 解决了最后一个问题
终于成
终于成成员
27 天前 评论:

compile

likedislike
终于成终于成成员
27 天前 update merge request[project id: 8547062, iid: 4665, commit_id: 78af0f81c92e0d97acbfd7e371a5d0bbf0c6aa63] virtual merging success
CANN-robotCANN-robot成员
27 天前 删除了label:ci-pipeline-failedapi-check-pass
CANN-robotCANN-robot成员
27 天前 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robot
CANN-robot成员
27 天前 评论:

流水线任务触发成功
任务链接 [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执行结束

likedislike
CANN-robotCANN-robot成员
27 天前 添加了label:api-check-pass
CANN-robotCANN-robot成员
27 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
27 天前 添加了label:ci-pipeline-passed
chenyiyuan成员
26 天前 评论:

/lgtm
/approve

likedislike
zhugexun_sjtu
zhugexun_sjtu成员
26 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
26 天前 添加了label:lgtm
hujiawen_kaven成员
26 天前 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
26 天前 添加了label:approved
CANN-robotCANN-robot成员
26 天前 合入了pull request