已合并
fix: 优化Gather Reduce融合场景核数惩罚 #1314
fix: 优化Gather Reduce融合场景核数惩罚 #1314
已合并
zhang_shengjie创建于 7月17日
7 个文件变更+240-6
@@ -519,8 +519,9 @@ Expr GenerateTilingExpr::CalcPenaltyCoreNumRatio(const AttAxis *split_axis,
519 GELOGD("[DFX] CalcPenaltyCoreNumRatio: accumulated=%s", Str(a_axis_size).c_str());519 GELOGD("[DFX] CalcPenaltyCoreNumRatio: accumulated=%s", Str(a_axis_size).c_str());
520 }520 }
521 521 
522- // 获取CacheLine大小522+ // 获取惩罚计算使用的CacheLine大小;特殊融合场景可使用独立粒度,不影响物理Cache Line配置。
523- uint32_t cache_line_size = GetCacheLineSize();523+ uint32_t cache_line_size =
524+ tuning_space_->penalty_cache_line_size > 0 ? tuning_space_->penalty_cache_line_size : GetCacheLineSize();
524 525 
525 // 计算 core_num_ratio = (a_axis_size * data_type_size) / cache_line_size526 // 计算 core_num_ratio = (a_axis_size * data_type_size) / cache_line_size
526 Expr core_num_ratio = (a_axis_size * af::Symbol(data_type_size)) / af::Symbol(cache_line_size);527 Expr core_num_ratio = (a_axis_size * af::Symbol(data_type_size)) / af::Symbol(cache_line_size);
@@ -30,6 +30,8 @@
30#include "reuse_group_utils/reuse_group_utils.h"30#include "reuse_group_utils/reuse_group_utils.h"
31#include "schedule_result.h"31#include "schedule_result.h"
32#include "ascgraph_info_complete.h"32#include "ascgraph_info_complete.h"
33+#include "ascir_ops.h"
34+#include "ascir/meta/ascir_ops_utils.h"
33 35 
34namespace att {36namespace att {
35namespace {37namespace {
@@ -39,8 +41,64 @@ const std::string kModelInfoFileName = "model_info.json";
39constexpr uint32_t kConstType = 1U;41constexpr uint32_t kConstType = 1U;
40constexpr uint32_t kVarType = 2U;42constexpr uint32_t kVarType = 2U;
41constexpr uint32_t kDefaultAlignValue = 1U;43constexpr uint32_t kDefaultAlignValue = 1U;
44+constexpr uint32_t kGatherReducePenaltyCacheLineSize = 32U;
42const std::string kModelInfoFilePath = "./";45const std::string kModelInfoFilePath = "./";
43 46 
47+bool HasComputeType(const std::vector<af::AscGraph> &graphs, const af::ComputeType compute_type) {
48+ for (const auto &graph : graphs) {
49+ for (const auto &node : graph.GetAllNodes()) {
50+ if (node->attr.api.compute_type == compute_type) {
51+ return true;
52+ }
53+ }
54+ }
55+ return false;
56+}
57+ 
58+bool HasGatherNode(const std::vector<std::vector<af::AscGraph>> &schedule_groups) {
59+ for (const auto &group : schedule_groups) {
60+ for (const auto &graph : group) {
61+ for (const auto &node : graph.GetAllNodes()) {
62+ if (af::ops::IsOps<af::ascir_op::Gather>(node)) {
63+ return true;
64+ }
65+ }
66+ }
67+ }
68+ return false;
69+}
70+ 
71+bool ShouldEnableGatherReducePenalty(const std::vector<std::vector<af::AscGraph>> &schedule_groups,
72+ const size_t group_id, const bool enable_group_parallel) {
73+ if (enable_group_parallel) {
74+ GELOGD(
75+ "[DFX] GatherReducePenalty decision: group_id=%zu, group_count=%zu, enable_group_parallel=1, enabled=0, "
76+ "reason=group_parallel",
77+ group_id, schedule_groups.size());
78+ return false;
79+ }
80+ if (schedule_groups.size() <= 1UL) {
81+ GELOGD(
82+ "[DFX] GatherReducePenalty decision: group_id=%zu, group_count=%zu, enable_group_parallel=0, enabled=0, "
83+ "reason=single_group",
84+ group_id, schedule_groups.size());
85+ return false;
86+ }
87+ if (!HasComputeType(schedule_groups[group_id], af::ComputeType::kComputeReduce)) {
88+ GELOGD(
89+ "[DFX] GatherReducePenalty decision: group_id=%zu, group_count=%zu, enable_group_parallel=0, enabled=0, "
90+ "reason=group_without_reduce",
91+ group_id, schedule_groups.size());
92+ return false;
93+ }
94+ const bool has_gather = HasGatherNode(schedule_groups);
95+ GELOGD(
96+ "[DFX] GatherReducePenalty decision: group_id=%zu, group_count=%zu, enable_group_parallel=0, enabled=%d, "
97+ "reason=%s",
98+ group_id, schedule_groups.size(), has_gather, has_gather ? "gather_reduce" : "gather_not_found");
99+ return has_gather;
100+}
101+ 
44std::set<std::string> GetUbContainerNames(const ModelInfo &model_info) {102std::set<std::string> GetUbContainerNames(const ModelInfo &model_info) {
45 std::set<std::string> names;103 std::set<std::string> names;
46 const auto ub_iter = model_info.hardware_cons.find(HardwareDef::UB);104 const auto ub_iter = model_info.hardware_cons.find(HardwareDef::UB);
@@ -343,6 +401,12 @@ inline bool IsAxesReorderAlgorithm() {
343 401 
344af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list,402af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list,
345 const std::map<std::string, std::string> &options, bool enable_group_parallel) {403 const std::map<std::string, std::string> &options, bool enable_group_parallel) {
404+ return GenerateModelInfo(graph_list, model_info_list, options, enable_group_parallel, false);
405+}
406+ 
407+af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list,
408+ const std::map<std::string, std::string> &options, bool enable_group_parallel,
409+ bool enable_gather_reduce_penalty) {
346 GE_ASSERT_SUCCESS(CheckKeyValid(graph_list));410 GE_ASSERT_SUCCESS(CheckKeyValid(graph_list));
347 uint32_t tiling_key = 0U;411 uint32_t tiling_key = 0U;
348 for (auto &graph : graph_list) {412 for (auto &graph : graph_list) {
@@ -354,6 +418,11 @@ af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::v
354 std::vector<AttAxisPtr> tiling_R_arg_list;418 std::vector<AttAxisPtr> tiling_R_arg_list;
355 TuningSpacePtr tuning_space = af::MakeShared<TuningSpace>();419 TuningSpacePtr tuning_space = af::MakeShared<TuningSpace>();
356 GE_ASSERT_NOTNULL(tuning_space, "Make tuning space failed.");420 GE_ASSERT_NOTNULL(tuning_space, "Make tuning space failed.");
421+ if (enable_gather_reduce_penalty) {
422+ tuning_space->penalty_cache_line_size = kGatherReducePenaltyCacheLineSize;
423+ }
424+ GELOGD("[DFX] GatherReducePenalty config: graph=%s, enabled=%d, penalty_cache_line_size=%u",
425+ graph.GetName().c_str(), enable_gather_reduce_penalty, tuning_space->penalty_cache_line_size);
357 tuning_space->cache_line_config = &model_info.cache_line_config;426 tuning_space->cache_line_config = &model_info.cache_line_config;
358 GetThreadLocalContext().SetOption(options);427 GetThreadLocalContext().SetOption(options);
359 GE_ASSERT_SUCCESS(GenerateModelInfo(graph, model_info, tuning_space, tiling_key), "General model info failed.");428 GE_ASSERT_SUCCESS(GenerateModelInfo(graph, model_info, tuning_space, tiling_key), "General model info failed.");
@@ -435,8 +504,14 @@ af::Status ProcessAndSetScheduleGroupInfo(const std::vector<std::vector<af::AscG
435 "%zu, graph name %s.",504 "%zu, graph name %s.",
436 asc_graph_id, impl_graph_id, schedule_group_id, schedule_groups[schedule_group_id].size(),505 asc_graph_id, impl_graph_id, schedule_group_id, schedule_groups[schedule_group_id].size(),
437 !schedule_groups[schedule_group_id].empty() ? schedule_groups[schedule_group_id][0].GetName().c_str() : "null");506 !schedule_groups[schedule_group_id].empty() ? schedule_groups[schedule_group_id][0].GetName().c_str() : "null");
507+ const bool enable_gather_reduce_penalty =
508+ ShouldEnableGatherReducePenalty(schedule_groups, schedule_group_id, out_schedule_groups.enable_group_parallel);
509+ GELOGD(
510+ "[DFX] GatherReducePenalty context: asc_graph_id=%zu, impl_graph_id=%zu, group_id=%zu, group_count=%zu, "
511+ "enabled=%d",
512+ asc_graph_id, impl_graph_id, schedule_group_id, schedule_groups.size(), enable_gather_reduce_penalty);
438 GE_ASSERT_SUCCESS(GenerateModelInfo(schedule_groups[schedule_group_id], model_info_list, options,513 GE_ASSERT_SUCCESS(GenerateModelInfo(schedule_groups[schedule_group_id], model_info_list, options,
439- out_schedule_groups.enable_group_parallel),514+ out_schedule_groups.enable_group_parallel, enable_gather_reduce_penalty),
440 "Get model info failed, impl graph id = %ld, group id = %ld.", impl_graph_id, schedule_group_id);515 "Get model info failed, impl graph id = %ld, group id = %ld.", impl_graph_id, schedule_group_id);
441 for (auto &model_info : model_info_list) {516 for (auto &model_info : model_info_list) {
442 model_info.schedule_group_ident.asc_graph_id = asc_graph_id;517 model_info.schedule_group_ident.asc_graph_id = asc_graph_id;
@@ -26,6 +26,9 @@ af::Status GenerateModelInfo(const af::AscGraph &graph, ModelInfo &model_info, T
26af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list);26af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list);
27af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list,27af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list,
28 const std::map<std::string, std::string> &options, bool enable_group_parallel = false);28 const std::map<std::string, std::string> &options, bool enable_group_parallel = false);
29+af::Status GenerateModelInfo(const std::vector<af::AscGraph> &graph_list, std::vector<ModelInfo> &model_info_list,
30+ const std::map<std::string, std::string> &options, bool enable_group_parallel,
31+ bool enable_gather_reduce_penalty);
29af::Status GetModelInfoMap(const ascir::FusedScheduledResult &schedule_results,32af::Status GetModelInfoMap(const ascir::FusedScheduledResult &schedule_results,
30 const std::map<std::string, std::string> &options,33 const std::map<std::string, std::string> &options,
31 std::map<size_t, std::map<size_t, ParsedScheduleResult>> &out_all_model_infos);34 std::map<size_t, std::map<size_t, ParsedScheduleResult>> &out_all_model_infos);
@@ -255,6 +255,7 @@ struct TuningSpace {
255 vector<CacheLineConfig> *cache_line_config{nullptr};255 vector<CacheLineConfig> *cache_line_config{nullptr};
256 const TilingScheduleConfigTable *tiling_schedule_config_table{nullptr};256 const TilingScheduleConfigTable *tiling_schedule_config_table{nullptr};
257 const af::AscGraph *asc_graph{nullptr};257 const af::AscGraph *asc_graph{nullptr};
258+ uint32_t penalty_cache_line_size{0}; // Reduce核数惩罚粒度,0表示使用配置的Cache Line
258};259};
259using TuningSpacePtr = std::shared_ptr<TuningSpace>;260using TuningSpacePtr = std::shared_ptr<TuningSpace>;
260} // namespace att261} // namespace att
@@ -439,6 +439,30 @@ TEST_F(TestGenerateTilingExprPenalty, CalcPenaltyCoreNumRatio_VerifyFormula) {
439 EXPECT_EQ(Str(result), "1");439 EXPECT_EQ(Str(result), "1");
440}440}
441 441 
442+// Test CalcPenaltyCoreNumRatio - Gather + Reduce uses 32B penalty granularity
443+TEST_F(TestGenerateTilingExprPenalty, CalcPenaltyCoreNumRatio_GatherReducePenaltyGranularity) {
444+ tuning_space->penalty_cache_line_size = 32;
445+ GenerateTilingExpr generator(tuning_space);
446+ 
447+ auto split_axis = std::make_shared<AttAxis>();
448+ split_axis->name = "R_split";
449+ auto split_size = std::make_shared<SymVarInfo>(af::Symbol(128));
450+ split_size->data_type_size = 4;
451+ split_axis->size = split_size;
452+ 
453+ auto a_axis = std::make_shared<AttAxis>();
454+ a_axis->name = "A";
455+ a_axis->axis_pos = AxisPosition::OUTER;
456+ auto a_size = std::make_shared<SymVarInfo>(af::Symbol(1));
457+ a_size->data_type_size = 4;
458+ a_size->symbol_expr = af::Symbol(1);
459+ a_axis->size = a_size;
460+ 
461+ const Expr result = generator.CalcPenaltyCoreNumRatio(split_axis.get(), {a_axis.get()});
462+ 
463+ EXPECT_EQ(Str(result), "Rational(1 , 8)");
464+}
465+ 
442// Test ApplyPenaltyConfig - Basic penalty (enabled by config table)466// Test ApplyPenaltyConfig - Basic penalty (enabled by config table)
443TEST_F(TestGenerateTilingExprPenalty, ApplyPenaltyConfig_BasicPenalty) {467TEST_F(TestGenerateTilingExprPenalty, ApplyPenaltyConfig_BasicPenalty) {
444 GenerateTilingExpr generator(tuning_space);468 GenerateTilingExpr generator(tuning_space);
@@ -11,6 +11,8 @@
11#include "gtest/gtest.h"11#include "gtest/gtest.h"
12#include "gen_model_info.h"12#include "gen_model_info.h"
13#include "test_fa_ascir_graph.h"13#include "test_fa_ascir_graph.h"
14+#include "base/att_const_values.h"
15+#include "common/platform_context.h"
14#define private public16#define private public
15#include "expr_gen/generate_tiling_expr.h"17#include "expr_gen/generate_tiling_expr.h"
16#include "parser/ascend_graph_parser.h"18#include "parser/ascend_graph_parser.h"
@@ -89,6 +91,68 @@ Status BuildReduceAscendGraphND(AscGraph &graph) {
89} // namespace ascir91} // namespace ascir
90} // namespace af92} // namespace af
91namespace att {93namespace att {
94+namespace {
95+ascir::FusedScheduledResult BuildGatherReduceScheduleResult(const af::AscGraph &gather_graph,
96+ const af::AscGraph &reduce_graph,
97+ const bool enable_group_parallel) {
98+ ascir::ScheduledResult schedule_result;
99+ ascir::ScheduleGroup gather_group;
100+ gather_group.impl_graphs.emplace_back(gather_graph);
101+ schedule_result.schedule_groups.emplace_back(gather_group);
102+ ascir::ScheduleGroup reduce_group;
103+ reduce_group.impl_graphs.emplace_back(reduce_graph);
104+ schedule_result.schedule_groups.emplace_back(reduce_group);
105+ schedule_result.enable_group_parallel = enable_group_parallel;
106+ 
107+ ascir::FusedScheduledResult fused_schedule_result;
108+ fused_schedule_result.node_idx_to_scheduled_results.emplace_back(
109+ std::vector<ascir::ScheduledResult>{schedule_result});
110+ return fused_schedule_result;
111+}
112+ 
113+af::Status GenerateGatherReduceModelInfos(const bool enable_group_parallel, const bool gather_as_load,
114+ FusedParsedScheduleResult &model_infos) {
115+ ge::PlatformContext::GetInstance().SetPlatform("5102");
116+ af::AscGraph gather_graph("gather_graph");
117+ af::AscGraph reduce_graph("reduce_graph");
118+ if (af::ascir::cg::BuildGatherAscendGraphND(gather_graph) != af::SUCCESS ||
119+ GraphConstructUtils::BuildConcatGroupAscendGraphS0S1ReduceMultiTiling(reduce_graph) != af::SUCCESS) {
120+ return af::FAILED;
121+ }
122+ if (gather_as_load) {
123+ const auto gather_node = gather_graph.FindNode("gather1");
124+ GE_ASSERT_NOTNULL(gather_node);
125+ GE_ASSERT_TRUE(gather_node->GetType() == af::ascir_op::Gather::Type);
126+ gather_node->attr.api.compute_type = af::ComputeType::kComputeLoad;
127+ }
128+ GraphConstructUtils::UpdateGraphVectorizedStride(reduce_graph);
129+ std::map<std::string, std::string> options = {{kOutputFilePath, "./"}, {kGenConfigType, "HighPerf"}};
130+ auto schedule_result = BuildGatherReduceScheduleResult(gather_graph, reduce_graph, enable_group_parallel);
131+ return GetModelInfoMap(schedule_result, options, model_infos);
132+}
133+ 
134+af::Status GenerateReduceOnlyModelInfos(const size_t group_count, FusedParsedScheduleResult &model_infos) {
135+ ge::PlatformContext::GetInstance().SetPlatform("5102");
136+ af::AscGraph reduce_graph("reduce_graph");
137+ if (GraphConstructUtils::BuildConcatGroupAscendGraphS0S1ReduceMultiTiling(reduce_graph) != af::SUCCESS) {
138+ return af::FAILED;
139+ }
140+ GraphConstructUtils::UpdateGraphVectorizedStride(reduce_graph);
141+ ascir::ScheduledResult schedule_result;
142+ for (size_t group_id = 0UL; group_id < group_count; ++group_id) {
143+ ascir::ScheduleGroup reduce_group;
144+ reduce_group.impl_graphs.emplace_back(reduce_graph);
145+ schedule_result.schedule_groups.emplace_back(reduce_group);
146+ }
147+ ascir::FusedScheduledResult fused_schedule_result;
148+ fused_schedule_result.node_idx_to_scheduled_results.emplace_back(
149+ std::vector<ascir::ScheduledResult>{schedule_result});
150+ 
151+ std::map<std::string, std::string> options = {{kOutputFilePath, "./"}, {kGenConfigType, "HighPerf"}};
152+ return GetModelInfoMap(fused_schedule_result, options, model_infos);
153+}
154+} // namespace
155+ 
92class TestAscendGraphParser : public ::testing::Test {156class TestAscendGraphParser : public ::testing::Test {
93 public:157 public:
94 static void TearDownTestCase() {158 static void TearDownTestCase() {
@@ -104,10 +168,74 @@ class TestAscendGraphParser : public ::testing::Test {
104 att::FaAfterScheduler(*graph);168 att::FaAfterScheduler(*graph);
105 att::FaAfterQueBufAlloc(*graph);169 att::FaAfterQueBufAlloc(*graph);
106 }170 }
107- void TearDown() override {}171+ void TearDown() override {
172+ ge::PlatformContext::GetInstance().Reset();
173+ }
108 std::shared_ptr<af::AscGraph> graph;174 std::shared_ptr<af::AscGraph> graph;
109};175};
110 176 
177+TEST_F(TestAscendGraphParser, GatherReduceMultiGroupUsesRelaxedPenalty) {
178+ FusedParsedScheduleResult model_infos;
179+ ASSERT_EQ(GenerateGatherReduceModelInfos(false, false, model_infos), af::SUCCESS);
180+ 
181+ ASSERT_EQ(model_infos.size(), 1UL);
182+ ASSERT_EQ(model_infos.at(0).at(0).groups_tiling_model_info.size(), 2UL);
183+ const auto &gather_info = model_infos.at(0).at(0).groups_tiling_model_info.at(0).at(0);
184+ const auto &reduce_info = model_infos.at(0).at(0).groups_tiling_model_info.at(1).at(0);
185+ EXPECT_FALSE(gather_info.tiling_schedule_config.is_penalty_config);
186+ ASSERT_TRUE(reduce_info.tiling_schedule_config.is_penalty_config);
187+ EXPECT_NE(Str(reduce_info.tiling_schedule_config.trade_off_config.core_num_ratio).find("Rational(1 , 8)"),
188+ std::string::npos);
189+}
190+ 
191+TEST_F(TestAscendGraphParser, GatherLoweredToLoadStillUsesRelaxedPenalty) {
192+ FusedParsedScheduleResult model_infos;
193+ ASSERT_EQ(GenerateGatherReduceModelInfos(false, true, model_infos), af::SUCCESS);
194+ 
195+ ASSERT_EQ(model_infos.size(), 1UL);
196+ ASSERT_EQ(model_infos.at(0).at(0).groups_tiling_model_info.size(), 2UL);
197+ const auto &reduce_info = model_infos.at(0).at(0).groups_tiling_model_info.at(1).at(0);
198+ ASSERT_TRUE(reduce_info.tiling_schedule_config.is_penalty_config);
199+ EXPECT_NE(Str(reduce_info.tiling_schedule_config.trade_off_config.core_num_ratio).find("Rational(1 , 8)"),
200+ std::string::npos);
201+}
202+ 
203+TEST_F(TestAscendGraphParser, GatherReduceGroupParallelKeepsDefaultPenalty) {
204+ FusedParsedScheduleResult model_infos;
205+ ASSERT_EQ(GenerateGatherReduceModelInfos(true, false, model_infos), af::SUCCESS);
206+ 
207+ ASSERT_EQ(model_infos.size(), 1UL);
208+ ASSERT_EQ(model_infos.at(0).at(0).groups_tiling_model_info.size(), 2UL);
209+ const auto &reduce_info = model_infos.at(0).at(0).groups_tiling_model_info.at(1).at(0);
210+ ASSERT_TRUE(reduce_info.tiling_schedule_config.is_penalty_config);
211+ EXPECT_NE(Str(reduce_info.tiling_schedule_config.trade_off_config.core_num_ratio).find("Rational(1 , 32)"),
212+ std::string::npos);
213+}
214+ 
215+TEST_F(TestAscendGraphParser, SingleReduceGroupKeepsDefaultPenalty) {
216+ FusedParsedScheduleResult model_infos;
217+ ASSERT_EQ(GenerateReduceOnlyModelInfos(1UL, model_infos), af::SUCCESS);
218+ 
219+ ASSERT_EQ(model_infos.size(), 1UL);
220+ ASSERT_EQ(model_infos.at(0).at(0).groups_tiling_model_info.size(), 1UL);
221+ const auto &reduce_info = model_infos.at(0).at(0).groups_tiling_model_info.at(0).at(0);
222+ ASSERT_TRUE(reduce_info.tiling_schedule_config.is_penalty_config);
223+ EXPECT_NE(Str(reduce_info.tiling_schedule_config.trade_off_config.core_num_ratio).find("Rational(1 , 32)"),
224+ std::string::npos);
225+}
226+ 
227+TEST_F(TestAscendGraphParser, MultiReduceGroupsWithoutGatherKeepDefaultPenalty) {
228+ FusedParsedScheduleResult model_infos;
229+ ASSERT_EQ(GenerateReduceOnlyModelInfos(2UL, model_infos), af::SUCCESS);
230+ 
231+ ASSERT_EQ(model_infos.size(), 1UL);
232+ ASSERT_EQ(model_infos.at(0).at(0).groups_tiling_model_info.size(), 2UL);
233+ const auto &reduce_info = model_infos.at(0).at(0).groups_tiling_model_info.at(1).at(0);
234+ ASSERT_TRUE(reduce_info.tiling_schedule_config.is_penalty_config);
235+ EXPECT_NE(Str(reduce_info.tiling_schedule_config.trade_off_config.core_num_ratio).find("Rational(1 , 32)"),
236+ std::string::npos);
237+}
238+ 
111TEST_F(TestAscendGraphParser, case1) {239TEST_F(TestAscendGraphParser, case1) {
112 af::AscGraph graph1("graph");240 af::AscGraph graph1("graph");
113 att::TuningSpacePtr tuning_space = std::make_shared<att::TuningSpace>();241 att::TuningSpacePtr tuning_space = std::make_shared<att::TuningSpace>();
@@ -20,9 +20,11 @@ namespace optimize {
20Status GatherToLoadPass::RunPass(af::AscGraph &graph) {20Status GatherToLoadPass::RunPass(af::AscGraph &graph) {
21 for (auto node : graph.GetAllNodes()) {21 for (auto node : graph.GetAllNodes()) {
22 if (ScheduleUtils::IsGather(node)) {22 if (ScheduleUtils::IsGather(node)) {
23- GELOGD("gather node name %s Type %s compute type %d", node->GetNamePtr(), node->GetType().c_str(),23+ const auto original_compute_type = node->attr.api.compute_type;
24- node->attr.api.compute_type);
25 node->attr.api.compute_type = af::ComputeType::kComputeLoad;24 node->attr.api.compute_type = af::ComputeType::kComputeLoad;
25+ GELOGD("[DFX] GatherToLoad: graph=%s, node=%s, op_type=%s, compute_type=%d->%d", graph.GetName().c_str(),
26+ node->GetNamePtr(), node->GetType().c_str(), static_cast<int32_t>(original_compute_type),
27+ static_cast<int32_t>(node->attr.api.compute_type));
26 }28 }
27 }29 }
28 return af::SUCCESS;30 return af::SUCCESS;