From 464aff111eee571c8a08908130446ece345776a4 Mon Sep 17 00:00:00 2001 From: zhangxiaokun Date: Thu, 7 Jan 2021 22:06:56 +0800 Subject: [PATCH] Fix Remove Edge --- ge/common/profiling/profiling_manager.cc | 11 +++++++---- ge/graph/passes/subgraph_const_migration_pass.cc | 12 ++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ge/common/profiling/profiling_manager.cc b/ge/common/profiling/profiling_manager.cc index aad2bbe3..1fc4dba6 100644 --- a/ge/common/profiling/profiling_manager.cc +++ b/ge/common/profiling/profiling_manager.cc @@ -27,6 +27,8 @@ namespace { const char *const kTrainingTrace = "training_trace"; const char *const kFpPoint = "fp_point"; const char *const kBpPoint = "bp_point"; + +#ifdef DAVINCI_SUPPORT_PROFILING const size_t kReportMaxLen = 2048; const int32_t kMaxDeviceNum = 256; const std::string kConfigNumsdev = "devNums"; @@ -35,6 +37,7 @@ const std::string kProfStart = "prof_start"; const std::string kProfStop = "prof_stop"; const std::string kProfModelSubscribe = "prof_model_subscribe"; const std::string kProfModelUnsubscribe = "prof_model_cancel_subscribe"; +#endif } // namespace namespace ge { @@ -110,7 +113,7 @@ ge::Status ProfilingManager::InitFromOptions(const Options &options, MsprofGeOpt } // enable profiling by env is_execute_profiling_ = true; - GELOGI("The profiling in env is %s, %s", env_profiling_mode, prof_conf.options); + GELOGI("The profiling in env is %s, %s", env_profiling_mode, prof_conf.options); } if (!is_execute_profiling_) { @@ -186,7 +189,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::StopProf GELOGW("Call rtProfilerStop failed, ret:%d", rt_ret); } } - + // stop profiling if (prof_cb_.msprofCtrlCallback == nullptr) { GELOGE(ge::PARAM_INVALID, "MsprofCtrlCallback callback is nullptr."); @@ -801,7 +804,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ProfilingManager::CallMs if (prof_cb_.msprofReporterCallback == nullptr) { GELOGE(ge::PARAM_INVALID, "MsprofReporterCallback callback is nullptr."); return ge::PARAM_INVALID; - } + } return prof_cb_.msprofReporterCallback( static_cast(MsprofReporterModuleId::MSPROF_MODULE_FRAMEWORK), static_cast(MsprofReporterCallbackType::MSPROF_REPORTER_REPORT), @@ -853,7 +856,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY void ProfilingManager::GetFpBpP return; } } - + return; } diff --git a/ge/graph/passes/subgraph_const_migration_pass.cc b/ge/graph/passes/subgraph_const_migration_pass.cc index 43a12897..f3a6b998 100644 --- a/ge/graph/passes/subgraph_const_migration_pass.cc +++ b/ge/graph/passes/subgraph_const_migration_pass.cc @@ -340,15 +340,15 @@ Status SubgraphConstMigrationPass::DetachParallelNode(const map const NodePtr &const_node, const NodePtr &data_node) { // Break Data and Move node. const auto &in_anchor = const_node->GetInControlAnchor(); - while (!in_anchor->GetPeerOutControlAnchors().empty()) { - const auto &out_anchor = in_anchor->GetPeerOutControlAnchors().at(kZeroIndex); + const auto out_anchors = in_anchor->GetPeerOutControlAnchors(); + for (const auto out_anchor : out_anchors) { GE_CHK_GRAPH_STATUS_RET(GraphUtils::RemoveEdge(out_anchor, in_anchor), "Remove edge failed"); GELOGI("Remove Edge: %s %s", out_anchor->GetOwnerNode()->GetName().c_str(), const_node->GetName().c_str()); } const auto &ctrl_anchor = const_node->GetOutControlAnchor(); - while (!ctrl_anchor->GetPeerInControlAnchors().empty()) { - const auto &in_anchor = ctrl_anchor->GetPeerInControlAnchors().at(kZeroIndex); + const auto ctrl_anchors = ctrl_anchor->GetPeerInControlAnchors(); + for (const auto in_anchor : ctrl_anchors) { GE_CHK_GRAPH_STATUS_RET(GraphUtils::RemoveEdge(ctrl_anchor, in_anchor), "Remove edge failed"); GELOGI("Remove Edge: %s %s", const_node->GetName().c_str(), in_anchor->GetOwnerNode()->GetName().c_str()); @@ -358,8 +358,8 @@ Status SubgraphConstMigrationPass::DetachParallelNode(const map // Break Move and follow, Link Data and follow. const auto &out_anchor = const_node->GetOutDataAnchor(kZeroIndex); - while (!out_anchor->GetPeerInDataAnchors().empty()) { - const auto &in_anchor = out_anchor->GetPeerInDataAnchors().at(kZeroIndex); + const auto in_anchors =out_anchor->GetPeerInDataAnchors(); + for (const auto in_anchor : in_anchors) { GE_CHK_GRAPH_STATUS_RET(GraphUtils::RemoveEdge(out_anchor, in_anchor), "Remove edge failed"); GELOGI("Remove Edge: %s %s", const_node->GetName().c_str(), in_anchor->GetOwnerNode()->GetName().c_str());