Pull Request已成功合入, 合并人@CANN-robot
(感谢 邢智雄 的贡献)变更摘要
该 PR 主要新增了图级别的调度(sched)信息,并为该信息配套提供 Python 访问接口、序列化/反序列化支持以及 Python 代码 dump 输出。核心改动是引入独立的图级调度数据结构 GraphSchedInfo(包含 axis 与 loop_axis)并挂载到 AscGraphAttr 上,在优化流程中通过 ScheduleUtils::ApplyGraphSchedAxisToNodes 将图级统一轴下发到各节点,同时为 Python 侧的 HintGraph 增加 sched 属性入口,实现 graph.sched.axis 的读写与 dump。
主要改动
- 新增图级调度数据结构: 在
ascendc_ir_def.h中新增GraphSchedInfo(含axis向量与默认值为kIdNone的loop_axis),并在AscGraphAttr中新增sched字段;注释说明其与节点级SchedInfo分开定义,避免将节点级exec_condition提升到图级。 - 扩展序列化协议: 在
af_ir.proto中新增GraphSchedInfoDef消息,并在AscGraphAttrGroupsDef中新增编号为 5 的sched字段;ascendc_ir.cc的SerializeAttr/DeserializeAttr相应增加对sched.axis与sched.loop_axis的写入和读取。 - 新增 Python 接口:
pyascir.cpp将SchedInfoPython 对象由持有af::SchedInfo *改为持有axis/loop_axis指针,并新增SchedInfo::FromGraph与HintGraph::GetSched;pyascir_types.cpp为HintGraph注册schedgetsetter(属性描述 "Graph schedule attributes."),使 Python 侧可访问和设置图级调度轴。 - 优化流程下发图级轴:
schedule_utils.cpp新增ApplyGraphSchedAxisToNodes,将graph.sched.axis作为统一输入轴同步到各节点的sched.axis(保留节点级loop_axis与exec_condition),并在NormalizeAxisIds中对图级sched.axis/loop_axis做轴 id 归一化;optimize.cpp的OptimizeForHintGraph在归一化后调用该方法下发。 - dump 输出图级 sched:
ascend_graph_code_dumper.cpp的GenerateGraphInstance在生成 Python 代码时,若graph_attr->sched.axis非空则输出graph.sched.axis = ...语句,用于 dump 图级调度信息。


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
/approveor/lgtm- Commenting
/approveimplies 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. 👍


/check-pr


The following label is not ready.
approved: Please wait for committers to review the code.


/approve


Pull Request
描述
给ascgraph新增图级schedInfo,同时提供对外的getter/setter接口,为后续将node级schedInfo收编成图级schedInfo做铺垫。
当前新增图级接口之后,在schedule的入口处先将图级的schedInfo下发给node级schedInfo,保持内部逻辑先不动,等后续node级schedInfo全部收编完成后再一把切换。
变更类型
请选择本次引入的变更类型:
关联的Issue
如何测试
描述测试此变更的步骤和前提条件:
核对清单
其他信息
在此添加任何其他关于本次 PR 的说明。