已合并
【PR】: [feat] [autofuse] 增加图级schedInfo. #4530
【PR】: [feat] [autofuse] 增加图级schedInfo. #4530
已合并
邢智雄创建于 8月24日
共 5 个文件变更+29-0
@@ -249,6 +249,13 @@ struct SchedInfo {
249 ExecuteCondition exec_condition{ExecuteCondition::kNoCache};249 ExecuteCondition exec_condition{ExecuteCondition::kNoCache};
250};250};
251 251 
252+// 图级调度信息。当前仅用于接收外部统一调度轴,loop_axis 保留给内部流程使用。
253+// 与节点级 SchedInfo 分开定义,避免将节点级 exec_condition 提升到图级。
254+struct GraphSchedInfo {
255+ std::vector<int64_t> axis;
256+ int64_t loop_axis{kIdNone};
257+};
258+ 
252class AscIrAttrDefBase {259class AscIrAttrDefBase {
253 public:260 public:
254 AscIrAttrDefBase() = default;261 AscIrAttrDefBase() = default;
@@ -432,6 +439,11 @@ class AscGraphAttr : public AfAttrGroupsBase {
432 // [HI] 图上的轴439 // [HI] 图上的轴
433 std::vector<AxisPtr> axis;440 std::vector<AxisPtr> axis;
434 441 
442+#ifndef AUTOFUSE_ST_COMPAT_CANN
443+ // 图级调度信息。axis 在进入优化流程前可同步到各节点的 sched.axis。
444+ GraphSchedInfo sched{};
445+#endif
446+ 
435 // TODO 待正式方案后删除447 // TODO 待正式方案后删除
436 TransInfoRoadOfGraph trans_info_road;448 TransInfoRoadOfGraph trans_info_road;
437 449 
@@ -188,6 +188,12 @@ message SchedInfoDef {
188 int64 loop_axis = 3;188 int64 loop_axis = 3;
189 int32 exec_condition = 4;189 int32 exec_condition = 4;
190}190}
191+ 
192+message GraphSchedInfoDef {
193+ repeated int64 axis = 1;
194+ int64 loop_axis = 2;
195+}
196+ 
191message ApiInfoDef {197message ApiInfoDef {
192 int32 type = 1;198 int32 type = 1;
193 int32 compute_type = 2;199 int32 compute_type = 2;
@@ -258,6 +264,7 @@ message AscGraphAttrGroupsDef {
258 repeated AxisDef axis = 2;264 repeated AxisDef axis = 2;
259 int64 type = 3;265 int64 type = 3;
260 repeated string size_var = 4;266 repeated string size_var = 4;
267+ GraphSchedInfoDef sched = 5;
261}268}
262 269 
263message AscIrAttrDef {270message AscIrAttrDef {
@@ -169,6 +169,9 @@ target_compile_definitions(autofuse PRIVATE
169 PROTOBUF_INLINE_NOT_IN_HEADERS=0169 PROTOBUF_INLINE_NOT_IN_HEADERS=0
170 google=ascend_private170 google=ascend_private
171 AUTOFUSE_USE_GE_METADEF171 AUTOFUSE_USE_GE_METADEF
172+ # Keep the test-only autofuse library ABI-compatible with the external
173+ # CANN AscIR library until the matching package is available.
174+ AUTOFUSE_ST_COMPAT_CANN
172)175)
173 176 
174target_include_directories(autofuse PUBLIC177target_include_directories(autofuse PUBLIC
@@ -29,6 +29,10 @@ target_compile_definitions(autofusion_st PRIVATE
29 PROTOBUF_INLINE_NOT_IN_HEADERS=029 PROTOBUF_INLINE_NOT_IN_HEADERS=0
30 google=ascend_private30 google=ascend_private
31 AUTOFUSE_USE_GE_METADEF31 AUTOFUSE_USE_GE_METADEF
32+ # The ST target currently links a CANN AscIR library with the old
33+ # AscGraphAttr layout. Keep this test target ABI-compatible until the
34+ # matching CANN package is available.
35+ AUTOFUSE_ST_COMPAT_CANN
32 )36 )
33 37 
34target_compile_options(autofusion_st PRIVATE ${ASCGEN_DT_COMPILE_OPTION}38target_compile_options(autofusion_st PRIVATE ${ASCGEN_DT_COMPILE_OPTION}
@@ -25,6 +25,9 @@ target_compile_definitions(autofusion_ut PRIVATE
25 PROTOBUF_INLINE_NOT_IN_HEADERS=025 PROTOBUF_INLINE_NOT_IN_HEADERS=0
26 google=ascend_private26 google=ascend_private
27 AUTOFUSE_USE_GE_METADEF27 AUTOFUSE_USE_GE_METADEF
28+ # Keep this test executable ABI-compatible with the external CANN
29+ # AscIR library, just like the shared test autofuse target.
30+ AUTOFUSE_ST_COMPAT_CANN
28 )31 )
29 32 
30target_compile_options(autofusion_ut PRIVATE ${ASCGEN_DT_COMPILE_OPTION}33target_compile_options(autofusion_ut PRIVATE ${ASCGEN_DT_COMPILE_OPTION}