Merged
aclnn手写框架支持按算子级上报profiling #934
ren-botaoAdd on Sep 24
aclnn手写框架支持按算子级上报profiling #934
Merged
ren-botaoAdd on Sep 24
ren-botao
ren-botaoCollaborators
Sep 24

描述

aclnn 手写框架引入按算子级(opType)控制 profiling 上报的能力:新增算子级 profiling 开关状态及查询接口,并在 tiling 上报、kernel launch 上报、addition info、cache 上报等路径上依据算子是否使能来决定是否采集/上报。改动通过 ProfilingCallBack 依据 PROF_OP_MASK 更新开关,并依赖弱符号 MsprofCheckOpSwitch 判断具体算子是否命中配置;同时将 opType 贯通到 kernel launch 配置与 cache 结构,并在 rts_arg 中按需下发 ACL_RT_LAUNCH_KERNEL_ATTR_ENABLE_PROFILING 属性。此外,将版本相关宏从 op_feature.cpp 上移到 op_feature_internal.h,新增 RUNTIME_VERSION_SUPPORT_OP_PROFILING 等编译期开关。

关联的Issue

#532

测试

新增UT看护用例
二级冒烟看护

文档更新

不涉及

类型标签

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for ren-botao's contribution.)
ren-botaoren-botaoCollaborators
Sep 24 Created pull request, commit a8d38011
atomgit-bot
atomgit-bot
Sep 24 Comments:

变更摘要

本 PR 为 aclnn 手写框架引入按算子级(opType)控制 profiling 上报的能力:新增算子级 profiling 开关状态及查询接口,并在 tiling 上报、kernel launch 上报、addition info、cache 上报等路径上依据算子是否使能来决定是否采集/上报。改动通过 ProfilingCallBack 依据 PROF_OP_MASK 更新开关,并依赖弱符号 MsprofCheckOpSwitch 判断具体算子是否命中配置;同时将 opType 贯通到 kernel launch 配置与 cache 结构,并在 rts_arg 中按需下发 ACL_RT_LAUNCH_KERNEL_ATTR_ENABLE_PROFILING 属性。此外,将版本相关宏从 op_feature.cpp 上移到 op_feature_internal.h,新增 RUNTIME_VERSION_SUPPORT_OP_PROFILING 等编译期开关。

主要改动

  • 新增算子级 profiling 开关与查询接口: 在 op_dfx.cpp 中新增原子变量 g_enableSpecifiedOpProfiling、SetSpecifiedOpProfilingSwitch(依据 PROF_OP_MASK 更新)与 CheckSpecifiedOpProfiling(通过弱符号 MsprofCheckOpSwitch 按算子名查询),并在 ProfilingCallBack 启动/停止时更新与复位该开关;op_dfx_internal.h 暴露 IsSpecifiedOpProfilingEnabled、CheckSpecifiedOpProfiling 及内联的 IsTilingProfilingEnabled、IsL0ProfilingEnabled。
  • 上报路径按算子级开关门控: op_kernel.h、non_finite_check_op.h、dsa_task.h、op_cache.cpp 中的 tiling、kernel launch、addition info 与 cache 上报由原先仅判断 opProfilingSwitch 标志,改为叠加 IsTilingProfilingEnabled(opType_) / IsL0ProfilingEnabled(opType_) 判断,未使能时使用 kInvalidProfilingId 替代真实 profiling id。
  • opType 贯通 kernel launch 与缓存结构: KernelLaunchConfig 新增 opType 字段,op_kernel.h 多处赋值 launchCfg.opType = opType_;OpExecCacheDfx 新增 opType_ 及 SetOpType/GetOpType,CacheDfxInfo 与 OpExecCache::Run 相应传入并使用该 opType 判断是否需要 profiling。
  • 下发 kernel profiling 属性: rts_arg.cpp 新增 AddOpProfilingLaunchKernelAttr,在 profiling 上报类型开启且算子命中配置时,向 launch 属性追加 ACL_RT_LAUNCH_KERNEL_ATTR_ENABLE_PROFILING,并对 runtime 版本不足或编译期不支持的情况仅打印一次告警。
  • 新增编译期版本宏并调整 rts_arg 字段命名: op_feature_internal.h 新增 PKG_VERSION_NUM_9_2_0、RUNTIME_VERSION_SUPPORT_PCIE_THROUGH、RUNTIME_VERSION_SUPPORT_OP_PROFILING 宏,op_feature.cpp 改用这些宏;rts_arg.h 将 opType_ 字段重命名为 l0Name_(SetOpType/GetOpType 改为 SetL0Name/GetL0Name)并扩大缓冲长度,新增 GetOpType 返回 launchCfg_.opType。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 24 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 24 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 24 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
repo-cann/opbase ✅ 宋恺, 汤平川 (2/2) ✅ 宋恺, 汤平川 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
76 messages are collapsed here。 See more
CANN-robotCANN-robotCollaborators
Oct 20 Added label: approved
TangPC
TangPCCollaborators
Oct 20 Comments:

/lgtm
/approve

likedislike
CANN-robotCANN-robotCollaborators
Oct 20 Added label: lgtm
CANN-robotCANN-robotCollaborators
Oct 20 Closed associated issue
CANN-robotCANN-robotCollaborators
Oct 20 Merged pull request