已合并
【PR】: [feat] 添加图级别的sched信息,并新增对应的python/序列化/dump接口. #1790
【PR】: [feat] 添加图级别的sched信息,并新增对应的python/序列化/dump接口. #1790
已合并
邢智雄创建于 15 天前
邢智雄
邢智雄成员
15 天前

Pull Request

描述

给ascgraph新增图级schedInfo,同时提供对外的getter/setter接口,为后续将node级schedInfo收编成图级schedInfo做铺垫。
当前新增图级接口之后,在schedule的入口处先将图级的schedInfo下发给node级schedInfo,保持内部逻辑先不动,等后续node级schedInfo全部收编完成后再一把切换。

变更类型

请选择本次引入的变更类型:

关联的Issue

如何测试

描述测试此变更的步骤和前提条件:

  1. inductor+af流程,前端保持老流程不动,所有inductor+af用例和网络均不受影响,验证兼容性
  2. inductor+af流程,前端将设置node级sched.axis接口改为直接设置图级sched.axis接口,所有inductor+af用例和网络仍不受影响,验证新接口无问题

核对清单

其他信息

在此添加任何其他关于本次 PR 的说明。

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 邢智雄 的贡献)
邢智雄邢智雄成员
15 天前 添加了label:enhancement
邢智雄邢智雄成员
15 天前 创建了 pull request,commit dc245c4f
atomgit-bot
atomgit-bot
15 天前 评论:

变更摘要

该 PR 主要新增了图级别的调度(sched)信息,并为该信息配套提供 Python 访问接口、序列化/反序列化支持以及 Python 代码 dump 输出。核心改动是引入独立的图级调度数据结构 GraphSchedInfo(包含 axisloop_axis)并挂载到 AscGraphAttr 上,在优化流程中通过 ScheduleUtils::ApplyGraphSchedAxisToNodes 将图级统一轴下发到各节点,同时为 Python 侧的 HintGraph 增加 sched 属性入口,实现 graph.sched.axis 的读写与 dump。

主要改动

  • 新增图级调度数据结构: 在 ascendc_ir_def.h 中新增 GraphSchedInfo(含 axis 向量与默认值为 kIdNoneloop_axis),并在 AscGraphAttr 中新增 sched 字段;注释说明其与节点级 SchedInfo 分开定义,避免将节点级 exec_condition 提升到图级。
  • 扩展序列化协议: 在 af_ir.proto 中新增 GraphSchedInfoDef 消息,并在 AscGraphAttrGroupsDef 中新增编号为 5 的 sched 字段;ascendc_ir.ccSerializeAttr/DeserializeAttr 相应增加对 sched.axissched.loop_axis 的写入和读取。
  • 新增 Python 接口: pyascir.cppSchedInfo Python 对象由持有 af::SchedInfo * 改为持有 axis/loop_axis 指针,并新增 SchedInfo::FromGraphHintGraph::GetSchedpyascir_types.cppHintGraph 注册 sched getsetter(属性描述 "Graph schedule attributes."),使 Python 侧可访问和设置图级调度轴。
  • 优化流程下发图级轴: schedule_utils.cpp 新增 ApplyGraphSchedAxisToNodes,将 graph.sched.axis 作为统一输入轴同步到各节点的 sched.axis(保留节点级 loop_axisexec_condition),并在 NormalizeAxisIds 中对图级 sched.axis/loop_axis 做轴 id 归一化;optimize.cppOptimizeForHintGraph 在归一化后调用该方法下发。
  • dump 输出图级 sched: ascend_graph_code_dumper.cppGenerateGraphInstance 在生成 Python 代码时,若 graph_attr->sched.axis 非空则输出 graph.sched.axis = ... 语句,用于 dump 图级调度信息。
likedislike
atomgit-bot
atomgit-bot
15 天前 评论:

代码审查

✅ 未发现问题

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

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/graph-autofusion yangyongqiang0606, xchu42, wangxiaotian995 (3/2) yangyongqiang0606 (1/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
此处折叠了156条消息 查看更多
邢智雄
邢智雄成员
3 天前 评论:

/check-pr

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

The following label is not ready.

approved: Please wait for committers to review the code.

likedislike
yangyongqiang
yangyongqiang成员
3 天前 评论:

/approve

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