Merged
perf(machine): Host ctrl-flow / stitch hot-path opts for 9.2.0 #7305
perf(machine): Host ctrl-flow / stitch hot-path opts for 9.2.0 #7305
Merged
LordOfMysteriesAdd on 27 days ago
LordOfMysteries
LordOfMysteriesCollaborators
27 days ago

Summary

将 master 上已落地的三笔 host ctrl-flow / stitch 热路径优化合入 9.2.0:

  1. #7244 fix(machine): Compile out host DEV_VERBOSE_ when ENABLE_COMPILE_VERBOSE_LOG=0
    host 侧 DEV_VERBOSE_* 与 device 对齐,用 DEV_IF_VERBOSE_LOG 编译期剔除,避免 CF 录制时假热。
  2. perf(machine): Skip unused ctrl-flow cache payload memset
    CreateHostCtrlFlowCache 不再整页 memset ~100MB;只清元数据前缀,payload 在 AllocateCache 按块清零。
  3. perf(machine): Gate host stitch verify/dump behind VERIFY mode
    默认跳过 CheckStitch / topo dump;仅 runtime_debug_mode=VERIFY 时开启。对外门控直接使用 topo_dump::DumpEnabled()。

Test plan

image.png

image.png

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for LordOfMysteries's contribution.)
LordOfMysteriesLordOfMysteriesCollaborators
27 days ago Created pull request, commit 2c4dca9b
atomgit-bot
atomgit-bot
27 days ago Comments:

变更摘要

本 PR 将 master 上已合入的三项 host ctrl-flow / stitch 热路径优化合并到 9.2.0 分支,目标是降低控制流录制与 stitch 录制阶段的无效开销。核心改动包括:将 host 侧 DEV_VERBOSE_* 日志宏与 device 侧对齐、统一由 DEV_IF_VERBOSE_LOG 在编译期裁剪;把 topo_dump::DumpEnabled() 提升为公共门控接口(device 侧恒为 false),用于按 runtime_debug_mode == VERIFY 决定是否执行 CheckStitch、stitch 边校验与 topo dump;以及让 CreateHostCtrlFlowCache 不再对整个 cache 区做一次性清零,只清元数据前缀,payload 改由 AllocateCache 按块清零。

主要改动

  • host 日志宏编译期裁剪: device_log.h 中的 DEV_VERBOSE_DEBUG_SPLIT、DEV_VERBOSE_DEBUG、DEV_VERBOSE_INFO 改为包裹在 DEV_IF_VERBOSE_LOG 的 do { ... } while (0) 中,使 ENABLE_COMPILE_VERBOSE_LOG=0 时日志代码被编译剔除,避免 CF 录制时的假热。
  • 新增对外 dump 门控接口: 在 dump_device_topo.h 中声明 bool DumpEnabled(),实现从匿名命名空间中移出,host 侧按 CFG_RUNTIME_DBEUG_MODE == CFG_RUNTIME_DEBUG_VERIFY 缓存结果,__DEVICE__ 分支返回 false。
  • stitch 热路径按 VERIFY 模式门控: device_stitch_context.cpp 与 device_slot_context.cpp 中,CheckStitch、ValidateAndDumpStitchEdge 在非 dump 模式下直接 return,DumpProducerCellAccess / DumpConsumerCellAccess 调用改为由 unlikely(topo_dump::DumpEnabled()) 前置判断。
  • ctrl-flow cache 构建去除整块清零: EmulationLauncher::CreateHostCtrlFlowCache 由 AllocZero 改为 AllocDev,仅用 memset_s 清除从结构体起始位置到 cacheData 的 headerBytes 元数据前缀,容量上限部分的 payload 不再预清零。
  • 由 AllocateCache 按块补零: DevControlFlowCache::AllocateCache 在返回前用 memset_s 清零本次 reserved(含 CFGCACHE_ALIGN 对齐填充)区间,保证调用方留下的空洞为 0;并新增 UT 验证被污染的 slab 与对齐填充均被清零。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
27 days ago Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
27 days ago Added label: stat/needs-squash
CANN-robotCANN-robotCollaborators
27 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
27 days ago 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
9.2.0 ✅ jason_yuan_ye, Andy-lb (2/2) ✅ Andy-lb (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
27 days ago Set xinweiliu,cam_bxh,dai-zhentao,TianXL,lululu40888,shi-dingkun,gguuaanngg,codehjp423,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,gcw_kUomxQ2l,Andy-lb,WenboCodes as approver
CANN-robotCANN-robotCollaborators
27 days ago Set TianXL,jiangtao_rts,gitcode-chenjiao,hanxiaolong,gcw_kUomxQ2l,Andy-lb as approver
LordOfMysteries
LordOfMysteriesCollaborators
27 days ago Comments:

compile

likedislike
LordOfMysteriesLordOfMysteriesCollaborators
27 days ago Pre merge succeeded (commit_id: ba460f4dcc0016bfe6038c57466ed3d3b64f7888)
CANN-robot
CANN-robotCollaborators
27 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
27 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
27 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
27 days ago Added label: ci-pipeline-passed
LordOfMysteriesLordOfMysteriesCollaborators
26 days ago Modify description of pull request
LordOfMysteriesLordOfMysteriesCollaborators
26 days ago Modify description of pull request
Andy-lb
Andy-lbCollaborators
24 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
24 days ago Added label: approved
袁野
袁野Collaborators
24 days ago Comments:

/lgtm

likedislike
CANN-robotCANN-robotCollaborators
24 days ago Added label: lgtm
CANN-robotCANN-robotCollaborators
24 days ago Removed label: ci-pipeline-passed
CANN-robot
CANN-robotCollaborators
24 days ago Comments:

The following label is not ready.

ci-pipeline-passed: The ci-pipeline-passed label is expired as added over 72 hours. Please use /compile to recompile.

likedislike
LordOfMysteries
LordOfMysteriesCollaborators
24 days ago Comments:

/compile

likedislike
LordOfMysteriesLordOfMysteriesCollaborators
24 days ago Pre merge succeeded (commit_id: d497ae8ba0d7aa21cd0258f50a8f256f3095a8b1)
CANN-robot
CANN-robotCollaborators
24 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
24 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
24 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
24 days ago Added label: ci-pipeline-passed
CANN-robotCANN-robotCollaborators
24 days ago Merged pull request