Merged
feat(tool): Speed up swimlane-graph generation #5945
sunhaoxuan2024Add on Sep 4
feat(tool): Speed up swimlane-graph generation #5945
Merged
sunhaoxuan2024Add on Sep 4
sunhaoxuan2024
sunhaoxuan2024Collaborators
Sep 4

泳道图增加开始结束标识,并且优化泳道图生成性能

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for sunhaoxuan2024's contribution.)
sunhaoxuan2024sunhaoxuan2024Collaborators
Sep 4 Created pull request, commit 55cc6810
atomgit-bot
atomgit-bot
Sep 4 Comments:

变更摘要

本 PR 针对泳道图生成工具 tools/profiling/draw_swim_lane.py 进行性能优化:通过引入更快的 JSON 解析与序列化方式、用哈希索引字典替代线性查找、为重复的算子信息查询增加缓存,并配合 gc.freeze() 等手段减少生成耗时,同时新增泳道图生成的开始/结束打印标识,便于观测生成流程。

主要改动

  • JSON 解析加速: 在 load_json 中优先尝试使用 orjson(import orjson as _fast_json,导入失败则回退标准 json),并在解析期间临时执行 gc.disable() 以提升大文件读取性能。
  • JSON 输出压缩: convert_to_chrome_trace_json 将带缩进的 json.dump(..., indent=4) 改为 json.dumps(..., separators=(",", ":")) 后直接写入文件,去除多余空白以减小生成的 trace 文件体积。
  • 哈希索引字典替代线性查找: 删除逐个遍历的 get_func_index,改为在 load_dyn_topo 中预先构建 func_index_by_hash 字典,将 root_index、leaf_index 的查询由线性扫描降为 O(1) 字典查找。
  • 重复计算结果缓存: 在 load_dyn_topo 中新增 hash_order_info_cache、tensors_cache、rawtensors_cache,复用 fcvt.get_hash_order_info_for_task、fcvt.get_tensors、fcvt.get_rawtensors 的结果,避免同哈希任务的重复计算。
  • GC 冻结与流程标识: 在 __main__ 读取函数表数据后调用 gc.freeze() 减少 GC 开销,并在生成前后打印 Swimlane diagram generation start/end 标识以标明生成起止。
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 4 Comments:

代码审查

✅ 未发现问题

likedislike
Incorrect?
CANN-robotCANN-robotCollaborators
Sep 4 Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
Sep 4 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
tools/profiling ✅ 尹杰, congqiannan (2/2) ✅ 尹杰 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robotCollaborators
Sep 4 Set xinweiliu,cam_bxh,dai-zhentao,lululu40888,shi-dingkun,gguuaanngg,codehjp423,gaoxiang618,wangzheng97,DCGDDD,syfeng,jason_yuan_ye,foundea,ym-HW,hw_zhangzhiqi,yinjie27_,congqiannan,zhangyuebing,tsungl4,gaoxingwang,zhiweiyuan,caodongdong,make_pto,zhoubotcam,linjiashu,wangbing110,WenboCodes as approver
CANN-robotCANN-robotCollaborators
Sep 4 Set jason_yuan_ye,yinjie27_,tsungl4,gaoxingwang,linjiashu as approver
sunhaoxuan2024sunhaoxuan2024Collaborators
Sep 4 Associated issue: [Bug-Report|缺陷反馈]: 泳道脚本解析大数据几十分钟零输出
sunhaoxuan2024sunhaoxuan2024Collaborators
Sep 4 Deleted associated issue: [Bug-Report|缺陷反馈]: 泳道脚本解析大数据几十分钟零输出
sunhaoxuan2024sunhaoxuan2024Collaborators
Sep 4 Associated issue: [Bug-Report|缺陷反馈]: pypto-gym gdr_fwd用例编译期报错 PASS_INNER_ERROR CoreAssign UB_ALLOC internal SubgraphID failed
sunhaoxuan2024
sunhaoxuan2024Collaborators
Sep 7 Comments:

compile

likedislike
sunhaoxuan2024sunhaoxuan2024Collaborators
Sep 7 Pre merge succeeded (commit_id: b4e6d3547d0cdb4d31c2b2cdad413d48a90ca43a)
CANN-robot
CANN-robotCollaborators
Sep 7 Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
Sep 7 Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 7 Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
Sep 7 Added label: ci-pipeline-passed
congqiannan
congqiannanCollaborators
Sep 7 Comments:

/lgtm

likedislike
wangzheng97
wangzheng97Collaborators
Sep 7 Comments:

/approve

likedislike
CANN-robot
CANN-robotCollaborators
Sep 7 Comments:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wangzheng97

likedislike
Jie Yin
Jie YinCollaborators
Sep 7 Comments:

/approve

likedislike
CANN-robot
CANN-robotCollaborators
Sep 7 Comments:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
wangzheng97

likedislike
CANN-robotCANN-robotCollaborators
Sep 7 Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
Sep 7 Merged pull request