@@ -38,7 +38,7 @@ GraphOptimize::GraphOptimize() | |||||
void AddNodeInputProperty(ComputeGraphPtr &compute_graph) { | void AddNodeInputProperty(ComputeGraphPtr &compute_graph) { | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[AddNodeInputProperty]: compute_graph is nullptr."); | |||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[Check][Param] compute_graph is nullptr."); | |||||
return; | return; | ||||
} | } | ||||
for (ge::NodePtr &node : compute_graph->GetDirectNode()) { | for (ge::NodePtr &node : compute_graph->GetDirectNode()) { | ||||
@@ -80,7 +80,7 @@ void AddNodeInputProperty(ComputeGraphPtr &compute_graph) { | |||||
Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std::string &engine_name) { | Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std::string &engine_name) { | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeSubGraph]: compute_graph is nullptr."); | |||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[Check][Param] compute_graph is nullptr."); | |||||
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | ||||
} | } | ||||
@@ -89,8 +89,10 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std | |||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GraphOptimzer: GE is not initialized"); | |||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid, graph:%s", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib] Gelib not init before, graph:%s", | |||||
compute_graph->GetName().c_str()); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -111,7 +113,8 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeFusedGraphAfterGraphSlice failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeFusedGraphAfterGraphSlice failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, engine_name.c_str(), | "graph_name:%s", ret, engine_name.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeSubGraph][OptimizeFusedGraphAfterGraphSlice]: graph optimize failed, ret:%d", ret); | |||||
GELOGE(ret, "[Call][OptimizeFusedGraphAfterGraphSlice] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, engine_name.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -124,7 +127,8 @@ Status GraphOptimize::OptimizeSubGraph(ComputeGraphPtr &compute_graph, const std | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeFusedGraph failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeFusedGraph failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, engine_name.c_str(), | "graph_name:%s", ret, engine_name.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeSubGraph][OptimizeFusedGraph]: graph optimize failed, ret:%d", ret); | |||||
GELOGE(ret, "[Optimize][FusedGraph] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, engine_name.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -142,15 +146,17 @@ Status GraphOptimize::OptimizeOriginalGraph(ComputeGraphPtr &compute_graph) { | |||||
} | } | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeOriginalGraph]: compute_graph is nullptr."); | |||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[Check][Param] compute_graph is nullptr."); | |||||
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | ||||
} | } | ||||
Status ret = SUCCESS; | Status ret = SUCCESS; | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeOriginalGraph failed."); | |||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib] Gelib not init before, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -169,7 +175,8 @@ Status GraphOptimize::OptimizeOriginalGraph(ComputeGraphPtr &compute_graph) { | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeOriginalGraph failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeOriginalGraph failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, iter->first.c_str(), | "graph_name:%s", ret, iter->first.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeOriginalGraph]: graph optimize failed, ret:%d", ret); | |||||
GELOGE(ret, "[Optimize][OriginalGraph] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, iter->first.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -188,8 +195,10 @@ Status GraphOptimize::OptimizeOriginalGraphJudgeInsert(ComputeGraphPtr &compute_ | |||||
Status ret = SUCCESS; | Status ret = SUCCESS; | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeOriginalGraph failed."); | |||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid, graph:%s", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib] Gelib not init before, graph:%s", | |||||
compute_graph->GetName().c_str()); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -209,7 +218,8 @@ Status GraphOptimize::OptimizeOriginalGraphJudgeInsert(ComputeGraphPtr &compute_ | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeOriginalGraphJudgeInsert failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeOriginalGraphJudgeInsert failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, iter->first.c_str(), | "graph_name:%s", ret, iter->first.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeOriginalGraphJudgeInsert]: graph optimize failed, ret:%d", ret); | |||||
GELOGE(ret, "[Call][OptimizeOriginalGraphJudgeInsert] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, iter->first.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -220,14 +230,16 @@ Status GraphOptimize::OptimizeOriginalGraphJudgeInsert(ComputeGraphPtr &compute_ | |||||
Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_graph) { | Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_graph) { | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeOriginalGraph]: compute_graph is nullptr."); | |||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[Check][Param] compute_graph is nullptr."); | |||||
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | ||||
} | } | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeOriginalGraph failed."); | |||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][Gelib] Gelib not init before, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -247,7 +259,8 @@ Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_ | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeGraphPrepare failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeGraphPrepare failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, iter->first.c_str(), | "graph_name:%s", ret, iter->first.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeOriginalGraphForQuantize]: graph optimize failed, ret:%u", ret); | |||||
GELOGE(ret, "[Call][OptimizeGraphPrepare] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, iter->first.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -258,14 +271,16 @@ Status GraphOptimize::OptimizeOriginalGraphForQuantize(ComputeGraphPtr &compute_ | |||||
Status GraphOptimize::OptimizeGraphBeforeBuildForRts(ComputeGraphPtr &compute_graph) { | Status GraphOptimize::OptimizeGraphBeforeBuildForRts(ComputeGraphPtr &compute_graph) { | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeGraphBeforeBuildForRts]: compute_graph is nullptr."); | |||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[Check][Param] compute_graph is nullptr."); | |||||
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | ||||
} | } | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeGraphBeforeBuildForRts failed."); | |||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib] Gelib not init before, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -286,7 +301,8 @@ Status GraphOptimize::OptimizeGraphBeforeBuildForRts(ComputeGraphPtr &compute_gr | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeGraphBeforeBuild failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeGraphBeforeBuild failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, iter->first.c_str(), | "graph_name:%s", ret, iter->first.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeGraphBeforeBuildForRts]: graph optimize failed, ret:%u", ret); | |||||
GELOGE(ret, "[Call][OptimizeGraphBeforeBuild] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, iter->first.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -413,14 +429,16 @@ Status GraphOptimize::IdentifyReference(ComputeGraphPtr &compute_graph) { | |||||
Status GraphOptimize::OptimizeWholeGraph(ComputeGraphPtr &compute_graph) { | Status GraphOptimize::OptimizeWholeGraph(ComputeGraphPtr &compute_graph) { | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[OptimizeWholeGraph]: compute_graph is nullptr."); | |||||
GELOGE(GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL, "[Check][Param] compute_graph is nullptr."); | |||||
return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | return GE_GRAPH_OPTIMIZE_COMPUTE_GRAPH_NULL; | ||||
} | } | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "OptimizeWholeGraph failed."); | |||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib] Gelib not init before, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -441,7 +459,8 @@ Status GraphOptimize::OptimizeWholeGraph(ComputeGraphPtr &compute_graph) { | |||||
REPORT_INNER_ERROR("E19999", "Call OptimizeWholeGraph failed, ret:%d, engine_name:%s, " | REPORT_INNER_ERROR("E19999", "Call OptimizeWholeGraph failed, ret:%d, engine_name:%s, " | ||||
"graph_name:%s", ret, iter.first.c_str(), | "graph_name:%s", ret, iter.first.c_str(), | ||||
compute_graph->GetName().c_str()); | compute_graph->GetName().c_str()); | ||||
GELOGE(ret, "[OptimizeWholeGraph]: graph optimize failed, ret:%u", ret); | |||||
GELOGE(ret, "[Call][OptimizeWholeGraph] failed, ret:%d, engine_name:%s, graph_name:%s", | |||||
ret, iter.first.c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -159,6 +159,8 @@ bool IsSubgraphOutputNode(const NodePtr &node) { | |||||
NodePtr AddIdentityToGraph(const Node &src_node, int out_anchor_idx) { | NodePtr AddIdentityToGraph(const Node &src_node, int out_anchor_idx) { | ||||
if (src_node.GetOpDesc() == nullptr) { | if (src_node.GetOpDesc() == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param src_node is invalid, which has no opdesc"); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Get][OpDesc] failed, Param src_node opdesc is nullptr."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
static std::atomic_long identity_num(0); | static std::atomic_long identity_num(0); | ||||
@@ -174,7 +176,9 @@ NodePtr AddIdentityToGraph(const Node &src_node, int out_anchor_idx) { | |||||
GELOGI("Insert new Identity node %s.", identity_name.c_str()); | GELOGI("Insert new Identity node %s.", identity_name.c_str()); | ||||
auto graph = src_node.GetOwnerComputeGraph(); | auto graph = src_node.GetOwnerComputeGraph(); | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "Node %s owner compute graph is null.", src_node.GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Node %s owner compute graph is nullptr.", src_node.GetName().c_str()); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Get][OwnerComputeGraph] failed, as Node %s owner compute graph is nullptr.", | |||||
src_node.GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
return graph->AddNode(identity_op_desc); | return graph->AddNode(identity_op_desc); | ||||
@@ -345,7 +349,7 @@ Status MarkRWTypeForSubgraph(const ComputeGraphPtr &sub_graph) { | |||||
pre_node->GetType().c_str(), | pre_node->GetType().c_str(), | ||||
node->GetName().c_str(), | node->GetName().c_str(), | ||||
node->GetType().c_str()); | node->GetType().c_str()); | ||||
GELOGE(FAILED, "Insert Identity node %s(%s) between %s(%s) -> %s(%s) failed.", | |||||
GELOGE(FAILED, "[Insert][IdentityNode] %s(%s) between %s(%s) -> %s(%s) failed.", | |||||
identity_node->GetName().c_str(), | identity_node->GetName().c_str(), | ||||
identity_node->GetType().c_str(), | identity_node->GetType().c_str(), | ||||
pre_node->GetName().c_str(), | pre_node->GetName().c_str(), | ||||
@@ -486,12 +490,14 @@ Status RemoveNoUseIdentity(const NodePtr &node) { | |||||
GELOGI("No need insert Identity. Node %s need to remove.", node->GetName().c_str()); | GELOGI("No need insert Identity. Node %s need to remove.", node->GetName().c_str()); | ||||
auto ret = GraphUtils::IsolateNode(node, {0}); | auto ret = GraphUtils::IsolateNode(node, {0}); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to isolate node %s.", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Isolate Node:%s failed", node->GetName().c_str()); | |||||
GELOGE(ret, "[Isolate][Node] %s failed.", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = GraphUtils::RemoveNodeWithoutRelink(node->GetOwnerComputeGraph(), node); | ret = GraphUtils::RemoveNodeWithoutRelink(node->GetOwnerComputeGraph(), node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to isolate node %s.", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Call RemoveNodeWithoutRelink failed, node:%s", node->GetName().c_str()); | |||||
GELOGE(ret, "[Call][RemoveNodeWithoutRelink] failed for node %s.", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
GELOGI("Pre node is %s and %dth output rw type is %s. Isolate and remove Identity node %s.", | GELOGI("Pre node is %s and %dth output rw type is %s. Isolate and remove Identity node %s.", | ||||
@@ -514,7 +520,7 @@ Status SplitIdentityAlongAnchor(const OutDataAnchorPtr &out_data_anchor, const I | |||||
auto ret = GraphUtils::InsertNodeBefore(peer_in_data_anchor, new_identity, kIdentityAnchorIndex, | auto ret = GraphUtils::InsertNodeBefore(peer_in_data_anchor, new_identity, kIdentityAnchorIndex, | ||||
kIdentityAnchorIndex); | kIdentityAnchorIndex); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Failed to insert Identity %s before %s %dth input.", | |||||
GELOGE(ret, "[Insert][Identity] %s before %s %dth input failed.", | |||||
new_identity->GetName().c_str(), | new_identity->GetName().c_str(), | ||||
peer_in_data_anchor->GetOwnerNode()->GetName().c_str(), | peer_in_data_anchor->GetOwnerNode()->GetName().c_str(), | ||||
peer_in_data_anchor->GetIdx()); | peer_in_data_anchor->GetIdx()); | ||||
@@ -560,7 +566,8 @@ Status SplitIdentity(const NodePtr &node) { | |||||
for (const auto &peer_in_data_anchor : out_data_anchor->GetPeerInDataAnchors()) { | for (const auto &peer_in_data_anchor : out_data_anchor->GetPeerInDataAnchors()) { | ||||
Status ret = SplitIdentityAlongAnchor(out_data_anchor, peer_in_data_anchor, pre_out_data_anchor, pre_node); | Status ret = SplitIdentityAlongAnchor(out_data_anchor, peer_in_data_anchor, pre_out_data_anchor, pre_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Split identity node along anchor failed."); | |||||
GELOGE(ret, "[Call][SplitIdentityAlongAnchor] failed, ret:%d, node:%s, pre_node:%s.", | |||||
ret, node->GetName().c_str(), pre_node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -568,12 +575,15 @@ Status SplitIdentity(const NodePtr &node) { | |||||
if (node->GetOutDataNodesSize() == 0) { | if (node->GetOutDataNodesSize() == 0) { | ||||
Status ret = GraphUtils::IsolateNode(node, {}); | Status ret = GraphUtils::IsolateNode(node, {}); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "IsolateAndDelete identity node %s.", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "IsolateNode %s failed, ret:%d", node->GetName().c_str(), ret); | |||||
GELOGE(FAILED, "[Isolate][Node] %s failed, ret:%d", node->GetName().c_str(), ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ret = GraphUtils::RemoveNodeWithoutRelink(node->GetOwnerComputeGraph(), node); | ret = GraphUtils::RemoveNodeWithoutRelink(node->GetOwnerComputeGraph(), node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "IsolateAndDelete identity node %s.", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Call RemoveNodeWithoutRelink failed, node:%s", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Call][RemoveNodeWithoutRelink] IsolateAndDelete identity node %s failed.", | |||||
node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGI("IsolateAndDelete identity node %s.", node->GetName().c_str()); | GELOGI("IsolateAndDelete identity node %s.", node->GetName().c_str()); | ||||
@@ -610,7 +620,7 @@ Status InsertIdentityAsNeeded(const NodePtr &node) { | |||||
auto ret = GraphUtils::InsertNodeBefore(peer_in_data_anchor, identity_node, kIdentityAnchorIndex, | auto ret = GraphUtils::InsertNodeBefore(peer_in_data_anchor, identity_node, kIdentityAnchorIndex, | ||||
kIdentityAnchorIndex); | kIdentityAnchorIndex); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to insert %s before %s %dth input.", identity_node->GetName().c_str(), | |||||
GELOGE(ret, "[Insert][Node] %s before %s %dth input failed.", identity_node->GetName().c_str(), | |||||
peer_in_data_anchor->GetOwnerNode()->GetName().c_str(), peer_in_data_anchor->GetIdx()); | peer_in_data_anchor->GetOwnerNode()->GetName().c_str(), peer_in_data_anchor->GetIdx()); | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -643,7 +653,7 @@ Status HandleAllreduceDuplicateInput(ComputeGraphPtr &compute_graph) { | |||||
auto ret = | auto ret = | ||||
GraphUtils::InsertNodeBefore(in_data_anchor, identity_node, kIdentityAnchorIndex, kIdentityAnchorIndex); | GraphUtils::InsertNodeBefore(in_data_anchor, identity_node, kIdentityAnchorIndex, kIdentityAnchorIndex); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Failed to insert node %s before %s %dth input.", identity_node->GetName().c_str(), | |||||
GELOGE(ret, "[Insert][Node] %s before %s %dth input failed.", identity_node->GetName().c_str(), | |||||
node->GetName().c_str(), in_data_anchor->GetIdx()); | node->GetName().c_str(), in_data_anchor->GetIdx()); | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -666,7 +676,7 @@ Status GraphOptimize::CheckRWConflict(ComputeGraphPtr &compute_graph, bool &has_ | |||||
// 1.loop all subgraph, mark rw type from inside to outside | // 1.loop all subgraph, mark rw type from inside to outside | ||||
Status ret = MarkRWTypeForAllSubgraph(sub_graph_vec); | Status ret = MarkRWTypeForAllSubgraph(sub_graph_vec); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to mark rw type for subgraph."); | |||||
GELOGE(ret, "[Call][MarkRWTypeForAllSubgraph] failed for %s.", compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
has_conflict = false; | has_conflict = false; | ||||
@@ -722,7 +732,7 @@ Status GraphOptimize::HandleMemoryRWConflict(ComputeGraphPtr &compute_graph) { | |||||
// 1.loop all subgraph, mark rw type from inside to outside | // 1.loop all subgraph, mark rw type from inside to outside | ||||
Status ret = MarkRWTypeForAllSubgraph(sub_graph_vec); | Status ret = MarkRWTypeForAllSubgraph(sub_graph_vec); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to mark rw type for subgraph."); | |||||
GELOGE(ret, "[Call][MarkRWTypeForAllSubgraph] failed for %s.", compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
// 2.loop all node, including node in subgraph and handle memory rw conflict | // 2.loop all node, including node in subgraph and handle memory rw conflict | ||||
@@ -749,20 +759,20 @@ Status GraphOptimize::HandleMemoryRWConflict(ComputeGraphPtr &compute_graph) { | |||||
// split identity | // split identity | ||||
ret = SplitIdentity(node); | ret = SplitIdentity(node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to split identity node %s.", node->GetName().c_str()); | |||||
GELOGE(ret, "[Split][Identity] %s failed.", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
// remove no use identity | // remove no use identity | ||||
ret = RemoveNoUseIdentity(node); | ret = RemoveNoUseIdentity(node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to remove useless identity node %s.", node->GetName().c_str()); | |||||
GELOGE(ret, "[Remove][Identity] %s failed.", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
// insert Identity | // insert Identity | ||||
ret = InsertIdentityAsNeeded(node); | ret = InsertIdentityAsNeeded(node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Fail to insert Identity node."); | |||||
GELOGE(ret, "[Insert][Identity] %s failed.", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -32,16 +32,19 @@ namespace ge { | |||||
Status GraphOptimize::HandleSummaryOp(ComputeGraphPtr &compute_graph) { | Status GraphOptimize::HandleSummaryOp(ComputeGraphPtr &compute_graph) { | ||||
GELOGI("[HandleSummaryOp] HandleSummaryOp start!"); | GELOGI("[HandleSummaryOp] HandleSummaryOp start!"); | ||||
if (summary_output_indexes_.size() >= kMaxMapSize) { | if (summary_output_indexes_.size() >= kMaxMapSize) { | ||||
GELOGE(FAILED, "Map size out of range."); | |||||
REPORT_INNER_ERROR("E19999", "Map size:%zu out of range:%d, check invalid.", | |||||
summary_output_indexes_.size(), kMaxMapSize); | |||||
GELOGE(FAILED, "[Check][Param] Map size:%zu out of range:%d.", summary_output_indexes_.size(), kMaxMapSize); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (summary_output_indexes_.find(compute_graph->GetGraphID()) != summary_output_indexes_.end()) { | |||||
return SUCCESS; | |||||
} | |||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "compute_graph is nullptr."); | |||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] compute_graph is nullptr."); | |||||
return GE_GRAPH_PARAM_NULLPTR; | return GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
if (summary_output_indexes_.find(compute_graph->GetGraphID()) != summary_output_indexes_.end()) { | |||||
return SUCCESS; | |||||
} | |||||
vector<NodePtr> del_nodes; | vector<NodePtr> del_nodes; | ||||
vector<NodePtr> front_nodes; | vector<NodePtr> front_nodes; | ||||
vector<uint8_t> out_index; | vector<uint8_t> out_index; | ||||
@@ -56,12 +59,18 @@ Status GraphOptimize::HandleSummaryOp(ComputeGraphPtr &compute_graph) { | |||||
compute_graph->SetSummaryFlag(true); | compute_graph->SetSummaryFlag(true); | ||||
auto in = node_ptr->GetInDataAnchor(0); | auto in = node_ptr->GetInDataAnchor(0); | ||||
if (in == nullptr) { | if (in == nullptr) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "in is nullptr."); | |||||
REPORT_INNER_ERROR("E19999", "In data anchor(index:0) of node:%s is nullptr", node_ptr->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Get][InDataAnchor] of node:%s is nullptr, index:0", | |||||
node_ptr->GetName().c_str()); | |||||
return GE_GRAPH_PARAM_NULLPTR; | return GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
auto peerin = in->GetPeerOutAnchor(); | auto peerin = in->GetPeerOutAnchor(); | ||||
GE_IF_BOOL_EXEC(peerin == nullptr, GELOGE(GE_GRAPH_PARAM_NULLPTR, "peerin is nullptr."); | |||||
GE_IF_BOOL_EXEC(peerin == nullptr, | |||||
REPORT_INNER_ERROR("E19999", "peer out anchor is nullptr, node:%s, in anchor index:0", | |||||
node_ptr->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Get][PeerOutAnchor] of node:%s is nullptr, in anchor index:0", | |||||
node_ptr->GetName().c_str()); | |||||
return GE_GRAPH_PARAM_NULLPTR); | return GE_GRAPH_PARAM_NULLPTR); | ||||
auto ret = GraphUtils::RemoveEdge(peerin, in); | auto ret = GraphUtils::RemoveEdge(peerin, in); | ||||
@@ -94,7 +103,10 @@ Status GraphOptimize::HandleSummaryOp(ComputeGraphPtr &compute_graph) { | |||||
for (auto &node_ptr : del_nodes) { | for (auto &node_ptr : del_nodes) { | ||||
auto ret = GraphUtils::RemoveNodeWithoutRelink(compute_graph, node_ptr); | auto ret = GraphUtils::RemoveNodeWithoutRelink(compute_graph, node_ptr); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "GraphUtils::RemoveNodeWithoutRelink failed."); | |||||
REPORT_CALL_ERROR("E19999", "Call RemoveNodeWithoutRelink failed, node:%s, graph:%s", | |||||
node_ptr->GetName().c_str(), compute_graph->GetName().c_str()); | |||||
GELOGE(ret, "[Call][RemoveNodeWithoutRelink] failed, node:%s, graph:%s", | |||||
node_ptr->GetName().c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
// update Target list | // update Target list | ||||
@@ -36,6 +36,7 @@ | |||||
#define REQUIRE(cond, ...) \ | #define REQUIRE(cond, ...) \ | ||||
do { \ | do { \ | ||||
if (!(cond)) { \ | if (!(cond)) { \ | ||||
REPORT_INNER_ERROR("E19999", __VA_ARGS__); \ | |||||
GELOGE(FAILED, "[Dynamic shape partition]" __VA_ARGS__); \ | GELOGE(FAILED, "[Dynamic shape partition]" __VA_ARGS__); \ | ||||
return FAILED; \ | return FAILED; \ | ||||
} \ | } \ | ||||
@@ -63,32 +64,32 @@ static bool IsSingleOpScene(const ComputeGraphPtr &root_graph) { | |||||
} | } | ||||
Status DynamicShapePartitioner::Partition() { | Status DynamicShapePartitioner::Partition() { | ||||
REQUIRE_NOT_NULL(root_graph_, "Graph is nullptr."); | |||||
REQUIRE_NOT_NULL(root_graph_, "[Check][Param] Graph is nullptr."); | |||||
if (IsSingleOpScene(root_graph_)) { | if (IsSingleOpScene(root_graph_)) { | ||||
GELOGD("Skip dynamic shape partition as in single op scene."); | GELOGD("Skip dynamic shape partition as in single op scene."); | ||||
REQUIRE(AttrUtils::SetBool(*root_graph_, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, false), | REQUIRE(AttrUtils::SetBool(*root_graph_, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, false), | ||||
"Failed set dynamic shape partitioned flag on root graph."); | |||||
"[Set][Attr] dynamic shape partitioned flag on root graph:%s failed.", root_graph_->GetName().c_str()); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
GELOGD("Start dynamic shape partition graph %s.", root_graph_->GetName().c_str()); | GELOGD("Start dynamic shape partition graph %s.", root_graph_->GetName().c_str()); | ||||
REQUIRE_SUCCESS(MarkUnknownShapeNodes(), "Failed mark unknown shape nodes, root grah name:%s.", | |||||
REQUIRE_SUCCESS(MarkUnknownShapeNodes(), "[Call][MarkUnknownShapeNodes] failed, root grah name:%s.", | |||||
root_graph_->GetName().c_str()); | root_graph_->GetName().c_str()); | ||||
if (unknown_shape_nodes_.empty()) { | if (unknown_shape_nodes_.empty()) { | ||||
GELOGD("Skip dynamic shape partition of graph %s as all nodes are known shape.", root_graph_->GetName().c_str()); | GELOGD("Skip dynamic shape partition of graph %s as all nodes are known shape.", root_graph_->GetName().c_str()); | ||||
REQUIRE(AttrUtils::SetBool(*root_graph_, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, false), | REQUIRE(AttrUtils::SetBool(*root_graph_, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, false), | ||||
"Failed set dynamic shape partitioned flag on root graph %s.", root_graph_->GetName().c_str()); | |||||
"[Set][Attr] dynamic shape partitioned flag on root graph %s failed.", root_graph_->GetName().c_str()); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
REQUIRE(AttrUtils::SetBool(*root_graph_, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, true), | REQUIRE(AttrUtils::SetBool(*root_graph_, ATTR_NAME_DYNAMIC_SHAPE_PARTITIONED, true), | ||||
"Failed set dynamic shape partitioned flag on root graph %s.", root_graph_->GetName().c_str()); | |||||
REQUIRE_SUCCESS(CtrlEdgeTransfer(), "Failed do ctrl edge transfer!"); | |||||
"[Set][Attr] dynamic shape partitioned flag on root graph %s failed.", root_graph_->GetName().c_str()); | |||||
REQUIRE_SUCCESS(CtrlEdgeTransfer(), "[Call][CtrlEdgeTransfer] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
DumpGraph("_Before_DSP"); | DumpGraph("_Before_DSP"); | ||||
auto status = PartitionImpl(); | auto status = PartitionImpl(); | ||||
GELOGD("%s.", DebugString().c_str()); | GELOGD("%s.", DebugString().c_str()); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, "Failed dynamic shape partition graph: %s, status:\n %s", root_graph_->GetName().c_str(), | |||||
DebugString().c_str()); | |||||
GELOGE(status, "[Call][PartitionImpl] Failed dynamic shape partition graph:%s, ret:%s", | |||||
root_graph_->GetName().c_str(), DebugString().c_str()); | |||||
} | } | ||||
DumpGraph("_After_DSP"); | DumpGraph("_After_DSP"); | ||||
GELOGD("Finish dynamic shape partition graph %s.", root_graph_->GetName().c_str()); | GELOGD("Finish dynamic shape partition graph %s.", root_graph_->GetName().c_str()); | ||||
@@ -123,13 +124,19 @@ Status DynamicShapePartitioner::CtrlEdgeTransfer() { | |||||
for (auto &in_control_node : n->GetInControlNodes()) { | for (auto &in_control_node : n->GetInControlNodes()) { | ||||
GE_CHECK_NOTNULL(in_control_node); | GE_CHECK_NOTNULL(in_control_node); | ||||
GE_CHK_STATUS_RET(ge::GraphUtils::RemoveEdge(in_control_node->GetOutControlAnchor(), | GE_CHK_STATUS_RET(ge::GraphUtils::RemoveEdge(in_control_node->GetOutControlAnchor(), | ||||
n->GetInControlAnchor()), "remove edge failed"); | |||||
n->GetInControlAnchor()), | |||||
"[Remove][Edge] between %s and %s failed", | |||||
in_control_node->GetOutControlAnchor()->GetOwnerNode()->GetName().c_str(), | |||||
n->GetName().c_str()); | |||||
for (auto &out_node : n->GetOutNodes()) { | for (auto &out_node : n->GetOutNodes()) { | ||||
if (out_node == nullptr) { | if (out_node == nullptr) { | ||||
continue; | continue; | ||||
} | } | ||||
GE_CHK_STATUS_RET(ge::GraphUtils::AddEdge(in_control_node->GetOutControlAnchor(), | GE_CHK_STATUS_RET(ge::GraphUtils::AddEdge(in_control_node->GetOutControlAnchor(), | ||||
out_node->GetInControlAnchor()), "add edge failed."); | |||||
out_node->GetInControlAnchor()), | |||||
"[Add][Edge] between %s and %s failed.", | |||||
in_control_node->GetOutControlAnchor()->GetOwnerNode()->GetName().c_str(), | |||||
out_node->GetName().c_str()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -141,13 +148,16 @@ Status DynamicShapePartitioner::CtrlEdgeTransfer() { | |||||
} | } | ||||
Status DynamicShapePartitioner::PartitionImpl() { | Status DynamicShapePartitioner::PartitionImpl() { | ||||
REQUIRE_SUCCESS(root_graph_->TopologicalSorting(), "Graph topological sort failed."); | |||||
REQUIRE_SUCCESS(InitClusters(), "Failed init cluster nodes."); | |||||
REQUIRE_SUCCESS(MergeClusters(), "Failed merge clusters."); | |||||
REQUIRE_SUCCESS(root_graph_->TopologicalSorting(), | |||||
"[Call][TopologicalSorting] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
REQUIRE_SUCCESS(InitClusters(), "[Init][Clusters] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
REQUIRE_SUCCESS(MergeClusters(), "[Merge][Clusters] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
PruneUniqueClusters(); | PruneUniqueClusters(); | ||||
REQUIRE_SUCCESS(BuildPartitionFrame(), "Failed build cluster partition frame."); | |||||
REQUIRE_SUCCESS(CombinePartitionFrame(), "Failed combine cluster partition frame."); | |||||
REQUIRE_SUCCESS(BuildPartitionSubgraph(), "Failed build cluster partition subgraph."); | |||||
REQUIRE_SUCCESS(BuildPartitionFrame(), "[Build][PartitionFrame] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
REQUIRE_SUCCESS(CombinePartitionFrame(), | |||||
"[Combine][PartitionFrame] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
REQUIRE_SUCCESS(BuildPartitionSubgraph(), | |||||
"[Build][PartitionSubgraph] failed, graph:%s.", root_graph_->GetName().c_str()); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -169,21 +179,21 @@ void DynamicShapePartitioner::PruneUniqueClusters() { | |||||
Status DynamicShapePartitioner::BuildPartitionFrame() { | Status DynamicShapePartitioner::BuildPartitionFrame() { | ||||
for (const auto &cluster : sorted_unique_clusters_) { | for (const auto &cluster : sorted_unique_clusters_) { | ||||
REQUIRE_SUCCESS(cluster->BuildFrame(), "Failed build frame of cluster[%lu].", cluster->Id()); | |||||
REQUIRE_SUCCESS(cluster->BuildFrame(), "[Build][Frame] of cluster[%lu] failed.", cluster->Id()); | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
Status DynamicShapePartitioner::CombinePartitionFrame() { | Status DynamicShapePartitioner::CombinePartitionFrame() { | ||||
for (const auto &cluster : sorted_unique_clusters_) { | for (const auto &cluster : sorted_unique_clusters_) { | ||||
REQUIRE_SUCCESS(cluster->CombinePartitionFrame(), "Failed combine frame of cluster[%lu].", cluster->Id()); | |||||
REQUIRE_SUCCESS(cluster->CombinePartitionFrame(), "[Combine][Frame] of cluster[%lu] failed.", cluster->Id()); | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
Status DynamicShapePartitioner::BuildPartitionSubgraph() { | Status DynamicShapePartitioner::BuildPartitionSubgraph() { | ||||
for (const auto &cluster : sorted_unique_clusters_) { | for (const auto &cluster : sorted_unique_clusters_) { | ||||
REQUIRE_SUCCESS(cluster->BuildPartitionSubgraph(), "Failed build subgraph of cluster[%lu].", cluster->Id()); | |||||
REQUIRE_SUCCESS(cluster->BuildPartitionSubgraph(), "[Build][SubGraph] of cluster[%lu] failed.", cluster->Id()); | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -245,8 +255,8 @@ void DynamicShapePartitioner::ClearResource() { | |||||
Status DynamicShapePartitioner::MarkUnknownShapeNodes() { | Status DynamicShapePartitioner::MarkUnknownShapeNodes() { | ||||
for (auto &node : root_graph_->GetDirectNode()) { | for (auto &node : root_graph_->GetDirectNode()) { | ||||
REQUIRE_SUCCESS(CollectSpreadUnknownShapeNodes(node), "Failed collect spread unknown shape nodes %s.", | |||||
node->GetName().c_str()); | |||||
REQUIRE_SUCCESS(CollectSpreadUnknownShapeNodes(node), | |||||
"[Call][CollectSpreadUnknownShapeNodes] for node:%s failed.", node->GetName().c_str()); | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -257,7 +267,7 @@ Status DynamicShapePartitioner::InitClusters() { | |||||
for (const auto &node : graph->GetDirectNode()) { | for (const auto &node : graph->GetDirectNode()) { | ||||
Cluster::Type type = Cluster::DATA; | Cluster::Type type = Cluster::DATA; | ||||
bool is_input = ((node->GetType() == CONSTANT) || (node->GetType() == CONSTANTOP)) && node->GetInNodes().empty(); | bool is_input = ((node->GetType() == CONSTANT) || (node->GetType() == CONSTANTOP)) && node->GetInNodes().empty(); | ||||
REQUIRE_NOT_NULL(node->GetOpDesc(), "op_desc is null"); | |||||
REQUIRE_NOT_NULL(node->GetOpDesc(), "[Get][OpDesc] op_desc is null, graph:%s", graph->GetName().c_str()); | |||||
if (node->GetType() == DATA) { | if (node->GetType() == DATA) { | ||||
type = Cluster::DATA; | type = Cluster::DATA; | ||||
} else if (is_input) { | } else if (is_input) { | ||||
@@ -272,7 +282,7 @@ Status DynamicShapePartitioner::InitClusters() { | |||||
type = Cluster::KNOWN_SHAPE; | type = Cluster::KNOWN_SHAPE; | ||||
} | } | ||||
auto cluster = MakeShared<Cluster>(rank++, type, node, this); | auto cluster = MakeShared<Cluster>(rank++, type, node, this); | ||||
REQUIRE_NOT_NULL(cluster, "Failed new memory for cluster."); | |||||
REQUIRE_NOT_NULL(cluster, "[New][Memory] for cluster failed."); | |||||
node_2_cluster_[node] = cluster; | node_2_cluster_[node] = cluster; | ||||
if (cluster->IsUnknownShape()) { | if (cluster->IsUnknownShape()) { | ||||
ordered_cluster_.push_back(cluster); | ordered_cluster_.push_back(cluster); | ||||
@@ -451,7 +461,7 @@ void DynamicShapePartitioner::MergeClustersInputData() { | |||||
Status DynamicShapePartitioner::MergeClusters() { | Status DynamicShapePartitioner::MergeClusters() { | ||||
MergeClustersControlFlow(); | MergeClustersControlFlow(); | ||||
MergeClustersUnknownShape(); | MergeClustersUnknownShape(); | ||||
REQUIRE_SUCCESS(TopologicalSortClusters(), "Failed topological sort clusters after merge unknown shape clusters."); | |||||
REQUIRE_SUCCESS(TopologicalSortClusters(), "[TopologicalSort][Clusters] after merge unknown shape clusters failed."); | |||||
MergeClustersKnownShape(); | MergeClustersKnownShape(); | ||||
MergeClustersInputData(); | MergeClustersInputData(); | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -477,7 +487,7 @@ Status DynamicShapePartitioner::CollectSpreadUnknownShapeNodes(NodePtr node) { | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
auto opdesc = node->GetOpDesc(); | auto opdesc = node->GetOpDesc(); | ||||
REQUIRE_NOT_NULL(opdesc, "Opdesc is nullptr."); | |||||
REQUIRE_NOT_NULL(opdesc, "[Get][OpDesc] Opdesc is nullptr."); | |||||
// One can set 'ATTR_NAME_IS_UNKNOWN_SHAPE=true' on node so as to forcing the node flow into the unknown subgraph, | // One can set 'ATTR_NAME_IS_UNKNOWN_SHAPE=true' on node so as to forcing the node flow into the unknown subgraph, | ||||
// ignore the actual shape. | // ignore the actual shape. | ||||
if (JudgeUnknowShapeWithAttr(opdesc)) { | if (JudgeUnknowShapeWithAttr(opdesc)) { | ||||
@@ -523,10 +533,11 @@ Status DynamicShapePartitioner::CollectSpreadUnknownShapeNodes(NodePtr node) { | |||||
auto graph = root_graph_; | auto graph = root_graph_; | ||||
for (const auto &subgraph_name : opdesc->GetSubgraphInstanceNames()) { | for (const auto &subgraph_name : opdesc->GetSubgraphInstanceNames()) { | ||||
auto subgraph = graph->GetSubgraph(subgraph_name); | auto subgraph = graph->GetSubgraph(subgraph_name); | ||||
REQUIRE_NOT_NULL(subgraph, "Failed get subgraph %s of node %s on root graph.", subgraph_name.c_str(), | |||||
REQUIRE_NOT_NULL(subgraph, "[Get][Subgraph] %s of node %s on root graph failed.", subgraph_name.c_str(), | |||||
node->GetName().c_str()); | node->GetName().c_str()); | ||||
bool is_graph_unknow = false; | bool is_graph_unknow = false; | ||||
REQUIRE_SUCCESS(IsUnknownShapeGraph(subgraph, is_graph_unknow), "Failed check subgraph %s shape of node %s.", | |||||
REQUIRE_SUCCESS(IsUnknownShapeGraph(subgraph, is_graph_unknow), | |||||
"[Call][IsUnknownShapeGraph] Failed check subgraph %s shape of node %s.", | |||||
subgraph_name.c_str(), node->GetName().c_str()); | subgraph_name.c_str(), node->GetName().c_str()); | ||||
if (is_graph_unknow) { | if (is_graph_unknow) { | ||||
GELOGD("Collect node %s as its subgraph %s is unknown.", node->GetName().c_str(), subgraph->GetName().c_str()); | GELOGD("Collect node %s as its subgraph %s is unknown.", node->GetName().c_str(), subgraph->GetName().c_str()); | ||||
@@ -557,9 +568,10 @@ Status DynamicShapePartitioner::IsUnknownShapeNode(NodePtr node, bool &is_unknow | |||||
} | } | ||||
for (auto &subgraph_name : opdesc->GetSubgraphInstanceNames()) { | for (auto &subgraph_name : opdesc->GetSubgraphInstanceNames()) { | ||||
auto subgraph = graph->GetSubgraph(subgraph_name); | auto subgraph = graph->GetSubgraph(subgraph_name); | ||||
REQUIRE_NOT_NULL(subgraph, "Failed get subgraph %s of node %s on root graph.", subgraph_name.c_str(), | |||||
REQUIRE_NOT_NULL(subgraph, "[Get][Subgraph] %s of node %s on root graph failed.", subgraph_name.c_str(), | |||||
node->GetName().c_str()); | node->GetName().c_str()); | ||||
REQUIRE_SUCCESS(IsUnknownShapeGraph(subgraph, is_unknown), "Failed check subgraph %s shape of node %s.", | |||||
REQUIRE_SUCCESS(IsUnknownShapeGraph(subgraph, is_unknown), | |||||
"[Call][IsUnknownShapeGraph] Failed check subgraph %s shape of node %s.", | |||||
subgraph_name.c_str(), node->GetName().c_str()); | subgraph_name.c_str(), node->GetName().c_str()); | ||||
if (is_unknown) { | if (is_unknown) { | ||||
GELOGD("Mark node %s unknown as unknown subgraph.", node->GetName().c_str()); | GELOGD("Mark node %s unknown as unknown subgraph.", node->GetName().c_str()); | ||||
@@ -572,7 +584,8 @@ Status DynamicShapePartitioner::IsUnknownShapeNode(NodePtr node, bool &is_unknow | |||||
Status DynamicShapePartitioner::IsUnknownShapeGraph(ComputeGraphPtr graph, bool &is_unknown) { | Status DynamicShapePartitioner::IsUnknownShapeGraph(ComputeGraphPtr graph, bool &is_unknown) { | ||||
for (auto &node : graph->GetDirectNode()) { | for (auto &node : graph->GetDirectNode()) { | ||||
REQUIRE_SUCCESS(IsUnknownShapeNode(node, is_unknown), "Failed check node %s shape on graph %s.", | |||||
REQUIRE_SUCCESS(IsUnknownShapeNode(node, is_unknown), | |||||
"[Call][IsUnknownShapeNode]Failed check node %s shape on graph %s.", | |||||
node->GetName().c_str(), graph->GetName().c_str()); | node->GetName().c_str(), graph->GetName().c_str()); | ||||
if (is_unknown) { | if (is_unknown) { | ||||
GELOGD("Mark graph %s unknown as contains unknown node %s.", graph->GetName().c_str(), node->GetName().c_str()); | GELOGD("Mark graph %s unknown as contains unknown node %s.", graph->GetName().c_str(), node->GetName().c_str()); | ||||
@@ -793,7 +806,7 @@ Status Cluster::BuildFrame() { | |||||
if (src_cluster->id_ != id_) { | if (src_cluster->id_ != id_) { | ||||
REQUIRE_GRAPH_SUCCESS( | REQUIRE_GRAPH_SUCCESS( | ||||
GraphUtils::RemoveEdge(peer_out_control_anchor, in_control_anchor), | GraphUtils::RemoveEdge(peer_out_control_anchor, in_control_anchor), | ||||
"Failed remove edge from node %s index %d to node %s index %d.", | |||||
"[Remove][Edge] from node %s index %d to node %s failed, index %d.", | |||||
peer_out_control_anchor->GetOwnerNode()->GetName().c_str(), AnchorUtils::GetIdx(peer_out_control_anchor), | peer_out_control_anchor->GetOwnerNode()->GetName().c_str(), AnchorUtils::GetIdx(peer_out_control_anchor), | ||||
in_control_anchor->GetOwnerNode()->GetName().c_str(), AnchorUtils::GetIdx(in_control_anchor)); | in_control_anchor->GetOwnerNode()->GetName().c_str(), AnchorUtils::GetIdx(in_control_anchor)); | ||||
control_inputs_.insert(src_cluster); | control_inputs_.insert(src_cluster); | ||||
@@ -823,20 +836,28 @@ Status Cluster::BuildPartitionFrame() { | |||||
string sub_graph_name_patten = (is_input ? "_input" : known_name); | string sub_graph_name_patten = (is_input ? "_input" : known_name); | ||||
std::string sub_graph_name = graph->GetName() + "_sub_" + std::to_string(unique_id_) + sub_graph_name_patten; | std::string sub_graph_name = graph->GetName() + "_sub_" + std::to_string(unique_id_) + sub_graph_name_patten; | ||||
subgraph_ = MakeShared<ComputeGraph>(sub_graph_name); | subgraph_ = MakeShared<ComputeGraph>(sub_graph_name); | ||||
REQUIRE_NOT_NULL(subgraph_, "Failed new memory for subgraph."); | |||||
REQUIRE_NOT_NULL(subgraph_, "[New][Memory] for subgraph failed, name:%s.", sub_graph_name.c_str()); | |||||
auto partition_op = MakeShared<OpDesc>("PartitionedCall_" + std::to_string(unique_id_++), "PartitionedCall"); | auto partition_op = MakeShared<OpDesc>("PartitionedCall_" + std::to_string(unique_id_++), "PartitionedCall"); | ||||
REQUIRE_NOT_NULL(partition_op, "Failed new memory for partition op."); | |||||
REQUIRE_NOT_NULL(partition_op, "[New][Memory] for partition op failed."); | |||||
REQUIRE(AttrUtils::SetBool(partition_op, ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | REQUIRE(AttrUtils::SetBool(partition_op, ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | ||||
"Failed set _is_unknown_shape flag on partitioned op %s.", partition_op->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(partition_op->AddSubgraphName(subgraph_->GetName()), "Failed add subgraph name."); | |||||
"[Set][Attr] _is_unknown_shape flag on partitioned op %s failed.", partition_op->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(partition_op->AddSubgraphName(subgraph_->GetName()), | |||||
"[Add][SubgraphName] %s for op:%s.", | |||||
subgraph_->GetName().c_str(), partition_op->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(partition_op->SetSubgraphInstanceName(0, subgraph_->GetName()), | REQUIRE_GRAPH_SUCCESS(partition_op->SetSubgraphInstanceName(0, subgraph_->GetName()), | ||||
"Failed set subgraph instance name."); | |||||
"[Call][SetSubgraphInstanceName] for op:%s failed, index:0, name:%s.", | |||||
partition_op->GetName().c_str(), subgraph_->GetName().c_str()); | |||||
for (auto &node : nodes_) { | for (auto &node : nodes_) { | ||||
REQUIRE_NOT_NULL(subgraph_->AddNode(node), "Failed add node to subgraph."); | |||||
REQUIRE_NOT_NULL(subgraph_->AddNode(node), | |||||
"[Add][Node] %s to subgraph:%s failed.", node->GetName().c_str(), subgraph_->GetName().c_str()); | |||||
REQUIRE(AttrUtils::SetBool(node->GetOpDesc(), ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | REQUIRE(AttrUtils::SetBool(node->GetOpDesc(), ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | ||||
"Failed set shape flag."); | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::RemoveJustNode(graph, node), "Failed remove root graph node."); | |||||
REQUIRE_GRAPH_SUCCESS(node->SetOwnerComputeGraph(subgraph_), "Failed set owner graph."); | |||||
"[Set][Attr] %s to op:%s failed.", ATTR_NAME_IS_UNKNOWN_SHAPE.c_str(), node->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::RemoveJustNode(graph, node), | |||||
"[Remove][JustNode] failed, graph:%s, node:%s.", | |||||
graph->GetName().c_str(), node->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(node->SetOwnerComputeGraph(subgraph_), | |||||
"[Set][OwnerComputeGraph] %s for node:%s failed.", | |||||
subgraph_->GetName().c_str(), node->GetName().c_str()); | |||||
for (const auto &anchor : node->GetAllInDataAnchors()) { | for (const auto &anchor : node->GetAllInDataAnchors()) { | ||||
auto peer_out_anchor = anchor->GetPeerOutAnchor(); | auto peer_out_anchor = anchor->GetPeerOutAnchor(); | ||||
if (peer_out_anchor == nullptr) { | if (peer_out_anchor == nullptr) { | ||||
@@ -846,7 +867,7 @@ Status Cluster::BuildPartitionFrame() { | |||||
if (src_cluster->id_ != id_) { | if (src_cluster->id_ != id_) { | ||||
AddFrameInput(anchor); | AddFrameInput(anchor); | ||||
REQUIRE_GRAPH_SUCCESS(partition_op->AddInputDesc(node->GetOpDesc()->GetInputDesc(anchor->GetIdx())), | REQUIRE_GRAPH_SUCCESS(partition_op->AddInputDesc(node->GetOpDesc()->GetInputDesc(anchor->GetIdx())), | ||||
"Failed add input desc."); | |||||
"[Add][InputDesc] to op:%s failed.", partition_op->GetName().c_str()); | |||||
} | } | ||||
} | } | ||||
auto in_control_anchor = node->GetInControlAnchor(); | auto in_control_anchor = node->GetInControlAnchor(); | ||||
@@ -859,7 +880,7 @@ Status Cluster::BuildPartitionFrame() { | |||||
if (src_cluster->id_ != id_) { | if (src_cluster->id_ != id_) { | ||||
REQUIRE_GRAPH_SUCCESS( | REQUIRE_GRAPH_SUCCESS( | ||||
GraphUtils::RemoveEdge(peer_out_control_anchor, in_control_anchor), | GraphUtils::RemoveEdge(peer_out_control_anchor, in_control_anchor), | ||||
"Failed remove edge from %s:%d to %s:%d.", peer_out_control_anchor->GetOwnerNode()->GetName().c_str(), | |||||
"[Remove][Edge] from %s:%d to %s:%d failed.", peer_out_control_anchor->GetOwnerNode()->GetName().c_str(), | |||||
peer_out_control_anchor->GetIdx(), node->GetName().c_str(), in_control_anchor->GetIdx()); | peer_out_control_anchor->GetIdx(), node->GetName().c_str(), in_control_anchor->GetIdx()); | ||||
control_inputs_.insert(src_cluster); | control_inputs_.insert(src_cluster); | ||||
src_cluster->control_outputs_.insert(peer_out_control_anchor); | src_cluster->control_outputs_.insert(peer_out_control_anchor); | ||||
@@ -873,23 +894,28 @@ Status Cluster::BuildPartitionFrame() { | |||||
if (src_cluster->id_ != id_) { | if (src_cluster->id_ != id_) { | ||||
AddFrameOutput(anchor); | AddFrameOutput(anchor); | ||||
REQUIRE_GRAPH_SUCCESS(partition_op->AddOutputDesc(node->GetOpDesc()->GetOutputDesc(anchor->GetIdx())), | REQUIRE_GRAPH_SUCCESS(partition_op->AddOutputDesc(node->GetOpDesc()->GetOutputDesc(anchor->GetIdx())), | ||||
"Failed add output desc."); | |||||
"[Add][OutputDesc] to op:%s failed.", partition_op->GetName().c_str()); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
partition_node_ = graph->AddNode(partition_op); | partition_node_ = graph->AddNode(partition_op); | ||||
REQUIRE_NOT_NULL(partition_node_, "Failed add partition node."); | |||||
REQUIRE_GRAPH_SUCCESS(partition_node_->SetOwnerComputeGraph(graph), "Failed set owner graph."); | |||||
REQUIRE_NOT_NULL(partition_node_, | |||||
"[Add][Node] %s to graph:%s failed.", partition_op->GetName().c_str(), graph->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(partition_node_->SetOwnerComputeGraph(graph), | |||||
"[Set][OwnerComputeGraph] %s for node:%s failed.", | |||||
graph->GetName().c_str(), partition_op->GetName().c_str()); | |||||
subgraph_->SetParentNode(partition_node_); | subgraph_->SetParentNode(partition_node_); | ||||
subgraph_->SetParentGraph(graph); | subgraph_->SetParentGraph(graph); | ||||
REQUIRE_GRAPH_SUCCESS(graph->AddSubgraph(subgraph_), "Failed add subgraph to root graph."); | |||||
REQUIRE_GRAPH_SUCCESS(graph->AddSubgraph(subgraph_), | |||||
"[Add][Subgraph] %s to root graph:%s failed.", | |||||
subgraph_->GetName().c_str(), graph->GetName().c_str()); | |||||
std::string session_graph_id; | std::string session_graph_id; | ||||
REQUIRE(AttrUtils::GetStr(*graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id), | REQUIRE(AttrUtils::GetStr(*graph, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id), | ||||
"Failed get ATTR_NAME_SESSION_GRAPH_ID on root graph."); | |||||
"[Get][Attr] %s on root graph:%s failed.", ATTR_NAME_SESSION_GRAPH_ID.c_str(), graph->GetName().c_str()); | |||||
REQUIRE(AttrUtils::SetStr(*subgraph_, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id), | REQUIRE(AttrUtils::SetStr(*subgraph_, ATTR_NAME_SESSION_GRAPH_ID, session_graph_id), | ||||
"Failed set ATTR_NAME_SESSION_GRAPH_ID on subgraph."); | |||||
"[Set][Attr] %s on subgraph:%s failed.", ATTR_NAME_SESSION_GRAPH_ID.c_str(), subgraph_->GetName().c_str()); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -899,17 +925,17 @@ Status Cluster::CombinePartitionFrame() { | |||||
auto src_cluster = partitioner_->node_2_cluster_[peer_out_anchor->GetOwnerNode()]; | auto src_cluster = partitioner_->node_2_cluster_[peer_out_anchor->GetOwnerNode()]; | ||||
auto src_anchor = src_cluster->GetFrameOutDataAnchor(peer_out_anchor); | auto src_anchor = src_cluster->GetFrameOutDataAnchor(peer_out_anchor); | ||||
auto dst_anchor = GetFrameInDataAnchor(anchor); | auto dst_anchor = GetFrameInDataAnchor(anchor); | ||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::RemoveEdge(peer_out_anchor, anchor), "Failed remove edge from %s:%d to %s:%d.", | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::RemoveEdge(peer_out_anchor, anchor), "[Remove][Edge] from %s:%d to %s:%d fail.", | |||||
peer_out_anchor->GetOwnerNode()->GetName().c_str(), peer_out_anchor->GetIdx(), | peer_out_anchor->GetOwnerNode()->GetName().c_str(), peer_out_anchor->GetIdx(), | ||||
anchor->GetOwnerNode()->GetName().c_str(), anchor->GetIdx()); | anchor->GetOwnerNode()->GetName().c_str(), anchor->GetIdx()); | ||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(src_anchor, dst_anchor), "Failed add edge from %s:%d to %s:%d.", | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(src_anchor, dst_anchor), "[Add][Edge] from %s:%d to %s:%d failed.", | |||||
src_anchor->GetOwnerNode()->GetName().c_str(), src_anchor->GetIdx(), | src_anchor->GetOwnerNode()->GetName().c_str(), src_anchor->GetIdx(), | ||||
dst_anchor->GetOwnerNode()->GetName().c_str(), dst_anchor->GetIdx()); | dst_anchor->GetOwnerNode()->GetName().c_str(), dst_anchor->GetIdx()); | ||||
} | } | ||||
for (const auto &src_cluster : control_inputs_) { | for (const auto &src_cluster : control_inputs_) { | ||||
auto src_anchor = src_cluster->GetFrameOutControlAnchor(); | auto src_anchor = src_cluster->GetFrameOutControlAnchor(); | ||||
auto dst_anchor = GetFrameInControlAnchor(); | auto dst_anchor = GetFrameInControlAnchor(); | ||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(src_anchor, dst_anchor), "Failed add edge from %s:%d to %s:%d.", | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(src_anchor, dst_anchor), "[Add][Edge] from %s:%d to %s:%d failed.", | |||||
src_anchor->GetOwnerNode()->GetName().c_str(), src_anchor->GetIdx(), | src_anchor->GetOwnerNode()->GetName().c_str(), src_anchor->GetIdx(), | ||||
dst_anchor->GetOwnerNode()->GetName().c_str(), dst_anchor->GetIdx()); | dst_anchor->GetOwnerNode()->GetName().c_str(), dst_anchor->GetIdx()); | ||||
} | } | ||||
@@ -924,55 +950,69 @@ Status Cluster::BuildPartitionSubgraph() { | |||||
for (auto anchor : inputs_) { | for (auto anchor : inputs_) { | ||||
auto data_op = | auto data_op = | ||||
MakeShared<OpDesc>(subgraph_->GetName() + std::string("Data_") + std::to_string(parent_node_index), ge::DATA); | MakeShared<OpDesc>(subgraph_->GetName() + std::string("Data_") + std::to_string(parent_node_index), ge::DATA); | ||||
REQUIRE_NOT_NULL(data_op, "Failed new memory for data op."); | |||||
REQUIRE_NOT_NULL(data_op, "[New][Memory] for data op failed."); | |||||
auto input_desc = anchor->GetOwnerNode()->GetOpDesc()->GetInputDesc(anchor->GetIdx()); | auto input_desc = anchor->GetOwnerNode()->GetOpDesc()->GetInputDesc(anchor->GetIdx()); | ||||
REQUIRE_GRAPH_SUCCESS(data_op->AddInputDesc(input_desc), "Failed add input desc."); | |||||
REQUIRE_GRAPH_SUCCESS(data_op->AddOutputDesc(input_desc), "Failed add output desc."); | |||||
REQUIRE_GRAPH_SUCCESS(data_op->AddInputDesc(input_desc), | |||||
"[Add][InputDesc] to op:%s failed.", data_op->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(data_op->AddOutputDesc(input_desc), | |||||
"[Add][OutputDesc] to op:%s failed.", data_op->GetName().c_str()); | |||||
REQUIRE(AttrUtils::SetInt(data_op, ATTR_NAME_PARENT_NODE_INDEX, parent_node_index), | REQUIRE(AttrUtils::SetInt(data_op, ATTR_NAME_PARENT_NODE_INDEX, parent_node_index), | ||||
"Failed set parent_node_index on subgraph data node."); | |||||
"[Set][Attr] %s on subgraph data node:%s failed.", | |||||
ATTR_NAME_PARENT_NODE_INDEX.c_str(), data_op->GetName().c_str()); | |||||
bool is_unknown_shape = IsUnknownShape(); | bool is_unknown_shape = IsUnknownShape(); | ||||
REQUIRE(AttrUtils::SetBool(data_op, ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | REQUIRE(AttrUtils::SetBool(data_op, ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | ||||
"Failed set _is_unknown_shape flag on data op %s.", data_op->GetName().c_str()); | |||||
"[Set][Attr] %s on data op %s failed.", ATTR_NAME_IS_UNKNOWN_SHAPE.c_str(), data_op->GetName().c_str()); | |||||
auto data_node = subgraph_->AddNode(data_op); | auto data_node = subgraph_->AddNode(data_op); | ||||
REQUIRE_NOT_NULL(data_node, "Failed add data node to subgraph."); | |||||
REQUIRE_GRAPH_SUCCESS(data_node->SetOwnerComputeGraph(subgraph_), "Failed set owner graph of data node."); | |||||
REQUIRE_NOT_NULL(data_node, | |||||
"[Add][Node] %s to subgraph:%s failed.", data_op->GetName().c_str(), subgraph_->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(data_node->SetOwnerComputeGraph(subgraph_), | |||||
"[Set][OwnerGraph] %s of data node:%s failed.", | |||||
subgraph_->GetName().c_str(), data_op->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(data_node->GetOutDataAnchor(0), anchor), | REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(data_node->GetOutDataAnchor(0), anchor), | ||||
"Faile add data input edge to %s:%d", anchor->GetOwnerNode()->GetName().c_str(), | |||||
anchor->GetIdx()); | |||||
"[Call][AddEdge] Failed add data input edge to %s:%d", | |||||
anchor->GetOwnerNode()->GetName().c_str(), anchor->GetIdx()); | |||||
parent_node_index++; | parent_node_index++; | ||||
} | } | ||||
if (outputs_.empty() && control_outputs_.empty()) { | if (outputs_.empty() && control_outputs_.empty()) { | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
auto net_output_op = MakeShared<OpDesc>(subgraph_->GetName() + "_" + NODE_NAME_NET_OUTPUT, ge::NETOUTPUT); | auto net_output_op = MakeShared<OpDesc>(subgraph_->GetName() + "_" + NODE_NAME_NET_OUTPUT, ge::NETOUTPUT); | ||||
REQUIRE_NOT_NULL(net_output_op, "Failed new memory for netoutput op."); | |||||
REQUIRE_NOT_NULL(net_output_op, "[New][Memory] for netoutput op failed."); | |||||
bool is_unknown_shape = IsUnknownShape(); | bool is_unknown_shape = IsUnknownShape(); | ||||
REQUIRE(AttrUtils::SetBool(net_output_op, ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | REQUIRE(AttrUtils::SetBool(net_output_op, ATTR_NAME_IS_UNKNOWN_SHAPE, is_unknown_shape), | ||||
"Failed set _is_unknown_shape flag on net_output_op %s.", net_output_op->GetName().c_str()); | |||||
"[Set][Attr] %s on op:%s failed.", ATTR_NAME_IS_UNKNOWN_SHAPE.c_str(), net_output_op->GetName().c_str()); | |||||
for (size_t i = 0; i < outputs_.size(); ++i) { | for (size_t i = 0; i < outputs_.size(); ++i) { | ||||
GeTensorDesc input_desc; | GeTensorDesc input_desc; | ||||
REQUIRE_GRAPH_SUCCESS(net_output_op->AddInputDesc(input_desc), "Failed add input desc."); | |||||
REQUIRE_GRAPH_SUCCESS(net_output_op->AddInputDesc(input_desc), | |||||
"[Add][InputDesc] to op:%s failed.", net_output_op->GetName().c_str()); | |||||
} | } | ||||
auto net_output_node = subgraph_->AddNode(net_output_op); | auto net_output_node = subgraph_->AddNode(net_output_op); | ||||
REQUIRE_NOT_NULL(net_output_node, "Failed add netoutput node to subgraph."); | |||||
REQUIRE_GRAPH_SUCCESS(net_output_node->SetOwnerComputeGraph(subgraph_), "Failed set owner graph of netoutput node."); | |||||
REQUIRE_NOT_NULL(net_output_node, | |||||
"[Call][AddNode] Failed add netoutput node:%s to subgraph:%s.", | |||||
net_output_op->GetName().c_str(), subgraph_->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(net_output_node->SetOwnerComputeGraph(subgraph_), | |||||
"[Set][OwnerGraph] %s of netoutput node:%s failed.", | |||||
subgraph_->GetName().c_str(), net_output_node->GetName().c_str()); | |||||
parent_node_index = 0; | parent_node_index = 0; | ||||
for (const auto &anchor : outputs_) { | for (const auto &anchor : outputs_) { | ||||
auto output_desc = anchor->GetOwnerNode()->GetOpDesc()->GetOutputDesc(static_cast<uint32_t>(anchor->GetIdx())); | auto output_desc = anchor->GetOwnerNode()->GetOpDesc()->GetOutputDesc(static_cast<uint32_t>(anchor->GetIdx())); | ||||
REQUIRE(AttrUtils::SetInt(output_desc, ATTR_NAME_PARENT_NODE_INDEX, parent_node_index), | REQUIRE(AttrUtils::SetInt(output_desc, ATTR_NAME_PARENT_NODE_INDEX, parent_node_index), | ||||
"Failed set parent_node_index on subgraph netoutput's input."); | |||||
"[Set][Attr] parent_node_index on subgraph node:%s netoutput's input failed.", | |||||
anchor->GetOwnerNode()->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(net_output_op->UpdateInputDesc(parent_node_index, output_desc), | REQUIRE_GRAPH_SUCCESS(net_output_op->UpdateInputDesc(parent_node_index, output_desc), | ||||
"Failed update input desc of netoutput node."); | |||||
"[Update][InputDesc] of netoutput node:%s failed.", net_output_op->GetName().c_str()); | |||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(anchor, net_output_node->GetInDataAnchor(parent_node_index)), | REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(anchor, net_output_node->GetInDataAnchor(parent_node_index)), | ||||
"Faile add edge from %s:%d to netoutput node.", anchor->GetOwnerNode()->GetName().c_str(), | |||||
anchor->GetIdx()); | |||||
"[Add][Edge] from %s:%d to netoutput node:%s failed.", | |||||
anchor->GetOwnerNode()->GetName().c_str(), anchor->GetIdx(), | |||||
net_output_op->GetName().c_str()); | |||||
parent_node_index++; | parent_node_index++; | ||||
} | } | ||||
for (const auto &anchor : control_outputs_) { | for (const auto &anchor : control_outputs_) { | ||||
REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(anchor, net_output_node->GetInControlAnchor()), | REQUIRE_GRAPH_SUCCESS(GraphUtils::AddEdge(anchor, net_output_node->GetInControlAnchor()), | ||||
"Faile add control edge from %s:%d to netoutput node.", | |||||
anchor->GetOwnerNode()->GetName().c_str(), anchor->GetIdx()); | |||||
"[Add][ControlEdge] from %s:%d to netoutput node:%s failed.", | |||||
anchor->GetOwnerNode()->GetName().c_str(), anchor->GetIdx(), | |||||
net_output_op->GetName().c_str()); | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -36,12 +36,14 @@ std::mutex check_support_cost_mutex; | |||||
} | } | ||||
Status EnginePlacer::Check() const { | Status EnginePlacer::Check() const { | ||||
if (compute_graph_ == nullptr) { | if (compute_graph_ == nullptr) { | ||||
GELOGE(GE_GRAPH_NULL_INPUT, "compute_graph_ is null."); | |||||
REPORT_INNER_ERROR("E19999", "compute_graph_ is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_NULL_INPUT, "[Check][Param] compute_graph_ is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if ((instance_ptr == nullptr) || (!instance_ptr->InitFlag())) { | if ((instance_ptr == nullptr) || (!instance_ptr->InitFlag())) { | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "Run enginePlacer failed"); | |||||
REPORT_INNER_ERROR("E19999", "GELib instance is nullptr or it is not InitFlag, check invalid."); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib] Run enginePlacer failed, because GELib is invalid."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -87,13 +89,13 @@ Status EnginePlacer::Run() { | |||||
is_check_support_success = false; | is_check_support_success = false; | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E13003", {"opname", "optype"}, {op_desc->GetName(), op_desc->GetType()}); | "E13003", {"opname", "optype"}, {op_desc->GetName(), op_desc->GetType()}); | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "Can not find engine of op type %s", | |||||
node_ptr->GetOpDesc()->GetType().c_str()); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] Can not find engine of op name %s type %s", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
if (AssignEngineAndLog(node_ptr, engine_name) != SUCCESS) { | if (AssignEngineAndLog(node_ptr, engine_name) != SUCCESS) { | ||||
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, "[GraphPartitioner]: AssignEngineAndLog FAILED"); | |||||
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, "[Call][AssignEngineAndLog] FAILED, node:%s", op_desc->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -107,7 +109,8 @@ Status EnginePlacer::Run() { | |||||
Status EnginePlacer::AssignEngineAndLog(ge::ConstNodePtr node_ptr, const std::string &engine_name) { | Status EnginePlacer::AssignEngineAndLog(ge::ConstNodePtr node_ptr, const std::string &engine_name) { | ||||
if ((node_ptr == nullptr) || (node_ptr->GetOpDesc() == nullptr)) { | if ((node_ptr == nullptr) || (node_ptr->GetOpDesc() == nullptr)) { | ||||
GELOGE(FAILED, "node_ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param node_ptr is nullptr or it's opdesc is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] node_ptr is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -49,13 +49,18 @@ Status ge::GraphPartitioner::CheckIfEnd2PldEmpty(ge::ComputeGraphPtr &output_mer | |||||
if (graph_info_.partitions_.size() == kOneGraph) { | if (graph_info_.partitions_.size() == kOneGraph) { | ||||
auto partition = (*graph_info_.partitions_.begin()); | auto partition = (*graph_info_.partitions_.begin()); | ||||
if (partition.first == nullptr) { | if (partition.first == nullptr) { | ||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "[GraphPartitioner]: partition.first is null, engine name is %s", | |||||
REPORT_INNER_ERROR("E19999", "partition.first is nullptr, check invalid, engine name is %s", | |||||
partition.second.c_str()); | |||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "[Check][Param] partition.first is null, engine name is %s", | |||||
partition.second.c_str()); | partition.second.c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
output_merged_compute_graph = partition.first; | output_merged_compute_graph = partition.first; | ||||
} else { // if placeholder to end map is empty, it should be an exception condition | } else { // if placeholder to end map is empty, it should be an exception condition | ||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "[GraphPartitioner]: placeholder to end map is empty, partitions size is not 1."); | |||||
REPORT_INNER_ERROR("E19999", "partitions size:%zu is not 1, check invalid.", graph_info_.partitions_.size()); | |||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, | |||||
"[Check][Param] placeholder to end map is empty, partitions size:%zu is not 1.", | |||||
graph_info_.partitions_.size()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -80,7 +85,8 @@ Status ge::GraphPartitioner::MergeAllSubGraph(ge::ComputeGraphPtr &output_merged | |||||
(void)AttrUtils::SetStr(node->GetOpDesc(), ATTR_NAME_STREAM_LABEL, temp_stream); | (void)AttrUtils::SetStr(node->GetOpDesc(), ATTR_NAME_STREAM_LABEL, temp_stream); | ||||
} | } | ||||
if (node->SetOwnerComputeGraph(output_merged_compute_graph) != GRAPH_SUCCESS) { | if (node->SetOwnerComputeGraph(output_merged_compute_graph) != GRAPH_SUCCESS) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "SetownerComputeGraph failed, node %s", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "SetOwnerComputeGraph for node:%s failed.", node->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Set][OwnerComputeGraph] failed, node %s", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
(void)output_merged_compute_graph->AddNode(node); | (void)output_merged_compute_graph->AddNode(node); | ||||
@@ -111,7 +117,8 @@ Status ge::GraphPartitioner::RemoveNodeAndEdgeBetweenEndPld(ge::ComputeGraphPtr | |||||
const std::vector<SubGraphInfoPtr> &sub_graph_list) { | const std::vector<SubGraphInfoPtr> &sub_graph_list) { | ||||
if ((output_merged_compute_graph == nullptr) || | if ((output_merged_compute_graph == nullptr) || | ||||
(MergeAllSubGraph(output_merged_compute_graph, sub_graph_list) != SUCCESS)) { | (MergeAllSubGraph(output_merged_compute_graph, sub_graph_list) != SUCCESS)) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: MergeAllSubGraph failed."); | |||||
REPORT_INNER_ERROR("E19999", "output_merged_compute_graph is nullptr or Call MergeAllSubGraph failed."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Merge][AllSubGraph] failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
for (const auto &it : graph_info_.index_2_end_) { | for (const auto &it : graph_info_.index_2_end_) { | ||||
@@ -127,19 +134,31 @@ Status ge::GraphPartitioner::RemoveNodeAndEdgeBetweenEndPld(ge::ComputeGraphPtr | |||||
: Anchor::DynamicAnchorCast<Anchor>(pld->GetOutDataAnchor(0)); | : Anchor::DynamicAnchorCast<Anchor>(pld->GetOutDataAnchor(0)); | ||||
auto src_anchor = end_in_anchor->GetFirstPeerAnchor(); // src_anchor should be only 1 | auto src_anchor = end_in_anchor->GetFirstPeerAnchor(); // src_anchor should be only 1 | ||||
if (GraphUtils::RemoveEdge(src_anchor, end_in_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::RemoveEdge(src_anchor, end_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: RemoveEdge failed. node_name:%s, graph_name:%s", | |||||
REPORT_CALL_ERROR("E19999", "RemoveEdge between %s and %s failed", | |||||
src_anchor->GetOwnerNode()->GetName().c_str(), | |||||
end_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Remove][Edge] between %s and %s failed. node_name:%s, graph_name:%s", | |||||
src_anchor->GetOwnerNode()->GetName().c_str(), end_in_anchor->GetOwnerNode()->GetName().c_str(), | |||||
end->GetName().c_str(), end->GetOwnerComputeGraph()->GetName().c_str()); | end->GetName().c_str(), end->GetOwnerComputeGraph()->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_CHECK_NOTNULL(pld_out_anchor); | GE_CHECK_NOTNULL(pld_out_anchor); | ||||
for (const auto &peer_in_anchor : pld_out_anchor->GetPeerAnchors()) { | for (const auto &peer_in_anchor : pld_out_anchor->GetPeerAnchors()) { | ||||
if (GraphUtils::RemoveEdge(pld_out_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::RemoveEdge(pld_out_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: RemoveEdge failed. node_name:%s, graph_name:%s", | |||||
REPORT_CALL_ERROR("E19999", "RemoveEdge between %s and %s failed", | |||||
pld_out_anchor->GetOwnerNode()->GetName().c_str(), | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Remove][Edge] between %s and %s failed. node_name:%s, graph_name:%s", | |||||
pld_out_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||||
pld->GetName().c_str(), pld->GetOwnerComputeGraph()->GetName().c_str()); | pld->GetName().c_str(), pld->GetOwnerComputeGraph()->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (GraphUtils::AddEdge(src_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(src_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "merge two subgraph fail."); | |||||
REPORT_CALL_ERROR("E19999", "AddEdge from %s to %s failed.", | |||||
src_anchor->GetOwnerNode()->GetName().c_str(), | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Add][Edge] from %s to %s failed.", | |||||
src_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -157,7 +176,7 @@ Status ge::GraphPartitioner::MergeAfterSubGraphOptimization(ge::ComputeGraphPtr | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
// even though failed, ensure all op do finish check support | // even though failed, ensure all op do finish check support | ||||
real_ret = FAILED; | real_ret = FAILED; | ||||
GELOGE(ret, "Graph merging Failed"); | |||||
GELOGE(ret, "[Merge][SubGraph] Failed, ret:%d", ret); | |||||
} | } | ||||
GE_CHECK_NOTNULL(original_compute_graph); | GE_CHECK_NOTNULL(original_compute_graph); | ||||
// partition sub graph | // partition sub graph | ||||
@@ -166,7 +185,7 @@ Status ge::GraphPartitioner::MergeAfterSubGraphOptimization(ge::ComputeGraphPtr | |||||
ret = MergeSubGraph(merged_sub_graph, sub_graph); | ret = MergeSubGraph(merged_sub_graph, sub_graph); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
real_ret = FAILED; | real_ret = FAILED; | ||||
GELOGE(ret, "Sub graph merging Failed"); | |||||
GELOGE(ret, "[Merge][SubGraph] Failed, ret:%d", ret); | |||||
continue; | continue; | ||||
} | } | ||||
// add sub graph | // add sub graph | ||||
@@ -176,19 +195,32 @@ Status ge::GraphPartitioner::MergeAfterSubGraphOptimization(ge::ComputeGraphPtr | |||||
merged_sub_graph->SetOutputSize(sub_graph->GetOutputSize()); | merged_sub_graph->SetOutputSize(sub_graph->GetOutputSize()); | ||||
auto parent_node = sub_graph->GetParentNode(); | auto parent_node = sub_graph->GetParentNode(); | ||||
GE_IF_BOOL_EXEC(parent_node == nullptr, | GE_IF_BOOL_EXEC(parent_node == nullptr, | ||||
GELOGE(FAILED, "Parent node is null, graph name is %s", sub_graph->GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Parent node of graph:%s is nullptr.", | |||||
sub_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Parent node is null, graph name is %s", | |||||
sub_graph->GetName().c_str()); | |||||
return FAILED;) | return FAILED;) | ||||
auto original_graph = parent_node->GetOwnerComputeGraph(); | auto original_graph = parent_node->GetOwnerComputeGraph(); | ||||
GE_IF_BOOL_EXEC(graph_2_graph_partition_info_.find(original_graph) == graph_2_graph_partition_info_.end(), | GE_IF_BOOL_EXEC(graph_2_graph_partition_info_.find(original_graph) == graph_2_graph_partition_info_.end(), | ||||
GELOGE(FAILED, "Find graph info failed, graph name is %s", original_graph->GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "graph:%s not find in graph_2_graph_partition_info_, check invalid.", | |||||
original_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Find graph info failed, graph name is %s", | |||||
original_graph->GetName().c_str()); | |||||
return FAILED;) | return FAILED;) | ||||
auto graph_info = graph_2_graph_partition_info_[original_graph]; | auto graph_info = graph_2_graph_partition_info_[original_graph]; | ||||
GE_IF_BOOL_EXEC(graph_info.corresponding_node_in_partitions_.count(parent_node) == 0, | GE_IF_BOOL_EXEC(graph_info.corresponding_node_in_partitions_.count(parent_node) == 0, | ||||
GELOGE(FAILED, "Find corresponding node failed, parent node name is %s", parent_node->GetName().c_str()); | |||||
return FAILED;) | |||||
REPORT_INNER_ERROR("E19999", "node:%s not find in corresponding_node_in_partitions_, " | |||||
"check invalid", parent_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Find corresponding node failed, parent node name is %s", | |||||
parent_node->GetName().c_str()); | |||||
return FAILED;) | |||||
auto corresponding_node = graph_info.corresponding_node_in_partitions_[parent_node]; | auto corresponding_node = graph_info.corresponding_node_in_partitions_[parent_node]; | ||||
GE_IF_BOOL_EXEC(corresponding_node == nullptr, GELOGE(FAILED, "Get null node, node name is %s", | |||||
parent_node->GetName().c_str()); return FAILED;); | |||||
GE_IF_BOOL_EXEC(corresponding_node == nullptr, | |||||
REPORT_INNER_ERROR("E19999", "Get null node in corresponding_node_in_partitions_, " | |||||
"first node name is %s", parent_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Get null node in corresponding_node_in_partitions_, " | |||||
"first node name is %s", parent_node->GetName().c_str()); | |||||
return FAILED;); | |||||
merged_sub_graph->SetParentNode(corresponding_node); | merged_sub_graph->SetParentNode(corresponding_node); | ||||
auto subgraph_parent_graph = corresponding_node->GetOwnerComputeGraph(); | auto subgraph_parent_graph = corresponding_node->GetOwnerComputeGraph(); | ||||
merged_sub_graph->SetParentGraph(subgraph_parent_graph); | merged_sub_graph->SetParentGraph(subgraph_parent_graph); | ||||
@@ -207,12 +239,17 @@ Status ge::GraphPartitioner::MergeAfterSubGraphOptimization(ge::ComputeGraphPtr | |||||
Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_compute_graph, | Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_compute_graph, | ||||
const ge::ComputeGraphPtr &original_compute_graph) { | const ge::ComputeGraphPtr &original_compute_graph) { | ||||
if (original_compute_graph == nullptr) { | if (original_compute_graph == nullptr) { | ||||
GELOGE(GE_GRAPH_NULL_INPUT, "[GraphPartitioner]: compute_graph is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param original_compute_graph is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_NULL_INPUT, "[Check][Param] original_compute_graph is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if ((graph_2_graph_partition_info_.find(original_compute_graph) == graph_2_graph_partition_info_.end()) || | if ((graph_2_graph_partition_info_.find(original_compute_graph) == graph_2_graph_partition_info_.end()) || | ||||
(graph_2_subgraph_list_.find(original_compute_graph) == graph_2_subgraph_list_.end())) { | (graph_2_subgraph_list_.find(original_compute_graph) == graph_2_subgraph_list_.end())) { | ||||
GELOGE(GE_GRAPH_NULL_INPUT, "[GraphPartitioner]: compute_graph is error."); | |||||
REPORT_INNER_ERROR("E19999", "original_compute_graph:%s is not find in graph_2_graph_partition_info_.", | |||||
original_compute_graph->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_NULL_INPUT, | |||||
"[Check][Param] original_compute_graph:%s is not find in graph_2_graph_partition_info_.", | |||||
original_compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GraphPartitionInfo &subgraph_info = graph_2_graph_partition_info_[original_compute_graph]; | GraphPartitionInfo &subgraph_info = graph_2_graph_partition_info_[original_compute_graph]; | ||||
@@ -220,14 +257,16 @@ Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_co | |||||
graph_info_ = subgraph_info; | graph_info_ = subgraph_info; | ||||
if (graph_info_.mode_ != kMerging) { | if (graph_info_.mode_ != kMerging) { | ||||
GELOGE(GE_GRAPH_UNSUPPORTED, "Cannot call merging in partition mode"); | |||||
REPORT_INNER_ERROR("E19999", "Cannot call merging in partition mode, as mode != %d", kMerging); | |||||
GELOGE(GE_GRAPH_UNSUPPORTED, "[Check][Param] Cannot call merging in partition mode, as mode != %d", kMerging); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGD("Graph merge starts."); | GELOGD("Graph merge starts."); | ||||
// check input param | // check input param | ||||
for (const auto &it : sub_graph_list) { | for (const auto &it : sub_graph_list) { | ||||
if (it == nullptr) { | if (it == nullptr) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: merging sub-graphs failed, sub-graph is null"); | |||||
REPORT_INNER_ERROR("E19999", "sub_graph is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] merging sub-graphs failed, sub-graph is nullptr"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -242,14 +281,16 @@ Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_co | |||||
output_merged_compute_graph = new_sub_graph; | output_merged_compute_graph = new_sub_graph; | ||||
GE_TIMESTAMP_START(MergeSubGraphRemoveNode); | GE_TIMESTAMP_START(MergeSubGraphRemoveNode); | ||||
if (RemoveNodeAndEdgeBetweenEndPld(output_merged_compute_graph, sub_graph_list) != ge::SUCCESS) { | if (RemoveNodeAndEdgeBetweenEndPld(output_merged_compute_graph, sub_graph_list) != ge::SUCCESS) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: merging sub-graphs failed"); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Call][RemoveNodeAndEdgeBetweenEndPld] failed, graph:%s", | |||||
output_merged_compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(MergeSubGraphRemoveNode, "GraphPartitioner::MergeGraphRemoveNodeAndEdge"); | GE_TIMESTAMP_END(MergeSubGraphRemoveNode, "GraphPartitioner::MergeGraphRemoveNodeAndEdge"); | ||||
GE_TIMESTAMP_START(MergeSubGraphTopologicalSorting); | GE_TIMESTAMP_START(MergeSubGraphTopologicalSorting); | ||||
Status ret = output_merged_compute_graph->TopologicalSorting(); | Status ret = output_merged_compute_graph->TopologicalSorting(); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(GE_GRAPH_TOPO_SORT_FAILED, "[GraphPartitioner]: output_merged_compute_graph->TopologicalSorting failed"); | |||||
GELOGE(GE_GRAPH_TOPO_SORT_FAILED, "[Call][TopologicalSorting] for output_merged_compute_graph:%s failed", | |||||
output_merged_compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(MergeSubGraphTopologicalSorting, "GraphPartitioner::MergeGraphTopologicalSorting"); | GE_TIMESTAMP_END(MergeSubGraphTopologicalSorting, "GraphPartitioner::MergeGraphTopologicalSorting"); | ||||
@@ -257,7 +298,8 @@ Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_co | |||||
GE_TIMESTAMP_START(MergeSubGraphEnginePlacerRun); | GE_TIMESTAMP_START(MergeSubGraphEnginePlacerRun); | ||||
graph_info_.engine_placer_.SetComputeGraph(output_merged_compute_graph); | graph_info_.engine_placer_.SetComputeGraph(output_merged_compute_graph); | ||||
if (graph_info_.engine_placer_.Run() != SUCCESS) { | if (graph_info_.engine_placer_.Run() != SUCCESS) { | ||||
GELOGE(GE_GRAPH_INIT_FAILED, "[GraphPartitioner]: engine_placer run failed"); | |||||
GELOGE(GE_GRAPH_INIT_FAILED, "[Call][Run] engine_placer run failed, graph:%s", | |||||
output_merged_compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(MergeSubGraphEnginePlacerRun, "GraphPartitioner::MergeGraphEnginePlacerRun"); | GE_TIMESTAMP_END(MergeSubGraphEnginePlacerRun, "GraphPartitioner::MergeGraphEnginePlacerRun"); | ||||
@@ -267,17 +309,22 @@ Status ge::GraphPartitioner::MergeSubGraph(ge::ComputeGraphPtr &output_merged_co | |||||
Status ge::GraphPartitioner::UpdatePldOpDesc(const NodePtr &dst_node, int input_index, OpDescPtr &pld_op_desc) { | Status ge::GraphPartitioner::UpdatePldOpDesc(const NodePtr &dst_node, int input_index, OpDescPtr &pld_op_desc) { | ||||
if ((dst_node == nullptr) || (pld_op_desc == nullptr) || (dst_node->GetOpDesc() == nullptr)) { | if ((dst_node == nullptr) || (pld_op_desc == nullptr) || (dst_node->GetOpDesc() == nullptr)) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param dst_node or pld_op_desc or op of dst_node is nullptr, check invalid"); | |||||
GELOGE(FAILED, "[Check][Param] parameter ptr is null."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
const auto &input_desc = dst_node->GetOpDesc()->GetInputDesc(static_cast<uint32_t>(input_index)); | const auto &input_desc = dst_node->GetOpDesc()->GetInputDesc(static_cast<uint32_t>(input_index)); | ||||
GE_IF_BOOL_EXEC(pld_op_desc->AddOutputDesc(input_desc) != GRAPH_SUCCESS, GELOGE(FAILED, "AddOutputDesc failed"); | |||||
return FAILED;) | |||||
GE_IF_BOOL_EXEC(pld_op_desc->AddOutputDesc(input_desc) != GRAPH_SUCCESS, | |||||
REPORT_CALL_ERROR("E19999", "AddOutputDesc to op:%s failed", pld_op_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][OutputDesc] to op:%s failed", pld_op_desc->GetName().c_str()); | |||||
return FAILED;) | |||||
if (pld_op_desc->MutableOutputDesc(0) != nullptr) { | if (pld_op_desc->MutableOutputDesc(0) != nullptr) { | ||||
ge::TensorUtils::SetRealDimCnt(*(pld_op_desc->MutableOutputDesc(0).get()), | ge::TensorUtils::SetRealDimCnt(*(pld_op_desc->MutableOutputDesc(0).get()), | ||||
static_cast<uint32_t>(input_desc.GetShape().GetDims().size())); | static_cast<uint32_t>(input_desc.GetShape().GetDims().size())); | ||||
} else { | } else { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[GraphPartitioner]: pld_op_desc is null."); | |||||
REPORT_INNER_ERROR("E19999", "output(0) of op:%s is nullptr, check invalid", pld_op_desc->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[Check][Param] output(0) of op:%s is nullptr.", | |||||
pld_op_desc->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -285,17 +332,22 @@ Status ge::GraphPartitioner::UpdatePldOpDesc(const NodePtr &dst_node, int input_ | |||||
Status ge::GraphPartitioner::UpdateEndOpDesc(const NodePtr &src_node, int output_index, OpDescPtr &end_op_desc) { | Status ge::GraphPartitioner::UpdateEndOpDesc(const NodePtr &src_node, int output_index, OpDescPtr &end_op_desc) { | ||||
if ((src_node == nullptr) || (end_op_desc == nullptr) || (src_node->GetOpDesc() == nullptr)) { | if ((src_node == nullptr) || (end_op_desc == nullptr) || (src_node->GetOpDesc() == nullptr)) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param src_node or end_op_desc or op of src_node is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter ptr is null."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
const auto &output_desc = src_node->GetOpDesc()->GetOutputDesc(static_cast<uint32_t>(output_index)); | const auto &output_desc = src_node->GetOpDesc()->GetOutputDesc(static_cast<uint32_t>(output_index)); | ||||
GE_IF_BOOL_EXEC(end_op_desc->AddInputDesc(output_desc) != GRAPH_SUCCESS, GELOGE(FAILED, "AddInputDesc failed"); | |||||
return FAILED;) | |||||
GE_IF_BOOL_EXEC(end_op_desc->AddInputDesc(output_desc) != GRAPH_SUCCESS, | |||||
REPORT_CALL_ERROR("E19999", "AddInputDesc to op:%s failed", end_op_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][InputDesc] to op:%s failed", end_op_desc->GetName().c_str()); | |||||
return FAILED;) | |||||
if (end_op_desc->MutableInputDesc(0) != nullptr) { | if (end_op_desc->MutableInputDesc(0) != nullptr) { | ||||
ge::TensorUtils::SetRealDimCnt(*(end_op_desc->MutableInputDesc(0).get()), | ge::TensorUtils::SetRealDimCnt(*(end_op_desc->MutableInputDesc(0).get()), | ||||
static_cast<uint32_t>(output_desc.GetShape().GetDims().size())); | static_cast<uint32_t>(output_desc.GetShape().GetDims().size())); | ||||
} else { | } else { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[GraphPartitioner]: pld_op_desc is null."); | |||||
REPORT_INNER_ERROR("E19999", "input(0) of op:%s is nullptr, check invalid.", end_op_desc->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[Check][Param] input(0) of op:%s is nullptr.", | |||||
end_op_desc->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -315,7 +367,8 @@ graphStatus ge::GraphPartitioner::AddPlaceHolderEndInSrcDstGraph(const AnchorPtr | |||||
string end_name = kEndType + std::to_string(graph_info_.num_of_pld_end_); | string end_name = kEndType + std::to_string(graph_info_.num_of_pld_end_); | ||||
auto end_op_desc = MakeShared<OpDesc>(end_graph->GetName() + "_" + end_name, END); | auto end_op_desc = MakeShared<OpDesc>(end_graph->GetName() + "_" + end_name, END); | ||||
if (end_op_desc == nullptr) { | if (end_op_desc == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "pld_op_desc is nullptr."); | |||||
REPORT_CALL_ERROR("E19999", "New Memory for OpDesc failed."); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[New][Memory] for OpDesc failed, pld_op_desc is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetInt(end_op_desc, "peerIndex", graph_info_.num_of_pld_end_), | GE_IF_BOOL_EXEC(!AttrUtils::SetInt(end_op_desc, "peerIndex", graph_info_.num_of_pld_end_), | ||||
@@ -333,28 +386,40 @@ graphStatus ge::GraphPartitioner::AddPlaceHolderEndInSrcDstGraph(const AnchorPtr | |||||
bool is_need_update_desc = (output_index >= 0) && (graph_info_.mode_ == kPartitioning); | bool is_need_update_desc = (output_index >= 0) && (graph_info_.mode_ == kPartitioning); | ||||
if (is_need_update_desc) { | if (is_need_update_desc) { | ||||
if (UpdateEndOpDesc(src_node, output_index, end_op_desc) != SUCCESS) { | if (UpdateEndOpDesc(src_node, output_index, end_op_desc) != SUCCESS) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "UpdateEndOpDesc failed, input index %d", output_index); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Update][EndOpDesc] failed, input index:%d, end_op_desc:%s", | |||||
output_index, end_op_desc->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} else { | } else { | ||||
GeTensorDesc input_desc; | GeTensorDesc input_desc; | ||||
if (end_op_desc->AddInputDesc(input_desc) != SUCCESS) { | if (end_op_desc->AddInputDesc(input_desc) != SUCCESS) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "AddInputDesc failed, input index %d", output_index); | |||||
REPORT_CALL_ERROR("E19999", "add input desc to op:%s failed, input index:%d", | |||||
end_op_desc->GetName().c_str(), output_index); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Add][InputDesc] to op:%s failed, input index %d", | |||||
end_op_desc->GetName().c_str(), output_index); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
NodePtr new_end_node = end_graph->AddNode(end_op_desc); | NodePtr new_end_node = end_graph->AddNode(end_op_desc); | ||||
if (new_end_node == nullptr) { | if (new_end_node == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "new_end_node is nullptr."); | |||||
REPORT_CALL_ERROR("E19999", "add node:%s in graph:%s failed", | |||||
end_op_desc->GetName().c_str(), end_graph->GetName().c_str()); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Add][Node] %s in graph:%s failed.", | |||||
end_op_desc->GetName().c_str(), end_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_IF_BOOL_EXEC(new_end_node->SetOwnerComputeGraph(end_graph) != GRAPH_SUCCESS, | GE_IF_BOOL_EXEC(new_end_node->SetOwnerComputeGraph(end_graph) != GRAPH_SUCCESS, | ||||
GELOGE(GRAPH_PARAM_INVALID, "SetOwnerComputeGraph failed"); | |||||
REPORT_CALL_ERROR("E19999", "SetOwnerComputeGraph %s for node:%s failed", | |||||
end_graph->GetName().c_str(), new_end_node->GetName().c_str()); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Set][OwnerComputeGraph] %s for node:%s failed", | |||||
end_graph->GetName().c_str(), new_end_node->GetName().c_str()); | |||||
return FAILED;) | return FAILED;) | ||||
AnchorPtr end_dst_anchor = GetEndInAnchor(out_anchor, new_end_node); | AnchorPtr end_dst_anchor = GetEndInAnchor(out_anchor, new_end_node); | ||||
if (GraphUtils::AddEdge(out_anchor, end_dst_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(out_anchor, end_dst_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "add end node : %s node %dth out-anchor --> end in %s subgraph fail.", | |||||
src_node->GetName().c_str(), AnchorUtils::GetIdx(out_anchor), end_graph->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "add edge from %s to %s failed", out_anchor->GetOwnerNode()->GetName().c_str(), | |||||
end_dst_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[Add][Edge] from %s to %s failed", | |||||
out_anchor->GetOwnerNode()->GetName().c_str(), end_dst_anchor->GetOwnerNode()->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
/// For fe, op id has been set in AddNode, | /// For fe, op id has been set in AddNode, | ||||
@@ -365,7 +430,8 @@ graphStatus ge::GraphPartitioner::AddPlaceHolderEndInSrcDstGraph(const AnchorPtr | |||||
const string pld_name = kPlaceHolderType + std::to_string(graph_info_.num_of_pld_end_); | const string pld_name = kPlaceHolderType + std::to_string(graph_info_.num_of_pld_end_); | ||||
auto pld_op_desc = MakeShared<OpDesc>(pld_graph->GetName() + "_" + pld_name, PLACEHOLDER); | auto pld_op_desc = MakeShared<OpDesc>(pld_graph->GetName() + "_" + pld_name, PLACEHOLDER); | ||||
if (pld_op_desc == nullptr) { | if (pld_op_desc == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "pld_op_desc is nullptr."); | |||||
REPORT_CALL_ERROR("E19999", "New Memory for OpDesc failed."); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[New][Memory] for OpDesc failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetInt(pld_op_desc, "peerIndex", graph_info_.num_of_pld_end_), | GE_IF_BOOL_EXEC(!AttrUtils::SetInt(pld_op_desc, "peerIndex", graph_info_.num_of_pld_end_), | ||||
@@ -401,30 +467,42 @@ graphStatus ge::GraphPartitioner::AddPlaceHolderEndInSrcDstGraph(const AnchorPtr | |||||
is_need_update_desc = (input_index >= 0) && (graph_info_.mode_ == kPartitioning); | is_need_update_desc = (input_index >= 0) && (graph_info_.mode_ == kPartitioning); | ||||
if (is_need_update_desc) { | if (is_need_update_desc) { | ||||
if (UpdatePldOpDesc(dst_node, input_index, pld_op_desc) != SUCCESS) { | if (UpdatePldOpDesc(dst_node, input_index, pld_op_desc) != SUCCESS) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "UpdateEndOpDesc failed, output index %d", input_index); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Update][PldOpDesc] failed, output index:%d, pld_op_desc:%s", | |||||
input_index, pld_op_desc->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} else { | } else { | ||||
GeTensorDesc output_desc; | GeTensorDesc output_desc; | ||||
if (pld_op_desc->AddOutputDesc(output_desc) != SUCCESS) { | if (pld_op_desc->AddOutputDesc(output_desc) != SUCCESS) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "AddOutputDesc failed, input index %d", input_index); | |||||
REPORT_CALL_ERROR("E19999", "AddOutputDesc to op:%s failed, input index %d", | |||||
pld_op_desc->GetName().c_str(), input_index); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Add][OutputDesc] to op:%s failed, input index %d", | |||||
pld_op_desc->GetName().c_str(), input_index); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
NodePtr new_pld_node = pld_graph->AddNode(pld_op_desc); | NodePtr new_pld_node = pld_graph->AddNode(pld_op_desc); | ||||
if (new_pld_node == nullptr) { | if (new_pld_node == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "new_pld_node is nullptr."); | |||||
REPORT_CALL_ERROR("E19999", "AddNode %s in graph:%s failed.", | |||||
pld_op_desc->GetName().c_str(), pld_graph->GetName().c_str()); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Add][Node] %s in graph:%s failed.", | |||||
pld_op_desc->GetName().c_str(), pld_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_IF_BOOL_EXEC(new_pld_node->SetOwnerComputeGraph(pld_graph) != GRAPH_SUCCESS, | GE_IF_BOOL_EXEC(new_pld_node->SetOwnerComputeGraph(pld_graph) != GRAPH_SUCCESS, | ||||
GELOGE(GRAPH_PARAM_INVALID, "SetOwnerComputeGraph failed"); | |||||
REPORT_CALL_ERROR("E19999", "SetOwnerComputeGraph for node:%s failed, graph:%s", | |||||
new_pld_node->GetName().c_str(), pld_graph->GetName().c_str()); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Set][OwnerComputeGraph] for node:%s failed, graph:%s", | |||||
new_pld_node->GetName().c_str(), pld_graph->GetName().c_str()); | |||||
return FAILED;) | return FAILED;) | ||||
AnchorPtr pld_src_anchor = GetPldOutAnchor(new_pld_node, peer_in_anchor); | AnchorPtr pld_src_anchor = GetPldOutAnchor(new_pld_node, peer_in_anchor); | ||||
// link placeHolder -> computeNode | // link placeHolder -> computeNode | ||||
if (GraphUtils::AddEdge(pld_src_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(pld_src_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, | |||||
"add placeholder node : placeholder --> %s node %dth in-anchor in %s subgraph fail.", | |||||
dst_node->GetName().c_str(), AnchorUtils::GetIdx(peer_in_anchor), pld_graph->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "AddEdge from %s to %s failed", | |||||
pld_src_anchor->GetOwnerNode()->GetName().c_str(), | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[Add][Edge] from %s to %s failed", | |||||
pld_src_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
graph_info_.index_2_end_[graph_info_.num_of_pld_end_] = new_end_node; | graph_info_.index_2_end_[graph_info_.num_of_pld_end_] = new_end_node; | ||||
@@ -436,7 +514,8 @@ graphStatus ge::GraphPartitioner::AddPlaceHolderEndInSrcDstGraph(const AnchorPtr | |||||
Status ge::GraphPartitioner::LinkInput2EndRemoveOrginalLink(ge::NodePtr input_node, ge::ComputeGraphPtr src_graph, | Status ge::GraphPartitioner::LinkInput2EndRemoveOrginalLink(ge::NodePtr input_node, ge::ComputeGraphPtr src_graph, | ||||
ge::ComputeGraphPtr dst_graph) { | ge::ComputeGraphPtr dst_graph) { | ||||
if ((input_node == nullptr) || (src_graph == nullptr) || (dst_graph == nullptr)) { | if ((input_node == nullptr) || (src_graph == nullptr) || (dst_graph == nullptr)) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param input_node or src_graph or dst_graph is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter input_node or src_graph or dst_graph is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// get the original anchors and remove the original link | // get the original anchors and remove the original link | ||||
@@ -444,27 +523,40 @@ Status ge::GraphPartitioner::LinkInput2EndRemoveOrginalLink(ge::NodePtr input_no | |||||
for (auto &peer_in_anchor : out_data_anchor->GetPeerAnchors()) { | for (auto &peer_in_anchor : out_data_anchor->GetPeerAnchors()) { | ||||
if (peer_in_anchor->GetOwnerNode()->GetType() != kEndType) { | if (peer_in_anchor->GetOwnerNode()->GetType() != kEndType) { | ||||
if (GraphUtils::RemoveEdge(out_data_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::RemoveEdge(out_data_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: RemoveEdge() failed."); | |||||
REPORT_CALL_ERROR("E19999", "RemoveEdge between %s and %s failed.", | |||||
out_data_anchor->GetOwnerNode()->GetName().c_str(), | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][Edge] between %s and %s failed.", | |||||
out_data_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// link input -> end | // link input -> end | ||||
auto ret = AddPlaceHolderEndInSrcDstGraph(out_data_anchor, peer_in_anchor, src_graph, dst_graph); | auto ret = AddPlaceHolderEndInSrcDstGraph(out_data_anchor, peer_in_anchor, src_graph, dst_graph); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[GraphPartitioner]: AddPlaceHolderEndInSrcDstGraph() failed."); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[Call][AddPlaceHolderEndInSrcDstGraph] failed, ret:%d.", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
} else { | } else { | ||||
auto end_node = peer_in_anchor->GetOwnerNode(); | auto end_node = peer_in_anchor->GetOwnerNode(); | ||||
if (GraphUtils::RemoveJustNode(src_graph, end_node) != GRAPH_SUCCESS) { | if (GraphUtils::RemoveJustNode(src_graph, end_node) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: RemoveJustNode() failed."); | |||||
REPORT_CALL_ERROR("E19999", "RemoveJustNode %s from graph:%s failed.", | |||||
end_node->GetName().c_str(), src_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][JustNode] %s from graph:%s failed.", | |||||
end_node->GetName().c_str(), src_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (end_node->SetOwnerComputeGraph(dst_graph) != GRAPH_SUCCESS) { | if (end_node->SetOwnerComputeGraph(dst_graph) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: RemoveJustNode() failed."); | |||||
REPORT_CALL_ERROR("E19999", "SetOwnerComputeGraph for node:%s failed, graph:%s.", | |||||
end_node->GetName().c_str(), dst_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Set][OwnerComputeGraph] to node:%s failed, graph:%s.", | |||||
end_node->GetName().c_str(), dst_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (dst_graph->AddNode(end_node) == nullptr) { | if (dst_graph->AddNode(end_node) == nullptr) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: AddNode() failed."); | |||||
REPORT_CALL_ERROR("E19999", "AddNode %s in graph:%s failed.", | |||||
end_node->GetName().c_str(), dst_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s in graph:%s failed.", | |||||
end_node->GetName().c_str(), dst_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -476,27 +568,37 @@ Status ge::GraphPartitioner::LinkInput2EndRemoveOrginalLink(ge::NodePtr input_no | |||||
Status ge::GraphPartitioner::PutInputNodesInSubGraph(const ge::ComputeGraphPtr &src_graph, | Status ge::GraphPartitioner::PutInputNodesInSubGraph(const ge::ComputeGraphPtr &src_graph, | ||||
const ge::ComputeGraphPtr &dst_graph) { | const ge::ComputeGraphPtr &dst_graph) { | ||||
if ((src_graph == nullptr) || (dst_graph == nullptr)) { | if ((src_graph == nullptr) || (dst_graph == nullptr)) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param src_graph or dst_graph is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter src_graph or dst_graph is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
for (auto &input_node : src_graph->GetDirectNode()) { | for (auto &input_node : src_graph->GetDirectNode()) { | ||||
if (IsDataLike(input_node)) { | if (IsDataLike(input_node)) { | ||||
if (input_node->SetOwnerComputeGraph(dst_graph) != GRAPH_SUCCESS) { | if (input_node->SetOwnerComputeGraph(dst_graph) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: SetOwnerComputeGraph failed."); | |||||
REPORT_CALL_ERROR("E19999", "SetOwnerComputeGraph for node:%s failed, graph:%s.", | |||||
input_node->GetName().c_str(), dst_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Set][OwnerComputeGraph] for node:%s failed, graph:%s.", | |||||
input_node->GetName().c_str(), dst_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// remove input node from src_graph | // remove input node from src_graph | ||||
if (GraphUtils::RemoveJustNode(src_graph, input_node) != GRAPH_SUCCESS) { | if (GraphUtils::RemoveJustNode(src_graph, input_node) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: RemoveJustNode() failed."); | |||||
REPORT_CALL_ERROR("E19999", "RemoveJustNode %s from graph:%s failed.", | |||||
input_node->GetName().c_str(), src_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][JustNode] %s from graph:%s failed.", | |||||
input_node->GetName().c_str(), src_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// add input node to dst_graph | // add input node to dst_graph | ||||
if (dst_graph->AddNode(input_node) == nullptr) { | if (dst_graph->AddNode(input_node) == nullptr) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: AddNode() failed."); | |||||
REPORT_CALL_ERROR("E19999", "AddNode %s in graph:%s failed.", | |||||
input_node->GetName().c_str(), src_graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s in graph:%s failed.", | |||||
input_node->GetName().c_str(), src_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (LinkInput2EndRemoveOrginalLink(input_node, src_graph, dst_graph) != ge::SUCCESS) { | if (LinkInput2EndRemoveOrginalLink(input_node, src_graph, dst_graph) != ge::SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: LinkInput2EndRemoveOrginalLink() failed."); | |||||
GELOGE(FAILED, "[Call][LinkInput2EndRemoveOrginalLink] failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -519,7 +621,7 @@ bool ge::GraphPartitioner::IsDataLike(ge::NodePtr node) { | |||||
bool ge::GraphPartitioner::HasNoInput(ge::NodePtr node) { | bool ge::GraphPartitioner::HasNoInput(ge::NodePtr node) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
GELOGE(FAILED, "node_ptr is null."); | |||||
GELOGE(FAILED, "[Check][Param] node is nullptr."); | |||||
return true; | return true; | ||||
} | } | ||||
return node->GetInNodes().empty(); | return node->GetInNodes().empty(); | ||||
@@ -529,12 +631,13 @@ Status ge::GraphPartitioner::Initialize(ge::ComputeGraphPtr compute_graph) { | |||||
GELOGI("Initialize starts."); | GELOGI("Initialize starts."); | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || compute_graph == nullptr) { | if (instance_ptr == nullptr || compute_graph == nullptr) { | ||||
GELOGE(GE_GRAPH_NOT_INIT, "Graph partitioner initialize failed."); | |||||
REPORT_INNER_ERROR("E19999", "compute_graph or instance_ptr of GELib is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_NOT_INIT, "[Check][Param] compute_graph or instance_ptr of GELib is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
graph_info_.engine_placer_.SetComputeGraph(compute_graph); | graph_info_.engine_placer_.SetComputeGraph(compute_graph); | ||||
if (graph_info_.engine_placer_.Run() != SUCCESS) { | if (graph_info_.engine_placer_.Run() != SUCCESS) { | ||||
GELOGE(FAILED, "Engine placer run failed."); | |||||
GELOGE(FAILED, "[Call][Run] Engine placer run failed, graph:%s.", compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
const NodeEngineMap *node_engine_map = graph_info_.engine_placer_.GetNodeEngineMap(); | const NodeEngineMap *node_engine_map = graph_info_.engine_placer_.GetNodeEngineMap(); | ||||
@@ -552,14 +655,16 @@ Status ge::GraphPartitioner::Initialize(ge::ComputeGraphPtr compute_graph) { | |||||
new_cluster = cluster; | new_cluster = cluster; | ||||
} else { | } else { | ||||
if (node_engine_map->count(node) == 0) { | if (node_engine_map->count(node) == 0) { | ||||
GELOGE(FAILED, "node[%s] does not owner engine!", node->GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "node:%s not find in node_engine_map", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] node[%s] does not owner engine!", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ClusterPtr cluster = MakeShared<Cluster>(temp_index, node_engine_map->at(node), temp_stream); | ClusterPtr cluster = MakeShared<Cluster>(temp_index, node_engine_map->at(node), temp_stream); | ||||
new_cluster = cluster; | new_cluster = cluster; | ||||
} | } | ||||
if (new_cluster == nullptr) { | if (new_cluster == nullptr) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: failed to allocate new_cluster"); | |||||
REPORT_CALL_ERROR("E19999", "Allocate Cluster failed, index:%zu", temp_index); | |||||
GELOGE(FAILED, "[Allocate][Cluster] failed, index:%zu", temp_index); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
new_cluster->nodes_.push_back(node); | new_cluster->nodes_.push_back(node); | ||||
@@ -570,11 +675,11 @@ Status ge::GraphPartitioner::Initialize(ge::ComputeGraphPtr compute_graph) { | |||||
if (parent_id < node_id) { | if (parent_id < node_id) { | ||||
auto iter = graph_info_.node_2_cluster_.find(parent); | auto iter = graph_info_.node_2_cluster_.find(parent); | ||||
if (iter == graph_info_.node_2_cluster_.end()) { | if (iter == graph_info_.node_2_cluster_.end()) { | ||||
GELOGE(FAILED, | |||||
"[GraphPartitioner]: node[%s]id[%ld]'s parent_node[%s]id[%ld]" | |||||
"should make cluster in advance", | |||||
node->GetOpDesc()->GetName().c_str(), node_id, | |||||
parent->GetOpDesc()->GetName().c_str(), parent_id); | |||||
REPORT_INNER_ERROR("E19999", "node[%s]id[%ld]'s parent_node[%s]id[%ld] should make cluster in advance", | |||||
node->GetOpDesc()->GetName().c_str(), node_id, | |||||
parent->GetOpDesc()->GetName().c_str(), parent_id); | |||||
GELOGE(FAILED, "[Check][Param] node[%s]id[%ld]'s parent_node[%s]id[%ld] should make cluster in advance", | |||||
node->GetOpDesc()->GetName().c_str(), node_id, parent->GetOpDesc()->GetName().c_str(), parent_id); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
new_cluster->in_clu_.insert(iter->second->index_); | new_cluster->in_clu_.insert(iter->second->index_); | ||||
@@ -603,7 +708,8 @@ Status ge::GraphPartitioner::AddPartitionsToGraphNode(vector<ge::SubGraphInfoPtr | |||||
// the output_subgraphs have topological order | // the output_subgraphs have topological order | ||||
for (const auto &sub_graph : graph_info_.rank_2_partitions_) { | for (const auto &sub_graph : graph_info_.rank_2_partitions_) { | ||||
if (graph_info_.partitions_.find(sub_graph) == graph_info_.partitions_.end()) { | if (graph_info_.partitions_.find(sub_graph) == graph_info_.partitions_.end()) { | ||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "[GraphPartitioner]: partition is null."); | |||||
REPORT_INNER_ERROR("E19999", "partition is null, subgraph:%s", sub_graph->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "[Check][Param] partition is null, subgraph:%s", sub_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto &engine_name = graph_info_.partitions_.at(sub_graph); | auto &engine_name = graph_info_.partitions_.at(sub_graph); | ||||
@@ -619,7 +725,8 @@ Status ge::GraphPartitioner::AddPartitionsToGraphNode(vector<ge::SubGraphInfoPtr | |||||
sub_graph->SetParentNode(compute_graph->GetParentNode()); | sub_graph->SetParentNode(compute_graph->GetParentNode()); | ||||
auto sgi = MakeShared<SubGraphInfo>(); | auto sgi = MakeShared<SubGraphInfo>(); | ||||
if (sgi == nullptr) { | if (sgi == nullptr) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: MakeShared sub graph info failed."); | |||||
REPORT_CALL_ERROR("E19999", "allocate memory for SubGraphInfo failed."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Allocate][Memory] for SubGraphInfo failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// set engine name | // set engine name | ||||
@@ -767,7 +874,8 @@ void ge::GraphPartitioner::MarkClusters() { | |||||
Status ge::GraphPartitioner::SplitSubGraphs(ge::ComputeGraphPtr compute_graph) { | Status ge::GraphPartitioner::SplitSubGraphs(ge::ComputeGraphPtr compute_graph) { | ||||
GELOGD("SplitSubGraphs starts."); | GELOGD("SplitSubGraphs starts."); | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | |||||
GELOGE(FAILED, "[Check][Param] parameter ptr is null."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// Create graphs for all clusters | // Create graphs for all clusters | ||||
@@ -785,7 +893,8 @@ Status ge::GraphPartitioner::SplitSubGraphs(ge::ComputeGraphPtr compute_graph) { | |||||
std::string graph_name = "new_sub_graph" + std::to_string(graph_info_.partitions_.size()); | std::string graph_name = "new_sub_graph" + std::to_string(graph_info_.partitions_.size()); | ||||
ComputeGraphPtr new_sub_graph = MakeShared<ge::ComputeGraph>(graph_name); | ComputeGraphPtr new_sub_graph = MakeShared<ge::ComputeGraph>(graph_name); | ||||
if (new_sub_graph == nullptr) { | if (new_sub_graph == nullptr) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: MakeShared() failed."); | |||||
REPORT_CALL_ERROR("E19999", "allocate memory for ge::ComputeGraph failed."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Allocate][Memory] for ge::ComputeGraph failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddNewGraphToPartition(new_sub_graph, child_cluster->engine_name_); | AddNewGraphToPartition(new_sub_graph, child_cluster->engine_name_); | ||||
@@ -796,7 +905,10 @@ Status ge::GraphPartitioner::SplitSubGraphs(ge::ComputeGraphPtr compute_graph) { | |||||
// build node to corresponding node map | // build node to corresponding node map | ||||
NodePtr corresponding_node = corresponding_graph->AddNode(node->GetOpDesc()); | NodePtr corresponding_node = corresponding_graph->AddNode(node->GetOpDesc()); | ||||
if (corresponding_node == nullptr) { | if (corresponding_node == nullptr) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: AddNode() failed."); | |||||
REPORT_CALL_ERROR("E19999", "add node:%s in graph:%s failed", | |||||
node->GetName().c_str(), corresponding_graph->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Add][Node] %s in graph:%s failed.", | |||||
node->GetName().c_str(), corresponding_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
graph_info_.corresponding_node_in_partitions_[node] = corresponding_node; | graph_info_.corresponding_node_in_partitions_[node] = corresponding_node; | ||||
@@ -808,8 +920,12 @@ Status ge::GraphPartitioner::SplitSubGraphs(ge::ComputeGraphPtr compute_graph) { | |||||
// Normally, all nodes have a copy in corresponding_node_in_partitions_, so function at can not be exception | // Normally, all nodes have a copy in corresponding_node_in_partitions_, so function at can not be exception | ||||
auto iter = graph_info_.corresponding_node_in_partitions_.find(peer_out_anchor->GetOwnerNode()); | auto iter = graph_info_.corresponding_node_in_partitions_.find(peer_out_anchor->GetOwnerNode()); | ||||
if (iter == graph_info_.corresponding_node_in_partitions_.end()) { | if (iter == graph_info_.corresponding_node_in_partitions_.end()) { | ||||
GELOGE(GRAPH_FAILED, | |||||
"[SpiltSubGraphs]: node[%s]id[%ld]'s parent_node[%s]id[%ld]" | |||||
REPORT_INNER_ERROR("E19999", "node[%s]id[%ld]'s parent_node[%s]id[%ld]" | |||||
"should make corresponding in advance", | |||||
node->GetOpDesc()->GetName().c_str(), node->GetOpDesc()->GetId(), | |||||
peer_out_anchor->GetOwnerNode()->GetOpDesc()->GetName().c_str(), | |||||
peer_out_anchor->GetOwnerNode()->GetOpDesc()->GetId()); | |||||
GELOGE(GRAPH_FAILED, "[Check][Param] node[%s]id[%ld]'s parent_node[%s]id[%ld]" | |||||
"should make corresponding in advance", | "should make corresponding in advance", | ||||
node->GetOpDesc()->GetName().c_str(), node->GetOpDesc()->GetId(), | node->GetOpDesc()->GetName().c_str(), node->GetOpDesc()->GetId(), | ||||
peer_out_anchor->GetOwnerNode()->GetOpDesc()->GetName().c_str(), | peer_out_anchor->GetOwnerNode()->GetOpDesc()->GetName().c_str(), | ||||
@@ -827,13 +943,19 @@ Status ge::GraphPartitioner::SplitSubGraphs(ge::ComputeGraphPtr compute_graph) { | |||||
if (parent_cluster != child_cluster) { | if (parent_cluster != child_cluster) { | ||||
GELOGD("Parent cluster is %zu, child_cluster is %zu", parent_cluster->index_, child_cluster->index_); | GELOGD("Parent cluster is %zu, child_cluster is %zu", parent_cluster->index_, child_cluster->index_); | ||||
if (AddPlaceHolderEnd(peer_out_anchor, in_anchor) != ge::SUCCESS) { | if (AddPlaceHolderEnd(peer_out_anchor, in_anchor) != ge::SUCCESS) { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[GraphPartitioner]: AddPlaceHolderEndInSrcDstGraph() failed."); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, | |||||
"[Call][AddPlaceHolderEnd] failed, out_anchor:%s index:%d, in_anchor:%s index:%d.", | |||||
peer_out_anchor->GetOwnerNode()->GetName().c_str(), AnchorUtils::GetIdx(peer_out_anchor), | |||||
in_anchor->GetOwnerNode()->GetName().c_str(), AnchorUtils::GetIdx(in_anchor)); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} else { // parent and child in the same cluster, add edge | } else { // parent and child in the same cluster, add edge | ||||
GELOGD("AddEdge from parent cluster %zu to child %zu", parent_cluster->index_, child_cluster->index_); | GELOGD("AddEdge from parent cluster %zu to child %zu", parent_cluster->index_, child_cluster->index_); | ||||
if (GraphUtils::AddEdge(src_anchor, dst_anchor) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(src_anchor, dst_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(GRAPH_FAILED, "AddEdge fail, from %s to %s", peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||||
REPORT_CALL_ERROR("E19999", "add edge from %s to %s failed", | |||||
peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||||
in_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(GRAPH_FAILED, "[Add][Edge] from %s to %s failed", peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||||
in_anchor->GetOwnerNode()->GetName().c_str()); | in_anchor->GetOwnerNode()->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -880,7 +1002,7 @@ Status ge::GraphPartitioner::Partition(ge::ComputeGraphPtr compute_graph, Mode m | |||||
auto real_ret = SUCCESS; | auto real_ret = SUCCESS; | ||||
auto ret = PartitionSubGraph(compute_graph, mode); | auto ret = PartitionSubGraph(compute_graph, mode); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Sub graph partition Failed"); | |||||
GELOGE(ret, "[Partition][SubGraph] Failed, ret:%d", ret); | |||||
real_ret = ret; | real_ret = ret; | ||||
} | } | ||||
GE_CHECK_NOTNULL(compute_graph); | GE_CHECK_NOTNULL(compute_graph); | ||||
@@ -888,7 +1010,7 @@ Status ge::GraphPartitioner::Partition(ge::ComputeGraphPtr compute_graph, Mode m | |||||
for (const auto &sub_graph : compute_graph->GetAllSubgraphs()) { | for (const auto &sub_graph : compute_graph->GetAllSubgraphs()) { | ||||
ret = PartitionSubGraph(sub_graph, mode); | ret = PartitionSubGraph(sub_graph, mode); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Sub graph partition Failed"); | |||||
GELOGE(ret, "[Partition][SubGraph] Failed, ret:%d", ret); | |||||
real_ret = ret; | real_ret = ret; | ||||
} | } | ||||
} | } | ||||
@@ -903,7 +1025,8 @@ Status ge::GraphPartitioner::Partition(ge::ComputeGraphPtr compute_graph, Mode m | |||||
Status ge::GraphPartitioner::PartitionSubGraph(ge::ComputeGraphPtr compute_graph, Mode mode) { | Status ge::GraphPartitioner::PartitionSubGraph(ge::ComputeGraphPtr compute_graph, Mode mode) { | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
GELOGE(GE_GRAPH_NULL_INPUT, "[GraphPartitioner]: compute_graph is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_NULL_INPUT, "[Check][Param] compute_graph is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// clear graph_info | // clear graph_info | ||||
@@ -912,18 +1035,24 @@ Status ge::GraphPartitioner::PartitionSubGraph(ge::ComputeGraphPtr compute_graph | |||||
graph_info_.output_size_ = compute_graph->GetOutputSize(); | graph_info_.output_size_ = compute_graph->GetOutputSize(); | ||||
graph_info_.input_size_ = compute_graph->GetInputSize(); | graph_info_.input_size_ = compute_graph->GetInputSize(); | ||||
if (graph_info_.output_size_ == 0) { | if (graph_info_.output_size_ == 0) { | ||||
GELOGE(GE_GRAPH_NULL_INPUT, "The output size need to be greater than 0."); | |||||
REPORT_INNER_ERROR("E19999", "the output size of graph:%s is 0, check invalid.", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_NULL_INPUT, "[Check][Param] The output size:0 of graph:%s need to be greater than 0.", | |||||
compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGI("Graph Partition starts, graph nodes size is %zu", compute_graph->GetDirectNodesSize()); | GELOGI("Graph Partition starts, graph nodes size is %zu", compute_graph->GetDirectNodesSize()); | ||||
Status ret = compute_graph->TopologicalSorting(); | Status ret = compute_graph->TopologicalSorting(); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(GE_GRAPH_TOPO_SORT_FAILED, "[GraphPartitioner]: subGraphPtr->TopologicalSorting failed"); | |||||
REPORT_CALL_ERROR("E19999", "TopologicalSorting for graph:%s failed", | |||||
compute_graph->GetName().c_str()); | |||||
GELOGE(GE_GRAPH_TOPO_SORT_FAILED, "[Call][TopologicalSorting] for subGraph:%s failed", | |||||
compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_START(PartitionSubGraphInitialize); | GE_TIMESTAMP_START(PartitionSubGraphInitialize); | ||||
if (Initialize(compute_graph) != SUCCESS) { | if (Initialize(compute_graph) != SUCCESS) { | ||||
GELOGE(GE_GRAPH_INIT_FAILED, "[GraphPartitioner]: initialize failed"); | |||||
GELOGE(GE_GRAPH_INIT_FAILED, "[Call][Initialize] for graph:%s failed", compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(PartitionSubGraphInitialize, "GraphPartitioner::PartitionInitialize"); | GE_TIMESTAMP_END(PartitionSubGraphInitialize, "GraphPartitioner::PartitionInitialize"); | ||||
@@ -932,20 +1061,22 @@ Status ge::GraphPartitioner::PartitionSubGraph(ge::ComputeGraphPtr compute_graph | |||||
GE_TIMESTAMP_END(PartitionSubGraphMarkClusters, "GraphPartitioner::PartitionMarkClusters"); | GE_TIMESTAMP_END(PartitionSubGraphMarkClusters, "GraphPartitioner::PartitionMarkClusters"); | ||||
GE_TIMESTAMP_START(PartitionSubGraphSplitSubGraphs); | GE_TIMESTAMP_START(PartitionSubGraphSplitSubGraphs); | ||||
if (SplitSubGraphs(compute_graph) != SUCCESS) { | if (SplitSubGraphs(compute_graph) != SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: SplitSubGraphs failed"); | |||||
GELOGE(FAILED, "[Split][SubGraphs] for graph:%s failed", compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(PartitionSubGraphSplitSubGraphs, "GraphPartitioner::PartitionSplitSubGraphs"); | GE_TIMESTAMP_END(PartitionSubGraphSplitSubGraphs, "GraphPartitioner::PartitionSplitSubGraphs"); | ||||
GE_TIMESTAMP_START(PartitionSubGraphSortSubGraphs); | GE_TIMESTAMP_START(PartitionSubGraphSortSubGraphs); | ||||
if (SortSubGraphs(compute_graph) != ge::SUCCESS) { | if (SortSubGraphs(compute_graph) != ge::SUCCESS) { | ||||
GELOGE(GE_GRAPH_TOPO_SORT_FAILED, "Graph Partition SortSubGraphs failed."); | |||||
GELOGE(GE_GRAPH_TOPO_SORT_FAILED, "[Sort][SubGraphs] for graph:%s failed.", | |||||
compute_graph->GetName().c_str()); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(PartitionSubGraphSortSubGraphs, "GraphPartitioner::PartitionSortSubGraphs"); | GE_TIMESTAMP_END(PartitionSubGraphSortSubGraphs, "GraphPartitioner::PartitionSortSubGraphs"); | ||||
GE_TIMESTAMP_START(PartitionSubGraphAddPartitionsToGraphNode); | GE_TIMESTAMP_START(PartitionSubGraphAddPartitionsToGraphNode); | ||||
vector<ge::SubGraphInfoPtr> output_subgraphs; | vector<ge::SubGraphInfoPtr> output_subgraphs; | ||||
if (AddPartitionsToGraphNode(output_subgraphs, compute_graph) != ge::SUCCESS) { | if (AddPartitionsToGraphNode(output_subgraphs, compute_graph) != ge::SUCCESS) { | ||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "Graph Partition AddPartitionsToGraphNode failed."); | |||||
GELOGE(GE_GRAPH_EMPTY_PARTITION, "[Add][Partitions] To GraphNode failed, graph:%s.", | |||||
compute_graph->GetName().c_str()); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
GE_TIMESTAMP_END(PartitionSubGraphAddPartitionsToGraphNode, "GraphPartitioner::PartitionAddPartitionsToGraphNode"); | GE_TIMESTAMP_END(PartitionSubGraphAddPartitionsToGraphNode, "GraphPartitioner::PartitionAddPartitionsToGraphNode"); | ||||
@@ -961,14 +1092,16 @@ Status ge::GraphPartitioner::PartitionSubGraph(ge::ComputeGraphPtr compute_graph | |||||
// all the inputs are the nodes and anchors in the original graph | // all the inputs are the nodes and anchors in the original graph | ||||
Status ge::GraphPartitioner::AddPlaceHolderEnd(const AnchorPtr &out_anchor, const AnchorPtr &in_anchor) { | Status ge::GraphPartitioner::AddPlaceHolderEnd(const AnchorPtr &out_anchor, const AnchorPtr &in_anchor) { | ||||
if ((out_anchor == nullptr) || (in_anchor == nullptr)) { | if ((out_anchor == nullptr) || (in_anchor == nullptr)) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "src_node or dst_node is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param out_anchor or in_anchor is nullptr, check invalid."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] out_anchor or in_anchor is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// nodes in original graph | // nodes in original graph | ||||
const auto &src_node = out_anchor->GetOwnerNode(); | const auto &src_node = out_anchor->GetOwnerNode(); | ||||
const auto &dst_node = in_anchor->GetOwnerNode(); | const auto &dst_node = in_anchor->GetOwnerNode(); | ||||
if ((src_node == nullptr) || (dst_node == nullptr)) { | if ((src_node == nullptr) || (dst_node == nullptr)) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "src_node or dst_node is null."); | |||||
REPORT_INNER_ERROR("E19999", "in_anchor'node or out_anchor'node is nullptr. check invalid."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] src_node or dst_node is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// All nodes have a copy in corresponding_node_in_partitions_, so function at can not be execption | // All nodes have a copy in corresponding_node_in_partitions_, so function at can not be execption | ||||
@@ -977,7 +1110,10 @@ Status ge::GraphPartitioner::AddPlaceHolderEnd(const AnchorPtr &out_anchor, cons | |||||
auto dst_anchor = | auto dst_anchor = | ||||
graph_info_.corresponding_node_in_partitions_.at(dst_node)->GetInAnchor(AnchorUtils::GetIdx(in_anchor)); | graph_info_.corresponding_node_in_partitions_.at(dst_node)->GetInAnchor(AnchorUtils::GetIdx(in_anchor)); | ||||
if ((src_anchor == nullptr) || (dst_anchor == nullptr)) { | if ((src_anchor == nullptr) || (dst_anchor == nullptr)) { | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "src_anchor or dst_anchor is null."); | |||||
REPORT_INNER_ERROR("E19999", "src_anchor(index:%d) or dst_anchor(index:%d) is nullptr.", | |||||
AnchorUtils::GetIdx(out_anchor), AnchorUtils::GetIdx(in_anchor)); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] src_anchor(index:%d) or dst_anchor(index:%d) is nullptr.", | |||||
AnchorUtils::GetIdx(out_anchor), AnchorUtils::GetIdx(in_anchor)); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// anchors in subGraph | // anchors in subGraph | ||||
@@ -986,7 +1122,7 @@ Status ge::GraphPartitioner::AddPlaceHolderEnd(const AnchorPtr &out_anchor, cons | |||||
// add end and pld node | // add end and pld node | ||||
auto ret = AddPlaceHolderEndInSrcDstGraph(src_anchor, dst_anchor, dst_subgraph, src_subgraph); | auto ret = AddPlaceHolderEndInSrcDstGraph(src_anchor, dst_anchor, dst_subgraph, src_subgraph); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[GraphPartitioner]: add placeholder end failed."); | |||||
GELOGE(GE_GRAPH_ADD_PLC_END_FAILED, "[Call][AddPlaceHolderEndInSrcDstGraph] failed, ret:%d.", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -996,7 +1132,8 @@ Status ge::GraphPartitioner::SortSubGraphs(const ge::ComputeGraphPtr &compute_gr | |||||
uint32_t rank = kRankOne; // rank 0 for data graph | uint32_t rank = kRankOne; // rank 0 for data graph | ||||
ComputeGraphPtr new_input_nodes_sub_graph = MakeShared<ComputeGraph>("inputNodeGraph"); | ComputeGraphPtr new_input_nodes_sub_graph = MakeShared<ComputeGraph>("inputNodeGraph"); | ||||
if ((new_input_nodes_sub_graph == nullptr) || (compute_graph == nullptr)) { | if ((new_input_nodes_sub_graph == nullptr) || (compute_graph == nullptr)) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: new_input_nodes_sub_graph or compute_graph is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr or Allocate Memory for ComputeGraph failed."); | |||||
GELOGE(FAILED, "[Check][Param] new_input_nodes_sub_graph or compute_graph is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
for (const auto &node : compute_graph->GetDirectNode()) { | for (const auto &node : compute_graph->GetDirectNode()) { | ||||
@@ -1009,7 +1146,7 @@ Status ge::GraphPartitioner::SortSubGraphs(const ge::ComputeGraphPtr &compute_gr | |||||
rank++; | rank++; | ||||
} else if (graph_info_.partitions_[sub_graph] == kEngineDefaultData) { // merge data graph | } else if (graph_info_.partitions_[sub_graph] == kEngineDefaultData) { // merge data graph | ||||
if (PutInputNodesInSubGraph(sub_graph, new_input_nodes_sub_graph) != SUCCESS) { | if (PutInputNodesInSubGraph(sub_graph, new_input_nodes_sub_graph) != SUCCESS) { | ||||
GELOGE(FAILED, "[GraphPartitioner]: putInputNodesInSubGraph failed."); | |||||
GELOGE(FAILED, "[Call][putInputNodesInSubGraph] failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto to_be_del = graph_info_.partitions_.find(sub_graph); | auto to_be_del = graph_info_.partitions_.find(sub_graph); | ||||
@@ -1038,7 +1175,8 @@ Status ge::GraphPartitioner::SortSubGraphs(const ge::ComputeGraphPtr &compute_gr | |||||
AnchorPtr ge::GraphPartitioner::GetEndInAnchor(const AnchorPtr &src_anchor, const NodePtr &end_node) { | AnchorPtr ge::GraphPartitioner::GetEndInAnchor(const AnchorPtr &src_anchor, const NodePtr &end_node) { | ||||
if ((src_anchor == nullptr) || (end_node == nullptr)) { | if ((src_anchor == nullptr) || (end_node == nullptr)) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param src_anchor or end_node is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter src_anchor or end_node is nullptr."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
AnchorPtr end_in_anchor; | AnchorPtr end_in_anchor; | ||||
@@ -1052,7 +1190,8 @@ AnchorPtr ge::GraphPartitioner::GetEndInAnchor(const AnchorPtr &src_anchor, cons | |||||
AnchorPtr ge::GraphPartitioner::GetPldOutAnchor(const NodePtr &pld_node, const AnchorPtr &dst_anchor) { | AnchorPtr ge::GraphPartitioner::GetPldOutAnchor(const NodePtr &pld_node, const AnchorPtr &dst_anchor) { | ||||
if ((pld_node == nullptr) || (dst_anchor == nullptr)) { | if ((pld_node == nullptr) || (dst_anchor == nullptr)) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param pld_node or dst_anchor is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter pld_node or dst_anchor is nullptr."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
AnchorPtr pld_out_anchor; | AnchorPtr pld_out_anchor; | ||||
@@ -1066,7 +1205,7 @@ AnchorPtr ge::GraphPartitioner::GetPldOutAnchor(const NodePtr &pld_node, const A | |||||
void ge::GraphPartitioner::AddEndPldInformationToSubGraphInfo(ge::SubGraphInfoPtr &subgraph_info) { | void ge::GraphPartitioner::AddEndPldInformationToSubGraphInfo(ge::SubGraphInfoPtr &subgraph_info) { | ||||
if (subgraph_info == nullptr) { | if (subgraph_info == nullptr) { | ||||
GELOGE(FAILED, "parameter ptr is null."); | |||||
GELOGE(FAILED, "[Check][Param] parameter subgraph_info is nullptr."); | |||||
return; | return; | ||||
} | } | ||||
auto subgraph = subgraph_info->GetSubGraph(); | auto subgraph = subgraph_info->GetSubGraph(); | ||||
@@ -54,12 +54,12 @@ Status StagePartitioner::Partition() { | |||||
GE_DUMP(root_graph_, "BeforeStagePartition"); | GE_DUMP(root_graph_, "BeforeStagePartition"); | ||||
if (SplitStageLevel() != SUCCESS) { | if (SplitStageLevel() != SUCCESS) { | ||||
GELOGE(FAILED, "Split graph-stage for graph %s failed.", root_graph_->GetName().c_str()); | |||||
GELOGE(FAILED, "[Split][GraphStage] for graph %s failed.", root_graph_->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (StagePartition() != SUCCESS) { | if (StagePartition() != SUCCESS) { | ||||
GELOGE(FAILED, "Stage partition for graph %s failed.", root_graph_->GetName().c_str()); | |||||
GELOGE(FAILED, "[Stage][Partition] for graph %s failed.", root_graph_->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -71,7 +71,7 @@ Status StagePartitioner::Partition() { | |||||
return a_level < b_level; | return a_level < b_level; | ||||
}); | }); | ||||
if (root_graph_->TopologicalSorting() != GRAPH_SUCCESS) { | if (root_graph_->TopologicalSorting() != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "Topological sort for graph %s after stage partition failed, " | |||||
GELOGE(FAILED, "[Call][TopologicalSorting] for graph %s after stage partition failed, " | |||||
"maybe stage_level was not set correctly.", root_graph_->GetName().c_str()); | "maybe stage_level was not set correctly.", root_graph_->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -103,7 +103,10 @@ Status StagePartitioner::SplitStageLevel() { | |||||
continue; | continue; | ||||
} | } | ||||
if (!AttrUtils::SetInt(in_node->GetOpDesc(), ATTR_STAGE_LEVEL, cur_stage_level)) { | if (!AttrUtils::SetInt(in_node->GetOpDesc(), ATTR_STAGE_LEVEL, cur_stage_level)) { | ||||
GELOGE(INTERNAL_ERROR, "Set attr ATTR_STAGE_LEVEL on node %s failed.", in_node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Set Attr %s on node %s failed.", | |||||
ATTR_STAGE_LEVEL.c_str(), in_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Set][Attr] %s on node %s failed.", | |||||
ATTR_STAGE_LEVEL.c_str(), in_node->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("Mark stage_level node %s, stage_level=%u", in_node->GetName().c_str(), cur_stage_level); | GELOGD("Mark stage_level node %s, stage_level=%u", in_node->GetName().c_str(), cur_stage_level); | ||||
@@ -131,23 +134,26 @@ Status StagePartitioner::StagePartition() { | |||||
std::string subgraph_name = "Subgraph_Level_" + std::to_string(stage.first); | std::string subgraph_name = "Subgraph_Level_" + std::to_string(stage.first); | ||||
NodePtr graph_node = BuildSubgraphNode(subgraph_name, stage_info); | NodePtr graph_node = BuildSubgraphNode(subgraph_name, stage_info); | ||||
if (graph_node == nullptr) { | if (graph_node == nullptr) { | ||||
GELOGE(FAILED, "Build PartitionedCall node for stage %u failed.", stage.first); | |||||
GELOGE(FAILED, "[Build][SubgraphNode] for stage %u failed, graph name:%s.", stage.first, subgraph_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ComputeGraphPtr subgraph = BuildStageGraph(graph_node, stage_info); | ComputeGraphPtr subgraph = BuildStageGraph(graph_node, stage_info); | ||||
if (subgraph == nullptr) { | if (subgraph == nullptr) { | ||||
GELOGE(FAILED, "Build subgraph for stage %u failed.", stage.first); | |||||
GELOGE(FAILED, "[Build][StageGraph] %s for stage %u failed.", graph_node->GetName().c_str(), stage.first); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (root_graph_->AddSubgraph(subgraph) != GRAPH_SUCCESS) { | if (root_graph_->AddSubgraph(subgraph) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "Add subgraph of stage %u failed.", stage.first); | |||||
REPORT_CALL_ERROR("E19999", "add subgraph:%s in root graph:%s of stage %u failed.", | |||||
subgraph->GetName().c_str(), root_graph_->GetName().c_str(), stage.first); | |||||
GELOGE(FAILED, "[Add][SubGraph] %s in root graph:%s of stage %u failed.", | |||||
subgraph->GetName().c_str(), root_graph_->GetName().c_str(), stage.first); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if ((RelinkDataEdges(graph_node, stage_info) != SUCCESS) || | if ((RelinkDataEdges(graph_node, stage_info) != SUCCESS) || | ||||
(RelinkCtrlEdges(graph_node, stage_info) != SUCCESS)) { | (RelinkCtrlEdges(graph_node, stage_info) != SUCCESS)) { | ||||
GELOGE(FAILED, "Relink edges for stage %u failed.", stage.first); | |||||
GELOGE(FAILED, "[ReLink][Edges] for stage %u failed, graph_node:%s.", stage.first, graph_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -214,7 +220,7 @@ NodePtr StagePartitioner::BuildSubgraphNode(const std::string &graph_name, const | |||||
for (size_t i = 0; i < input_num; i++) { | for (size_t i = 0; i < input_num; i++) { | ||||
auto input_desc = stage_info.data_inputs[i].second->GetOwnerNode()->GetOpDesc(); | auto input_desc = stage_info.data_inputs[i].second->GetOwnerNode()->GetOpDesc(); | ||||
if (input_desc == nullptr) { | if (input_desc == nullptr) { | ||||
GELOGE(PARAM_INVALID, "op_desc is null, node: %s", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] op_desc is null, node:%s", | |||||
stage_info.data_inputs[i].second->GetOwnerNode()->GetName().c_str()); | stage_info.data_inputs[i].second->GetOwnerNode()->GetName().c_str()); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -225,7 +231,7 @@ NodePtr StagePartitioner::BuildSubgraphNode(const std::string &graph_name, const | |||||
for (size_t i = 0; i < output_num; i++) { | for (size_t i = 0; i < output_num; i++) { | ||||
auto output_desc = stage_info.data_outputs[i].first->GetOwnerNode()->GetOpDesc(); | auto output_desc = stage_info.data_outputs[i].first->GetOwnerNode()->GetOpDesc(); | ||||
if (output_desc == nullptr) { | if (output_desc == nullptr) { | ||||
GELOGE(PARAM_INVALID, "op_desc is null, node: %s", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] op_desc is null, node:%s", | |||||
stage_info.data_outputs[i].first->GetOwnerNode()->GetName().c_str()); | stage_info.data_outputs[i].first->GetOwnerNode()->GetName().c_str()); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -235,7 +241,7 @@ NodePtr StagePartitioner::BuildSubgraphNode(const std::string &graph_name, const | |||||
OpDescPtr op_desc = op_desc_builder.Build(); | OpDescPtr op_desc = op_desc_builder.Build(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
GELOGE(FAILED, "Create op_desc for subgraph node failed, name:%s.", graph_name.c_str()); | |||||
GELOGE(FAILED, "[Create][OpDesc] for subgraph node failed, name:%s.", graph_name.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -243,17 +249,23 @@ NodePtr StagePartitioner::BuildSubgraphNode(const std::string &graph_name, const | |||||
op_desc->SetSubgraphInstanceName(0, graph_name); | op_desc->SetSubgraphInstanceName(0, graph_name); | ||||
if (!AttrUtils::SetInt(op_desc, ATTR_STAGE_LEVEL, stage_info.stage_level)) { | if (!AttrUtils::SetInt(op_desc, ATTR_STAGE_LEVEL, stage_info.stage_level)) { | ||||
GELOGE(INTERNAL_ERROR, "Set attr ATTR_STAGE_LEVEL on node %s failed", op_desc->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "set attr %s on node %s failed", ATTR_STAGE_LEVEL.c_str(), op_desc->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Set][Attr] %s on node %s failed", ATTR_STAGE_LEVEL.c_str(), op_desc->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
NodePtr subgraph_node = root_graph_->AddNode(op_desc); | NodePtr subgraph_node = root_graph_->AddNode(op_desc); | ||||
if (subgraph_node == nullptr) { | if (subgraph_node == nullptr) { | ||||
GELOGE(FAILED, "Add node %s failed.", graph_name.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "add node:%s in graph:%s failed.", | |||||
op_desc->GetName().c_str(), root_graph_->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s in graph:%s failed.", op_desc->GetName().c_str(), root_graph_->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (subgraph_node->SetOwnerComputeGraph(root_graph_) != GRAPH_SUCCESS) { | if (subgraph_node->SetOwnerComputeGraph(root_graph_) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "Set owner graph for node %s failed.", subgraph_node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "SetOwnerComputeGraph for node %s failed, grpah:%s.", | |||||
subgraph_node->GetName().c_str(), root_graph_->GetName().c_str()); | |||||
GELOGE(FAILED, "[Set][OwnerGraph] for node %s failed, grpah:%s.", | |||||
subgraph_node->GetName().c_str(), root_graph_->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -314,11 +326,13 @@ ComputeGraphPtr StagePartitioner::BuildStageGraph(const NodePtr &subgraph_node, | |||||
std::string error_msg; | std::string error_msg; | ||||
ComputeGraphPtr subgraph = graph_builder.Build(error_code, error_msg); | ComputeGraphPtr subgraph = graph_builder.Build(error_code, error_msg); | ||||
if (subgraph == nullptr) { | if (subgraph == nullptr) { | ||||
GELOGE(error_code, "Build subgraph %s failed: %s.", subgraph_node->GetName().c_str(), error_msg.c_str()); | |||||
GELOGE(error_code, "[Build][Subgraph] %s failed:%s.", subgraph_node->GetName().c_str(), error_msg.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (!AttrUtils::SetInt(subgraph, ATTR_STAGE_LEVEL, stage_info.stage_level)) { | if (!AttrUtils::SetInt(subgraph, ATTR_STAGE_LEVEL, stage_info.stage_level)) { | ||||
GELOGE(FAILED, "Set ATTR_STAGE_LEVEL on graph %s failed.", subgraph->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "set attr %s on graph %s failed.", | |||||
ATTR_STAGE_LEVEL.c_str(), subgraph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Set][Attr] %s on graph %s failed.", ATTR_STAGE_LEVEL.c_str(), subgraph->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -329,7 +343,12 @@ Status StagePartitioner::RelinkDataEdges(const NodePtr &subgraph_node, const Sta | |||||
// in data nodes | // in data nodes | ||||
for (size_t i = 0; i < stage_info.data_inputs.size(); i++) { | for (size_t i = 0; i < stage_info.data_inputs.size(); i++) { | ||||
if (stage_info.data_inputs[i].first->Unlink(stage_info.data_inputs[i].second) != GRAPH_SUCCESS) { | if (stage_info.data_inputs[i].first->Unlink(stage_info.data_inputs[i].second) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Remove data edge %s:%d->%s:%d failed.", | |||||
REPORT_CALL_ERROR("E19999", "remove data edge from %s:%d to %s:%d failed", | |||||
stage_info.data_inputs[i].first->GetOwnerNode()->GetName().c_str(), | |||||
stage_info.data_inputs[i].first->GetIdx(), | |||||
stage_info.data_inputs[i].second->GetOwnerNode()->GetName().c_str(), | |||||
stage_info.data_inputs[i].second->GetIdx()); | |||||
GELOGE(INTERNAL_ERROR, "[Remove][DataEdge] %s:%d->%s:%d failed.", | |||||
stage_info.data_inputs[i].first->GetOwnerNode()->GetName().c_str(), | stage_info.data_inputs[i].first->GetOwnerNode()->GetName().c_str(), | ||||
stage_info.data_inputs[i].first->GetIdx(), | stage_info.data_inputs[i].first->GetIdx(), | ||||
stage_info.data_inputs[i].second->GetOwnerNode()->GetName().c_str(), | stage_info.data_inputs[i].second->GetOwnerNode()->GetName().c_str(), | ||||
@@ -337,7 +356,11 @@ Status StagePartitioner::RelinkDataEdges(const NodePtr &subgraph_node, const Sta | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if (stage_info.data_inputs[i].first->LinkTo(subgraph_node->GetInDataAnchor(i)) != GRAPH_SUCCESS) { | if (stage_info.data_inputs[i].first->LinkTo(subgraph_node->GetInDataAnchor(i)) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Add data edge %s:%d->%s:%zu failed.", | |||||
REPORT_CALL_ERROR("E19999", "add data edge from %s:%d to %s:%zu failed.", | |||||
stage_info.data_inputs[i].first->GetOwnerNode()->GetName().c_str(), | |||||
stage_info.data_inputs[i].first->GetIdx(), | |||||
subgraph_node->GetName().c_str(), i); | |||||
GELOGE(INTERNAL_ERROR, "[Add][DataEdge] %s:%d->%s:%zu failed.", | |||||
stage_info.data_inputs[i].first->GetOwnerNode()->GetName().c_str(), | stage_info.data_inputs[i].first->GetOwnerNode()->GetName().c_str(), | ||||
stage_info.data_inputs[i].first->GetIdx(), | stage_info.data_inputs[i].first->GetIdx(), | ||||
subgraph_node->GetName().c_str(), i); | subgraph_node->GetName().c_str(), i); | ||||
@@ -350,14 +373,20 @@ Status StagePartitioner::RelinkDataEdges(const NodePtr &subgraph_node, const Sta | |||||
GE_CHECK_NOTNULL(out_data_anchor); | GE_CHECK_NOTNULL(out_data_anchor); | ||||
for (const auto &peer_in_anchor : stage_info.data_outputs[i].second) { | for (const auto &peer_in_anchor : stage_info.data_outputs[i].second) { | ||||
if (stage_info.data_outputs[i].first->Unlink(peer_in_anchor) != GRAPH_SUCCESS) { | if (stage_info.data_outputs[i].first->Unlink(peer_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Remove data edge %s:%d->%s:%d failed.", | |||||
REPORT_CALL_ERROR("E19999", "Remove data edge from %s:%d to %s:%d failed.", | |||||
stage_info.data_outputs[i].first->GetOwnerNode()->GetName().c_str(), | |||||
stage_info.data_outputs[i].first->GetIdx(), | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | |||||
GELOGE(INTERNAL_ERROR, "[Remove][DataEdge] %s:%d->%s:%d failed.", | |||||
stage_info.data_outputs[i].first->GetOwnerNode()->GetName().c_str(), | stage_info.data_outputs[i].first->GetOwnerNode()->GetName().c_str(), | ||||
stage_info.data_outputs[i].first->GetIdx(), | stage_info.data_outputs[i].first->GetIdx(), | ||||
peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if (out_data_anchor->LinkTo(peer_in_anchor) != GRAPH_SUCCESS) { | if (out_data_anchor->LinkTo(peer_in_anchor) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Add data edge %s:%zu->%s:%d failed.", subgraph_node->GetName().c_str(), i, | |||||
REPORT_CALL_ERROR("E19999", "Add data edge from %s:%zu to %s:%d failed.", subgraph_node->GetName().c_str(), i, | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][DataEdge] %s:%zu->%s:%d failed.", subgraph_node->GetName().c_str(), i, | |||||
peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -371,13 +400,18 @@ Status StagePartitioner::RelinkCtrlEdges(const NodePtr &subgraph_node, const Sta | |||||
// in ctrl nodes | // in ctrl nodes | ||||
for (const auto &ctrl_input : stage_info.ctrl_inputs) { | for (const auto &ctrl_input : stage_info.ctrl_inputs) { | ||||
if (ctrl_input.first->Unlink(ctrl_input.second) != GRAPH_SUCCESS) { | if (ctrl_input.first->Unlink(ctrl_input.second) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Remove ctrl edge %s->%s failed.", | |||||
REPORT_CALL_ERROR("E19999", "Remove ctrl edge %s->%s failed.", | |||||
ctrl_input.first->GetOwnerNode()->GetName().c_str(), | |||||
ctrl_input.second->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Remove][CtrlEdge] %s->%s failed.", | |||||
ctrl_input.first->GetOwnerNode()->GetName().c_str(), ctrl_input.second->GetOwnerNode()->GetName().c_str()); | ctrl_input.first->GetOwnerNode()->GetName().c_str(), ctrl_input.second->GetOwnerNode()->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if (!ctrl_input.first->IsLinkedWith(subgraph_node->GetInControlAnchor())) { | if (!ctrl_input.first->IsLinkedWith(subgraph_node->GetInControlAnchor())) { | ||||
if (ctrl_input.first->LinkTo(subgraph_node->GetInControlAnchor()) != GRAPH_SUCCESS) { | if (ctrl_input.first->LinkTo(subgraph_node->GetInControlAnchor()) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Add ctrl edge %s->%s failed.", | |||||
REPORT_CALL_ERROR("E19999", "Add ctrl edge %s->%s failed.", | |||||
ctrl_input.first->GetOwnerNode()->GetName().c_str(), subgraph_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][CtrlEdge] %s->%s failed.", | |||||
ctrl_input.first->GetOwnerNode()->GetName().c_str(), subgraph_node->GetName().c_str()); | ctrl_input.first->GetOwnerNode()->GetName().c_str(), subgraph_node->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -386,14 +420,19 @@ Status StagePartitioner::RelinkCtrlEdges(const NodePtr &subgraph_node, const Sta | |||||
// out ctrl nodes | // out ctrl nodes | ||||
for (const auto &ctrl_output : stage_info.ctrl_outputs) { | for (const auto &ctrl_output : stage_info.ctrl_outputs) { | ||||
if (ctrl_output.first->Unlink(ctrl_output.second) != GRAPH_SUCCESS) { | if (ctrl_output.first->Unlink(ctrl_output.second) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Remove ctrl edge %s->%s failed.", | |||||
REPORT_CALL_ERROR("E19999", "Remove ctrl edge %s->%s failed.", | |||||
ctrl_output.first->GetOwnerNode()->GetName().c_str(), | |||||
ctrl_output.second->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Remove][CtrlEdge] %s->%s failed.", | |||||
ctrl_output.first->GetOwnerNode()->GetName().c_str(), | ctrl_output.first->GetOwnerNode()->GetName().c_str(), | ||||
ctrl_output.second->GetOwnerNode()->GetName().c_str()); | ctrl_output.second->GetOwnerNode()->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if (!subgraph_node->GetOutControlAnchor()->IsLinkedWith(ctrl_output.second)) { | if (!subgraph_node->GetOutControlAnchor()->IsLinkedWith(ctrl_output.second)) { | ||||
if (subgraph_node->GetOutControlAnchor()->LinkTo(ctrl_output.second) != GRAPH_SUCCESS) { | if (subgraph_node->GetOutControlAnchor()->LinkTo(ctrl_output.second) != GRAPH_SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Add ctrl edge %s->%s failed.", | |||||
REPORT_CALL_ERROR("E19999", "Add ctrl edge %s->%s failed.", | |||||
subgraph_node->GetName().c_str(), ctrl_output.second->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][CtrlEdge] %s->%s failed.", | |||||
subgraph_node->GetName().c_str(), ctrl_output.second->GetOwnerNode()->GetName().c_str()); | subgraph_node->GetName().c_str(), ctrl_output.second->GetOwnerNode()->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -27,14 +27,14 @@ Status AddNPass::Run(NodePtr &node) { | |||||
GELOGD("AddNPass running"); | GELOGD("AddNPass running"); | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "param [node] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] param [node] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (node->GetType() == ADDN) { | if (node->GetType() == ADDN) { | ||||
if (node->GetOpDesc() == nullptr) { | if (node->GetOpDesc() == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "Param [node] op desc is null."); | |||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] Param [node] op desc is null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
// AddN with single input can be optimized | // AddN with single input can be optimized | ||||
@@ -123,7 +123,7 @@ Status AicpuConstantFoldingPass::GetInputAddrs(const vector<ConstGeTensorPtr> &w | |||||
vector<AddrAndType> &input_addrs) { | vector<AddrAndType> &input_addrs) { | ||||
if (weight_vec.empty()) { | if (weight_vec.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Param weight_vec is empty, check invalid"); | REPORT_INNER_ERROR("E19999", "Param weight_vec is empty, check invalid"); | ||||
GELOGE(FAILED, "Weight is null"); | |||||
GELOGE(FAILED, "[Check][Param] Weight is null"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
for (const ConstGeTensorPtr &weight : weight_vec) { | for (const ConstGeTensorPtr &weight : weight_vec) { | ||||
@@ -135,7 +135,7 @@ Status AicpuConstantFoldingPass::GetInputAddrs(const vector<ConstGeTensorPtr> &w | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | ||||
weight->GetData().size(), rt_ret); | weight->GetData().size(), rt_ret); | ||||
GELOGE(rt_ret, "rtMemcpy error"); | |||||
GELOGE(rt_ret, "[Call][RtMemcpy] failed, size:%zu, ret = 0x%X", weight->GetData().size(), rt_ret); | |||||
GE_CHK_RT(rtFree(input_addr)); | GE_CHK_RT(rtFree(input_addr)); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -150,7 +150,8 @@ Status AicpuConstantFoldingPass::GetOutputAddrs(const OpDescPtr &node_desc, vect | |||||
if (node_desc->GetOutputsSize() == 0) { | if (node_desc->GetOutputsSize() == 0) { | ||||
REPORT_INNER_ERROR("E19999", "Ouput desc size of op:%s(%s) is 0, check invalid", | REPORT_INNER_ERROR("E19999", "Ouput desc size of op:%s(%s) is 0, check invalid", | ||||
node_desc->GetName().c_str(), node_desc->GetType().c_str()); | node_desc->GetName().c_str(), node_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Output size is 0 "); | |||||
GELOGE(FAILED, "[Get][OutputsSize] Ouput desc size of op:%s(%s) is 0", | |||||
node_desc->GetName().c_str(), node_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
for (size_t i = 0; i < node_desc->GetOutputsSize(); ++i) { | for (size_t i = 0; i < node_desc->GetOutputsSize(); ++i) { | ||||
@@ -178,7 +179,7 @@ Status AicpuConstantFoldingPass::GenerateDataPtrInfo(const vector<uint64_t> &out | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%lu, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, size:%lu, ret = 0x%X", | ||||
result_summary.shape_data_size, rt_ret); | result_summary.shape_data_size, rt_ret); | ||||
GELOGE(rt_ret, "rtMalloc error"); | |||||
GELOGE(rt_ret, "[Call][RtMalloc] failed, size:%lu, ret = 0x%X", result_summary.shape_data_size, rt_ret); | |||||
GE_CHK_RT(rtFree(raw_data_addr)); | GE_CHK_RT(rtFree(raw_data_addr)); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -208,7 +209,7 @@ Status AicpuConstantFoldingPass::UpdateWorkSpaceAddr(string &task_info, STR_FWK_ | |||||
// Update the workspace_addr | // Update the workspace_addr | ||||
if (task_info.empty()) { | if (task_info.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Param task_info is empty, check invalid"); | REPORT_INNER_ERROR("E19999", "Param task_info is empty, check invalid"); | ||||
GELOGE(FAILED, "task_info is empty "); | |||||
GELOGE(FAILED, "[Check][Param] task_info is empty "); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
void *workspace_addr = nullptr; | void *workspace_addr = nullptr; | ||||
@@ -218,7 +219,7 @@ Status AicpuConstantFoldingPass::UpdateWorkSpaceAddr(string &task_info, STR_FWK_ | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | ||||
task_info.size(), rt_ret); | task_info.size(), rt_ret); | ||||
GELOGE(rt_ret, "rtMemcpy error"); | |||||
GELOGE(rt_ret, "[Call][RtMemcpy] failed, size:%zu, ret = 0x%X", task_info.size(), rt_ret); | |||||
GE_CHK_RT(rtFree(workspace_addr)); | GE_CHK_RT(rtFree(workspace_addr)); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -232,7 +233,7 @@ Status AicpuConstantFoldingPass::UpdateInputAndOutputAddr(const vector<uint64_t> | |||||
auto addrs_size = sizeof(uint64_t) * (io_addrs.size()); | auto addrs_size = sizeof(uint64_t) * (io_addrs.size()); | ||||
if (addrs_size <= 0) { | if (addrs_size <= 0) { | ||||
REPORT_INNER_ERROR("E19999", "Param io_addrs size is 0, check invalid"); | REPORT_INNER_ERROR("E19999", "Param io_addrs size is 0, check invalid"); | ||||
GELOGE(FAILED, "addrs_size is less than 1 "); | |||||
GELOGE(FAILED, "[Check][Param] addrs_size is less than 1 "); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
void *input_output_addr = nullptr; | void *input_output_addr = nullptr; | ||||
@@ -241,7 +242,7 @@ Status AicpuConstantFoldingPass::UpdateInputAndOutputAddr(const vector<uint64_t> | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | ||||
addrs_size, rt_ret); | addrs_size, rt_ret); | ||||
GELOGE(rt_ret, "rtMemcpy error"); | |||||
GELOGE(rt_ret, "[Call][RtMemcpy] failed, size:%zu, ret = 0x%X", addrs_size, rt_ret); | |||||
GE_CHK_RT(rtFree(input_output_addr)); | GE_CHK_RT(rtFree(input_output_addr)); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -264,12 +265,12 @@ Status AicpuConstantFoldingPass::UpdateSingleOpAddr(string &task_info, const vec | |||||
Status ret = UpdateInputAndOutputAddr(io_addrs, task); | Status ret = UpdateInputAndOutputAddr(io_addrs, task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "UpdateInputAndOutputAddr error"); | |||||
GELOGE(ret, "[Update][InputAndOutputAddr] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = UpdateWorkSpaceAddr(task_info, task); | ret = UpdateWorkSpaceAddr(task_info, task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "UpdateWorkSpaceAddr error"); | |||||
GELOGE(ret, "[Update][WorkSpaceAddr] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -299,7 +300,7 @@ Status AicpuConstantFoldingPass::UpdateMemCopyAddr(string &task_info, const vect | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | ||||
data_size, rt_ret); | data_size, rt_ret); | ||||
GELOGE(rt_ret, "rtMemcpy error"); | |||||
GELOGE(rt_ret, "[Call][RtMemcpy] failed, size:%zu, ret = 0x%X", data_size, rt_ret); | |||||
GE_CHK_RT(rtFree(input_addr_ptr)); | GE_CHK_RT(rtFree(input_addr_ptr)); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -311,12 +312,12 @@ Status AicpuConstantFoldingPass::UpdateMemCopyAddr(string &task_info, const vect | |||||
Status ret = UpdateInputAndOutputAddr(io_addrs, task); | Status ret = UpdateInputAndOutputAddr(io_addrs, task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "UpdateInputAndOutputAddr error"); | |||||
GELOGE(ret, "[Update][InputAndOutputAddr] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = UpdateWorkSpaceAddr(task_info, task); | ret = UpdateWorkSpaceAddr(task_info, task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "UpdateWorkSpaceAddr error"); | |||||
GELOGE(ret, "[Update][WorkSpaceAddr] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -328,14 +329,14 @@ Status AicpuConstantFoldingPass::LaunchSingleOpRunTask(const NodePtr &node, cons | |||||
auto instance_ptr = ge::GELib::GetInstance(); | auto instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] GE is not initialized"); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
auto kernel_builder = OpsKernelBuilderManager::Instance().GetOpsKernelBuilder(kKernelLibName); | auto kernel_builder = OpsKernelBuilderManager::Instance().GetOpsKernelBuilder(kKernelLibName); | ||||
if (kernel_builder == nullptr) { | if (kernel_builder == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | ||||
kKernelLibName); | kKernelLibName); | ||||
GELOGE(FAILED, "Get op kernel info store failed"); | |||||
GELOGE(FAILED, "[Get][OpsKernelBuilder] by name:%s failed", kKernelLibName); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
STR_FWK_OP_KERNEL aicpu_task; | STR_FWK_OP_KERNEL aicpu_task; | ||||
@@ -364,17 +365,17 @@ Status AicpuConstantFoldingPass::LaunchSingleOpRunTask(const NodePtr &node, cons | |||||
ret = UpdateSingleOpAddr(task_info, input_addrs, output_addrs, aicpu_task); | ret = UpdateSingleOpAddr(task_info, input_addrs, output_addrs, aicpu_task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "UpdateSingleOpAddr error"); | |||||
GELOGE(ret, "[Update][SingleOpAddr] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = GenerateTaskForLaunch(aicpu_task, task_buf); | ret = GenerateTaskForLaunch(aicpu_task, task_buf); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "GenerateTaskForLaunch error"); | |||||
GELOGE(ret, "[Generate][Task] For Launch failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = KernelLaunch(task_buf); | ret = KernelLaunch(task_buf); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "KernelLaunch error"); | |||||
GELOGE(ret, "[Call][KernelLaunch] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -386,14 +387,14 @@ Status AicpuConstantFoldingPass::LaunchMemCopyTask(const vector<uint64_t> &data_ | |||||
auto instance_ptr = ge::GELib::GetInstance(); | auto instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] GE is not initialized"); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
auto kernel_builder = OpsKernelBuilderManager::Instance().GetOpsKernelBuilder(kKernelLibName); | auto kernel_builder = OpsKernelBuilderManager::Instance().GetOpsKernelBuilder(kKernelLibName); | ||||
if (kernel_builder == nullptr) { | if (kernel_builder == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | ||||
kKernelLibName); | kKernelLibName); | ||||
GELOGE(FAILED, "Get op kernel info store failed"); | |||||
GELOGE(FAILED, "[Get][OpsKernelBuilder] by name:%s failed", kKernelLibName); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
STR_FWK_OP_KERNEL aicpu_task; | STR_FWK_OP_KERNEL aicpu_task; | ||||
@@ -427,17 +428,17 @@ Status AicpuConstantFoldingPass::LaunchMemCopyTask(const vector<uint64_t> &data_ | |||||
ret = UpdateMemCopyAddr(task_info, data_infos, internal_addrs, aicpu_task); | ret = UpdateMemCopyAddr(task_info, data_infos, internal_addrs, aicpu_task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "UpdateMemCopyAddr error"); | |||||
GELOGE(ret, "[Update][MemCopyAddr] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = GenerateTaskForLaunch(aicpu_task, task_buf); | ret = GenerateTaskForLaunch(aicpu_task, task_buf); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "GenerateTaskForLaunch error"); | |||||
GELOGE(ret, "[Generate][Task] For Launch failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = KernelLaunch(task_buf); | ret = KernelLaunch(task_buf); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "KernelLaunch error"); | |||||
GELOGE(ret, "[Call][KernelLaunch] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -451,7 +452,7 @@ Status AicpuConstantFoldingPass::GenerateTaskForLaunch(STR_FWK_OP_KERNEL &aicpu_ | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, size:%zu, ret = 0x%X", | ||||
sizeof(STR_FWK_OP_KERNEL), rt_ret); | sizeof(STR_FWK_OP_KERNEL), rt_ret); | ||||
GELOGE(rt_ret, "rtMemcpy error"); | |||||
GELOGE(rt_ret, "[Call][RtMemcpy] failed, size:%zu, ret = 0x%X", sizeof(STR_FWK_OP_KERNEL), rt_ret); | |||||
GE_CHK_RT(rtFree(task_buf)); | GE_CHK_RT(rtFree(task_buf)); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -482,56 +483,56 @@ Status AicpuConstantFoldingPass::KernelLaunch(void *task_buf) { | |||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtModelCreate failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtModelCreate failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "create model failed."); | |||||
GELOGE(rt_ret, "[Create][Model] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtStreamCreate(&stream, 0); | rt_ret = rtStreamCreate(&stream, 0); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtStreamCreate failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtStreamCreate failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "create stream failed."); | |||||
GELOGE(rt_ret, "[Create][Stream] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtModelBindStream(model, stream, 0); | rt_ret = rtModelBindStream(model, stream, 0); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtModelBindStream failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtModelBindStream failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "rtModelBindStream failed."); | |||||
GELOGE(rt_ret, "[Call][RtModelBindStream] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtKernelLaunchEx(task_buf, sizeof(STR_FWK_OP_KERNEL), 0, stream); | rt_ret = rtKernelLaunchEx(task_buf, sizeof(STR_FWK_OP_KERNEL), 0, stream); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtModelBindStream failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtModelBindStream failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "rtKernelLaunchEx failed."); | |||||
GELOGE(rt_ret, "[Call][RtModelBindStream] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtModelLoadComplete(model); | rt_ret = rtModelLoadComplete(model); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtModelLoadComplete failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtModelLoadComplete failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "rtModelLoadComplete failed."); | |||||
GELOGE(rt_ret, "[Call][RtModelLoadComplete] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtStreamCreate(&stream_run, 0); | rt_ret = rtStreamCreate(&stream_run, 0); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtStreamCreate failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtStreamCreate failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "create run stream failed."); | |||||
GELOGE(rt_ret, "[Call][RtStreamCreate] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtModelExecute(model, stream_run, 0); | rt_ret = rtModelExecute(model, stream_run, 0); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtModelExecute failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtModelExecute failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "rtModelExecute failed."); | |||||
GELOGE(rt_ret, "[Call][RtModelExecute] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
rt_ret = rtStreamSynchronize(stream_run); | rt_ret = rtStreamSynchronize(stream_run); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
REPORT_CALL_ERROR("E19999", "Call rtStreamSynchronize failed, ret = 0x%X", | REPORT_CALL_ERROR("E19999", "Call rtStreamSynchronize failed, ret = 0x%X", | ||||
rt_ret); | rt_ret); | ||||
GELOGE(rt_ret, "rtStreamSynchronize failed."); | |||||
GELOGE(rt_ret, "[Call][RtStreamSynchronize] failed, ret = 0x%X", rt_ret); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -543,7 +544,8 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co | |||||
REPORT_INNER_ERROR("E19999", "Output desc size:%zu of op:%s(%s), after multi 2, not equal to data_vec.size:%zu, " | REPORT_INNER_ERROR("E19999", "Output desc size:%zu of op:%s(%s), after multi 2, not equal to data_vec.size:%zu, " | ||||
"check invalid", node_desc->GetOutputsSize(), | "check invalid", node_desc->GetOutputsSize(), | ||||
node_desc->GetName().c_str(), node_desc->GetType().c_str(), data_vec.size()); | node_desc->GetName().c_str(), node_desc->GetType().c_str(), data_vec.size()); | ||||
GELOGE(FAILED, "node[%s] something wrong with output size", node_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Output desc size:%zu of op:%s(%s), after multi 2, not equal to data_vec.size:%zu", | |||||
node_desc->GetOutputsSize(), node_desc->GetName().c_str(), node_desc->GetType().c_str(), data_vec.size()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -552,7 +554,7 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co | |||||
GeTensorPtr output_ptr = MakeShared<GeTensor>(output_tensor_desc); | GeTensorPtr output_ptr = MakeShared<GeTensor>(output_tensor_desc); | ||||
if (output_ptr == nullptr) { | if (output_ptr == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | ||||
GELOGE(FAILED, "node[%s] something wrong with construct GeTensor", node_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[New][GeTensor] failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
const DataPtrInfo &raw_data_info = data_vec.at(i * kDouble); | const DataPtrInfo &raw_data_info = data_vec.at(i * kDouble); | ||||
@@ -561,14 +563,14 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co | |||||
if (data_addr == nullptr) { | if (data_addr == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New Buffer failed, size:%lu", | REPORT_CALL_ERROR("E19999", "New Buffer failed, size:%lu", | ||||
raw_data_size); | raw_data_size); | ||||
GELOGE(MEMALLOC_FAILED, "new data_addr failed"); | |||||
GELOGE(MEMALLOC_FAILED, "[New][Buffer] failed, size:%lu", raw_data_size); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GE_CHK_RT_RET(rtMemcpy(data_addr.get(), raw_data_size, | GE_CHK_RT_RET(rtMemcpy(data_addr.get(), raw_data_size, | ||||
reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(raw_data_info.dst_ptr)), raw_data_size, | reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(raw_data_info.dst_ptr)), raw_data_size, | ||||
RT_MEMCPY_DEVICE_TO_HOST)); | RT_MEMCPY_DEVICE_TO_HOST)); | ||||
GE_IF_BOOL_EXEC(output_ptr->SetData(data_addr.get(), raw_data_size) != GRAPH_SUCCESS, | GE_IF_BOOL_EXEC(output_ptr->SetData(data_addr.get(), raw_data_size) != GRAPH_SUCCESS, | ||||
GELOGE(FAILED, "set data failed"); | |||||
GELOGE(FAILED, "[Set][Data] for node:%s output[%zu] failed", node_desc->GetName().c_str(), i); | |||||
return FAILED); | return FAILED); | ||||
GELOGD("GenerateGeTensor: raw_data_size %lu", raw_data_size); | GELOGD("GenerateGeTensor: raw_data_size %lu", raw_data_size); | ||||
@@ -586,7 +588,7 @@ Status AicpuConstantFoldingPass::GenerateGeTensor(const OpDescPtr &node_desc, co | |||||
if (shape_addr == nullptr) { | if (shape_addr == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New Buffer failed, size:%lu", | REPORT_CALL_ERROR("E19999", "New Buffer failed, size:%lu", | ||||
dim_num); | dim_num); | ||||
GELOGE(MEMALLOC_FAILED, "new shape_addr failed"); | |||||
GELOGE(MEMALLOC_FAILED, "[New][Buffer] failed, size:%lu", dim_num); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GE_CHK_RT_RET(rtMemcpy(shape_addr.get(), shape_data_size, | GE_CHK_RT_RET(rtMemcpy(shape_addr.get(), shape_data_size, | ||||
@@ -632,22 +634,23 @@ bool AicpuConstantFoldingPass::IsSkipFold(const ge::NodePtr &node) { | |||||
auto instance_ptr = ge::GELib::GetInstance(); | auto instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized"); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] GE is not initialized"); | |||||
return true; | return true; | ||||
} | } | ||||
OpsKernelInfoStorePtr kernel_info = instance_ptr->OpsKernelManagerObj().GetOpsKernelInfoStore(kKernelLibName); | OpsKernelInfoStorePtr kernel_info = instance_ptr->OpsKernelManagerObj().GetOpsKernelInfoStore(kKernelLibName); | ||||
if (kernel_info == nullptr) { | if (kernel_info == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | ||||
kKernelLibName); | kKernelLibName); | ||||
GELOGE(FAILED, "Get op kernel info store failed"); | |||||
GELOGE(FAILED, "[Get][OpsKernelInfoStore] by name:%s failed", kKernelLibName); | |||||
return true; | return true; | ||||
} | } | ||||
std::string check_result; | std::string check_result; | ||||
kernel_info->opsFlagCheck(*node, check_result); | kernel_info->opsFlagCheck(*node, check_result); | ||||
if (check_result.empty()) { | if (check_result.empty()) { | ||||
REPORT_CALL_ERROR("E19999", "Call opsFlagCheck faled, ops kernel name:%s, op:%s(%s)", | |||||
REPORT_CALL_ERROR("E19999", "Call opsFlagCheck failed, ops kernel name:%s, op:%s(%s)", | |||||
kKernelLibName, node->GetName().c_str(), node->GetType().c_str()); | kKernelLibName, node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Get op check_result failed"); | |||||
GELOGE(FAILED, "[Call][OpsFlagCheck] failed, ops kernel name:%s, op:%s(%s)", | |||||
kKernelLibName, node->GetName().c_str(), node->GetType().c_str()); | |||||
return true; | return true; | ||||
} | } | ||||
return check_result.substr(0, kOpsFlag) == kNotSupported; | return check_result.substr(0, kOpsFlag) == kNotSupported; | ||||
@@ -36,7 +36,7 @@ Status AssertPass::Run(NodePtr &node) { | |||||
} | } | ||||
if (node->GetOpDesc() == nullptr) { | if (node->GetOpDesc() == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "param [node] [opDesc] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] param [node] [opDesc] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
std::string op_type = node->GetOpDesc()->GetType(); | std::string op_type = node->GetOpDesc()->GetType(); | ||||
@@ -49,7 +49,7 @@ Status AssertPass::Run(NodePtr &node) { | |||||
// remove unused node | // remove unused node | ||||
Status status = RemoveUnusedNode(nodes_unused); | Status status = RemoveUnusedNode(nodes_unused); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, "remove unused node failed."); | |||||
GELOGE(status, "[Remove][UnusedNode] failed, ret:%d.", status); | |||||
return status; | return status; | ||||
} | } | ||||
} | } | ||||
@@ -95,8 +95,10 @@ Status AssertPass::RemoveUnusedNode(std::vector<NodePtr> &nodes_unused) { | |||||
} | } | ||||
if (IsolateAndDeleteNode(node, assert_io_map) != SUCCESS) { | if (IsolateAndDeleteNode(node, assert_io_map) != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Isolate and delete node:%s(%s) faild", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
GELOGE(FAILED, "[Call][IsolateAndDeleteNode] for node:%s(%s) failed", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -33,13 +33,13 @@ Status AssignRemovePass::Run(NodePtr &node) { | |||||
GELOGD("AssignRemovePass running"); | GELOGD("AssignRemovePass running"); | ||||
if (TransformAttr(node) != SUCCESS) { | if (TransformAttr(node) != SUCCESS) { | ||||
GELOGE(FAILED, "Transform assign_var_name attr failed, node=%s", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Call][TransformAttr] Transform assign_var_name attr failed, node=%s", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (node->GetType() == ASSIGN) { | if (node->GetType() == ASSIGN) { | ||||
if (OptimizedAssignNode(node) != SUCCESS) { | if (OptimizedAssignNode(node) != SUCCESS) { | ||||
GELOGE(FAILED, "Optimize for assign_node %s failed", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Call][Optimize] for assign_node %s failed", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -60,7 +60,9 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
REPORT_INNER_ERROR("E19999", "Index %d or %d input anchor of node:%s(%s) is nullptr, check invalid", | REPORT_INNER_ERROR("E19999", "Index %d or %d input anchor of node:%s(%s) is nullptr, check invalid", | ||||
kAssignRefInputIndex, kAssignValueInputIndex, | kAssignRefInputIndex, kAssignValueInputIndex, | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "In data anchor is null, node:%s", assign_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Index %d or %d input anchor of node:%s(%s) is nullptr", | |||||
kAssignRefInputIndex, kAssignValueInputIndex, | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
const auto &ref_peer_anchor = ref_in_anchor->GetPeerOutAnchor(); | const auto &ref_peer_anchor = ref_in_anchor->GetPeerOutAnchor(); | ||||
@@ -69,7 +71,9 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
REPORT_INNER_ERROR("E19999", "Index %d or %d input anchor of node:%s(%s), peer anchor is nullptr, check invalid", | REPORT_INNER_ERROR("E19999", "Index %d or %d input anchor of node:%s(%s), peer anchor is nullptr, check invalid", | ||||
kAssignRefInputIndex, kAssignValueInputIndex, | kAssignRefInputIndex, kAssignValueInputIndex, | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Peer data anchor is null, node:%s", assign_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Index %d or %d input anchor of node:%s(%s), peer anchor is nullptr", | |||||
kAssignRefInputIndex, kAssignValueInputIndex, | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -87,7 +91,7 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
if (IsolateAndDeleteNode(assign_node, {kAssignRefInputIndex}) != SUCCESS) { | if (IsolateAndDeleteNode(assign_node, {kAssignRefInputIndex}) != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Isolate and delete assign_node %s failed.", assign_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[IsolateAndDelete][Node] %s failed.", assign_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -97,7 +101,9 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
REPORT_INNER_ERROR("E19999", "Input index %d or %d of node:%s(%s), peer op is nullptr, check invalid", | REPORT_INNER_ERROR("E19999", "Input index %d or %d of node:%s(%s), peer op is nullptr, check invalid", | ||||
kAssignRefInputIndex, kAssignValueInputIndex, | kAssignRefInputIndex, kAssignValueInputIndex, | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "value input is null"); | |||||
GELOGE(FAILED, "[Check][Param] Input index %d or %d of node:%s(%s), peer op is nullptr", | |||||
kAssignRefInputIndex, kAssignValueInputIndex, | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -105,7 +111,8 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
if (ref_input->UpdateInputDesc(0, value_input->GetOutputDesc(value_peer_anchor->GetIdx())) != GRAPH_SUCCESS) { | if (ref_input->UpdateInputDesc(0, value_input->GetOutputDesc(value_peer_anchor->GetIdx())) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Input index %d of node:%s(%s), update it's peer op input:0 desc failed", | REPORT_CALL_ERROR("E19999", "Input index %d of node:%s(%s), update it's peer op input:0 desc failed", | ||||
kAssignRefInputIndex, assign_node->GetName().c_str(), assign_node->GetType().c_str()); | kAssignRefInputIndex, assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Update input_desc for variable %s failed.", ref_input->GetName().c_str()); | |||||
GELOGE(FAILED, "[Update][InputDesc] Input index %d of node:%s(%s), update it's peer op input:0 desc failed", | |||||
kAssignRefInputIndex, assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (GraphUtils::AddEdge(value_peer_anchor, ref_peer_anchor->GetOwnerNode()->GetInDataAnchor(0)) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(value_peer_anchor, ref_peer_anchor->GetOwnerNode()->GetInDataAnchor(0)) != GRAPH_SUCCESS) { | ||||
@@ -114,7 +121,10 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
value_peer_anchor->GetOwnerNode()->GetType().c_str(), value_peer_anchor->GetIdx(), | value_peer_anchor->GetOwnerNode()->GetType().c_str(), value_peer_anchor->GetIdx(), | ||||
ref_peer_anchor->GetOwnerNode()->GetName().c_str(), | ref_peer_anchor->GetOwnerNode()->GetName().c_str(), | ||||
ref_peer_anchor->GetOwnerNode()->GetType().c_str()); | ref_peer_anchor->GetOwnerNode()->GetType().c_str()); | ||||
GELOGE(FAILED, "Add data edge %s->%s failed", value_input->GetName().c_str(), ref_input->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(out_index:%d) and op:%s(%s)(in_index:0) failed", | |||||
value_peer_anchor->GetOwnerNode()->GetName().c_str(), | |||||
value_peer_anchor->GetOwnerNode()->GetType().c_str(), value_peer_anchor->GetIdx(), | |||||
ref_peer_anchor->GetOwnerNode()->GetName().c_str(), ref_peer_anchor->GetOwnerNode()->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -125,7 +135,9 @@ Status AssignRemovePass::OptimizedAssignNode(NodePtr &assign_node) { | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of node:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of node:%s(%s) failed", | ||||
ASSIGN_VAR_NAME.c_str(), value_peer_anchor->GetIdx(), | ASSIGN_VAR_NAME.c_str(), value_peer_anchor->GetIdx(), | ||||
value_input->GetName().c_str(), value_input->GetType().c_str()); | value_input->GetName().c_str(), value_input->GetType().c_str()); | ||||
GELOGE(FAILED, "Set attr ASSIGN_VAR_NAME failed."); | |||||
GELOGE(FAILED, "[Set][Attr] %s to output:%d desc of node:%s(%s) failed", | |||||
ASSIGN_VAR_NAME.c_str(), value_peer_anchor->GetIdx(), | |||||
value_input->GetName().c_str(), value_input->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto value_node = value_peer_anchor->GetOwnerNode(); | auto value_node = value_peer_anchor->GetOwnerNode(); | ||||
@@ -160,7 +172,9 @@ Status AssignRemovePass::TransformAttr(NodePtr &node) { | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of node:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of node:%s(%s) failed", | ||||
ASSIGN_VAR_NAME.c_str(), peer_data_anchor->GetIdx(), | ASSIGN_VAR_NAME.c_str(), peer_data_anchor->GetIdx(), | ||||
in_node->GetName().c_str(), in_node->GetType().c_str()); | in_node->GetName().c_str(), in_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Set attr ASSIGN_VAR_NAME failed."); | |||||
GELOGE(FAILED, "[Set][Attr] %s to output:%d desc of node:%s(%s) failed", | |||||
ASSIGN_VAR_NAME.c_str(), peer_data_anchor->GetIdx(), | |||||
in_node->GetName().c_str(), in_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddRePassNode(in_node); | AddRePassNode(in_node); | ||||
@@ -159,7 +159,8 @@ Status AtomicAddrCleanPass::HandleLoopGraph(ComputeGraphPtr &graph, const vector | |||||
// Insert atomic clean op | // Insert atomic clean op | ||||
NodePtr clean_addr_node = InsertAtomicAddrCleanNode(graph); | NodePtr clean_addr_node = InsertAtomicAddrCleanNode(graph); | ||||
if (clean_addr_node == nullptr) { | if (clean_addr_node == nullptr) { | ||||
GELOGE(FAILED, "Insert AtomicAddrClean node failed. Ignore atomicAddrClean pass."); | |||||
GELOGE(FAILED, "[Insert][AtomicAddrCleanNode] to graph:%s failed. Ignore atomicAddrClean pass.", | |||||
graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -173,7 +174,9 @@ Status AtomicAddrCleanPass::HandleLoopGraph(ComputeGraphPtr &graph, const vector | |||||
auto ret = LinkToAtomicNode(node, clean_addr_node); | auto ret = LinkToAtomicNode(node, clean_addr_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Link control anchor failed from atomic node to atomic_addr_clean node."); | |||||
GELOGE(ret, | |||||
"[Call][LinkToAtomicNode] Link control anchor failed from atomic node:%s to atomic_addr_clean:%s node.", | |||||
node->GetName().c_str(), clean_addr_node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
index++; | index++; | ||||
@@ -188,7 +191,7 @@ Status AtomicAddrCleanPass::HandleNormalGraph(ComputeGraphPtr &graph, const vect | |||||
vector<NodePtr> dispersed_atomic_nodes; | vector<NodePtr> dispersed_atomic_nodes; | ||||
auto ret = HandleDispersedAtomicNodes(graph, atomic_node_vec, common_atomic_nodes, dispersed_atomic_nodes); | auto ret = HandleDispersedAtomicNodes(graph, atomic_node_vec, common_atomic_nodes, dispersed_atomic_nodes); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Handle dispersed atomic nodes failed, graph name is %s.", graph->GetName().c_str()); | |||||
GELOGE(ret, "[Call][HandleDispersedAtomicNodes] failed, graph name is %s.", graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -200,13 +203,15 @@ Status AtomicAddrCleanPass::HandleNormalGraph(ComputeGraphPtr &graph, const vect | |||||
// not loop graph , insert only one clean node in graph | // not loop graph , insert only one clean node in graph | ||||
NodePtr clean_addr_node = InsertAtomicAddrCleanNode(graph); | NodePtr clean_addr_node = InsertAtomicAddrCleanNode(graph); | ||||
if (clean_addr_node == nullptr) { | if (clean_addr_node == nullptr) { | ||||
GELOGE(FAILED, "Insert AtomicAddrClean node failed. Ignore atomicAddrClean pass."); | |||||
GELOGE(FAILED, "[Insert][AtomicAddrCleanNode] in graph:%s failed. Ignore atomicAddrClean pass.", | |||||
graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
for (const auto &node : common_atomic_nodes) { | for (const auto &node : common_atomic_nodes) { | ||||
ret = LinkToAtomicNode(node, clean_addr_node); | ret = LinkToAtomicNode(node, clean_addr_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Link control anchor failed from atomic node to atomic_addr_clean node."); | |||||
GELOGE(ret, "[Link][ControlAnchor] failed from atomic node:%s to atomic_addr_clean node:%s.", | |||||
node->GetName().c_str(), clean_addr_node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -218,7 +223,8 @@ Status AtomicAddrCleanPass::HandleNormalGraph(ComputeGraphPtr &graph, const vect | |||||
NodePtr peer_in_node = in_anchor->GetPeerOutAnchor()->GetOwnerNode(); | NodePtr peer_in_node = in_anchor->GetPeerOutAnchor()->GetOwnerNode(); | ||||
ret = LinkToAtomicNode(peer_in_node, clean_addr_node); | ret = LinkToAtomicNode(peer_in_node, clean_addr_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Link failed, %s : %s", peer_in_node->GetName().c_str(), clean_addr_node->GetName().c_str()); | |||||
GELOGE(ret, "[Link][ControlAnchor] from node:%s to node:%s failed", | |||||
peer_in_node->GetName().c_str(), clean_addr_node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -276,7 +282,8 @@ Status AtomicAddrCleanPass::HandleDispersedAtomicNodes(ComputeGraphPtr &graph, | |||||
if (!node_anchors_connect_netoutput.empty()) { | if (!node_anchors_connect_netoutput.empty()) { | ||||
NodePtr dispersed_clean_addr_node = InsertAtomicAddrCleanNode(graph); | NodePtr dispersed_clean_addr_node = InsertAtomicAddrCleanNode(graph); | ||||
if (dispersed_clean_addr_node == nullptr) { | if (dispersed_clean_addr_node == nullptr) { | ||||
GELOGE(FAILED, "Insert AtomicAddrClean node failed. Ignore atomicAddrClean pass."); | |||||
GELOGE(FAILED, "[Insert][AtomicAddrCleanNode] in graph:%s failed. Ignore atomicAddrClean pass.", | |||||
graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -291,7 +298,7 @@ Status AtomicAddrCleanPass::HandleDispersedAtomicNodes(ComputeGraphPtr &graph, | |||||
++index; | ++index; | ||||
Status ret = LinkToAtomicNode(node, dispersed_clean_addr_node); | Status ret = LinkToAtomicNode(node, dispersed_clean_addr_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Link control anchor failed from atomic node: %s to atomic_addr_clean node: %s.", | |||||
GELOGE(ret, "[Link][ControlAnchor] failed from atomic node:%s to atomic_addr_clean node:%s.", | |||||
node->GetName().c_str(), dispersed_clean_addr_node->GetName().c_str()); | node->GetName().c_str(), dispersed_clean_addr_node->GetName().c_str()); | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -308,7 +315,7 @@ NodePtr AtomicAddrCleanPass::InsertAtomicAddrCleanNode(ComputeGraphPtr &graph) { | |||||
OpDescPtr op_desc = MakeShared<OpDesc>(NODE_NAME_ATOMIC_ADDR_CLEAN, ATOMICADDRCLEAN); | OpDescPtr op_desc = MakeShared<OpDesc>(NODE_NAME_ATOMIC_ADDR_CLEAN, ATOMICADDRCLEAN); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(INTERNAL_ERROR, "Make shared atomic addr clean op failed."); | |||||
GELOGE(INTERNAL_ERROR, "[New][OpDesc] failed."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
string session_graph_id; | string session_graph_id; | ||||
@@ -336,7 +343,7 @@ Status AtomicAddrCleanPass::LinkToAtomicNode(const NodePtr &atomic_node, NodePtr | |||||
GE_IF_BOOL_EXEC(atomic_node == nullptr || atomic_clean_node == nullptr, | GE_IF_BOOL_EXEC(atomic_node == nullptr || atomic_clean_node == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param atomic_node or atomic_clean_node is nullptr, " | REPORT_INNER_ERROR("E19999", "Param atomic_node or atomic_clean_node is nullptr, " | ||||
"check invalid"); | "check invalid"); | ||||
DOMI_LOGE("param [atomic_node][atomic_clean_node] must not be null."); | |||||
DOMI_LOGE("[Check][Param] param [atomic_node][atomic_clean_node] must not be null."); | |||||
return PARAM_INVALID); | return PARAM_INVALID); | ||||
InControlAnchorPtr in_ctrl_anchor = atomic_node->GetInControlAnchor(); | InControlAnchorPtr in_ctrl_anchor = atomic_node->GetInControlAnchor(); | ||||
OutControlAnchorPtr out_ctrl_anchor = atomic_clean_node->GetOutControlAnchor(); | OutControlAnchorPtr out_ctrl_anchor = atomic_clean_node->GetOutControlAnchor(); | ||||
@@ -345,9 +352,9 @@ Status AtomicAddrCleanPass::LinkToAtomicNode(const NodePtr &atomic_node, NodePtr | |||||
"check invalid", | "check invalid", | ||||
atomic_node->GetName().c_str(), atomic_node->GetType().c_str(), | atomic_node->GetName().c_str(), atomic_node->GetType().c_str(), | ||||
atomic_clean_node->GetName().c_str(), atomic_clean_node->GetType().c_str()); | atomic_clean_node->GetName().c_str(), atomic_clean_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Get control anchor faild, dst node: %s.", | |||||
atomic_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] in_ctrl_anchor of op:%s(%s) or out_ctrl_anchor of op:%s(%s) is nullptr.", | |||||
atomic_node->GetName().c_str(), atomic_node->GetType().c_str(), | |||||
atomic_clean_node->GetName().c_str(), atomic_clean_node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -358,9 +365,9 @@ Status AtomicAddrCleanPass::LinkToAtomicNode(const NodePtr &atomic_node, NodePtr | |||||
out_ctrl_anchor->GetOwnerNode()->GetType().c_str(), | out_ctrl_anchor->GetOwnerNode()->GetType().c_str(), | ||||
in_ctrl_anchor->GetOwnerNode()->GetName().c_str(), | in_ctrl_anchor->GetOwnerNode()->GetName().c_str(), | ||||
in_ctrl_anchor->GetOwnerNode()->GetType().c_str()); | in_ctrl_anchor->GetOwnerNode()->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Graph add cleanAddrNode op out ctrl edge fail, dst node: %s.", | |||||
atomic_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
out_ctrl_anchor->GetOwnerNode()->GetName().c_str(), out_ctrl_anchor->GetOwnerNode()->GetType().c_str(), | |||||
in_ctrl_anchor->GetOwnerNode()->GetName().c_str(), in_ctrl_anchor->GetOwnerNode()->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("Graph add cleanAddrNode op out ctrl edge, dst node: %s.", atomic_node->GetName().c_str()); | GELOGD("Graph add cleanAddrNode op out ctrl edge, dst node: %s.", atomic_node->GetName().c_str()); | ||||
@@ -375,7 +382,7 @@ Status AtomicAddrCleanPass::LinkToAtomicNode(const NodePtr &atomic_node, NodePtr | |||||
} | } | ||||
bool AtomicAddrCleanPass::IsAtomicOp(const NodePtr &node) { | bool AtomicAddrCleanPass::IsAtomicOp(const NodePtr &node) { | ||||
GE_IF_BOOL_EXEC(node == nullptr, GELOGE(FAILED, "node is null."); return false); | |||||
GE_IF_BOOL_EXEC(node == nullptr, GELOGE(FAILED, "[Check][Param] node is nullptr."); return false); | |||||
OpDescPtr op_desc = node->GetOpDesc(); | OpDescPtr op_desc = node->GetOpDesc(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
return false; | return false; | ||||
@@ -416,7 +423,7 @@ Status AtomicAddrCleanPass::CompileUnknownGraphOp(const vector<NodePtr> &atomic_ | |||||
std::shared_ptr<GELib> instance = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance = ge::GELib::GetInstance(); | ||||
if ((instance == nullptr) || !instance->InitFlag()) { | if ((instance == nullptr) || !instance->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | REPORT_INNER_ERROR("E19999", "GeLib is not init before, check invalid"); | ||||
GELOGE(ge::GE_CLI_GE_NOT_INITIALIZED, "CompileSingleOp failed."); | |||||
GELOGE(ge::GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] GeLib is not init before."); | |||||
return ge::GE_CLI_GE_NOT_INITIALIZED; | return ge::GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
@@ -428,10 +435,10 @@ Status AtomicAddrCleanPass::CompileUnknownGraphOp(const vector<NodePtr> &atomic_ | |||||
} | } | ||||
string kernel_lib_name = op_desc->GetOpKernelLibName(); | string kernel_lib_name = op_desc->GetOpKernelLibName(); | ||||
if (kernel_lib_name.empty()) { | if (kernel_lib_name.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | |||||
kernel_lib_name.c_str()); | |||||
GELOGE(ge::INTERNAL_ERROR, "Get atomic node:%s(%s) kernel lib failed.", atomic_node->GetName().c_str(), | |||||
atomic_node->GetType().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name of op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
GELOGE(ge::INTERNAL_ERROR, "[Get][OpKernelLibName] of op:%s(%s) failed.", op_desc->GetName().c_str(), | |||||
op_desc->GetType().c_str()); | |||||
return ge::INTERNAL_ERROR; | return ge::INTERNAL_ERROR; | ||||
} | } | ||||
@@ -452,7 +459,7 @@ Status AtomicAddrCleanPass::CompileUnknownGraphOp(const vector<NodePtr> &atomic_ | |||||
if (ret != ge::SUCCESS) { | if (ret != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Call CompileOp failed, kernel_lib_name:%s, ret:%d", | REPORT_CALL_ERROR("E19999", "Call CompileOp failed, kernel_lib_name:%s, ret:%d", | ||||
kernel_lib_name.c_str(), ret); | kernel_lib_name.c_str(), ret); | ||||
GELOGE(ret, "Compile atomic op failed, kernel lib name is %s", kernel_lib_name.c_str()); | |||||
GELOGE(ret, "[Compile][AtomicOp] failed, kernel lib name is %s", kernel_lib_name.c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -29,10 +29,11 @@ Status AttachStreamLabelPass::Run(ComputeGraphPtr graph) { | |||||
std::map<NodePtr, NodePtr> branch_head_nodes; | std::map<NodePtr, NodePtr> branch_head_nodes; | ||||
FindNodes(graph, need_label_nodes, enter_nodes, branch_head_nodes); | FindNodes(graph, need_label_nodes, enter_nodes, branch_head_nodes); | ||||
for (const auto &node : need_label_nodes) { | for (const auto &node : need_label_nodes) { | ||||
GE_CHK_STATUS_RET(UpdateCondBranch(node, branch_head_nodes), "Update cond branch failed, start node:%s.", | |||||
GE_CHK_STATUS_RET(UpdateCondBranch(node, branch_head_nodes), "[Update][CondBranch] failed, start node:%s.", | |||||
node->GetName().c_str()); | node->GetName().c_str()); | ||||
} | } | ||||
GE_CHK_STATUS_RET(UpdateEnterNode(enter_nodes), "UpdateEnterNode failed."); | |||||
GE_CHK_STATUS_RET(UpdateEnterNode(enter_nodes), | |||||
"[Update][EnterNode] in graph:%s failed.", graph->GetName().c_str()); | |||||
GELOGD("AttachStreamLabelPass Leave."); | GELOGD("AttachStreamLabelPass Leave."); | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -84,7 +85,7 @@ Status AttachStreamLabelPass::UpdateCondBranch(const NodePtr &node, | |||||
const std::map<NodePtr, NodePtr> &branch_head_nodes) { | const std::map<NodePtr, NodePtr> &branch_head_nodes) { | ||||
std::string stream_label; | std::string stream_label; | ||||
if (AttachFlag(node, stream_label) != SUCCESS) { | if (AttachFlag(node, stream_label) != SUCCESS) { | ||||
GELOGE(FAILED, "Attach flag for node %s failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Attach][Flag] for node %s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -120,9 +121,8 @@ Status AttachStreamLabelPass::UpdateCondBranch(const NodePtr &node, | |||||
GELOGD("Attach label %s to node: %s.", stream_label.c_str(), tmp_node->GetName().c_str()); | GELOGD("Attach label %s to node: %s.", stream_label.c_str(), tmp_node->GetName().c_str()); | ||||
auto status = SetStreamLabel(tmp_node, stream_label); | auto status = SetStreamLabel(tmp_node, stream_label); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | |||||
stream_label.c_str(), tmp_node->GetName().c_str(), tmp_node->GetType().c_str()); | |||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed.", | |||||
stream_label.c_str(), tmp_node->GetName().c_str(), tmp_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
} | } | ||||
@@ -142,7 +142,7 @@ Status AttachStreamLabelPass::AttachFlag(const NodePtr &node, std::string &strea | |||||
if (node->GetInDataNodes().empty()) { | if (node->GetInDataNodes().empty()) { | ||||
REPORT_INNER_ERROR("E19999", "In data nodes is empty of op:%s(%s), check invalid", | REPORT_INNER_ERROR("E19999", "In data nodes is empty of op:%s(%s), check invalid", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "node %s has no input_data_node.", node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Get][InDataNodes] node %s has no input_data_node.", node->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
stream_label = node->GetInDataNodes().at(0)->GetName(); | stream_label = node->GetInDataNodes().at(0)->GetName(); | ||||
@@ -154,22 +154,21 @@ Status AttachStreamLabelPass::AttachFlag(const NodePtr &node, std::string &strea | |||||
ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG.c_str(), | ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG.c_str(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
return FAILED, | return FAILED, | ||||
"StreamSwitch get attr TRUE_BRANCH_STREAM failed."); | |||||
"[Get][Attr] %s of op:%s(%s) failed", ATTR_NAME_SWITCH_TRUE_BRANCH_FLAG.c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
stream_label += (value ? "_t" : "_f"); | stream_label += (value ? "_t" : "_f"); | ||||
auto status = SetActiveLabelList(node, {stream_label}); | auto status = SetActiveLabelList(node, {stream_label}); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | |||||
stream_label.c_str(), node->GetName().c_str(), node->GetType().c_str()); | |||||
GELOGE(status, "set active_label_list failed."); | |||||
GELOGE(status, "[Set][ActiveLabelList] %s to op:%s(%s) failed.", | |||||
stream_label.c_str(), node->GetName().c_str(), node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
} else if (type == STREAMMERGE) { | } else if (type == STREAMMERGE) { | ||||
stream_label = node->GetName(); | stream_label = node->GetName(); | ||||
auto status = SetStreamLabel(node, stream_label); | auto status = SetStreamLabel(node, stream_label); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | |||||
stream_label.c_str(), node->GetName().c_str(), node->GetType().c_str()); | |||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed.", | |||||
stream_label.c_str(), node->GetName().c_str(), node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
} | } | ||||
@@ -199,7 +198,7 @@ Status AttachStreamLabelPass::UpdateEnterNode(const std::vector<NodePtr> &enter_ | |||||
for (const auto &pair : enter_active_map) { | for (const auto &pair : enter_active_map) { | ||||
if (SetEnterLabel(pair.second, pair.first) != SUCCESS) { | if (SetEnterLabel(pair.second, pair.first) != SUCCESS) { | ||||
GELOGE(FAILED, "Set stream_label for enter_nodes failed."); | |||||
GELOGE(FAILED, "[Set][EnterLabel] for enter_nodes failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -212,7 +211,8 @@ Status AttachStreamLabelPass::UpdateEnterNode(const std::vector<NodePtr> &enter_ | |||||
REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | ||||
ATTR_NAME_ACTIVE_LABEL_LIST.c_str(), | ATTR_NAME_ACTIVE_LABEL_LIST.c_str(), | ||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Get attr ATTR_NAME_ACTIVE_LABEL_LIST failed, node: %s.", active_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Get][Attr] %s of op:%s(%s) failed.", ATTR_NAME_ACTIVE_LABEL_LIST.c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -221,7 +221,7 @@ Status AttachStreamLabelPass::UpdateEnterNode(const std::vector<NodePtr> &enter_ | |||||
nodes.emplace(enter_node); | nodes.emplace(enter_node); | ||||
} | } | ||||
if (UpdateLoopBranch(nodes, active_label_list[0]) != SUCCESS) { | if (UpdateLoopBranch(nodes, active_label_list[0]) != SUCCESS) { | ||||
GELOGE(FAILED, "Update stream_label for loop_branch failed."); | |||||
GELOGE(FAILED, "[Update][StreamLabel] %s for loop_branch failed.", active_label_list[0].c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -247,9 +247,8 @@ Status AttachStreamLabelPass::SetEnterLabel(const std::vector<NodePtr> &enter_no | |||||
for (const auto &enter_node : enter_nodes) { | for (const auto &enter_node : enter_nodes) { | ||||
auto status = SetStreamLabel(enter_node, stream_label); | auto status = SetStreamLabel(enter_node, stream_label); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | |||||
stream_label.c_str(), enter_node->GetName().c_str(), enter_node->GetType().c_str()); | |||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed.", | |||||
stream_label.c_str(), enter_node->GetName().c_str(), enter_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
} | } | ||||
@@ -282,9 +281,8 @@ Status AttachStreamLabelPass::UpdateLoopBranch(const std::stack<NodePtr> &enter_ | |||||
GELOGD("Attach label %s to node: %s.", stream_label.c_str(), out_node->GetName().c_str()); | GELOGD("Attach label %s to node: %s.", stream_label.c_str(), out_node->GetName().c_str()); | ||||
auto status = SetStreamLabel(out_node, stream_label); | auto status = SetStreamLabel(out_node, stream_label); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | |||||
stream_label.c_str(), out_node->GetName().c_str(), out_node->GetType().c_str()); | |||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed.", | |||||
stream_label.c_str(), out_node->GetName().c_str(), out_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
nodes.push(out_node); | nodes.push(out_node); | ||||
@@ -142,13 +142,14 @@ void PushToRePassIfSeen(NodePtr &node, const std::pair<std::string, BaseNodePass | |||||
Status RunPasses(NodePtr &node, const NamesToPass &names_to_passes, DuringPassNodeSets &during_pass_node_set) { | Status RunPasses(NodePtr &node, const NamesToPass &names_to_passes, DuringPassNodeSets &during_pass_node_set) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
GELOGE(FAILED, "parameter is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGD("Begin to run pass for node %s", node->GetName().c_str()); | GELOGD("Begin to run pass for node %s", node->GetName().c_str()); | ||||
for (const auto &name_to_pass : names_to_passes) { | for (const auto &name_to_pass : names_to_passes) { | ||||
if (name_to_pass.second == nullptr) { | if (name_to_pass.second == nullptr) { | ||||
GELOGE(INTERNAL_ERROR, "There is null pointer in passes(%s), skip it", name_to_pass.first.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] There is null pointer in passes(%s), skip it", name_to_pass.first.c_str()); | |||||
continue; | continue; | ||||
} | } | ||||
@@ -156,8 +157,9 @@ Status RunPasses(NodePtr &node, const NamesToPass &names_to_passes, DuringPassNo | |||||
name_to_pass.second->init(); | name_to_pass.second->init(); | ||||
auto result = name_to_pass.second->Run(node); | auto result = name_to_pass.second->Run(node); | ||||
if (result != SUCCESS) { | if (result != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to process pass %s on node %s, result " | |||||
REPORT_CALL_ERROR("E19999", "process pass %s on node:%s failed, ret:%u", | |||||
name_to_pass.first.c_str(), node->GetName().c_str(), result); | |||||
GELOGE(INTERNAL_ERROR, "[Process][Pass] %s on node %s failed, result " | |||||
"%u, the passes will be terminated immediately.", | "%u, the passes will be terminated immediately.", | ||||
name_to_pass.first.c_str(), node->GetName().c_str(), result); | name_to_pass.first.c_str(), node->GetName().c_str(), result); | ||||
return result; | return result; | ||||
@@ -201,26 +203,31 @@ void ClearOption(NamesToPass names_to_pass) { | |||||
Status BaseNodePass::IsolateAndDeleteNode(NodePtr &node, const std::vector<int> &io_map) { | Status BaseNodePass::IsolateAndDeleteNode(NodePtr &node, const std::vector<int> &io_map) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
GELOGE(FAILED, "parameter is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid."); | |||||
GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGI("Prepare to isolate and delete node, name:%s, type:%s.", node->GetName().c_str(), | GELOGI("Prepare to isolate and delete node, name:%s, type:%s.", node->GetName().c_str(), | ||||
node->GetType().c_str()); | node->GetType().c_str()); | ||||
ComputeGraphPtr graph = node->GetOwnerComputeGraph(); | ComputeGraphPtr graph = node->GetOwnerComputeGraph(); | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
GELOGE(FAILED, "[%s] The owner graph must not be null.", node->GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "The owner graph of node:%s must not be null.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][OwnerComputeGraph] failed, The owner graph of node:%s must not be null.", | |||||
node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddRePassNodesWithInOut(node); | AddRePassNodesWithInOut(node); | ||||
if (GraphUtils::IsolateNode(node, io_map) != GRAPH_SUCCESS) { | if (GraphUtils::IsolateNode(node, io_map) != GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[%s] IsolateNode failed.", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Isolate Node:%s failed", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Isolate][Node] %s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { | if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { | ||||
GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", node->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "call RemoveNodeWithoutRelink for node:%s failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Call][RemoveNodeWithoutRelink] for node:%s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -230,7 +237,8 @@ Status BaseNodePass::IsolateAndDeleteNode(NodePtr &node, const std::vector<int> | |||||
Status GEPass::Run(const NamesToPass &names_to_passes) { | Status GEPass::Run(const NamesToPass &names_to_passes) { | ||||
if (graph_ == nullptr) { | if (graph_ == nullptr) { | ||||
GELOGE(INTERNAL_ERROR, "The graph is null"); | |||||
REPORT_INNER_ERROR("E19999", "graph_ is nullptr, check invalid."); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] The graph is nullptr"); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if (names_to_passes.empty()) { | if (names_to_passes.empty()) { | ||||
@@ -240,7 +248,7 @@ Status GEPass::Run(const NamesToPass &names_to_passes) { | |||||
if (depth_ > kMaxRecursiveDepth) { | if (depth_ > kMaxRecursiveDepth) { | ||||
GELOGE(PARAM_INVALID, | GELOGE(PARAM_INVALID, | ||||
"The pass for root graph %s will be terminated because too many nesting" | |||||
"[Check][Param] The pass for root graph %s will be terminated because too many nesting" | |||||
" levels(%d) of subgraphs, last subgraph is %s", | " levels(%d) of subgraphs, last subgraph is %s", | ||||
root_graph_->GetName().c_str(), depth_, graph_->GetName().c_str()); | root_graph_->GetName().c_str(), depth_, graph_->GetName().c_str()); | ||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
@@ -284,7 +292,7 @@ Status GEPass::RunPassesOneGraph(const NamesToPass &names_to_passes) { | |||||
auto ret = RunPasses(node, names_to_passes, during_pass_node_set); | auto ret = RunPasses(node, names_to_passes, during_pass_node_set); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Failed to process passes on node %s type %s, error code: %u", | |||||
GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code:%u", | |||||
node->GetName().c_str(), node->GetType().c_str(), ret); | node->GetName().c_str(), node->GetType().c_str(), ret); | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -292,7 +300,7 @@ Status GEPass::RunPassesOneGraph(const NamesToPass &names_to_passes) { | |||||
bool has_sub_graph = false; | bool has_sub_graph = false; | ||||
ret = RunPassesOnSubGraph(node, names_to_passes, has_sub_graph); | ret = RunPassesOnSubGraph(node, names_to_passes, has_sub_graph); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Failed to run passes on the sub graph of node %s", node->GetName().c_str()); | |||||
GELOGE(ret, "[Run][Passes] on the sub graph of node %s failed", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -301,7 +309,7 @@ Status GEPass::RunPassesOneGraph(const NamesToPass &names_to_passes) { | |||||
SetFlagOption(kOptimizeAfterSubGraph, names_to_passes); | SetFlagOption(kOptimizeAfterSubGraph, names_to_passes); | ||||
ret = RunPasses(node, names_to_passes, during_pass_node_set); | ret = RunPasses(node, names_to_passes, during_pass_node_set); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Failed to process passes on node %s type %s, error code: %u", | |||||
GELOGE(ret, "[Process][Passes] on node %s type %s failed, error code: %u", | |||||
node->GetName().c_str(), node->GetType().c_str(), ret); | node->GetName().c_str(), node->GetType().c_str(), ret); | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -347,7 +355,7 @@ Status GEPass::RunPassesOnSubGraph(const NodePtr &node, const NamesToPass &names | |||||
GEPass pass(graph, root_graph_, depth_ + 1); | GEPass pass(graph, root_graph_, depth_ + 1); | ||||
auto ret = pass.Run(names_to_passes); | auto ret = pass.Run(names_to_passes); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Failed to run passes for sub graph %s from node %s", name.c_str(), node->GetName().c_str()); | |||||
GELOGE(ret, "[Run][Passes] for sub graph:%s from node:%s failed", name.c_str(), node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -33,7 +33,7 @@ Status BitcastPass::Run(NodePtr &node) { | |||||
GELOGD("Bitcast running"); | GELOGD("Bitcast running"); | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "Param [node] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Param [node] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -44,6 +44,7 @@ Status BitcastPass::Run(NodePtr &node) { | |||||
OpDescPtr op_desc = node->GetOpDesc(); | OpDescPtr op_desc = node->GetOpDesc(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] failed, op_desc of node is nullptr"); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
ge::DataType dst_data_type; | ge::DataType dst_data_type; | ||||
@@ -63,21 +64,24 @@ Status BitcastPass::CheckDstDataType(const OpDescPtr op_desc, ge::DataType &dst_ | |||||
if (!ge::AttrUtils::GetDataType(op_desc, kAttrNameType, dst_data_type)) { | if (!ge::AttrUtils::GetDataType(op_desc, kAttrNameType, dst_data_type)) { | ||||
REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | ||||
kAttrNameType, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | kAttrNameType, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(PARAM_INVALID, "Node failed to get attribute type."); | |||||
GELOGE(PARAM_INVALID, "[Get][Attr] %s of op:%s(%s) failed", | |||||
kAttrNameType, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (dst_data_type >= ge::DT_UNDEFINED) { | if (dst_data_type >= ge::DT_UNDEFINED) { | ||||
REPORT_INNER_ERROR("E19999", "Param dst_data_type:%d check invalid, op:%s(%s)", | REPORT_INNER_ERROR("E19999", "Param dst_data_type:%d check invalid, op:%s(%s)", | ||||
dst_data_type, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | dst_data_type, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(PARAM_INVALID, "dst_data_type[%s] is not valid.", | |||||
TypeUtils::DataTypeToSerialString(dst_data_type).c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] dst_data_type[%s] is not valid, op:%s(%s)", | |||||
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (op_desc->GetOutputDescPtr(0) == nullptr) { | if (op_desc->GetOutputDescPtr(0) == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Index 0 ouput desc of op:%s(%s) not exist, check invalid", | REPORT_INNER_ERROR("E19999", "Index 0 ouput desc of op:%s(%s) not exist, check invalid", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(PARAM_INVALID, "Bitcast node outputDesc is null."); | |||||
GELOGE(PARAM_INVALID, "[Get][OutputDescPtr] Index 0 ouput desc of op:%s(%s) not exist.", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (op_desc->GetOutputDescPtr(0)->GetDataType() != dst_data_type) { | if (op_desc->GetOutputDescPtr(0)->GetDataType() != dst_data_type) { | ||||
@@ -85,9 +89,10 @@ Status BitcastPass::CheckDstDataType(const OpDescPtr op_desc, ge::DataType &dst_ | |||||
"check invalid", op_desc->GetName().c_str(), op_desc->GetType().c_str(), | "check invalid", op_desc->GetName().c_str(), op_desc->GetType().c_str(), | ||||
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | ||||
TypeUtils::DataTypeToSerialString(op_desc->GetOutputDescPtr(0)->GetDataType()).c_str()); | TypeUtils::DataTypeToSerialString(op_desc->GetOutputDescPtr(0)->GetDataType()).c_str()); | ||||
GELOGE(PARAM_INVALID, "dst_data_type[%s] is not equal to output_data_type[%s].", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] dst_data_type[%s] is not equal to output_data_type[%s], op:%s(%s).", | |||||
TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | ||||
TypeUtils::DataTypeToSerialString(op_desc->GetOutputDescPtr(0)->GetDataType()).c_str()); | |||||
TypeUtils::DataTypeToSerialString(op_desc->GetOutputDescPtr(0)->GetDataType()).c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -99,7 +104,8 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType | |||||
if (input_tensor_desc == nullptr) { | if (input_tensor_desc == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Index 0 input desc of op:%s(%s) not exist, check invalid", | REPORT_INNER_ERROR("E19999", "Index 0 input desc of op:%s(%s) not exist, check invalid", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(PARAM_INVALID, "input_tensor_desc must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] input_tensor_desc(index:0) of op:%s(%s) must not be null.", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -109,8 +115,9 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType | |||||
REPORT_INNER_ERROR("E19999", "ori_data_type:%d of index 0 input desc in op:%s(%s), " | REPORT_INNER_ERROR("E19999", "ori_data_type:%d of index 0 input desc in op:%s(%s), " | ||||
"check invalid", | "check invalid", | ||||
ori_data_type, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ori_data_type, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(PARAM_INVALID, "ori_data_type[%s] is not valid.", | |||||
TypeUtils::DataTypeToSerialString(ori_data_type).c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] ori_data_type[%s] of input desc(index 0) in op:%s(%s) is not valid.", | |||||
TypeUtils::DataTypeToSerialString(ori_data_type).c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -121,7 +128,7 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType | |||||
BitcastPass::kVecInt64 dim_vec(input_tensor_desc->GetShape().GetDims()); | BitcastPass::kVecInt64 dim_vec(input_tensor_desc->GetShape().GetDims()); | ||||
if (CalcAndUpdateShape(dim_vec, ori_data_type, dst_data_type) != SUCCESS) { | if (CalcAndUpdateShape(dim_vec, ori_data_type, dst_data_type) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "CalcAndUpdateShape failed."); | |||||
GELOGE(PARAM_INVALID, "[Call][CalcAndUpdateShape] failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -130,7 +137,9 @@ Status BitcastPass::CheckOutputShape(const OpDescPtr op_desc, const ge::DataType | |||||
"check invalid", | "check invalid", | ||||
formats::JoinToString(output_tensor_desc->GetShape().GetDims()).c_str(), | formats::JoinToString(output_tensor_desc->GetShape().GetDims()).c_str(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), formats::JoinToString(dim_vec).c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), formats::JoinToString(dim_vec).c_str()); | ||||
GELOGE(PARAM_INVALID, "out_put_shape is different from expectations."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Shape:%s of index 0 output desc in op:%s(%s), different from expect shape:%s", | |||||
formats::JoinToString(output_tensor_desc->GetShape().GetDims()).c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), formats::JoinToString(dim_vec).c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -141,7 +150,7 @@ Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::Data | |||||
ge::DataType dst_data_type) { | ge::DataType dst_data_type) { | ||||
if (dim_vec.size() == 0) { | if (dim_vec.size() == 0) { | ||||
REPORT_INNER_ERROR("E19999", "Param dim_vec is empty, check invalid"); | REPORT_INNER_ERROR("E19999", "Param dim_vec is empty, check invalid"); | ||||
GELOGE(PARAM_INVALID, "Pre node shape size is zero."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Param dim_vec is empty."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
int64_t ori_data_size = GetSizeByDataType(ori_data_type); | int64_t ori_data_size = GetSizeByDataType(ori_data_type); | ||||
@@ -155,7 +164,10 @@ Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::Data | |||||
"check invalid", | "check invalid", | ||||
ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str(), | ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str(), | ||||
dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str()); | dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str()); | ||||
GELOGE(PARAM_INVALID, "ori_data_size is not divisible by dst_data_size."); | |||||
GELOGE(PARAM_INVALID, | |||||
"[Check][Param] size:%ld of ori_data_type:%s is not divisible by size:%ld of dst_data_type:%s.", | |||||
ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str(), | |||||
dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
dim_vec.push_back(ori_data_size / dst_data_size); | dim_vec.push_back(ori_data_size / dst_data_size); | ||||
@@ -166,7 +178,10 @@ Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::Data | |||||
"check invalid", | "check invalid", | ||||
dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | ||||
ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str()); | ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str()); | ||||
GELOGE(PARAM_INVALID, "dst_data_size is not divisible by ori_data_size."); | |||||
GELOGE(PARAM_INVALID, | |||||
"[Check][Param] size:%ld of dst_data_type:%s is not divisible by size:%ld of ori_data_type:%s.", | |||||
dst_data_size, TypeUtils::DataTypeToSerialString(dst_data_type).c_str(), | |||||
ori_data_size, TypeUtils::DataTypeToSerialString(ori_data_type).c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -174,7 +189,9 @@ Status BitcastPass::CalcAndUpdateShape(BitcastPass::kVecInt64 &dim_vec, ge::Data | |||||
REPORT_INNER_ERROR("E19999", "The last dim:%ld in param dim_vec is not equal to " | REPORT_INNER_ERROR("E19999", "The last dim:%ld in param dim_vec is not equal to " | ||||
"dst_data_size:%ld / ori_data_size:%ld, check invalid", | "dst_data_size:%ld / ori_data_size:%ld, check invalid", | ||||
dim_vec[dim_vec.size() - 1], dst_data_size, ori_data_size); | dim_vec[dim_vec.size() - 1], dst_data_size, ori_data_size); | ||||
GELOGE(PARAM_INVALID, "The last dim is not equal to dst_data_size / ori_data_size."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] The last dim:%ld in param dim_vec is not equal to " | |||||
"dst_data_size:%ld / ori_data_size:%ld", | |||||
dim_vec[dim_vec.size() - 1], dst_data_size, ori_data_size); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
dim_vec.pop_back(); | dim_vec.pop_back(); | ||||
@@ -26,13 +26,13 @@ namespace ge { | |||||
Status CastRemovePass::Run(NodePtr &node) { | Status CastRemovePass::Run(NodePtr &node) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "Param [node] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Param [node] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
OpDescPtr op_desc = node->GetOpDesc(); | OpDescPtr op_desc = node->GetOpDesc(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "OpDesc of param [node] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] OpDesc of param [node] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -49,7 +49,7 @@ Status CastRemovePass::Run(NodePtr &node) { | |||||
OpDescPtr end_op_desc = end_node->GetOpDesc(); | OpDescPtr end_op_desc = end_node->GetOpDesc(); | ||||
if (end_op_desc == nullptr) { | if (end_op_desc == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "op_desc of end_node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "op_desc of end_node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "OpDesc of end node must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] OpDesc of end node must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -104,7 +104,7 @@ Status CastRemovePass::RemoveCast(DataType &type, std::vector<NodePtr> &nodes_to | |||||
if (IsolateAndDeleteNode(node, {0}) != SUCCESS) { | if (IsolateAndDeleteNode(node, {0}) != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "IsolateAndDeleteNode %s failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[IsolateAndDelete][Node] %s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -120,7 +120,7 @@ Status CastRemovePass::RemoveCast(DataType &type, std::vector<NodePtr> &nodes_to | |||||
OpDescPtr op_desc = node->GetOpDesc(); | OpDescPtr op_desc = node->GetOpDesc(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Find nullptr op_desc in node, check invalid"); | REPORT_INNER_ERROR("E19999", "Find nullptr op_desc in node, check invalid"); | ||||
GELOGE(FAILED, "OpDesc must not be null."); | |||||
GELOGE(FAILED, "[Get][OpDesc] OpDesc must not be null."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -132,7 +132,8 @@ Status CastRemovePass::RemoveCast(DataType &type, std::vector<NodePtr> &nodes_to | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s of op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s of op:%s(%s) failed", | ||||
ATTR_NEED_COMPILE.c_str(), | ATTR_NEED_COMPILE.c_str(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Set ATTR_NEED_COMPILE Attr fail."); | |||||
GELOGE(FAILED, "[Set][Attr] %s of op:%s(%s) failed", ATTR_NEED_COMPILE.c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto in_desc = op_desc->MutableInputDesc(0); | auto in_desc = op_desc->MutableInputDesc(0); | ||||
@@ -33,7 +33,7 @@ | |||||
namespace ge { | namespace ge { | ||||
bool CastTranslatePass::CheckInAndOutDataAnchor(NodePtr &node) const { | bool CastTranslatePass::CheckInAndOutDataAnchor(NodePtr &node) const { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
GELOGE(FAILED, "parameter is null."); | |||||
GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); | |||||
return false; | return false; | ||||
} | } | ||||
if (node->GetOpDesc() == nullptr) { | if (node->GetOpDesc() == nullptr) { | ||||
@@ -191,7 +191,7 @@ bool CastTranslatePass::IsOpSupportedOptimize(NodePtr &cast_node, NodePtr &trans | |||||
} | } | ||||
bool CastTranslatePass::CheckOpSupportOptimize(NodePtr &node, bool &is_src_cast) { | bool CastTranslatePass::CheckOpSupportOptimize(NodePtr &node, bool &is_src_cast) { | ||||
GE_IF_BOOL_EXEC(node == nullptr, GELOGE(FAILED, "node is null."); return false); | |||||
GE_IF_BOOL_EXEC(node == nullptr, GELOGE(FAILED, "[Check][Param] node is nullptr."); return false); | |||||
auto out_node = node->GetOutDataNodes().at(0); | auto out_node = node->GetOutDataNodes().at(0); | ||||
// N dst nodes have the same datatype and format, check the first node | // N dst nodes have the same datatype and format, check the first node | ||||
if (is_src_cast) { | if (is_src_cast) { | ||||
@@ -249,14 +249,19 @@ Status CastTranslatePass::FuseDstNTranslates(NodePtr &node) { | |||||
GE_CHECK_NOTNULL(out_data_node); | GE_CHECK_NOTNULL(out_data_node); | ||||
AddRePassNodesWithInOut(out_data_node); | AddRePassNodesWithInOut(out_data_node); | ||||
// Has checked nodes only has one in data anchor one out data anchor | // Has checked nodes only has one in data anchor one out data anchor | ||||
GE_CHK_GRAPH_STATUS_RET(NodeUtils::MoveOutputEdges(out_data_node, base_node), "move out put edge failed"); | |||||
GE_CHK_GRAPH_STATUS_RET(NodeUtils::MoveOutputEdges(out_data_node, base_node), | |||||
"[Move][OutputEdges] failed, out data node:%s, index:0", | |||||
base_node->GetName().c_str()); | |||||
// Relink in control anchor, delete in data anchor | // Relink in control anchor, delete in data anchor | ||||
auto in_ctr_anchor = out_data_node->GetInControlAnchor(); | auto in_ctr_anchor = out_data_node->GetInControlAnchor(); | ||||
GE_CHECK_NOTNULL(in_ctr_anchor); | GE_CHECK_NOTNULL(in_ctr_anchor); | ||||
for (const auto &peer_anchor : in_ctr_anchor->GetPeerOutControlAnchors()) { | for (const auto &peer_anchor : in_ctr_anchor->GetPeerOutControlAnchors()) { | ||||
GE_CHECK_NOTNULL(base_node->GetInControlAnchor()); | GE_CHECK_NOTNULL(base_node->GetInControlAnchor()); | ||||
GE_CHK_GRAPH_STATUS_RET(base_node->GetInControlAnchor()->LinkFrom(peer_anchor), "link from peer anchor failed"); | |||||
GE_CHK_GRAPH_STATUS_RET(base_node->GetInControlAnchor()->LinkFrom(peer_anchor), | |||||
"[Add][Edge] between %s and %s failed", | |||||
base_node->GetInControlAnchor()->GetOwnerNode()->GetName().c_str(), | |||||
peer_anchor->GetOwnerNode()->GetName().c_str()); | |||||
} | } | ||||
in_ctr_anchor->UnlinkAll(); | in_ctr_anchor->UnlinkAll(); | ||||
out_data_node->GetAllInDataAnchors().at(0)->UnlinkAll(); | out_data_node->GetAllInDataAnchors().at(0)->UnlinkAll(); | ||||
@@ -266,7 +271,8 @@ Status CastTranslatePass::FuseDstNTranslates(NodePtr &node) { | |||||
if (GraphUtils::RemoveNodeWithoutRelink(graph, out_data_node) != SUCCESS) { | if (GraphUtils::RemoveNodeWithoutRelink(graph, out_data_node) != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | ||||
out_data_node->GetName().c_str(), out_data_node->GetType().c_str(), graph->GetName().c_str()); | out_data_node->GetName().c_str(), out_data_node->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", out_data_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][Node] %s(%s) without relink in graph:%s failed", | |||||
out_data_node->GetName().c_str(), out_data_node->GetType().c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddNodeDeleted(out_data_node); | AddNodeDeleted(out_data_node); | ||||
@@ -109,8 +109,8 @@ Status CommonSubexpressionEliminationPass::Run(ComputeGraphPtr graph) { | |||||
REPORT_CALL_ERROR("E19999", "Replace node:%s(%s)'s anchor by node:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Replace node:%s(%s)'s anchor by node:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), | node->GetName().c_str(), node->GetType().c_str(), | ||||
iter->second->GetName().c_str(), iter->second->GetType().c_str()); | iter->second->GetName().c_str(), iter->second->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to replace node %s by node %s error node %u", | |||||
node->GetName().c_str(), iter->second->GetName().c_str(), ret); | |||||
GELOGE(INTERNAL_ERROR, "[Replace][Node] %s by node %s failed, ret:%u", | |||||
node->GetName().c_str(), iter->second->GetName().c_str(), ret); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -120,7 +120,8 @@ Status CommonSubexpressionEliminationPass::Run(ComputeGraphPtr graph) { | |||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to remove node %s from graph", node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Remove][Node] %s from graph:%s failed", node->GetName().c_str(), | |||||
graph->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -42,7 +42,7 @@ graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) { | |||||
std::shared_ptr<GELib> instance = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance = ge::GELib::GetInstance(); | ||||
if (instance == nullptr || !instance->InitFlag()) { | if (instance == nullptr || !instance->InitFlag()) { | ||||
REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | REPORT_INNER_ERROR("E19999", "Gelib not init before, check invalid"); | ||||
GELOGE(ge::GE_CLI_GE_NOT_INITIALIZED, "Run CompileNodesPass failed."); | |||||
GELOGE(ge::GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] Gelib not init before."); | |||||
return ge::GE_CLI_GE_NOT_INITIALIZED; | return ge::GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
std::unordered_map<string, vector<NodePtr>> kernel_to_compile_nodes; | std::unordered_map<string, vector<NodePtr>> kernel_to_compile_nodes; | ||||
@@ -71,7 +71,7 @@ graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) { | |||||
kernel_to_compile_nodes.insert(std::make_pair(kernel_lib_name, node_vec)); | kernel_to_compile_nodes.insert(std::make_pair(kernel_lib_name, node_vec)); | ||||
} | } | ||||
} else { | } else { | ||||
GELOGE(GRAPH_FAILED, "Get node:%s, type:%s supported kernel failed.", node->GetName().c_str(), | |||||
GELOGE(GRAPH_FAILED, "[Get][SupportedKernel] for node:%s(%s) failed.", node->GetName().c_str(), | |||||
node->GetType().c_str()); | node->GetType().c_str()); | ||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
@@ -79,7 +79,7 @@ graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) { | |||||
// compile node follow different kernel, currently only TBE kernel | // compile node follow different kernel, currently only TBE kernel | ||||
auto result = CompileNodes(instance, kernel_to_compile_nodes); | auto result = CompileNodes(instance, kernel_to_compile_nodes); | ||||
if (result != GRAPH_SUCCESS) { | if (result != GRAPH_SUCCESS) { | ||||
GELOGE(result, "Compile op failed."); | |||||
GELOGE(result, "[Compile][Op] failed, ret:%u.", result); | |||||
return result; | return result; | ||||
} | } | ||||
GELOGD("[CompileNodesPass]: Optimize success."); | GELOGD("[CompileNodesPass]: Optimize success."); | ||||
@@ -91,7 +91,7 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std: | |||||
string &kernel_lib_name) { | string &kernel_lib_name) { | ||||
auto op_desc = node->GetOpDesc(); | auto op_desc = node->GetOpDesc(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "Get op %s opdesc failed", node->GetName().c_str()); | |||||
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "[Get][OpDesc] failed, op of param node is nullptr."); | |||||
return ge::GE_GRAPH_PARAM_NULLPTR; | return ge::GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
// reset op kernel lib, find supported kernel | // reset op kernel lib, find supported kernel | ||||
@@ -102,7 +102,7 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std: | |||||
if (kernel_lib_name.empty()) { | if (kernel_lib_name.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "kernel_lib_name in op:%s(%s) is empty, check invalid", | REPORT_INNER_ERROR("E19999", "kernel_lib_name in op:%s(%s) is empty, check invalid", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(GRAPH_FAILED, "Get node:%s, type:%s kernel lib failed.", node->GetName().c_str(), | |||||
GELOGE(GRAPH_FAILED, "[Get][OpKernelLib] for node:%s(%s) failed.", node->GetName().c_str(), | |||||
op_desc->GetType().c_str()); | op_desc->GetType().c_str()); | ||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
@@ -111,7 +111,7 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std: | |||||
if (kernel_info == nullptr) { | if (kernel_info == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed for op:%s(%s)", | REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed for op:%s(%s)", | ||||
kernel_lib_name.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str()); | kernel_lib_name.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "Get op %s ops kernel info store failed", node->GetName().c_str()); | |||||
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "[Get][OpsKernelInfoStore] for op:%s failed", node->GetName().c_str()); | |||||
return ge::GE_GRAPH_PARAM_NULLPTR; | return ge::GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
@@ -144,13 +144,13 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std: | |||||
REPORT_INPUT_ERROR("E13002", std::vector<std::string>({"optype", "opskernel", "reason"}), | REPORT_INPUT_ERROR("E13002", std::vector<std::string>({"optype", "opskernel", "reason"}), | ||||
std::vector<std::string>({op_desc->GetType(), it.first, it.second})); | std::vector<std::string>({op_desc->GetType(), it.first, it.second})); | ||||
GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, | GELOGE(GE_GRAPH_ASSIGN_ENGINE_FAILED, | ||||
"CheckAccuracySupport:Op type %s of ops kernel %s is unsupported, reason:%s", | |||||
"[Call][CheckAccuracySupport] for Op type %s of ops kernel %s is unsupported, reason:%s", | |||||
op_desc->GetType().c_str(), it.first.c_str(), it.second.c_str()); | op_desc->GetType().c_str(), it.first.c_str(), it.second.c_str()); | ||||
} | } | ||||
REPORT_INPUT_ERROR("E13003", std::vector<std::string>({"opname", "optype"}), | REPORT_INPUT_ERROR("E13003", std::vector<std::string>({"opname", "optype"}), | ||||
std::vector<std::string>({op_desc->GetName(), op_desc->GetType()})); | std::vector<std::string>({op_desc->GetName(), op_desc->GetType()})); | ||||
GELOGE(GRAPH_FAILED, "Cannot find kernel lib support node:%s, type:%s , get kernel lib failed.", | |||||
GELOGE(GRAPH_FAILED, "[Check][Param] Cannot find kernel lib support node:%s, type:%s , get kernel lib failed.", | |||||
node->GetName().c_str(), op_desc->GetType().c_str()); | node->GetName().c_str(), op_desc->GetType().c_str()); | ||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
@@ -173,9 +173,8 @@ graphStatus CompileNodesPass::CompileNodes(const std::shared_ptr<GELib> instance | |||||
for (auto &kernel_nodes : kernel_to_compile_nodes) { | for (auto &kernel_nodes : kernel_to_compile_nodes) { | ||||
kernel_info = instance->OpsKernelManagerObj().GetOpsKernelInfoStore(kernel_nodes.first); | kernel_info = instance->OpsKernelManagerObj().GetOpsKernelInfoStore(kernel_nodes.first); | ||||
if (kernel_info == nullptr) { | if (kernel_info == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", | |||||
kernel_nodes.first.c_str()); | |||||
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "Get op %s ops kernel info store failed", kernel_nodes.first.c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Find ops kernel by name:%s failed", kernel_nodes.first.c_str()); | |||||
GELOGE(ge::GE_GRAPH_PARAM_NULLPTR, "[Get][OpsKernelInfoStore] for op %s failed", kernel_nodes.first.c_str()); | |||||
return ge::GE_GRAPH_PARAM_NULLPTR; | return ge::GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
string reason; | string reason; | ||||
@@ -192,7 +191,7 @@ graphStatus CompileNodesPass::CompileNodes(const std::shared_ptr<GELib> instance | |||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Call CompileOp failed, kernel_lib_name:%s, ret:%d", | REPORT_CALL_ERROR("E19999", "Call CompileOp failed, kernel_lib_name:%s, ret:%d", | ||||
kernel_nodes.first.c_str(), ret); | kernel_nodes.first.c_str(), ret); | ||||
GELOGE(ret, "Compile op failed, kernel name is %s", kernel_nodes.first.c_str()); | |||||
GELOGE(ret, "[Compile][Op] failed, kernel name is %s", kernel_nodes.first.c_str()); | |||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -32,7 +32,7 @@ Status CondPass::Run(NodePtr &node) { | |||||
if (ret == NOT_CHANGED) { | if (ret == NOT_CHANGED) { | ||||
return SUCCESS; | return SUCCESS; | ||||
} else if (ret != SUCCESS) { | } else if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "Get cond_info for node %s failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][CondInfo] for node %s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -48,19 +48,19 @@ Status CondPass::Run(NodePtr &node) { | |||||
if (cond_tensor.MutableShape().GetDim(0) == UNKNOWN_DIM_NUM) { | if (cond_tensor.MutableShape().GetDim(0) == UNKNOWN_DIM_NUM) { | ||||
GELOGI("Output tensor rank of Cond is unknown."); | GELOGI("Output tensor rank of Cond is unknown."); | ||||
if (cond_tensor.GetDataType() == DT_STRING) { | if (cond_tensor.GetDataType() == DT_STRING) { | ||||
GE_CHK_STATUS_RET(HandleStringCond(graph, peer_out_anchor, cond_in_anchor), "HandleStringCond for %s failed.", | |||||
op_desc->GetName().c_str()) | |||||
GE_CHK_STATUS_RET(HandleStringCond(graph, peer_out_anchor, cond_in_anchor), | |||||
"[Handle][StringCond] for op:%s failed.", op_desc->GetName().c_str()) | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
if (!cond_tensor.GetShape().IsScalar()) { | if (!cond_tensor.GetShape().IsScalar()) { | ||||
GE_CHK_STATUS_RET(HandleNonScalarCond(graph, peer_out_anchor, cond_in_anchor), "HandleNonScalarCond for %s failed.", | |||||
op_desc->GetName().c_str()) | |||||
GE_CHK_STATUS_RET(HandleNonScalarCond(graph, peer_out_anchor, cond_in_anchor), | |||||
"[Handle][NonScalarCond] for op:%s failed.", op_desc->GetName().c_str()) | |||||
} else { | } else { | ||||
switch (cond_tensor.GetDataType()) { | switch (cond_tensor.GetDataType()) { | ||||
case DT_STRING: | case DT_STRING: | ||||
GE_CHK_STATUS_RET(HandleStringCond(graph, peer_out_anchor, cond_in_anchor), "HandleStringCond for %s failed.", | |||||
op_desc->GetName().c_str()) | |||||
GE_CHK_STATUS_RET(HandleStringCond(graph, peer_out_anchor, cond_in_anchor), | |||||
"[Handle][StringCond] for op:%s failed.", op_desc->GetName().c_str()) | |||||
break; | break; | ||||
case DT_BOOL: | case DT_BOOL: | ||||
case DT_FLOAT: | case DT_FLOAT: | ||||
@@ -70,7 +70,7 @@ Status CondPass::Run(NodePtr &node) { | |||||
case DT_INT8: | case DT_INT8: | ||||
case DT_INT64: | case DT_INT64: | ||||
GE_CHK_STATUS_RET(HandleScalarCond(graph, peer_out_anchor, cond_in_anchor, cond_tensor.GetDataType()), | GE_CHK_STATUS_RET(HandleScalarCond(graph, peer_out_anchor, cond_in_anchor, cond_tensor.GetDataType()), | ||||
"HandleScalarCond for %s failed.", op_desc->GetName().c_str()) | |||||
"[Handle][ScalarCond] for op:%s failed.", op_desc->GetName().c_str()) | |||||
break; | break; | ||||
case DT_INT32: | case DT_INT32: | ||||
break; | break; | ||||
@@ -79,7 +79,9 @@ Status CondPass::Run(NodePtr &node) { | |||||
"data_type:%d of index:%d input tensor in op:%s(%s) check invalid", | "data_type:%d of index:%d input tensor in op:%s(%s) check invalid", | ||||
cond_tensor.GetDataType(), cond_in_anchor->GetIdx(), | cond_tensor.GetDataType(), cond_in_anchor->GetIdx(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "UpdateInputDesc for node %s failed.", op_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] data_type:%d of index:%d input tensor in op:%s(%s) is invalid", | |||||
cond_tensor.GetDataType(), cond_in_anchor->GetIdx(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -91,7 +93,8 @@ Status CondPass::Run(NodePtr &node) { | |||||
if (op_desc->UpdateInputDesc(cond_in_anchor->GetIdx(), cond_tensor) != GRAPH_SUCCESS) { | if (op_desc->UpdateInputDesc(cond_in_anchor->GetIdx(), cond_tensor) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Update input desc of op:%s(%s) failed, index:%d", | REPORT_CALL_ERROR("E19999", "Update input desc of op:%s(%s) failed, index:%d", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), cond_in_anchor->GetIdx()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), cond_in_anchor->GetIdx()); | ||||
GELOGE(FAILED, "UpdateInputDesc for node %s failed.", op_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[Update][InputDesc] for op:%s(%s) failed, index:%d", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), cond_in_anchor->GetIdx()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -112,12 +115,12 @@ Status CondPass::GetCondInfo(const NodePtr &node, ComputeGraphPtr &graph, OutDat | |||||
std::string type = node->GetType(); | std::string type = node->GetType(); | ||||
if (kIfOpTypes.count(type) != 0) { | if (kIfOpTypes.count(type) != 0) { | ||||
if (GetCondInfoForIf(node, graph, peer_out_anchor, cond_in_anchor) != SUCCESS) { | if (GetCondInfoForIf(node, graph, peer_out_anchor, cond_in_anchor) != SUCCESS) { | ||||
GELOGE(FAILED, "Get cond_info for if node failed."); | |||||
GELOGE(FAILED, "[Get][CondInfo] for if node:%s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} else if (kWhileOpTypes.count(type) != 0) { | } else if (kWhileOpTypes.count(type) != 0) { | ||||
if (GetCondInfoForWhile(node, graph, peer_out_anchor, cond_in_anchor) != SUCCESS) { | if (GetCondInfoForWhile(node, graph, peer_out_anchor, cond_in_anchor) != SUCCESS) { | ||||
GELOGE(FAILED, "Get cond_info for while node failed."); | |||||
GELOGE(FAILED, "[Get][CondInfo] for while node:%s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -167,7 +170,8 @@ Status CondPass::GetCondInfoForWhile(const NodePtr &node, ComputeGraphPtr &graph | |||||
REPORT_INNER_ERROR("E19999", "subgraph name:%s not exist in SubgraphNameIndexes map of op:%s(%s), " | REPORT_INNER_ERROR("E19999", "subgraph name:%s not exist in SubgraphNameIndexes map of op:%s(%s), " | ||||
"check invalid", ATTR_NAME_WHILE_COND.c_str(), | "check invalid", ATTR_NAME_WHILE_COND.c_str(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Get cond_graph index failed, while_node:%s.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "subgraph name:%s not exist in SubgraphNameIndexes map of op:%s(%s)", ATTR_NAME_WHILE_COND.c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
std::string cond_graph_instance_name = op_desc->GetSubgraphInstanceName(iter->second); | std::string cond_graph_instance_name = op_desc->GetSubgraphInstanceName(iter->second); | ||||
@@ -181,7 +185,7 @@ Status CondPass::GetCondInfoForWhile(const NodePtr &node, ComputeGraphPtr &graph | |||||
if (output_num != 1) { | if (output_num != 1) { | ||||
REPORT_INNER_ERROR("E19999", "Input data anchor num:%u of op:%s(%s) not equal to 1, check invalid", | REPORT_INNER_ERROR("E19999", "Input data anchor num:%u of op:%s(%s) not equal to 1, check invalid", | ||||
output_num, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | output_num, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "output size of cond_graph is invalid, expect 1 but %u exactly, while_node:%s.", | |||||
GELOGE(FAILED, "[Check][Param] output size of cond_graph is invalid, expect 1 but %u exactly, while_node:%s.", | |||||
output_num, node->GetName().c_str()); | output_num, node->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -239,7 +243,7 @@ Status CondPass::HandleScalarCond(const ComputeGraphPtr &graph, const OutDataAnc | |||||
std::string cast_name = cond_in_anchor->GetOwnerNode()->GetName() + "_Cast"; | std::string cast_name = cond_in_anchor->GetOwnerNode()->GetName() + "_Cast"; | ||||
NodePtr cast_node = AddCastNode(graph, cast_name, tensor, src_type, DT_INT32); | NodePtr cast_node = AddCastNode(graph, cast_name, tensor, src_type, DT_INT32); | ||||
if (cast_node == nullptr) { | if (cast_node == nullptr) { | ||||
GELOGE(FAILED, "Add Cast node failed, name:%s.", cast_name.c_str()); | |||||
GELOGE(FAILED, "[Add][CastNode] failed, name:%s.", cast_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -250,7 +254,7 @@ Status CondPass::HandleScalarCond(const ComputeGraphPtr &graph, const OutDataAnc | |||||
peer_out_anchor->GetOwnerNode()->GetType().c_str(), | peer_out_anchor->GetOwnerNode()->GetType().c_str(), | ||||
cond_in_anchor->GetOwnerNode()->GetName().c_str(), | cond_in_anchor->GetOwnerNode()->GetName().c_str(), | ||||
cond_in_anchor->GetOwnerNode()->GetType().c_str()); | cond_in_anchor->GetOwnerNode()->GetType().c_str()); | ||||
GELOGE(FAILED, "Insert Cast node %s between %s->%s failed.", | |||||
GELOGE(FAILED, "[Insert][CastNode] %s between %s->%s failed.", | |||||
cast_node->GetName().c_str(), peer_out_anchor->GetOwnerNode()->GetName().c_str(), | cast_node->GetName().c_str(), peer_out_anchor->GetOwnerNode()->GetName().c_str(), | ||||
cond_in_anchor->GetOwnerNode()->GetName().c_str()); | cond_in_anchor->GetOwnerNode()->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
@@ -287,14 +291,16 @@ Status CondPass::InsertNode(const ComputeGraphPtr &graph, const OutDataAnchorPtr | |||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Create op_desc:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Create op_desc:%s(%s) failed", | ||||
(in_data_anchor->GetOwnerNode()->GetName() + "_" + type).c_str(), type.c_str()); | (in_data_anchor->GetOwnerNode()->GetName() + "_" + type).c_str(), type.c_str()); | ||||
GELOGE(FAILED, "Create op_desc failed."); | |||||
GELOGE(FAILED, "[Create][OpDesc] %s(%s) failed.", | |||||
(in_data_anchor->GetOwnerNode()->GetName() + "_" + type).c_str(), type.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr new_node = graph->AddNode(op_desc); | NodePtr new_node = graph->AddNode(op_desc); | ||||
if (new_node == nullptr) { | if (new_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Create %s node failed.", type.c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddRePassNode(new_node); | AddRePassNode(new_node); | ||||
@@ -306,9 +312,10 @@ Status CondPass::InsertNode(const ComputeGraphPtr &graph, const OutDataAnchorPtr | |||||
peer_out_anchor->GetOwnerNode()->GetType().c_str(), | peer_out_anchor->GetOwnerNode()->GetType().c_str(), | ||||
in_data_anchor->GetOwnerNode()->GetName().c_str(), | in_data_anchor->GetOwnerNode()->GetName().c_str(), | ||||
in_data_anchor->GetOwnerNode()->GetType().c_str()); | in_data_anchor->GetOwnerNode()->GetType().c_str()); | ||||
GELOGE(FAILED, "Insert %s node %s between %s->%s failed.", type.c_str(), | |||||
new_node->GetName().c_str(), peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||||
in_data_anchor->GetOwnerNode()->GetName().c_str()); | |||||
GELOGE(FAILED, "[Insert][Node] %s(%s) between %s(%s)->%s(%s) failed", | |||||
new_node->GetName().c_str(), new_node->GetType().c_str(), | |||||
peer_out_anchor->GetOwnerNode()->GetName().c_str(), peer_out_anchor->GetOwnerNode()->GetType().c_str(), | |||||
in_data_anchor->GetOwnerNode()->GetName().c_str(), in_data_anchor->GetOwnerNode()->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -337,20 +344,22 @@ NodePtr CondPass::AddCastNode(const ComputeGraphPtr &graph, const std::string &n | |||||
OpDescBuilder op_desc_builder(name, CAST); | OpDescBuilder op_desc_builder(name, CAST); | ||||
OpDescPtr cast_desc = op_desc_builder.AddInput("x", in_tensor).AddOutput("y", out_tensor).Build(); | OpDescPtr cast_desc = op_desc_builder.AddInput("x", in_tensor).AddOutput("y", out_tensor).Build(); | ||||
if (cast_desc == nullptr) { | if (cast_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Create op_desc:%s(%s) failed", | |||||
name.c_str(), CAST); | |||||
GELOGE(FAILED, "Create cast op_desc failed, name: %s.", name.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Create op_desc:%s(%s) failed", name.c_str(), CAST); | |||||
GELOGE(FAILED, "[Create][OpDesc] failed, name:%s(%s).", name.c_str(), CAST); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (!(AttrUtils::SetInt(cast_desc, CAST_ATTR_SRCT, src) && | if (!(AttrUtils::SetInt(cast_desc, CAST_ATTR_SRCT, src) && | ||||
AttrUtils::SetInt(cast_desc, CAST_ATTR_DSTT, dst) && | AttrUtils::SetInt(cast_desc, CAST_ATTR_DSTT, dst) && | ||||
AttrUtils::SetInt(cast_desc, CAST_ATTR_DST_TYPE, dst) && | AttrUtils::SetInt(cast_desc, CAST_ATTR_DST_TYPE, dst) && | ||||
AttrUtils::SetBool(cast_desc, CAST_ATTR_TRUNCATE, false))) { | AttrUtils::SetBool(cast_desc, CAST_ATTR_TRUNCATE, false))) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s,%s,%s,%s to node:%s(%s) not all success", | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s, %s, %s, %s to node:%s(%s) not all success", | |||||
CAST_ATTR_SRCT.c_str(), CAST_ATTR_DSTT.c_str(), | CAST_ATTR_SRCT.c_str(), CAST_ATTR_DSTT.c_str(), | ||||
CAST_ATTR_DST_TYPE.c_str(), CAST_ATTR_TRUNCATE.c_str(), | CAST_ATTR_DST_TYPE.c_str(), CAST_ATTR_TRUNCATE.c_str(), | ||||
cast_desc->GetName().c_str(), cast_desc->GetType().c_str()); | cast_desc->GetName().c_str(), cast_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Set CAST_ATTR failed, node: %s.", name.c_str()); | |||||
GELOGE(FAILED, "[Set][Attr] %s, %s, %s, %s to node:%s(%s) not all success", | |||||
CAST_ATTR_SRCT.c_str(), CAST_ATTR_DSTT.c_str(), | |||||
CAST_ATTR_DST_TYPE.c_str(), CAST_ATTR_TRUNCATE.c_str(), | |||||
cast_desc->GetName().c_str(), cast_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -358,7 +367,8 @@ NodePtr CondPass::AddCastNode(const ComputeGraphPtr &graph, const std::string &n | |||||
if (cast_node == nullptr) { | if (cast_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
cast_desc->GetName().c_str(), cast_desc->GetType().c_str(), graph->GetName().c_str()); | cast_desc->GetName().c_str(), cast_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Add cast node failed, name: %s.", name.c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s(%s) to graph:%s failed", | |||||
cast_desc->GetName().c_str(), cast_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
AddRePassNode(cast_node); | AddRePassNode(cast_node); | ||||
@@ -41,7 +41,7 @@ Status CondRemovePass::Run(NodePtr &node) { | |||||
if (ret == NOT_CHANGED) { | if (ret == NOT_CHANGED) { | ||||
return SUCCESS; | return SUCCESS; | ||||
} else if (ret != SUCCESS) { | } else if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "Get cond_info for node %s failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][CondInfo] for node %s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
int32_t cond_index = 0; | int32_t cond_index = 0; | ||||
@@ -90,7 +90,7 @@ Status CondRemovePass::RemoveDeadCondLink(const int32_t index, const NodePtr &no | |||||
peerout_anchor->GetOwnerNode()->GetType().c_str(), peerout_anchor->GetIdx(), | peerout_anchor->GetOwnerNode()->GetType().c_str(), peerout_anchor->GetIdx(), | ||||
in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetOwnerNode()->GetType().c_str(), | in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetOwnerNode()->GetType().c_str(), | ||||
in_anchor->GetIdx()); | in_anchor->GetIdx()); | ||||
GELOGE(FAILED, "Remove edge from node %s index %d to node %s index %d.", | |||||
GELOGE(FAILED, "[Remove][Edge] from node %s index %d to node %s index %d.", | |||||
peerout_anchor->GetOwnerNode()->GetName().c_str(), peerout_anchor->GetIdx(), | peerout_anchor->GetOwnerNode()->GetName().c_str(), peerout_anchor->GetIdx(), | ||||
in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetIdx()); | in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetIdx()); | ||||
return FAILED; | return FAILED; | ||||
@@ -105,7 +105,7 @@ Status CondRemovePass::GetCaseChosenBranch(const NodePtr &node, const uint32_t c | |||||
if (subgraph_names_size == 0) { | if (subgraph_names_size == 0) { | ||||
REPORT_INNER_ERROR("E19999", "subgraph size of op:%s(%s) is 0, check invavlid", | REPORT_INNER_ERROR("E19999", "subgraph size of op:%s(%s) is 0, check invavlid", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Node %s has none subgraph.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Node %s has none subgraph.", node->GetName().c_str()); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
// If cond index is over the maimum subgraph number, choose the last subgraph | // If cond index is over the maimum subgraph number, choose the last subgraph | ||||
@@ -116,7 +116,7 @@ Status CondRemovePass::GetCaseChosenBranch(const NodePtr &node, const uint32_t c | |||||
if (chosen_branch_name.empty()) { | if (chosen_branch_name.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Get subgraph name from op:%s(%s) by index:%u failed", | REPORT_INNER_ERROR("E19999", "Get subgraph name from op:%s(%s) by index:%u failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), cond_index_new); | node->GetName().c_str(), node->GetType().c_str(), cond_index_new); | ||||
GELOGE(FAILED, "Node %s has no subgraph, index is %u.", node->GetName().c_str(), cond_index_new); | |||||
GELOGE(FAILED, "[Get][SubGraph] Node %s has no subgraph, index is %u.", node->GetName().c_str(), cond_index_new); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
auto chosen_graph = GraphUtils::FindRootGraph(node->GetOwnerComputeGraph())->GetSubgraph(chosen_branch_name); | auto chosen_graph = GraphUtils::FindRootGraph(node->GetOwnerComputeGraph())->GetSubgraph(chosen_branch_name); | ||||
@@ -132,7 +132,7 @@ Status CondRemovePass::GetIfChosenBranch(const NodePtr &node, const uint32_t con | |||||
if (subgraph_names_size == 0) { | if (subgraph_names_size == 0) { | ||||
REPORT_INNER_ERROR("E19999", "subgraph size of op:%s(%s) is 0, check invavlid", | REPORT_INNER_ERROR("E19999", "subgraph size of op:%s(%s) is 0, check invavlid", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Node %s has none subgraph.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Node %s has none subgraph.", node->GetName().c_str()); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
// If cond is false, else branch | // If cond is false, else branch | ||||
@@ -143,7 +143,7 @@ Status CondRemovePass::GetIfChosenBranch(const NodePtr &node, const uint32_t con | |||||
if (chosen_branch_name.empty()) { | if (chosen_branch_name.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Get subgraph name from op:%s(%s) by index:%u failed", | REPORT_INNER_ERROR("E19999", "Get subgraph name from op:%s(%s) by index:%u failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), cond_index_new); | node->GetName().c_str(), node->GetType().c_str(), cond_index_new); | ||||
GELOGE(FAILED, "Node %s has no subgraph, index is %u.", node->GetName().c_str(), cond_index_new); | |||||
GELOGE(FAILED, "[Get][SubGraph] Node %s has no subgraph, index is %u.", node->GetName().c_str(), cond_index_new); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
auto chosen_graph = GraphUtils::FindRootGraph(node->GetOwnerComputeGraph())->GetSubgraph(chosen_branch_name); | auto chosen_graph = GraphUtils::FindRootGraph(node->GetOwnerComputeGraph())->GetSubgraph(chosen_branch_name); | ||||
@@ -151,7 +151,7 @@ Status CondRemovePass::GetIfChosenBranch(const NodePtr &node, const uint32_t con | |||||
REPORT_INNER_ERROR("E19999", | REPORT_INNER_ERROR("E19999", | ||||
"Find subgraph by name:%s from node:%s(%s)'s root_graph failed", | "Find subgraph by name:%s from node:%s(%s)'s root_graph failed", | ||||
chosen_branch_name.c_str(), node->GetName().c_str(), node->GetType().c_str()); | chosen_branch_name.c_str(), node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Can not find branch %s in node %s's parent graph %s.", chosen_branch_name.c_str(), | |||||
GELOGE(FAILED, "[Check][Param] Can not find branch %s in node %s's parent graph %s.", chosen_branch_name.c_str(), | |||||
node->GetName().c_str(), node->GetOwnerComputeGraph()->GetName().c_str()); | node->GetName().c_str(), node->GetOwnerComputeGraph()->GetName().c_str()); | ||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
@@ -263,7 +263,7 @@ Status CondRemovePass::ReplaceIfCaseNodeWithPartitioncall(const NodePtr &node, c | |||||
peerout_anchor->GetOwnerNode()->GetType().c_str(), peerout_anchor->GetIdx(), | peerout_anchor->GetOwnerNode()->GetType().c_str(), peerout_anchor->GetIdx(), | ||||
partitioncall_node->GetName().c_str(), | partitioncall_node->GetName().c_str(), | ||||
partitioncall_node->GetType().c_str(), input_anchor->GetIdx()); | partitioncall_node->GetType().c_str(), input_anchor->GetIdx()); | ||||
GELOGE(FAILED, "Add edge failed, from node:%s idx:%d to node:%s idx:%d, input num:%zu, output num:%zu", | |||||
GELOGE(FAILED, "[Add][Edge] failed, from node:%s idx:%d to node:%s idx:%d, input num:%zu, output num:%zu", | |||||
peerout_anchor->GetOwnerNode()->GetName().c_str(), peerout_anchor->GetIdx(), | peerout_anchor->GetOwnerNode()->GetName().c_str(), peerout_anchor->GetIdx(), | ||||
partitioncall_node->GetName().c_str(), input_anchor->GetIdx(), input_desc_size, | partitioncall_node->GetName().c_str(), input_anchor->GetIdx(), input_desc_size, | ||||
output_desc_size); | output_desc_size); | ||||
@@ -280,7 +280,7 @@ Status CondRemovePass::ReplaceIfCaseNodeWithPartitioncall(const NodePtr &node, c | |||||
node->GetName().c_str(), node->GetType().c_str(), output_anchor->GetIdx(), | node->GetName().c_str(), node->GetType().c_str(), output_anchor->GetIdx(), | ||||
peerin_anchor->GetOwnerNode()->GetName().c_str(), | peerin_anchor->GetOwnerNode()->GetName().c_str(), | ||||
peerin_anchor->GetOwnerNode()->GetType().c_str(), peerin_anchor->GetIdx()); | peerin_anchor->GetOwnerNode()->GetType().c_str(), peerin_anchor->GetIdx()); | ||||
GELOGE(FAILED, "Remove edge failed, from node:%s idx:%d to node:%s idx:%d, input num:%zu, output num:%zu", | |||||
GELOGE(FAILED, "[Remove][Edge] failed, from node:%s idx:%d to node:%s idx:%d, input num:%zu, output num:%zu", | |||||
node->GetName().c_str(), output_anchor->GetIdx(), peerin_anchor->GetOwnerNode()->GetName().c_str(), | node->GetName().c_str(), output_anchor->GetIdx(), peerin_anchor->GetOwnerNode()->GetName().c_str(), | ||||
peerin_anchor->GetIdx(), input_desc_size, output_desc_size); | peerin_anchor->GetIdx(), input_desc_size, output_desc_size); | ||||
return FAILED; | return FAILED; | ||||
@@ -292,7 +292,7 @@ Status CondRemovePass::ReplaceIfCaseNodeWithPartitioncall(const NodePtr &node, c | |||||
partitioncall_node->GetType().c_str(), output_anchor->GetIdx(), | partitioncall_node->GetType().c_str(), output_anchor->GetIdx(), | ||||
peerin_anchor->GetOwnerNode()->GetName().c_str(), | peerin_anchor->GetOwnerNode()->GetName().c_str(), | ||||
peerin_anchor->GetOwnerNode()->GetType().c_str(), peerin_anchor->GetIdx()); | peerin_anchor->GetOwnerNode()->GetType().c_str(), peerin_anchor->GetIdx()); | ||||
GELOGE(FAILED, "Add edge failed, from node:%s idx:%d to node:%s idx:%d, input num:%zu, output num:%zu", | |||||
GELOGE(FAILED, "[Add][Edge] failed, from node:%s idx:%d to node:%s idx:%d, input num:%zu, output num:%zu", | |||||
partitioncall_node->GetName().c_str(), output_anchor->GetIdx(), | partitioncall_node->GetName().c_str(), output_anchor->GetIdx(), | ||||
peerin_anchor->GetOwnerNode()->GetName().c_str(), peerin_anchor->GetIdx(), input_desc_size, | peerin_anchor->GetOwnerNode()->GetName().c_str(), peerin_anchor->GetIdx(), input_desc_size, | ||||
output_desc_size); | output_desc_size); | ||||
@@ -370,7 +370,7 @@ Status CondRemovePass::GetCondInfo(const NodePtr &node, ComputeGraphPtr &graph, | |||||
std::string type = node->GetType(); | std::string type = node->GetType(); | ||||
if ((kIfOpTypes.count(type) != 0) || (kCaseOpTypes.count(type) != 0)) { | if ((kIfOpTypes.count(type) != 0) || (kCaseOpTypes.count(type) != 0)) { | ||||
if (GetCondInfoForIfCase(node, graph, cond_out_anchor, cond_in_anchor) != SUCCESS) { | if (GetCondInfoForIfCase(node, graph, cond_out_anchor, cond_in_anchor) != SUCCESS) { | ||||
GELOGE(FAILED, "Get cond_info for if/case node failed."); | |||||
GELOGE(FAILED, "[Get][CondInfo] for if/case node:%s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -33,12 +33,12 @@ Status RunOpKernelWithCheck(NodePtr &node, | |||||
std::vector<GeTensorPtr> &outputs) { | std::vector<GeTensorPtr> &outputs) { | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if ((instance_ptr == nullptr) || (!instance_ptr->InitFlag())) { | if ((instance_ptr == nullptr) || (!instance_ptr->InitFlag())) { | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "GE is not initialized or is finalized."); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Check][Param] GE is not initialized or is finalized."); | |||||
return UNSUPPORTED; | return UNSUPPORTED; | ||||
} | } | ||||
OpsKernelInfoStorePtr kernel_info = instance_ptr->OpsKernelManagerObj().GetOpsKernelInfoStore(kKernelLibName); | OpsKernelInfoStorePtr kernel_info = instance_ptr->OpsKernelManagerObj().GetOpsKernelInfoStore(kKernelLibName); | ||||
if (kernel_info == nullptr) { | if (kernel_info == nullptr) { | ||||
GELOGE(FAILED, "Get op kernel info store %s failed", kKernelLibName.c_str()); | |||||
GELOGE(FAILED, "[Get][OpsKernelInfoStore] %s failed", kKernelLibName.c_str()); | |||||
return UNSUPPORTED; | return UNSUPPORTED; | ||||
} | } | ||||
@@ -110,7 +110,7 @@ Status ConstantFoldingPass::Run(ge::NodePtr &node) { | |||||
} | } | ||||
REPORT_CALL_ERROR("E19999", "Calculate for node %s(%s) failed", | REPORT_CALL_ERROR("E19999", "Calculate for node %s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Calculate for node %s failed in constant folding", node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Call][Calculate] for node %s failed in constant folding", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
GELOGI("Node %s type %s, constant folding compute success.", node->GetName().c_str(), node->GetType().c_str()); | GELOGI("Node %s type %s, constant folding compute success.", node->GetName().c_str(), node->GetType().c_str()); | ||||
@@ -129,10 +129,8 @@ Status ConstantFoldingPass::Run(ge::NodePtr &node) { | |||||
if (outputs.empty()) { | if (outputs.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "After calculate for node %s(%s), output weight is empty, check invalid", | REPORT_INNER_ERROR("E19999", "After calculate for node %s(%s), output weight is empty, check invalid", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to constant folding on node %s," | |||||
" no output weight", | |||||
node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] After calculate for node %s(%s), output weight is empty", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -58,7 +58,7 @@ void GetOutDataNodeToIndexMap(NodePtr &node, std::map<string, InDataAnchorPtr> & | |||||
Status ConstantFuseSamePass::Run(ge::ComputeGraphPtr graph) { | Status ConstantFuseSamePass::Run(ge::ComputeGraphPtr graph) { | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "Compute graph is null."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] Compute graph is nullptr."); | |||||
return GE_GRAPH_PARAM_NULLPTR; | return GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
GELOGI("ConstantFuseSamePass in."); | GELOGI("ConstantFuseSamePass in."); | ||||
@@ -160,13 +160,14 @@ Status ConstantFuseSamePass::MoveOutDataEdges(NodePtr &src_node, NodePtr &dst_no | |||||
} | } | ||||
auto ret = dst_out_data_anchor->LinkTo(it->second); | auto ret = dst_out_data_anchor->LinkTo(it->second); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", | |||||
"Op:%s(%s) out index:0 link to op:%s(%s) in index:%d failed", | |||||
REPORT_CALL_ERROR("E19999", "Op:%s(%s) out index:0 link to op:%s(%s) in index:%d failed", | |||||
dst_node->GetName().c_str(), dst_node->GetType().c_str(), | dst_node->GetName().c_str(), dst_node->GetType().c_str(), | ||||
it->second->GetOwnerNode()->GetName().c_str(), it->second->GetOwnerNode()->GetType().c_str(), | it->second->GetOwnerNode()->GetName().c_str(), it->second->GetOwnerNode()->GetType().c_str(), | ||||
it->second->GetIdx()); | it->second->GetIdx()); | ||||
GELOGE(FAILED, "Failed to move out data edge from %s to %s", src_node->GetName().c_str(), | |||||
dst_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Edge] Op:%s(%s) out index:0 link to op:%s(%s) in index:%d failed", | |||||
dst_node->GetName().c_str(), dst_node->GetType().c_str(), | |||||
it->second->GetOwnerNode()->GetName().c_str(), it->second->GetOwnerNode()->GetType().c_str(), | |||||
it->second->GetIdx()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -193,7 +194,8 @@ Status ConstantFuseSamePass::FuseConstNodes(ComputeGraphPtr &graph, | |||||
if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { | if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][Node] %s(%s) Without Relink in graph:%s failed.", | |||||
node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -30,7 +30,7 @@ Status ControlTriggerPass::Run(ComputeGraphPtr graph) { | |||||
auto in_ctrl_nodes = node->GetInControlNodes(); | auto in_ctrl_nodes = node->GetInControlNodes(); | ||||
for (NodePtr &in_ctrl_node : in_ctrl_nodes) { | for (NodePtr &in_ctrl_node : in_ctrl_nodes) { | ||||
if (HandleDynamicCtrlEdges(graph, node, in_ctrl_node) != SUCCESS) { | if (HandleDynamicCtrlEdges(graph, node, in_ctrl_node) != SUCCESS) { | ||||
GELOGE(FAILED, "HandleDynamicCtrlEdges for %s->%s fail.", in_ctrl_node->GetName().c_str(), | |||||
GELOGE(FAILED, "[Handle][DynamicCtrlEdges] for node:%s->node:%s failed.", in_ctrl_node->GetName().c_str(), | |||||
node->GetName().c_str()); | node->GetName().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -55,7 +55,7 @@ Status ControlTriggerPass::HandleDynamicCtrlEdges(ComputeGraphPtr &graph, NodePt | |||||
NodePtr switch_node = nullptr; | NodePtr switch_node = nullptr; | ||||
bool branch_flag = false; | bool branch_flag = false; | ||||
if (FindSwitchNode(in_ctrl_node, switch_node, branch_flag) != SUCCESS) { | if (FindSwitchNode(in_ctrl_node, switch_node, branch_flag) != SUCCESS) { | ||||
GELOGE(FAILED, "FindSwitchNode fail."); | |||||
GELOGE(FAILED, "[Find][SwitchNode] failed, in_ctrl_node:%s.", in_ctrl_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -76,8 +76,9 @@ Status ControlTriggerPass::HandleDynamicCtrlEdges(ComputeGraphPtr &graph, NodePt | |||||
node->GetName().c_str(), node->GetType().c_str(), | node->GetName().c_str(), node->GetType().c_str(), | ||||
in_ctrl_node->GetName().c_str(), in_ctrl_node->GetType().c_str(), | in_ctrl_node->GetName().c_str(), in_ctrl_node->GetType().c_str(), | ||||
constant->GetName().c_str(), constant->GetType().c_str()); | constant->GetName().c_str(), constant->GetType().c_str()); | ||||
GELOGE(FAILED, "Replace ctrl edge fail, %s->%s, %s->%s.", in_ctrl_node->GetName().c_str(), | |||||
node->GetName().c_str(), in_ctrl_node->GetName().c_str(), constant->GetName().c_str()); | |||||
GELOGE(FAILED, "[Replace][CtrlEdge] failed, remove edge:%s->%s, add edge:%s->%s.", | |||||
in_ctrl_node->GetName().c_str(), node->GetName().c_str(), | |||||
in_ctrl_node->GetName().c_str(), constant->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -87,7 +88,8 @@ Status ControlTriggerPass::HandleDynamicCtrlEdges(ComputeGraphPtr &graph, NodePt | |||||
} | } | ||||
if (InsertOppositeBranch(graph, node, in_ctrl_node, switch_node, branch_flag) != SUCCESS) { | if (InsertOppositeBranch(graph, node, in_ctrl_node, switch_node, branch_flag) != SUCCESS) { | ||||
GELOGE(FAILED, "InsertOppositeBranch fail."); | |||||
GELOGE(FAILED, "[Insert][OppositeBranch] failed, node:%s, in_ctrl_node:%s.", | |||||
node->GetName().c_str(), in_ctrl_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -145,7 +147,7 @@ Status ControlTriggerPass::FindSwitchNode(const NodePtr &node, NodePtr &switch_n | |||||
case kNotControlOp: | case kNotControlOp: | ||||
break; | break; | ||||
default: | default: | ||||
GELOGE(FAILED, "invalid type"); | |||||
GELOGE(FAILED, "[Check][Param] invalid node type"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -167,6 +169,12 @@ Status ControlTriggerPass::FindSwitchNode(const NodePtr &node, NodePtr &switch_n | |||||
/// @return ControlNodeType | /// @return ControlNodeType | ||||
/// | /// | ||||
ControlNodeType ControlTriggerPass::TransferNodeType(const NodePtr &node, uint32_t index) { | ControlNodeType ControlTriggerPass::TransferNodeType(const NodePtr &node, uint32_t index) { | ||||
OpDescPtr merge_desc = node->GetOpDesc(); | |||||
if (merge_desc == nullptr) { | |||||
REPORT_INNER_ERROR("E19999", "op_desc in merge node is nullptr, check invalid"); | |||||
GELOGE(INTERNAL_ERROR, "[Get][OpDesc] failed, merge_desc is nullptr."); | |||||
return kInvalidType; | |||||
} | |||||
const std::string type = node->GetType(); | const std::string type = node->GetType(); | ||||
if ((type == SWITCH) || (type == REFSWITCH)) { | if ((type == SWITCH) || (type == REFSWITCH)) { | ||||
if ((index != SWITCH_TRUE_OUTPUT) && (index != SWITCH_FALSE_OUTPUT)) { | if ((index != SWITCH_TRUE_OUTPUT) && (index != SWITCH_FALSE_OUTPUT)) { | ||||
@@ -175,7 +183,7 @@ ControlNodeType ControlTriggerPass::TransferNodeType(const NodePtr &node, uint32 | |||||
} | } | ||||
if (FindPredInput(node) != SUCCESS) { | if (FindPredInput(node) != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "FindPredInput fail, switch_node: %s.", node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Find][PredInput] failed, switch_node:%s.", node->GetName().c_str()); | |||||
return kInvalidType; | return kInvalidType; | ||||
} | } | ||||
@@ -189,12 +197,6 @@ ControlNodeType ControlTriggerPass::TransferNodeType(const NodePtr &node, uint32 | |||||
return branch_flag ? kLoopSwitchT : kLoopSwitchF; | return branch_flag ? kLoopSwitchT : kLoopSwitchF; | ||||
} | } | ||||
} else if ((type == MERGE) || (type == REFMERGE)) { | } else if ((type == MERGE) || (type == REFMERGE)) { | ||||
OpDescPtr merge_desc = node->GetOpDesc(); | |||||
if (merge_desc == nullptr) { | |||||
REPORT_INNER_ERROR("E19999", "op_desc in merge node is nullptr, check invalid"); | |||||
GELOGE(INTERNAL_ERROR, "FindPredInput fail, merge_desc is null, merge_node: %s.", node->GetName().c_str()); | |||||
return kInvalidType; | |||||
} | |||||
if (!merge_desc->HasAttr(ATTR_NAME_NEXT_ITERATION)) { | if (!merge_desc->HasAttr(ATTR_NAME_NEXT_ITERATION)) { | ||||
return kCondMerge; | return kCondMerge; | ||||
} | } | ||||
@@ -248,14 +250,16 @@ Status ControlTriggerPass::InsertOppositeBranch(ComputeGraphPtr &graph, NodePtr | |||||
NodePtr merge_node = InsertMergeNode(graph, node, in_ctrl_node, data_desc); | NodePtr merge_node = InsertMergeNode(graph, node, in_ctrl_node, data_desc); | ||||
if (merge_node == nullptr) { | if (merge_node == nullptr) { | ||||
GELOGE(FAILED, "InsertMergeNode fail."); | |||||
GELOGE(FAILED, "[Insert][MergeNode] failed, node:%s, in_ctrl_node:%s.", | |||||
node->GetName().c_str(), in_ctrl_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr const_f = InsertConstNode(graph, merge_node, data_desc, false); | NodePtr const_f = InsertConstNode(graph, merge_node, data_desc, false); | ||||
NodePtr const_t = InsertConstNode(graph, merge_node, data_desc, true); | NodePtr const_t = InsertConstNode(graph, merge_node, data_desc, true); | ||||
if ((const_f == nullptr) || (const_t == nullptr)) { | if ((const_f == nullptr) || (const_t == nullptr)) { | ||||
GELOGE(FAILED, "InsertConstNode fail."); | |||||
GELOGE(FAILED, "[Insert][ConstNode] failed, graph:%s, merge_node:%s.", | |||||
graph->GetName().c_str(), merge_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -266,7 +270,8 @@ Status ControlTriggerPass::InsertOppositeBranch(ComputeGraphPtr &graph, NodePtr | |||||
const std::string identity_name = switch_desc->GetName() + "_" + IDENTITY; | const std::string identity_name = switch_desc->GetName() + "_" + IDENTITY; | ||||
NodePtr identity_node = InsertIdentityNode(graph, identity_name, switch_desc->GetOutputDesc(new_idx)); | NodePtr identity_node = InsertIdentityNode(graph, identity_name, switch_desc->GetOutputDesc(new_idx)); | ||||
if (identity_node == nullptr) { | if (identity_node == nullptr) { | ||||
GELOGE(FAILED, "InsertIdentityNode fail."); | |||||
GELOGE(FAILED, "[Insert][IdentityNode] name:%s failed, graph:%s.", | |||||
identity_name.c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -274,21 +279,25 @@ Status ControlTriggerPass::InsertOppositeBranch(ComputeGraphPtr &graph, NodePtr | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
in_ctrl_node->GetName().c_str(), in_ctrl_node->GetType().c_str(), | in_ctrl_node->GetName().c_str(), in_ctrl_node->GetType().c_str(), | ||||
orig_const->GetName().c_str(), orig_const->GetType().c_str()); | orig_const->GetName().c_str(), orig_const->GetType().c_str()); | ||||
GELOGE(FAILED, "Add in ctrl edge fail, %s->%s.", in_ctrl_node->GetName().c_str(), orig_const->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][CtrlEdge] failed, %s->%s.", in_ctrl_node->GetName().c_str(), orig_const->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (GraphUtils::AddEdge(switch_node->GetOutDataAnchor(new_idx), identity_node->GetInDataAnchor(0)) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(switch_node->GetOutDataAnchor(new_idx), identity_node->GetInDataAnchor(0)) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%u) and op:%s(%s)(index:0) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%u) and op:%s(%s)(index:0) failed", | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), new_idx, | switch_node->GetName().c_str(), switch_node->GetType().c_str(), new_idx, | ||||
identity_node->GetName().c_str(), identity_node->GetType().c_str()); | identity_node->GetName().c_str(), identity_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add in data edge fail, %s->%s.", switch_desc->GetName().c_str(), identity_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:%u) and op:%s(%s)(index:0) failed", | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), new_idx, | |||||
identity_node->GetName().c_str(), identity_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (GraphUtils::AddEdge(identity_node->GetOutControlAnchor(), new_const->GetInControlAnchor()) != GRAPH_SUCCESS) { | if (GraphUtils::AddEdge(identity_node->GetOutControlAnchor(), new_const->GetInControlAnchor()) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
identity_node->GetName().c_str(), identity_node->GetType().c_str(), | identity_node->GetName().c_str(), identity_node->GetType().c_str(), | ||||
new_const->GetName().c_str(), new_const->GetType().c_str()); | new_const->GetName().c_str(), new_const->GetType().c_str()); | ||||
GELOGE(FAILED, "Add in ctrl edge fail, %s->%s.", identity_node->GetName().c_str(), new_const->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
identity_node->GetName().c_str(), identity_node->GetType().c_str(), | |||||
new_const->GetName().c_str(), new_const->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -299,7 +308,7 @@ Status ControlTriggerPass::InsertOppositeBranch(ComputeGraphPtr &graph, NodePtr | |||||
} else { | } else { | ||||
if (!iter->second.insert(pred_const).second) { | if (!iter->second.insert(pred_const).second) { | ||||
REPORT_INNER_ERROR("E19999", "Insert to control_trigger_map_ failed"); | REPORT_INNER_ERROR("E19999", "Insert to control_trigger_map_ failed"); | ||||
GELOGE(FAILED, "control_trigger_map_ insert failed."); | |||||
GELOGE(FAILED, "[Check][Param] control_trigger_map_ insert failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -321,7 +330,7 @@ NodePtr ControlTriggerPass::InsertMergeNode(ComputeGraphPtr &graph, NodePtr &nod | |||||
OpDescPtr op_desc = MakeShared<OpDesc>(name, MERGE); | OpDescPtr op_desc = MakeShared<OpDesc>(name, MERGE); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(FAILED, "Create Merge op %s: create op_desc fail.", name.c_str()); | |||||
GELOGE(FAILED, "[New][OpDesc] failed"); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -329,7 +338,8 @@ NodePtr ControlTriggerPass::InsertMergeNode(ComputeGraphPtr &graph, NodePtr &nod | |||||
(op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS) || (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS)) { | (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS) || (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Add input or ouput desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input or ouput desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Merge op %s: add input/output desc fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][GeTensorDesc] to op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -338,7 +348,8 @@ NodePtr ControlTriggerPass::InsertMergeNode(ComputeGraphPtr &graph, NodePtr &nod | |||||
if (merge_node == nullptr) { | if (merge_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Merge op %s fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -350,7 +361,8 @@ NodePtr ControlTriggerPass::InsertMergeNode(ComputeGraphPtr &graph, NodePtr &nod | |||||
node->GetName().c_str(), node->GetType().c_str(), | node->GetName().c_str(), node->GetType().c_str(), | ||||
merge_node->GetName().c_str(), merge_node->GetType().c_str(), | merge_node->GetName().c_str(), merge_node->GetType().c_str(), | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Replace ctrl edge fail, %s->%s, %s->%s", in_ctrl_node->GetName().c_str(), node->GetName().c_str(), | |||||
GELOGE(FAILED, "[Replace][CtrlEdge] failed, remove edge:%s->%s, add edge:%s->%s", | |||||
in_ctrl_node->GetName().c_str(), node->GetName().c_str(), | |||||
merge_node->GetName().c_str(), node->GetName().c_str()); | merge_node->GetName().c_str(), node->GetName().c_str()); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -372,7 +384,7 @@ NodePtr ControlTriggerPass::InsertConstNode(ComputeGraphPtr &graph, NodePtr &mer | |||||
OpDescPtr op_desc = MakeShared<OpDesc>(name, CONSTANT); | OpDescPtr op_desc = MakeShared<OpDesc>(name, CONSTANT); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(FAILED, "Create Const op %s: create op_desc fail.", name.c_str()); | |||||
GELOGE(FAILED, "[New][OpDesc] failed."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -380,20 +392,22 @@ NodePtr ControlTriggerPass::InsertConstNode(ComputeGraphPtr &graph, NodePtr &mer | |||||
GeTensorPtr const_value = MakeShared<GeTensor>(data_desc, reinterpret_cast<uint8_t *>(&value), sizeof(int32_t)); | GeTensorPtr const_value = MakeShared<GeTensor>(data_desc, reinterpret_cast<uint8_t *>(&value), sizeof(int32_t)); | ||||
if (const_value == nullptr) { | if (const_value == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | ||||
GELOGE(FAILED, "Create tensor fail."); | |||||
GELOGE(FAILED, "[New][GeTensor] failed."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (!AttrUtils::SetTensor(op_desc, ATTR_NAME_WEIGHTS, const_value)) { | if (!AttrUtils::SetTensor(op_desc, ATTR_NAME_WEIGHTS, const_value)) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_WEIGHTS.c_str(), | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_WEIGHTS.c_str(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Const op %s: set attr ATTR_NAME_WEIGHTS fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_WEIGHTS.c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS) { | if (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add ouput desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add ouput desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Const op %s: add output desc fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][OutputDesc] to op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -402,7 +416,8 @@ NodePtr ControlTriggerPass::InsertConstNode(ComputeGraphPtr &graph, NodePtr &mer | |||||
if (const_node == nullptr) { | if (const_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Const op %s fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -411,7 +426,9 @@ NodePtr ControlTriggerPass::InsertConstNode(ComputeGraphPtr &graph, NodePtr &mer | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%u) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%u) failed", | ||||
const_node->GetName().c_str(), const_node->GetType().c_str(), | const_node->GetName().c_str(), const_node->GetType().c_str(), | ||||
merge_node->GetName().c_str(), merge_node->GetType().c_str(), out_idx); | merge_node->GetName().c_str(), merge_node->GetType().c_str(), out_idx); | ||||
GELOGE(FAILED, "Add in data edge fail, %s->%s", const_node->GetName().c_str(), merge_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:0) and op:%s(%s)(index:%u) failed", | |||||
const_node->GetName().c_str(), const_node->GetType().c_str(), | |||||
merge_node->GetName().c_str(), merge_node->GetType().c_str(), out_idx); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -430,14 +447,15 @@ NodePtr ControlTriggerPass::InsertIdentityNode(ComputeGraphPtr &graph, const std | |||||
OpDescPtr op_desc = MakeShared<OpDesc>(name, IDENTITY); | OpDescPtr op_desc = MakeShared<OpDesc>(name, IDENTITY); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(FAILED, "Create Identity op %s: create op_desc fail.", name.c_str()); | |||||
GELOGE(FAILED, "[New][OpDesc] failed"); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if ((op_desc->AddInputDesc(data_desc) != GRAPH_SUCCESS) || (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS)) { | if ((op_desc->AddInputDesc(data_desc) != GRAPH_SUCCESS) || (op_desc->AddOutputDesc(data_desc) != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Add input or output desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input or output desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Identity op %s: add input/output desc fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][GeTensorDesc] to op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -446,7 +464,8 @@ NodePtr ControlTriggerPass::InsertIdentityNode(ComputeGraphPtr &graph, const std | |||||
if (identity_node == nullptr) { | if (identity_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Create Identity op %s fail.", name.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -463,7 +482,7 @@ NodePtr ControlTriggerPass::InsertIdentityNode(ComputeGraphPtr &graph, const std | |||||
Status ControlTriggerPass::FindPredInput(const NodePtr &switch_node) { | Status ControlTriggerPass::FindPredInput(const NodePtr &switch_node) { | ||||
if (switch_node == nullptr) { | if (switch_node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param switch_node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param switch_node is nullptr, check invalid"); | ||||
GELOGE(INTERNAL_ERROR, "switch_node is null"); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] switch_node is nullptr"); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -472,7 +491,8 @@ Status ControlTriggerPass::FindPredInput(const NodePtr &switch_node) { | |||||
REPORT_INNER_ERROR("E19999", "Index:%d in anchor of switch_node:%s(%s) is nullptr, check invalid", | REPORT_INNER_ERROR("E19999", "Index:%d in anchor of switch_node:%s(%s) is nullptr, check invalid", | ||||
SWITCH_PRED_INPUT, | SWITCH_PRED_INPUT, | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "in_cond_anchor is nullptr, node: %s.", switch_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Get][InDataAnchor] Index:%d in anchor of switch_node:%s(%s) is nullptr", | |||||
SWITCH_PRED_INPUT, switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
OutDataAnchorPtr pred_cond_anchor = in_cond_anchor->GetPeerOutAnchor(); | OutDataAnchorPtr pred_cond_anchor = in_cond_anchor->GetPeerOutAnchor(); | ||||
@@ -480,7 +500,8 @@ Status ControlTriggerPass::FindPredInput(const NodePtr &switch_node) { | |||||
REPORT_INNER_ERROR("E19999", "Index:%d in anchor of switch_node:%s(%s), it's peer anchor is nullptr, " | REPORT_INNER_ERROR("E19999", "Index:%d in anchor of switch_node:%s(%s), it's peer anchor is nullptr, " | ||||
"check invalid", SWITCH_PRED_INPUT, | "check invalid", SWITCH_PRED_INPUT, | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "pred_cond_anchor is nullptr, node: %s.", switch_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "Index:%d in anchor of switch_node:%s(%s), it's peer anchor is nullptr", | |||||
SWITCH_PRED_INPUT, switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -65,13 +65,17 @@ Status CtrlEdgeTransferPass::Run(ge::ComputeGraphPtr graph) { | |||||
for (auto &in_control_node : n->GetInControlNodes()) { | for (auto &in_control_node : n->GetInControlNodes()) { | ||||
GE_CHECK_NOTNULL(in_control_node); | GE_CHECK_NOTNULL(in_control_node); | ||||
GE_CHK_GRAPH_STATUS_RET(ge::GraphUtils::RemoveEdge(in_control_node->GetOutControlAnchor(), | GE_CHK_GRAPH_STATUS_RET(ge::GraphUtils::RemoveEdge(in_control_node->GetOutControlAnchor(), | ||||
n->GetInControlAnchor()), "remove edge failed"); | |||||
n->GetInControlAnchor()), | |||||
"[Remove][ControlEdge] between %s and %s failed", | |||||
in_control_node->GetName().c_str(), n->GetName().c_str()); | |||||
for (auto &out_node : n->GetOutNodes()) { | for (auto &out_node : n->GetOutNodes()) { | ||||
if (out_node == nullptr) { | if (out_node == nullptr) { | ||||
continue; | continue; | ||||
} | } | ||||
GE_CHK_GRAPH_STATUS_RET(ge::GraphUtils::AddEdge(in_control_node->GetOutControlAnchor(), | GE_CHK_GRAPH_STATUS_RET(ge::GraphUtils::AddEdge(in_control_node->GetOutControlAnchor(), | ||||
out_node->GetInControlAnchor()), "add edge failed."); | |||||
out_node->GetInControlAnchor()), | |||||
"[Add][ControlEdge] between %s and %s failed.", | |||||
in_control_node->GetName().c_str(), out_node->GetName().c_str()); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -32,7 +32,8 @@ Status MappingSubgraphInput(const ComputeGraphPtr &graph, const std::function<in | |||||
if (!AttrUtils::GetInt(node->GetOpDesc(), "index", index)) { | if (!AttrUtils::GetInt(node->GetOpDesc(), "index", index)) { | ||||
REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) failed", "index", | REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) failed", "index", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Failed to get index from data[%s]", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][Attr] index from op:%s(%s) failed", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -42,7 +43,8 @@ Status MappingSubgraphInput(const ComputeGraphPtr &graph, const std::function<in | |||||
if (!AttrUtils::SetInt(node->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { | if (!AttrUtils::SetInt(node->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(), | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(), | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Failed to set parent index for node %s", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(), | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -72,7 +74,8 @@ Status MappingSubgraphOutput(const ComputeGraphPtr &graph, const std::function<i | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to tensor of op:%s(%s) input:%zu failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to tensor of op:%s(%s) input:%zu failed", | ||||
ATTR_NAME_PARENT_NODE_INDEX.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), | ATTR_NAME_PARENT_NODE_INDEX.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), | ||||
index); | index); | ||||
GELOGE(FAILED, "Failed to set parent index for graph %s", graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Set][Attr] %s to tensor of op:%s(%s) input:%zu failed", | |||||
ATTR_NAME_PARENT_NODE_INDEX.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), index); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -87,12 +90,12 @@ Status MappingSubgraphIndex(const ComputeGraphPtr &graph, | |||||
GE_CHECK_NOTNULL(input); | GE_CHECK_NOTNULL(input); | ||||
GE_CHECK_NOTNULL(output); | GE_CHECK_NOTNULL(output); | ||||
if (MappingSubgraphInput(graph, input) != SUCCESS) { | if (MappingSubgraphInput(graph, input) != SUCCESS) { | ||||
GELOGE(FAILED, "Failed to mapping subgraph input for graph: %s", graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Call][MappingSubgraphInput] for graph:%s failed", graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (MappingSubgraphOutput(graph, output) != SUCCESS) { | if (MappingSubgraphOutput(graph, output) != SUCCESS) { | ||||
GELOGE(FAILED, "Failed to mapping subgraph output for graph: %s", graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Call][MappingSubgraphOutput] for graph:%s failed", graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -149,7 +152,7 @@ Status DataPass::PostParseSubgraph(const ComputeGraphPtr &graph, const string &i | |||||
if (post_func_it == subgraph_handle.end()) { | if (post_func_it == subgraph_handle.end()) { | ||||
REPORT_INNER_ERROR("E19999", "The subgraph post func for node %s type %s is null, check invalid", | REPORT_INNER_ERROR("E19999", "The subgraph post func for node %s type %s is null, check invalid", | ||||
parent_node->GetName().c_str(), parent_node->GetType().c_str()); | parent_node->GetName().c_str(), parent_node->GetType().c_str()); | ||||
GELOGE(FAILED, "The subgraph post func for node %s type %s is null.", | |||||
GELOGE(FAILED, "[Check][Param] The subgraph post func for node %s type %s is null.", | |||||
parent_node->GetName().c_str(), parent_node->GetType().c_str()); | parent_node->GetName().c_str(), parent_node->GetType().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -157,7 +160,7 @@ Status DataPass::PostParseSubgraph(const ComputeGraphPtr &graph, const string &i | |||||
if (post_func_it->second(ir_name, graph) != SUCCESS) { | if (post_func_it->second(ir_name, graph) != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Post process subgraph %s on node %s type %s failed", | REPORT_INNER_ERROR("E19999", "Post process subgraph %s on node %s type %s failed", | ||||
graph->GetName().c_str(), parent_node->GetName().c_str(), parent_node->GetType().c_str()); | graph->GetName().c_str(), parent_node->GetName().c_str(), parent_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Failed to post process subgraph %s on node %s type %s", | |||||
GELOGE(FAILED, "[Call][PostFunc] Failed to post process subgraph %s on node %s type %s", | |||||
graph->GetName().c_str(), parent_node->GetName().c_str(), parent_node->GetType().c_str()); | graph->GetName().c_str(), parent_node->GetName().c_str(), parent_node->GetType().c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -188,7 +191,7 @@ Status DataPass::Run(ComputeGraphPtr compute_graph) { | |||||
GE_CHECK_NOTNULL(parent_node->GetOpDesc()); | GE_CHECK_NOTNULL(parent_node->GetOpDesc()); | ||||
auto func_desc = parent_node->GetOpDesc(); | auto func_desc = parent_node->GetOpDesc(); | ||||
GE_CHK_STATUS_RET(func_desc->GetSubgraphNameByInstanceName(compute_graph->GetName(), subgraph_name), | GE_CHK_STATUS_RET(func_desc->GetSubgraphNameByInstanceName(compute_graph->GetName(), subgraph_name), | ||||
"Subgraph: %s get subgraph name failed.", compute_graph->GetName().c_str()); | |||||
"[Get][SubGraphName] for Graph:%s failed.", compute_graph->GetName().c_str()); | |||||
GELOGI("Post process for subgraph %s, Subgraph name: %s, Parent name: %s, Parent type: %s.", | GELOGI("Post process for subgraph %s, Subgraph name: %s, Parent name: %s, Parent type: %s.", | ||||
compute_graph->GetName().c_str(), subgraph_name.c_str(), parent_node->GetName().c_str(), | compute_graph->GetName().c_str(), subgraph_name.c_str(), parent_node->GetName().c_str(), | ||||
@@ -30,14 +30,14 @@ const int kRemoveInputIndex = 1; | |||||
Status DimensionAdjustPass::Run(ge::NodePtr &node) { | Status DimensionAdjustPass::Run(ge::NodePtr &node) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "node is nullptr."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] node is nullptr."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
OpDescPtr op_desc_ptr = node->GetOpDesc(); | OpDescPtr op_desc_ptr = node->GetOpDesc(); | ||||
if (op_desc_ptr == nullptr) { | if (op_desc_ptr == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "GetOpDesc return nullptr."); | |||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] return nullptr."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -46,7 +46,7 @@ Status DimensionAdjustPass::Run(ge::NodePtr &node) { | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Get OriginalType of op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Get OriginalType of op:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(ret, "DimensionAdjustPass get originnal type fail."); | |||||
GELOGE(ret, "[Get][OriginalType] of op:%s(%s) failed", node->GetName().c_str(), node->GetType().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -75,7 +75,7 @@ Status DimensionAdjustPass::Run(ge::NodePtr &node) { | |||||
} | } | ||||
REPORT_CALL_ERROR("E19999", "kernel compute for op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "kernel compute for op:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(ret, "DimensionAdjustPass compute failed"); | |||||
GELOGE(ret, "[Call][Compute] for op:%s(%s) failed", node->GetName().c_str(), node->GetType().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
// Need to handle axis_input of node like ExpandDims | // Need to handle axis_input of node like ExpandDims | ||||
@@ -88,21 +88,22 @@ Status DimensionAdjustPass::Run(ge::NodePtr &node) { | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Unlink op:%s(%s) data input:%u with control edge copy failed", | REPORT_CALL_ERROR("E19999", "Unlink op:%s(%s) data input:%u with control edge copy failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), kRemoveInputIndex); | node->GetName().c_str(), node->GetType().c_str(), kRemoveInputIndex); | ||||
GELOGE(ret, "DimensionAdjustPass unlink node with control copy fail."); | |||||
GELOGE(ret, "[Unlink][Op] %s(%s) data input:%u with control edge copy failed", | |||||
node->GetName().c_str(), node->GetType().c_str(), kRemoveInputIndex); | |||||
return ret; | return ret; | ||||
} | } | ||||
// 2.Remove const axis node without any output | // 2.Remove const axis node without any output | ||||
if ((axis_node->GetType() == CONSTANT || axis_node->GetType() == CONSTANTOP) && | if ((axis_node->GetType() == CONSTANT || axis_node->GetType() == CONSTANTOP) && | ||||
axis_node->GetOutDataNodesSize() == 0) { | axis_node->GetOutDataNodesSize() == 0) { | ||||
ret = IsolateAndDeleteNode(axis_node, {}); | ret = IsolateAndDeleteNode(axis_node, {}); | ||||
GE_CHK_GRAPH_STATUS_RET(ret, "Fail to remove node %s.", axis_node->GetName().c_str()); | |||||
GE_CHK_GRAPH_STATUS_RET(ret, "[Remove][Node] %s failed.", axis_node->GetName().c_str()); | |||||
GELOGI("Remove useless axis input const %s", axis_node->GetName().c_str()); | GELOGI("Remove useless axis input const %s", axis_node->GetName().c_str()); | ||||
} | } | ||||
} | } | ||||
ret = DealWithInNodes(node); | ret = DealWithInNodes(node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "DealWithInNodes of %s failed.", node->GetName().c_str()); | |||||
GELOGE(ret, "[DealWith][InNodes] of node:%s failed.", node->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -147,14 +148,14 @@ NodePtr DimensionAdjustPass::AddIdentityNodeToGraph(const string &name, const Ge | |||||
ComputeGraphPtr &graph) { | ComputeGraphPtr &graph) { | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | ||||
GELOGE(INTERNAL_ERROR, "Comput graph ptr is null in creating identity node."); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] Comput graph ptr is nullptr in creating identity node."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
OpDescPtr desc = MakeShared<OpDesc>("", ""); | OpDescPtr desc = MakeShared<OpDesc>("", ""); | ||||
if (desc == nullptr) { | if (desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(MEMALLOC_FAILED, "Failed to create op desc."); | |||||
GELOGE(MEMALLOC_FAILED, "[New][OpDesc] failed."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -165,7 +166,8 @@ NodePtr DimensionAdjustPass::AddIdentityNodeToGraph(const string &name, const Ge | |||||
if ((ret != GRAPH_SUCCESS) || (ret2 != GRAPH_SUCCESS)) { | if ((ret != GRAPH_SUCCESS) || (ret2 != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Add input or ouput desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input or ouput desc to op:%s(%s) failed", | ||||
desc->GetName().c_str(), desc->GetType().c_str()); | desc->GetName().c_str(), desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to add input/output desc in creating identity."); | |||||
GELOGE(INTERNAL_ERROR, "[Add][GeTensorDesc] to op:%s(%s) failed", | |||||
desc->GetName().c_str(), desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -41,7 +41,7 @@ Status DimensionComputePass::Run(ge::NodePtr &node) { | |||||
} else { | } else { | ||||
REPORT_CALL_ERROR("E19999", "kernel compute for op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "kernel compute for op:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(ret, "DimensionComputePass Compute failed"); | |||||
GELOGE(ret, "[Call][Compute] for op:%s(%s) failed", node->GetName().c_str(), node->GetType().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -49,10 +49,8 @@ Status DimensionComputePass::Run(ge::NodePtr &node) { | |||||
if (outputs.empty()) { | if (outputs.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "After compute for node %s(%s), output weight is empty, check invalid", | REPORT_INNER_ERROR("E19999", "After compute for node %s(%s), output weight is empty, check invalid", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to compute dims for node %s," | |||||
" no output weight", | |||||
node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] After compute for node %s(%s), output weight is empty", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -32,12 +32,12 @@ Status DropOutPass::Run(NodePtr &node) { | |||||
GELOGD("DropOutPass running"); | GELOGD("DropOutPass running"); | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(FAILED, "parameter is null."); | |||||
GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (node->GetOpDesc() == nullptr) { | if (node->GetOpDesc() == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param op_desc of node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "param [opDesc] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Get][OpDesc] failed, param [opDesc] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
std::string op_type = node->GetOpDesc()->GetType(); | std::string op_type = node->GetOpDesc()->GetType(); | ||||
@@ -27,7 +27,7 @@ namespace ge { | |||||
Status EndOfSequenceAddControlPass::Run(ComputeGraphPtr graph) { | Status EndOfSequenceAddControlPass::Run(ComputeGraphPtr graph) { | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "param [graph] must not be null."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] param [graph] must not be null."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (graph->GetParentGraph() != nullptr) { | if (graph->GetParentGraph() != nullptr) { | ||||
@@ -67,7 +67,8 @@ Status EndOfSequenceAddControlPass::Run(ComputeGraphPtr graph) { | |||||
// Insert control edge | // Insert control edge | ||||
Status status = AddControlEdge(end_of_sequence, target_nodes); | Status status = AddControlEdge(end_of_sequence, target_nodes); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(FAILED, "Graph add EndOfSequence op out ctrl edge fail."); | |||||
GELOGE(FAILED, "[Add][ControlEdge] Graph add EndOfSequence op:%s out ctrl edge failed.", | |||||
end_of_sequence->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGI("EndOfSequenceAddControlPass end."); | GELOGI("EndOfSequenceAddControlPass end."); | ||||
@@ -83,11 +84,12 @@ Status EndOfSequenceAddControlPass::AddControlEdge(NodePtr &end_of_sequence, std | |||||
} | } | ||||
Status status = GraphUtils::AddEdge(out_ctrl_anchor, in_ctrl_anchor); | Status status = GraphUtils::AddEdge(out_ctrl_anchor, in_ctrl_anchor); | ||||
if (status != GRAPH_SUCCESS) { | if (status != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", | |||||
"Add control edge between op:%s(%s) and op:%s(%s) failed", | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||||
end_of_sequence->GetName().c_str(), end_of_sequence->GetType().c_str(), | end_of_sequence->GetName().c_str(), end_of_sequence->GetType().c_str(), | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "Graph add EndOfSequence op out ctrl edge fail, dst node: %s.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
end_of_sequence->GetName().c_str(), end_of_sequence->GetType().c_str(), | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGI("Graph add EndOfSequence op out ctrl edge, dst node: %s.", node->GetName().c_str()); | GELOGI("Graph add EndOfSequence op out ctrl edge, dst node: %s.", node->GetName().c_str()); | ||||
@@ -38,7 +38,7 @@ Status EnterPass::Run(NodePtr &node) { | |||||
// enter node has only one input | // enter node has only one input | ||||
if (node->GetInDataNodes().empty()) { | if (node->GetInDataNodes().empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Param node in data nodes is empty, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node in data nodes is empty, check invalid"); | ||||
GELOGE(PARAM_INVALID, "enter_node %s has no input", node->GetName().c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] enter_node %s has no input", node->GetName().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
NodePtr in_node = node->GetInDataNodes().at(0); | NodePtr in_node = node->GetInDataNodes().at(0); | ||||
@@ -62,18 +62,19 @@ Status EnterPass::Run(NodePtr &node) { | |||||
REPORT_CALL_ERROR("E19999", "Remove control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Remove control edge between op:%s(%s) and op:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), | node->GetName().c_str(), node->GetType().c_str(), | ||||
out_ctrl_node->GetName().c_str(), out_ctrl_node->GetType().c_str()); | out_ctrl_node->GetName().c_str(), out_ctrl_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Remove Enter ctrl output fail, %s->%s", node->GetName().c_str(), | |||||
out_ctrl_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
node->GetName().c_str(), node->GetType().c_str(), | |||||
out_ctrl_node->GetName().c_str(), out_ctrl_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
if (OptimizeEnterWithOnlyDataOut(node, in_node) != SUCCESS) { | if (OptimizeEnterWithOnlyDataOut(node, in_node) != SUCCESS) { | ||||
GELOGE(FAILED, "Optimize enter node[%s] with only out data node failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Optimize][EnterNode] [%s] with only out data node failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (UnlinkCtrlEdgeBeforeConst(node) != SUCCESS) { | if (UnlinkCtrlEdgeBeforeConst(node) != SUCCESS) { | ||||
GELOGE(FAILED, "Unlink control edge before const of node[%s]'s out nodes failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Unlink][ControlEdge] before const of node[%s]'s out nodes failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -52,7 +52,8 @@ Status FlowCtrlPass::Run(ComputeGraphPtr compute_graph) { | |||||
// Add big cycle | // Add big cycle | ||||
Status ret = AddFpBpIteratorCtrl(compute_graph, node); | Status ret = AddFpBpIteratorCtrl(compute_graph, node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "AddFpBpIteratorCtrl fail, node: %s.", node->GetName().c_str()); | |||||
GELOGE(ret, "[Add][FpBpIteratorCtrl] failed, node:%s, graph:%s.", | |||||
node->GetName().c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
graph_change = true; | graph_change = true; | ||||
@@ -74,7 +75,8 @@ Status FlowCtrlPass::Run(ComputeGraphPtr compute_graph) { | |||||
if (is_found && need_cycle_flag) { | if (is_found && need_cycle_flag) { | ||||
Status ret = AddSpecialNodeIteratorCtrl(compute_graph, node); | Status ret = AddSpecialNodeIteratorCtrl(compute_graph, node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "AddSpecialNodeIteratorCtrl fail, node: %s.", node->GetName().c_str()); | |||||
GELOGE(ret, "[Add][SpecialNodeIteratorCtrl] failed, node:%s, graph:%s.", | |||||
node->GetName().c_str(), compute_graph->GetName().c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
graph_change = true; | graph_change = true; | ||||
@@ -116,7 +118,7 @@ NodePtr FlowCtrlPass::InsertOp(ComputeGraphPtr &compute_graph, const string &nod | |||||
OpDescPtr op_desc = MakeShared<OpDesc>(node_name, node_type); | OpDescPtr op_desc = MakeShared<OpDesc>(node_name, node_type); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(FAILED, "Make OpDesc failed, name:%s, type:%s.", node_name.c_str(), node_type.c_str()); | |||||
GELOGE(FAILED, "[New][OpDesc] failed, name:%s, type:%s.", node_name.c_str(), node_type.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -125,7 +127,7 @@ NodePtr FlowCtrlPass::InsertOp(ComputeGraphPtr &compute_graph, const string &nod | |||||
if (graph_status != GRAPH_SUCCESS) { | if (graph_status != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Add node:%s intput desc failed, error=%u.", node_name.c_str(), graph_status); | |||||
GELOGE(FAILED, "[Add][InputDesc] to op:%s(%s) failed", op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
@@ -135,20 +137,22 @@ NodePtr FlowCtrlPass::InsertOp(ComputeGraphPtr &compute_graph, const string &nod | |||||
if (graph_status != GRAPH_SUCCESS) { | if (graph_status != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Add node:%s output desc failed, error=%u.", node_name.c_str(), graph_status); | |||||
GELOGE(FAILED, "[Add][OutputDesc] to op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
GE_IF_BOOL_EXEC(compute_graph == nullptr, | GE_IF_BOOL_EXEC(compute_graph == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
DOMI_LOGE("compute_graph is nullptr"); | |||||
DOMI_LOGE("[Check][Param] compute_graph is nullptr"); | |||||
return nullptr); | return nullptr); | ||||
NodePtr node = compute_graph->AddNode(op_desc); | NodePtr node = compute_graph->AddNode(op_desc); | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), compute_graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), compute_graph->GetName().c_str()); | ||||
GELOGE(FAILED, "add node failed, name:%s, type:%s.", node_name.c_str(), node_type.c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), compute_graph->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -159,21 +163,19 @@ NodePtr FlowCtrlPass::InsertOp(ComputeGraphPtr &compute_graph, const string &nod | |||||
NodePtr FlowCtrlPass::InsertStreamSwitchOp(ComputeGraphPtr &compute_graph, const string &switch_name, | NodePtr FlowCtrlPass::InsertStreamSwitchOp(ComputeGraphPtr &compute_graph, const string &switch_name, | ||||
const NodePtr &loop_cond, const NodePtr &iter_per_loop) { | const NodePtr &loop_cond, const NodePtr &iter_per_loop) { | ||||
GE_IF_BOOL_EXEC(loop_cond == nullptr || loop_cond->GetOpDesc() == nullptr, | GE_IF_BOOL_EXEC(loop_cond == nullptr || loop_cond->GetOpDesc() == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param loop_cond or its op_desc is nullptr, " | |||||
"check invalid"); | |||||
GELOGE(FAILED, "loop_cond is null"); | |||||
REPORT_INNER_ERROR("E19999", "Param loop_cond or its op_desc is nullptr, check invalid"); | |||||
GELOGE(FAILED, "[Check][Param] Param loop_cond or its op_desc is nullptr"); | |||||
return nullptr); | return nullptr); | ||||
GE_IF_BOOL_EXEC(iter_per_loop == nullptr || iter_per_loop->GetOpDesc() == nullptr, | GE_IF_BOOL_EXEC(iter_per_loop == nullptr || iter_per_loop->GetOpDesc() == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param iter_per_loop or its op_desc is nullptr, " | |||||
"check invalid"); | |||||
GELOGE(FAILED, "iter_per_loop is nullptr"); | |||||
REPORT_INNER_ERROR("E19999", "Param iter_per_loop or its op_desc is nullptr, check invalid"); | |||||
GELOGE(FAILED, "[Check][Param] Param iter_per_loop or its op_desc is nullptr"); | |||||
return nullptr); | return nullptr); | ||||
std::vector<GeTensorDesc> input_desc_list = {loop_cond->GetOpDesc()->GetOutputDesc(0), | std::vector<GeTensorDesc> input_desc_list = {loop_cond->GetOpDesc()->GetOutputDesc(0), | ||||
iter_per_loop->GetOpDesc()->GetOutputDesc(0)}; | iter_per_loop->GetOpDesc()->GetOutputDesc(0)}; | ||||
std::vector<GeTensorDesc> output_desc_list; | std::vector<GeTensorDesc> output_desc_list; | ||||
NodePtr stream_switch = InsertOp(compute_graph, STREAMSWITCH, switch_name, input_desc_list, output_desc_list); | NodePtr stream_switch = InsertOp(compute_graph, STREAMSWITCH, switch_name, input_desc_list, output_desc_list); | ||||
if (stream_switch == nullptr) { | if (stream_switch == nullptr) { | ||||
GELOGE(FAILED, "InsertStreamSwitchOp failed, name:%s.", switch_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][StreamSwitchOp] failed, name:%s.", switch_name.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -183,7 +185,9 @@ NodePtr FlowCtrlPass::InsertStreamSwitchOp(ComputeGraphPtr &compute_graph, const | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | ||||
loop_cond->GetName().c_str(), loop_cond->GetType().c_str(), | loop_cond->GetName().c_str(), loop_cond->GetType().c_str(), | ||||
stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | ||||
GELOGE(FAILED, "Add loop_cond_node to switch_node:%s edge failed, ret = %u.", switch_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||||
loop_cond->GetName().c_str(), loop_cond->GetType().c_str(), | |||||
stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -193,17 +197,20 @@ NodePtr FlowCtrlPass::InsertStreamSwitchOp(ComputeGraphPtr &compute_graph, const | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:1) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:1) failed", | ||||
iter_per_loop->GetName().c_str(), iter_per_loop->GetType().c_str(), | iter_per_loop->GetName().c_str(), iter_per_loop->GetType().c_str(), | ||||
stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | ||||
GELOGE(FAILED, "Add iter_per_loop_node to switch_node:%s edge failed, ret = %u.", switch_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:0) and op:%s(%s)(index:1) failed", | |||||
iter_per_loop->GetName().c_str(), iter_per_loop->GetType().c_str(), | |||||
stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
// stream switch op need switch cond by attr. | // stream switch op need switch cond by attr. | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetInt(stream_switch->GetOpDesc(), ATTR_NAME_STREAM_SWITCH_COND, | GE_IF_BOOL_EXEC(!AttrUtils::SetInt(stream_switch->GetOpDesc(), ATTR_NAME_STREAM_SWITCH_COND, | ||||
static_cast<int64_t>(RT_LESS)), | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | |||||
ATTR_NAME_STREAM_SWITCH_COND.c_str(), | |||||
static_cast<int64_t>(RT_LESS)), | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_STREAM_SWITCH_COND.c_str(), | |||||
stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | ||||
DOMI_LOGE("set ATTR_NAME_STREAM_SWITCH_COND failed"); return nullptr); | |||||
DOMI_LOGE("[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_STREAM_SWITCH_COND.c_str(), | |||||
stream_switch->GetName().c_str(), stream_switch->GetType().c_str()); | |||||
return nullptr); | |||||
return stream_switch; | return stream_switch; | ||||
} | } | ||||
@@ -211,7 +218,7 @@ NodePtr FlowCtrlPass::InsertStreamSwitchOp(ComputeGraphPtr &compute_graph, const | |||||
NodePtr FlowCtrlPass::AddVariableNode(ComputeGraphPtr &compute_graph, const string &name) { | NodePtr FlowCtrlPass::AddVariableNode(ComputeGraphPtr &compute_graph, const string &name) { | ||||
GE_IF_BOOL_EXEC(compute_graph == nullptr, | GE_IF_BOOL_EXEC(compute_graph == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param compute_graph is nullptr, check invalid"); | ||||
DOMI_LOGE("compute_graph is nullptr"); | |||||
DOMI_LOGE("[Check][Param] compute_graph is nullptr"); | |||||
return nullptr); | return nullptr); | ||||
NodePtr exist_node = compute_graph->FindNode(name); | NodePtr exist_node = compute_graph->FindNode(name); | ||||
if (exist_node != nullptr) { | if (exist_node != nullptr) { | ||||
@@ -221,15 +228,14 @@ NodePtr FlowCtrlPass::AddVariableNode(ComputeGraphPtr &compute_graph, const stri | |||||
// fetch and set tensor desc | // fetch and set tensor desc | ||||
GeTensorDesc tensor_desc; | GeTensorDesc tensor_desc; | ||||
if (ge::VarManager::Instance(compute_graph->GetSessionID()) == nullptr) { | if (ge::VarManager::Instance(compute_graph->GetSessionID()) == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Get VarManager by session_id:%lu failed", | |||||
compute_graph->GetSessionID()); | |||||
REPORT_INNER_ERROR("E19999", "Get VarManager by session_id:%lu failed", compute_graph->GetSessionID()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
Status ret = ge::VarManager::Instance(compute_graph->GetSessionID())->GetCurVarDesc(name, tensor_desc); | Status ret = ge::VarManager::Instance(compute_graph->GetSessionID())->GetCurVarDesc(name, tensor_desc); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Get var tensor from VarManager by name:%s failed, session_id:%lu", | REPORT_INNER_ERROR("E19999", "Get var tensor from VarManager by name:%s failed, session_id:%lu", | ||||
name.c_str(), compute_graph->GetSessionID()); | name.c_str(), compute_graph->GetSessionID()); | ||||
GELOGE(FAILED, "Get var desc fail, name:%s", name.c_str()); | |||||
GELOGE(FAILED, "[Get][CurVarDesc] failed, name:%s, session_id:%lu", name.c_str(), compute_graph->GetSessionID()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
std::vector<GeTensorDesc> input_desc_list; | std::vector<GeTensorDesc> input_desc_list; | ||||
@@ -263,7 +269,7 @@ Status FlowCtrlPass::AddGlobalStepVariableNode(ComputeGraphPtr &compute_graph) { | |||||
NodePtr global_step = InsertOp(compute_graph, VARIABLE, NODE_NAME_GLOBAL_STEP, | NodePtr global_step = InsertOp(compute_graph, VARIABLE, NODE_NAME_GLOBAL_STEP, | ||||
input_desc_list, output_desc_list); | input_desc_list, output_desc_list); | ||||
if (global_step == nullptr) { | if (global_step == nullptr) { | ||||
GELOGE(FAILED, "Add global_step node failed, global_step is null."); | |||||
GELOGE(FAILED, "[Insert][Op] in graph:%s failed, global_step is null.", compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -273,7 +279,9 @@ Status FlowCtrlPass::AddGlobalStepVariableNode(ComputeGraphPtr &compute_graph) { | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
global_step->GetName().c_str(), global_step->GetType().c_str(), | global_step->GetName().c_str(), global_step->GetType().c_str(), | ||||
output_node->GetName().c_str(), output_node->GetType().c_str()); | output_node->GetName().c_str(), output_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add global_step to netoutput edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
global_step->GetName().c_str(), global_step->GetType().c_str(), | |||||
output_node->GetName().c_str(), output_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGD("Add global_step to netoutput edge in graph %u success", compute_graph->GetGraphID()); | GELOGD("Add global_step to netoutput edge in graph %u success", compute_graph->GetGraphID()); | ||||
@@ -284,9 +292,9 @@ NodePtr FlowCtrlPass::InsertAssignOp(ge::ComputeGraphPtr &compute_graph, const s | |||||
const string &node_name, const NodePtr &ref_node, const NodePtr &value_node) { | const string &node_name, const NodePtr &ref_node, const NodePtr &value_node) { | ||||
GE_IF_BOOL_EXEC(ref_node == nullptr || value_node == nullptr || | GE_IF_BOOL_EXEC(ref_node == nullptr || value_node == nullptr || | ||||
ref_node->GetOpDesc() == nullptr || value_node->GetOpDesc() == nullptr, | ref_node->GetOpDesc() == nullptr || value_node->GetOpDesc() == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param ref_node or value_node or their op_desc has nullptr, " | |||||
REPORT_INNER_ERROR("E19999", "Param ref_node or value_node or their op_desc is nullptr, " | |||||
"check invalid"); | "check invalid"); | ||||
GELOGE(FAILED, "ref node or value node is null"); | |||||
GELOGE(FAILED, "[Check][Param] Param ref_node or value_node or their op_desc is nullptr"); | |||||
return nullptr); | return nullptr); | ||||
GeTensorDesc ref_tensor_desc = ref_node->GetOpDesc()->GetOutputDesc(0); | GeTensorDesc ref_tensor_desc = ref_node->GetOpDesc()->GetOutputDesc(0); | ||||
GeTensorDesc val_tensor_desc = value_node->GetOpDesc()->GetOutputDesc(0); | GeTensorDesc val_tensor_desc = value_node->GetOpDesc()->GetOutputDesc(0); | ||||
@@ -294,7 +302,7 @@ NodePtr FlowCtrlPass::InsertAssignOp(ge::ComputeGraphPtr &compute_graph, const s | |||||
std::vector<GeTensorDesc> output_desc_list = {ref_tensor_desc}; | std::vector<GeTensorDesc> output_desc_list = {ref_tensor_desc}; | ||||
NodePtr assign_node = InsertOp(compute_graph, node_type, node_name, input_desc_list, output_desc_list); | NodePtr assign_node = InsertOp(compute_graph, node_type, node_name, input_desc_list, output_desc_list); | ||||
if (assign_node == nullptr) { | if (assign_node == nullptr) { | ||||
GELOGE(FAILED, "Insert node %s(%s) failed.", node_name.c_str(), node_type.c_str()); | |||||
GELOGE(FAILED, "[Insert][node] %s(%s) failed.", node_name.c_str(), node_type.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
// assign node input 0 = ref_node | // assign node input 0 = ref_node | ||||
@@ -303,7 +311,9 @@ NodePtr FlowCtrlPass::InsertAssignOp(ge::ComputeGraphPtr &compute_graph, const s | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | ||||
ref_node->GetName().c_str(), ref_node->GetType().c_str(), | ref_node->GetName().c_str(), ref_node->GetType().c_str(), | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add ref_node to %s edge failed, add_ret=%u.", node_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||||
ref_node->GetName().c_str(), ref_node->GetType().c_str(), | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
// assign input 1 = value_node | // assign input 1 = value_node | ||||
@@ -312,7 +322,9 @@ NodePtr FlowCtrlPass::InsertAssignOp(ge::ComputeGraphPtr &compute_graph, const s | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:1) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:1) failed", | ||||
value_node->GetName().c_str(), value_node->GetType().c_str(), | value_node->GetName().c_str(), value_node->GetType().c_str(), | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add value_node to %s edge failed, add_ret=%u.", node_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:0) and op:%s(%s)(index:1) failed", | |||||
value_node->GetName().c_str(), value_node->GetType().c_str(), | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
(void)ge::AttrUtils::SetBool(assign_node->GetOpDesc(), ATTR_NEED_COMPILE, true); | (void)ge::AttrUtils::SetBool(assign_node->GetOpDesc(), ATTR_NEED_COMPILE, true); | ||||
@@ -335,7 +347,7 @@ Status FlowCtrlPass::CreateIterCtrlTrueBranch(ComputeGraphPtr &compute_graph, co | |||||
assign_add_node_in_fpbp_loop_ = | assign_add_node_in_fpbp_loop_ = | ||||
InsertAssignOp(compute_graph, ASSIGNADD, NODE_NAME_FLOWCTRL_LOOP_ASSIGNADD, loop_cond_node, loop_inc_node); | InsertAssignOp(compute_graph, ASSIGNADD, NODE_NAME_FLOWCTRL_LOOP_ASSIGNADD, loop_cond_node, loop_inc_node); | ||||
if (assign_add_node_in_fpbp_loop_ == nullptr || switch_node == nullptr) { | if (assign_add_node_in_fpbp_loop_ == nullptr || switch_node == nullptr) { | ||||
GELOGE(PARAM_INVALID, "assign add node or switch node is null"); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] assign add node or switch node is null"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -346,7 +358,9 @@ Status FlowCtrlPass::CreateIterCtrlTrueBranch(ComputeGraphPtr &compute_graph, co | |||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | ||||
active_name.c_str(), assign_add_node_in_fpbp_loop_->GetName().c_str(), | active_name.c_str(), assign_add_node_in_fpbp_loop_->GetName().c_str(), | ||||
assign_add_node_in_fpbp_loop_->GetType().c_str()); | assign_add_node_in_fpbp_loop_->GetType().c_str()); | ||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", | |||||
active_name.c_str(), assign_add_node_in_fpbp_loop_->GetName().c_str(), | |||||
assign_add_node_in_fpbp_loop_->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
@@ -355,28 +369,31 @@ Status FlowCtrlPass::CreateIterCtrlTrueBranch(ComputeGraphPtr &compute_graph, co | |||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | ||||
active_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | active_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(status, "set active_label_list failed."); | |||||
GELOGE(status, "[Set][ActiveLabelList] %s to op:%s(%s) failed", | |||||
active_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
// 2. Insert active node | // 2. Insert active node | ||||
NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | ||||
if (active_node == nullptr) { | if (active_node == nullptr) { | ||||
GELOGE(FAILED, "Insert stream active node:%s for IterCtrlTrueStream failed.", active_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][StreamActiveNode] %s for IterCtrlTrueStream failed.", active_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
status = SetStreamLabel(active_node, active_name); | status = SetStreamLabel(active_node, active_name); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | ||||
active_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | active_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", | |||||
active_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), | GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_IS_LOOP_ACTIVE.c_str(), | ATTR_NAME_IS_LOOP_ACTIVE.c_str(), | ||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
DOMI_LOGE("set ATTR_NAME_IS_LOOP_ACTIVE failed"); | |||||
DOMI_LOGE("[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_IS_LOOP_ACTIVE.c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
// add ctrl edges | // add ctrl edges | ||||
@@ -387,7 +404,9 @@ Status FlowCtrlPass::CreateIterCtrlTrueBranch(ComputeGraphPtr &compute_graph, co | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), | switch_node->GetName().c_str(), switch_node->GetType().c_str(), | ||||
assign_add_node_in_fpbp_loop_->GetName().c_str(), | assign_add_node_in_fpbp_loop_->GetName().c_str(), | ||||
assign_add_node_in_fpbp_loop_->GetType().c_str()); | assign_add_node_in_fpbp_loop_->GetType().c_str()); | ||||
GELOGE(FAILED, "Add switch_node to assign_add_node ctrl edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), | |||||
assign_add_node_in_fpbp_loop_->GetName().c_str(), assign_add_node_in_fpbp_loop_->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -398,7 +417,9 @@ Status FlowCtrlPass::CreateIterCtrlTrueBranch(ComputeGraphPtr &compute_graph, co | |||||
assign_add_node_in_fpbp_loop_->GetName().c_str(), | assign_add_node_in_fpbp_loop_->GetName().c_str(), | ||||
assign_add_node_in_fpbp_loop_->GetType().c_str(), | assign_add_node_in_fpbp_loop_->GetType().c_str(), | ||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add assign_add_node to active_node ctrl edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
assign_add_node_in_fpbp_loop_->GetName().c_str(), assign_add_node_in_fpbp_loop_->GetType().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -421,7 +442,7 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
NodePtr assign_node = | NodePtr assign_node = | ||||
InsertAssignOp(compute_graph, ASSIGN, NODE_NAME_FLOWCTRL_LOOP_ASSIGN, loop_cond_node, loop_reset_node); | InsertAssignOp(compute_graph, ASSIGN, NODE_NAME_FLOWCTRL_LOOP_ASSIGN, loop_cond_node, loop_reset_node); | ||||
if (assign_node == nullptr || switch_node == nullptr) { | if (assign_node == nullptr || switch_node == nullptr) { | ||||
GELOGE(PARAM_INVALID, "assign_node or switch node is null."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] assign_node or switch node is null."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -429,7 +450,8 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | ||||
switch_node->GetName().c_str(), assign_node->GetName().c_str(), assign_node->GetType().c_str()); | switch_node->GetName().c_str(), assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", | |||||
switch_node->GetName().c_str(), assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
@@ -438,7 +460,9 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), | switch_node->GetName().c_str(), switch_node->GetType().c_str(), | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | assign_node->GetName().c_str(), assign_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add switch_node to assign_node ctrl edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -448,25 +472,28 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
string active_name = switch_node->GetName() + "_StreamExitActive"; | string active_name = switch_node->GetName() + "_StreamExitActive"; | ||||
NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | ||||
if (active_node == nullptr) { | if (active_node == nullptr) { | ||||
GELOGE(FAILED, "Insert stream active node:%s for IterCtrlTrueStream failed.", active_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][StreamActiveNode] %s for IterCtrlTrueStream failed.", active_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
status = SetStreamLabel(active_node, switch_node->GetName()); | status = SetStreamLabel(active_node, switch_node->GetName()); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | |||||
switch_node->GetName().c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
GELOGE(status, "Set stream label failed."); | |||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", switch_node->GetName().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", switch_node->GetName().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
GE_CHK_STATUS_RET(SetSwitchBranchNodeLabel(active_node, switch_node->GetName()), | GE_CHK_STATUS_RET(SetSwitchBranchNodeLabel(active_node, switch_node->GetName()), | ||||
"set switch branch node label failed."); | |||||
"[Set][SwitchBranchNodeLabel] %s to op:%s(%s) failed", switch_node->GetName().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
string model_exit_name = switch_node->GetName() + "_ModelExit"; | string model_exit_name = switch_node->GetName() + "_ModelExit"; | ||||
status = SetActiveLabelList(active_node, { model_exit_name }); | status = SetActiveLabelList(active_node, { model_exit_name }); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | ||||
model_exit_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | model_exit_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(status, "set active_label_list failed."); | |||||
GELOGE(status, "[Set][ActiveLabelList] %s to op:%s(%s) failed", | |||||
model_exit_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
@@ -475,14 +502,16 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
assign_node->GetName().c_str(), assign_node->GetType().c_str(), | assign_node->GetName().c_str(), assign_node->GetType().c_str(), | ||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add assign_node to active_node ctrl edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
assign_node->GetName().c_str(), assign_node->GetType().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// 3. Insert model exit node and add ctrl edge | // 3. Insert model exit node and add ctrl edge | ||||
NodePtr model_exit_node = InsertOp(compute_graph, MODELEXIT, model_exit_name, {}, {}); | NodePtr model_exit_node = InsertOp(compute_graph, MODELEXIT, model_exit_name, {}, {}); | ||||
if (model_exit_node == nullptr) { | if (model_exit_node == nullptr) { | ||||
GELOGE(FAILED, "Insert model_exit node:%s for IterCtrlTrueStream failed.", model_exit_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][ModelExitNode] %s for IterCtrlTrueStream failed.", model_exit_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
status = SetStreamLabel(model_exit_node, model_exit_name); | status = SetStreamLabel(model_exit_node, model_exit_name); | ||||
@@ -490,7 +519,8 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream_label:%s to op:%s(%s) failed", | ||||
model_exit_name.c_str(), model_exit_node->GetName().c_str(), | model_exit_name.c_str(), model_exit_node->GetName().c_str(), | ||||
model_exit_node->GetType().c_str()); | model_exit_node->GetType().c_str()); | ||||
GELOGE(status, "Set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", model_exit_name.c_str(), | |||||
model_exit_node->GetName().c_str(), model_exit_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
@@ -499,7 +529,9 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
active_node->GetName().c_str(), assign_node->GetType().c_str(), | active_node->GetName().c_str(), assign_node->GetType().c_str(), | ||||
model_exit_node->GetName().c_str(), model_exit_node->GetType().c_str()); | model_exit_node->GetName().c_str(), model_exit_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add active_node to model_exit_node ctrl edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
active_node->GetName().c_str(), assign_node->GetType().c_str(), | |||||
model_exit_node->GetName().c_str(), model_exit_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -509,28 +541,28 @@ Status FlowCtrlPass::CreateIterCtrlFalseBranch(ComputeGraphPtr &compute_graph, c | |||||
} | } | ||||
Status FlowCtrlPass::AddFpBpIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr &pre_node) { | Status FlowCtrlPass::AddFpBpIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr &pre_node) { | ||||
GE_IF_BOOL_EXEC(pre_node == nullptr, DOMI_LOGE("pre_node is nullptr."); return FAILED); | |||||
GE_IF_BOOL_EXEC(pre_node == nullptr, DOMI_LOGE("[Check][Param] pre_node is nullptr."); return FAILED); | |||||
string pre_node_name = pre_node->GetName(); | string pre_node_name = pre_node->GetName(); | ||||
GELOGI("Add FpBp Iterator ctrl, pre node:%s.", pre_node_name.c_str()); | GELOGI("Add FpBp Iterator ctrl, pre node:%s.", pre_node_name.c_str()); | ||||
// 1. Get or add variables | // 1. Get or add variables | ||||
NodePtr loop_cond_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_COND); | NodePtr loop_cond_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_COND); | ||||
if (loop_cond_node == nullptr) { | if (loop_cond_node == nullptr) { | ||||
GELOGE(FAILED, "Add variable:%s failed.", NODE_NAME_FLOWCTRL_LOOP_COND.c_str()); | |||||
GELOGE(FAILED, "[Add][Variable] %s failed.", NODE_NAME_FLOWCTRL_LOOP_COND.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr loop_inc_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_INCREMENT); | NodePtr loop_inc_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_INCREMENT); | ||||
if (loop_inc_node == nullptr) { | if (loop_inc_node == nullptr) { | ||||
GELOGE(FAILED, "Add variable:%s failed.", NODE_NAME_FLOWCTRL_LOOP_INCREMENT.c_str()); | |||||
GELOGE(FAILED, "[Add][Variable] %s failed.", NODE_NAME_FLOWCTRL_LOOP_INCREMENT.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr loop_reset_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_RESETVALUE); | NodePtr loop_reset_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_RESETVALUE); | ||||
if (loop_reset_node == nullptr) { | if (loop_reset_node == nullptr) { | ||||
GELOGE(FAILED, "Add variable:%s failed.", NODE_NAME_FLOWCTRL_LOOP_RESETVALUE.c_str()); | |||||
GELOGE(FAILED, "[Add][Variable] %s failed.", NODE_NAME_FLOWCTRL_LOOP_RESETVALUE.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr iter_per_loop_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_PER_ITER); | NodePtr iter_per_loop_node = AddVariableNode(compute_graph, NODE_NAME_FLOWCTRL_LOOP_PER_ITER); | ||||
if (iter_per_loop_node == nullptr) { | if (iter_per_loop_node == nullptr) { | ||||
GELOGE(FAILED, "Add variable:%s failed.", NODE_NAME_FLOWCTRL_LOOP_PER_ITER.c_str()); | |||||
GELOGE(FAILED, "[Add][Variable] %s failed.", NODE_NAME_FLOWCTRL_LOOP_PER_ITER.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -538,14 +570,15 @@ Status FlowCtrlPass::AddFpBpIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr | |||||
string switch_name = pre_node_name + "_" + NODE_NAME_STREAM_SWITCH; | string switch_name = pre_node_name + "_" + NODE_NAME_STREAM_SWITCH; | ||||
NodePtr switch_node = InsertStreamSwitchOp(compute_graph, switch_name, loop_cond_node, iter_per_loop_node); | NodePtr switch_node = InsertStreamSwitchOp(compute_graph, switch_name, loop_cond_node, iter_per_loop_node); | ||||
if (switch_node == nullptr) { | if (switch_node == nullptr) { | ||||
GELOGE(FAILED, "InsertStreamSwitchOp:%s failed.", switch_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][StreamSwitchOp] %s failed.", switch_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto status = SetStreamLabel(switch_node, switch_name); | auto status = SetStreamLabel(switch_node, switch_name); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream label:%s to op:%s(%s) failed", | ||||
switch_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(status, "set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", | |||||
switch_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
@@ -554,15 +587,16 @@ Status FlowCtrlPass::AddFpBpIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
pre_node->GetName().c_str(), pre_node->GetType().c_str(), | pre_node->GetName().c_str(), pre_node->GetType().c_str(), | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add pre node:%s to switch_node:%s ctrl edge failed, ret = %u.", pre_node_name.c_str(), | |||||
switch_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
pre_node->GetName().c_str(), pre_node->GetType().c_str(), | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// 3. Create switch false branch: return results and reset the loopCond | // 3. Create switch false branch: return results and reset the loopCond | ||||
Status ret = CreateIterCtrlFalseBranch(compute_graph, loop_cond_node, loop_reset_node, switch_node); | Status ret = CreateIterCtrlFalseBranch(compute_graph, loop_cond_node, loop_reset_node, switch_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "CreateIterCtrlFalseBranch fail, pre node:%s.", pre_node_name.c_str()); | |||||
GELOGE(ret, "[Create][IterCtrlFalseBranch] fail, pre node:%s.", pre_node_name.c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -570,7 +604,7 @@ Status FlowCtrlPass::AddFpBpIteratorCtrl(ComputeGraphPtr &compute_graph, NodePtr | |||||
// active train streams and increase the loopCond | // active train streams and increase the loopCond | ||||
ret = CreateIterCtrlTrueBranch(compute_graph, loop_cond_node, loop_inc_node, switch_node); | ret = CreateIterCtrlTrueBranch(compute_graph, loop_cond_node, loop_inc_node, switch_node); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "CreateIterCtrlTrueBranch fail, pre node:%s.", pre_node_name.c_str()); | |||||
GELOGE(ret, "[Create][IterCtrlTrueBranch] fail, pre node:%s.", pre_node_name.c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -594,15 +628,15 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
* itersPerLoop loopCond | * itersPerLoop loopCond | ||||
*/ | */ | ||||
GE_IF_BOOL_EXEC(loop_after_node == nullptr || compute_graph == nullptr, | GE_IF_BOOL_EXEC(loop_after_node == nullptr || compute_graph == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param loop_after_node or compute_graph is nullptr, " | |||||
"check invalid"); | |||||
DOMI_LOGE("loop after node or compute graph is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param loop_after_node or compute_graph is nullptr, check invalid"); | |||||
DOMI_LOGE("[Check][Param] loop after node or compute graph is null."); | |||||
return FAILED); | return FAILED); | ||||
InDataAnchorPtr in_anchor = loop_after_node->GetInDataAnchor(0); | InDataAnchorPtr in_anchor = loop_after_node->GetInDataAnchor(0); | ||||
if (in_anchor == nullptr || in_anchor->GetPeerOutAnchor() == nullptr) { | if (in_anchor == nullptr || in_anchor->GetPeerOutAnchor() == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param loop_after_node:%s(%s) no in data node, check invalid", | REPORT_INNER_ERROR("E19999", "Param loop_after_node:%s(%s) no in data node, check invalid", | ||||
loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str()); | loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Find %s in data anchor failed.", loop_after_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Param loop_after_node:%s(%s) no in data node.", | |||||
loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr loop_pre_node = in_anchor->GetPeerOutAnchor()->GetOwnerNode(); | NodePtr loop_pre_node = in_anchor->GetPeerOutAnchor()->GetOwnerNode(); | ||||
@@ -612,28 +646,30 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
if (loop_cond_node == nullptr) { | if (loop_cond_node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Node:%s not found in graph:%s, check invalid", | REPORT_INNER_ERROR("E19999", "Node:%s not found in graph:%s, check invalid", | ||||
NODE_NAME_FLOWCTRL_LOOP_COND.c_str(), compute_graph->GetName().c_str()); | NODE_NAME_FLOWCTRL_LOOP_COND.c_str(), compute_graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Find node :%s failed.", NODE_NAME_FLOWCTRL_LOOP_COND.c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Node:%s not found in graph:%s.", | |||||
NODE_NAME_FLOWCTRL_LOOP_COND.c_str(), compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodePtr iter_per_loop_node = compute_graph->FindNode(NODE_NAME_FLOWCTRL_LOOP_PER_ITER); | NodePtr iter_per_loop_node = compute_graph->FindNode(NODE_NAME_FLOWCTRL_LOOP_PER_ITER); | ||||
if (iter_per_loop_node == nullptr) { | if (iter_per_loop_node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Node:%s not found in graph:%s, check invalid", | REPORT_INNER_ERROR("E19999", "Node:%s not found in graph:%s, check invalid", | ||||
NODE_NAME_FLOWCTRL_LOOP_PER_ITER.c_str(), compute_graph->GetName().c_str()); | NODE_NAME_FLOWCTRL_LOOP_PER_ITER.c_str(), compute_graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Find node :%s failed.", NODE_NAME_FLOWCTRL_LOOP_PER_ITER.c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Node:%s not found in graph:%s.", | |||||
NODE_NAME_FLOWCTRL_LOOP_PER_ITER.c_str(), compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// 2. Add StreamSwitch and edges to switch_node. | // 2. Add StreamSwitch and edges to switch_node. | ||||
GE_IF_BOOL_EXEC(loop_pre_node == nullptr, | GE_IF_BOOL_EXEC(loop_pre_node == nullptr, | ||||
REPORT_INNER_ERROR("E19999", "Param loop_after_node:%s(%s) no in data node, " | |||||
"check invalid", loop_after_node->GetName().c_str(), | |||||
loop_after_node->GetType().c_str()); | |||||
DOMI_LOGE("loop pre node is null."); | |||||
REPORT_INNER_ERROR("E19999", "Param loop_after_node:%s(%s) no in data node, check invalid", | |||||
loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str()); | |||||
DOMI_LOGE("[Check][Param] Param loop_after_node:%s(%s) no in data node", | |||||
loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
string switch_name = loop_pre_node->GetName() + "_" + NODE_NAME_STREAM_SWITCH; | string switch_name = loop_pre_node->GetName() + "_" + NODE_NAME_STREAM_SWITCH; | ||||
NodePtr switch_node = InsertStreamSwitchOp(compute_graph, switch_name, loop_cond_node, iter_per_loop_node); | NodePtr switch_node = InsertStreamSwitchOp(compute_graph, switch_name, loop_cond_node, iter_per_loop_node); | ||||
if (switch_node == nullptr) { | if (switch_node == nullptr) { | ||||
GELOGE(FAILED, "InsertStreamSwitchOp:%s failed.", switch_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][StreamSwitchOp] %s failed.", switch_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -641,7 +677,8 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream label:%s to op:%s(%s) failed", | ||||
switch_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(status, "set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", | |||||
switch_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
@@ -650,8 +687,9 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
loop_pre_node->GetName().c_str(), loop_pre_node->GetType().c_str(), | loop_pre_node->GetName().c_str(), loop_pre_node->GetType().c_str(), | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add loop_pre_node:%s to switch_node:%s ctrl edge failed, ret = %u.", | |||||
loop_pre_node->GetName().c_str(), switch_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
loop_pre_node->GetName().c_str(), loop_pre_node->GetType().c_str(), | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
add_ret = GraphUtils::AddEdge(loop_after_node->GetOutControlAnchor(), switch_node->GetInControlAnchor()); | add_ret = GraphUtils::AddEdge(loop_after_node->GetOutControlAnchor(), switch_node->GetInControlAnchor()); | ||||
@@ -659,8 +697,9 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str(), | loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str(), | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add node:%s to switch_node:%s ctrl edge failed, ret = %u.", loop_after_node->GetName().c_str(), | |||||
switch_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
loop_after_node->GetName().c_str(), loop_after_node->GetType().c_str(), | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -668,7 +707,7 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
string active_name = switch_name + "_StreamActive"; | string active_name = switch_name + "_StreamActive"; | ||||
NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | NodePtr active_node = InsertOp(compute_graph, STREAMACTIVE, active_name, {}, {}); | ||||
if (active_node == nullptr) { | if (active_node == nullptr) { | ||||
GELOGE(FAILED, "Insert stream active node:%s for SpecialNodeIteratorCtrl failed.", active_name.c_str()); | |||||
GELOGE(FAILED, "[Insert][StreamActiveNode] %s for SpecialNodeIteratorCtrl failed.", active_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -676,15 +715,16 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set stream label:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set stream label:%s to op:%s(%s) failed", | ||||
active_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | active_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(status, "set stream label failed."); | |||||
GELOGE(status, "[Set][StreamLabel] %s to op:%s(%s) failed", | |||||
active_name.c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), | GE_IF_BOOL_EXEC(!AttrUtils::SetBool(active_node->GetOpDesc(), ATTR_NAME_IS_LOOP_ACTIVE, true), | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | |||||
ATTR_NAME_IS_LOOP_ACTIVE.c_str(), | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_IS_LOOP_ACTIVE.c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
DOMI_LOGE("set ATTR_NAME_IS_LOOP_ACTIVE failed"); | |||||
DOMI_LOGE("[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_IS_LOOP_ACTIVE.c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
add_ret = GraphUtils::AddEdge(switch_node->GetOutControlAnchor(), active_node->GetInControlAnchor()); | add_ret = GraphUtils::AddEdge(switch_node->GetOutControlAnchor(), active_node->GetInControlAnchor()); | ||||
@@ -692,8 +732,9 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), | switch_node->GetName().c_str(), switch_node->GetType().c_str(), | ||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | active_node->GetName().c_str(), active_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add switch_node:%s to active_node:%s ctrl edge failed, ret = %u.", switch_name.c_str(), | |||||
active_name.c_str(), add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
switch_node->GetName().c_str(), switch_node->GetType().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -702,15 +743,17 @@ Status FlowCtrlPass::AddSpecialNodeIteratorCtrl(ComputeGraphPtr &compute_graph, | |||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | ||||
active_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | active_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | ||||
GELOGE(status, "set active_label_list failed."); | |||||
GELOGE(status, "[Set][ActiveLabelList] %s to op:%s(%s) failed", | |||||
active_name.c_str(), switch_node->GetName().c_str(), switch_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
// used for stream assign to find active stream | // used for stream assign to find active stream | ||||
status = SetActiveLabelList(active_node, { loop_pre_node->GetName() }); | status = SetActiveLabelList(active_node, { loop_pre_node->GetName() }); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", | |||||
loop_pre_node->GetName().c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
GELOGE(status, "set active_label_list failed."); | |||||
REPORT_CALL_ERROR("E19999", "Set active label list:%s to op:%s(%s) failed", loop_pre_node->GetName().c_str(), | |||||
active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
GELOGE(status, "[Set][ActiveLabelList] %s to op:%s(%s) failed", | |||||
loop_pre_node->GetName().c_str(), active_node->GetName().c_str(), active_node->GetType().c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
active_nodes_in_iter_loop_.push_back(active_node); | active_nodes_in_iter_loop_.push_back(active_node); | ||||
@@ -36,7 +36,7 @@ namespace folding_pass { | |||||
shared_ptr<Kernel> GetKernelByType(const NodePtr &node) { | shared_ptr<Kernel> GetKernelByType(const NodePtr &node) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(FAILED, "parameter is null."); | |||||
GELOGE(FAILED, "[Check][Param] parameter node is nullptr."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
KernelFactory &factory = KernelFactory::Instance(); | KernelFactory &factory = KernelFactory::Instance(); | ||||
@@ -84,7 +84,7 @@ NodePtr AddConstNodeToGraph(GeTensorPtr &tensor, ComputeGraphPtr &graph) { | |||||
auto const_desc = OpDescUtils::CreateConstOp(tensor); | auto const_desc = OpDescUtils::CreateConstOp(tensor); | ||||
if (const_desc == nullptr) { | if (const_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Create Const op failed"); | REPORT_CALL_ERROR("E19999", "Create Const op failed"); | ||||
GELOGE(OUT_OF_MEMORY, "Failed to get const desc from tensor"); | |||||
GELOGE(OUT_OF_MEMORY, "[Create][ConstOp] failed"); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -96,14 +96,14 @@ NodePtr AddConstNodeToGraph(GeTensorPtr &tensor, ComputeGraphPtr &graph) { | |||||
NodePtr AddIdentityNodeToGraph(const std::string &name, const GeTensorDesc &tensor, ComputeGraphPtr &graph) { | NodePtr AddIdentityNodeToGraph(const std::string &name, const GeTensorDesc &tensor, ComputeGraphPtr &graph) { | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | ||||
GELOGE(INTERNAL_ERROR, "Compute graph ptr is null in creating identity node."); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] Compute graph ptr is null in creating identity node."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
OpDescPtr desc = MakeShared<OpDesc>("", ""); | OpDescPtr desc = MakeShared<OpDesc>("", ""); | ||||
if (desc == nullptr) { | if (desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(MEMALLOC_FAILED, "Failed to create op desc."); | |||||
GELOGE(MEMALLOC_FAILED, "[New][OpDesc] failed."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -114,7 +114,8 @@ NodePtr AddIdentityNodeToGraph(const std::string &name, const GeTensorDesc &tens | |||||
if ((ret != GRAPH_SUCCESS) || (ret2 != GRAPH_SUCCESS)) { | if ((ret != GRAPH_SUCCESS) || (ret2 != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Add input or output desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input or output desc to op:%s(%s) failed", | ||||
desc->GetName().c_str(), desc->GetType().c_str()); | desc->GetName().c_str(), desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to add input/output desc in creating Identity."); | |||||
GELOGE(INTERNAL_ERROR, "[Add][GeTensorDesc] to op:%s(%s) failed", | |||||
desc->GetName().c_str(), desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -146,9 +147,9 @@ Status FoldingPass::Folding(NodePtr &node, vector<GeTensorPtr> &outputs) { | |||||
auto in_data_nodes = node->GetInDataNodes(); | auto in_data_nodes = node->GetInDataNodes(); | ||||
std::unordered_set<NodePtr> in_data_nodes_set(in_data_nodes.begin(), in_data_nodes.end()); | std::unordered_set<NodePtr> in_data_nodes_set(in_data_nodes.begin(), in_data_nodes.end()); | ||||
if (IsolateAndDeleteNode(node, {}) != SUCCESS) { | if (IsolateAndDeleteNode(node, {}) != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Isolate and delete node:%s(%s) faild", | |||||
REPORT_INNER_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to isolate and delete node %s, type %s.", | |||||
GELOGE(INTERNAL_ERROR, "[IsolateAndDelete][Node] %s(%s) failed.", | |||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -160,9 +161,9 @@ Status FoldingPass::Folding(NodePtr &node, vector<GeTensorPtr> &outputs) { | |||||
continue; | continue; | ||||
} | } | ||||
if (IsolateAndDeleteNode(pre_node, {}) != SUCCESS) { | if (IsolateAndDeleteNode(pre_node, {}) != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Isolate and delete node:%s(%s) faild", | |||||
REPORT_INNER_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||||
pre_node->GetName().c_str(), pre_node->GetType().c_str()); | pre_node->GetName().c_str(), pre_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to isolate and delete in data node %s, type %s.", | |||||
GELOGE(INTERNAL_ERROR, "[IsolateAndDelete][Node] %s(%s) failed.", | |||||
pre_node->GetName().c_str(), pre_node->GetType().c_str()); | pre_node->GetName().c_str(), pre_node->GetType().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -190,11 +191,10 @@ Status FoldingPass::DealWithInNodes(NodePtr &node) { | |||||
GELOGI("The in_node name is %s, and node type is %s.", in_node->GetName().c_str(), in_node->GetType().c_str()); | GELOGI("The in_node name is %s, and node type is %s.", in_node->GetName().c_str(), in_node->GetType().c_str()); | ||||
auto ret = in_node_anchor->Unlink(in_data_anchor); | auto ret = in_node_anchor->Unlink(in_data_anchor); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", | |||||
"Op:%s(%s) out index:%d unlink from op:%s(%s) in index:%d failed", | |||||
REPORT_CALL_ERROR("E19999", "Op:%s(%s) out index:%d unlink from op:%s(%s) in index:%d failed", | |||||
in_node->GetName().c_str(), in_node->GetType().c_str(), in_node_anchor->GetIdx(), | in_node->GetName().c_str(), in_node->GetType().c_str(), in_node_anchor->GetIdx(), | ||||
node->GetName().c_str(), node->GetType().c_str(), in_data_anchor->GetIdx()); | node->GetName().c_str(), node->GetType().c_str(), in_data_anchor->GetIdx()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to unlink anchor between const node %s to constant-folding-node %s, type %s.", | |||||
GELOGE(INTERNAL_ERROR, "[Unlink][Anchor] between const node:%s and constant-folding-node:%s(%s) failed.", | |||||
in_node->GetName().c_str(), node->GetName().c_str(), node->GetType().c_str()); | in_node->GetName().c_str(), node->GetName().c_str(), node->GetType().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -204,16 +204,18 @@ Status FoldingPass::DealWithInNodes(NodePtr &node) { | |||||
auto identity = | auto identity = | ||||
AddIdentityNodeToGraph(identity_name, node->GetOpDesc()->GetInputDesc(in_data_anchor->GetIdx()), graph); | AddIdentityNodeToGraph(identity_name, node->GetOpDesc()->GetInputDesc(in_data_anchor->GetIdx()), graph); | ||||
if (identity == nullptr) { | if (identity == nullptr) { | ||||
GELOGE(INTERNAL_ERROR, "Failed to add identity node to graph."); | |||||
GELOGE(INTERNAL_ERROR, "[Add][IdentityNode] %s to graph:%s failed.", | |||||
identity_name.c_str(), graph->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
ret = GraphUtils::AddEdge(in_node_anchor, identity->GetInDataAnchor(0)); | ret = GraphUtils::AddEdge(in_node_anchor, identity->GetInDataAnchor(0)); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(inde:0) failed", | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||||
in_node->GetName().c_str(), in_node->GetType().c_str(), in_node_anchor->GetIdx(), | in_node->GetName().c_str(), in_node->GetType().c_str(), in_node_anchor->GetIdx(), | ||||
identity->GetName().c_str(), identity->GetType().c_str()); | identity->GetName().c_str(), identity->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to add edge, from node %s to node %s.", in_node->GetName().c_str(), | |||||
identity->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][Edge] between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||||
in_node->GetName().c_str(), in_node->GetType().c_str(), in_node_anchor->GetIdx(), | |||||
identity->GetName().c_str(), identity->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGI("Create new identity node success."); | GELOGI("Create new identity node success."); | ||||
@@ -222,8 +224,9 @@ Status FoldingPass::DealWithInNodes(NodePtr &node) { | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
identity->GetName().c_str(), identity->GetType().c_str(), | identity->GetName().c_str(), identity->GetType().c_str(), | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to add edge, from node %s to node %s.", in_node->GetName().c_str(), | |||||
node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
identity->GetName().c_str(), identity->GetType().c_str(), | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
@@ -236,7 +239,7 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho | |||||
std::vector<GeTensorPtr> &v_weight) { | std::vector<GeTensorPtr> &v_weight) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "node is null"); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] node is nullptr"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto graph = node->GetOwnerComputeGraph(); | auto graph = node->GetOwnerComputeGraph(); | ||||
@@ -245,24 +248,23 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho | |||||
if (index >= v_weight.size()) { | if (index >= v_weight.size()) { | ||||
REPORT_INNER_ERROR("E19999", "Index:%lu in param index_to_anchors >= param v_weight.size:%zu, " | REPORT_INNER_ERROR("E19999", "Index:%lu in param index_to_anchors >= param v_weight.size:%zu, " | ||||
"check invalid", index, v_weight.size()); | "check invalid", index, v_weight.size()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to constant fold on node %s type %s, " | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] Failed to constant fold on node %s type %s, " | |||||
"the out nodes num %lu calculated is less than the node out anchor index %zu", | "the out nodes num %lu calculated is less than the node out anchor index %zu", | ||||
node->GetName().c_str(), node->GetType().c_str(), v_weight.size(), index); | node->GetName().c_str(), node->GetType().c_str(), v_weight.size(), index); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GeTensorPtr weight = v_weight[index]; | GeTensorPtr weight = v_weight[index]; | ||||
if (weight == nullptr) { | if (weight == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Index:%lu in param v_weight is nullptr check invalid", | |||||
index); | |||||
GELOGE(INTERNAL_ERROR, "Failed to constant fold on node %s type %s, the %lust node calculated is null", | |||||
REPORT_INNER_ERROR("E19999", "Index:%lu in param v_weight is nullptr check invalid", index); | |||||
GELOGE(INTERNAL_ERROR, | |||||
"[Check][Param] Failed to constant fold on node %s type %s, the %lust node calculated is null", | |||||
node->GetName().c_str(), node->GetType().c_str(), index); | node->GetName().c_str(), node->GetType().c_str(), index); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
auto const_node = AddConstNodeToGraph(weight, graph); | auto const_node = AddConstNodeToGraph(weight, graph); | ||||
if (const_node == nullptr) { | if (const_node == nullptr) { | ||||
GELOGE(INTERNAL_ERROR, "Failed to add dynamic const node, node name:%s, index:%zu.", | |||||
GELOGE(INTERNAL_ERROR, "[Add][ConstNode] To Graph failed, node name:%s, index:%zu.", | |||||
node->GetName().c_str(), index); | node->GetName().c_str(), index); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -273,7 +275,8 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho | |||||
if (in_anchor == nullptr) { | if (in_anchor == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Index:%lu in param index_to_anchors has nullptr member in_anchor, " | REPORT_INNER_ERROR("E19999", "Index:%lu in param index_to_anchors has nullptr member in_anchor, " | ||||
"check invalid", index); | "check invalid", index); | ||||
GELOGE(INTERNAL_ERROR, "In anchor is nullptr."); | |||||
GELOGE(INTERNAL_ERROR, | |||||
"[Check][Param] Index:%lu in param index_to_anchors has nullptr member in_anchor", index); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
auto ret = ConnectNodeToInAnchor(in_anchor, const_node, 0); | auto ret = ConnectNodeToInAnchor(in_anchor, const_node, 0); | ||||
@@ -287,7 +290,7 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), | node->GetName().c_str(), node->GetType().c_str(), | ||||
const_node->GetName().c_str(), const_node->GetType().c_str()); | const_node->GetName().c_str(), const_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to add control edge, from node %s to const node %s.", node->GetName().c_str(), | |||||
GELOGE(INTERNAL_ERROR, "[Add][ControlEdge] failed, from node %s to const node %s.", node->GetName().c_str(), | |||||
const_node->GetName().c_str()); | const_node->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -296,11 +299,10 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho | |||||
if (AttrUtils::GetStr(node->GetOpDesc(), ATTR_NAME_STREAM_LABEL, stream_label)) { | if (AttrUtils::GetStr(node->GetOpDesc(), ATTR_NAME_STREAM_LABEL, stream_label)) { | ||||
GE_CHECK_NOTNULL(const_node->GetOpDesc()); | GE_CHECK_NOTNULL(const_node->GetOpDesc()); | ||||
if (!AttrUtils::SetStr(const_node->GetOpDesc(), ATTR_NAME_STREAM_LABEL, stream_label)) { | if (!AttrUtils::SetStr(const_node->GetOpDesc(), ATTR_NAME_STREAM_LABEL, stream_label)) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | |||||
ATTR_NAME_STREAM_LABEL.c_str(), | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_STREAM_LABEL.c_str(), | |||||
const_node->GetName().c_str(), const_node->GetType().c_str()); | const_node->GetName().c_str(), const_node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to set stream label on dynamic const node %s, with stream label:%s.", | |||||
const_node->GetName().c_str(), stream_label.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_STREAM_LABEL.c_str(), | |||||
const_node->GetName().c_str(), const_node->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
@@ -317,7 +319,7 @@ Status FoldingPass::RemoveNodeKeepingCtrlEdges(NodePtr &node) { | |||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Isolate node:%s(%s) in graph failed", | REPORT_CALL_ERROR("E19999", "Isolate node:%s(%s) in graph failed", | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to isolate the folding-node %s type %s", node->GetName().c_str(), | |||||
GELOGE(INTERNAL_ERROR, "[Isolate][Node] %s type %s failed", node->GetName().c_str(), | |||||
node->GetType().c_str()); | node->GetType().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -327,7 +329,8 @@ Status FoldingPass::RemoveNodeKeepingCtrlEdges(NodePtr &node) { | |||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to remove node %s from graph", node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Remove][Node] %s(%s) without relink in graph:%s failed", | |||||
node->GetName().c_str(), node->GetType().c_str(), graph->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
AddNodeDeleted(node); | AddNodeDeleted(node); | ||||
@@ -338,7 +341,7 @@ Status FoldingPass::ConnectNodeToInAnchor(InDataAnchorPtr &in_anchor, NodePtr &n | |||||
// the origin edge must be removed before add | // the origin edge must be removed before add | ||||
if (in_anchor == nullptr || node == nullptr) { | if (in_anchor == nullptr || node == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param node or in_anchor is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param node or in_anchor is nullptr, check invalid"); | ||||
GELOGE(PARAM_INVALID, "in anchor or node is null"); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] in anchor or node is null"); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
auto peer_out_anchor = in_anchor->GetPeerOutAnchor(); | auto peer_out_anchor = in_anchor->GetPeerOutAnchor(); | ||||
@@ -352,8 +355,7 @@ Status FoldingPass::ConnectNodeToInAnchor(InDataAnchorPtr &in_anchor, NodePtr &n | |||||
if (new_out_anchor == nullptr) { | if (new_out_anchor == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param out index:%d data anchor of node:%s(%s) is nullptr, check invalid", | REPORT_INNER_ERROR("E19999", "Param out index:%d data anchor of node:%s(%s) is nullptr, check invalid", | ||||
node_index, node->GetName().c_str(), node->GetType().c_str()); | node_index, node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to add node to in anchor," | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] Failed to add node to in anchor," | |||||
" the index %d for node %s, type %s is invalid", | " the index %d for node %s, type %s is invalid", | ||||
node_index, node->GetName().c_str(), node->GetType().c_str()); | node_index, node->GetName().c_str(), node->GetType().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
@@ -363,10 +365,10 @@ Status FoldingPass::ConnectNodeToInAnchor(InDataAnchorPtr &in_anchor, NodePtr &n | |||||
node->GetName().c_str(), node->GetType().c_str(), node_index, | node->GetName().c_str(), node->GetType().c_str(), node_index, | ||||
in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetOwnerNode()->GetType().c_str(), | in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetOwnerNode()->GetType().c_str(), | ||||
in_anchor->GetIdx()); | in_anchor->GetIdx()); | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to add edge between anchors," | |||||
" new node %s, type %s", | |||||
node->GetName().c_str(), node->GetType().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Add][Edge] between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||||
node->GetName().c_str(), node->GetType().c_str(), node_index, | |||||
in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetOwnerNode()->GetType().c_str(), | |||||
in_anchor->GetIdx()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
AddRePassNodesWithInOut(node); | AddRePassNodesWithInOut(node); | ||||
@@ -56,17 +56,18 @@ Status ForPass::Run(NodePtr &node) { | |||||
ForInfo for_info; | ForInfo for_info; | ||||
GE_CHK_STATUS_RET(BuildForInfo(root_graph, node, for_info), | GE_CHK_STATUS_RET(BuildForInfo(root_graph, node, for_info), | ||||
"Build ForInfo failed, node:%s.", node->GetName().c_str()); | |||||
"[Build][ForInfo] failed, node:%s.", node->GetName().c_str()); | |||||
WhileInfo while_info; | WhileInfo while_info; | ||||
GE_CHK_STATUS_RET(TranWhileInfo(graph, for_info, while_info), | GE_CHK_STATUS_RET(TranWhileInfo(graph, for_info, while_info), | ||||
"Transfer WhileInfo from ForInfo failed, node:%s.", node->GetName().c_str()); | |||||
"[Transfer][WhileInfo] from ForInfo failed, node:%s.", node->GetName().c_str()); | |||||
ComputeGraphPtr cond_graph = BuildCondGraph(while_info); | ComputeGraphPtr cond_graph = BuildCondGraph(while_info); | ||||
if ((cond_graph == nullptr) || (root_graph->AddSubgraph(cond_graph) != GRAPH_SUCCESS)) { | if ((cond_graph == nullptr) || (root_graph->AddSubgraph(cond_graph) != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Build cond graph failed or add cond subgraph to root_graph:%s failed", | REPORT_CALL_ERROR("E19999", "Build cond graph failed or add cond subgraph to root_graph:%s failed", | ||||
root_graph->GetName().c_str()); | root_graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Add while_cond_graph failed, node:%s.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Build cond graph failed or add cond subgraph to root_graph:%s failed.", | |||||
root_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -74,12 +75,13 @@ Status ForPass::Run(NodePtr &node) { | |||||
if ((body_graph == nullptr) || (root_graph->AddSubgraph(body_graph) != GRAPH_SUCCESS)) { | if ((body_graph == nullptr) || (root_graph->AddSubgraph(body_graph) != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Build body graph failed or add body subgraph to root_graph:%s failed", | REPORT_CALL_ERROR("E19999", "Build body graph failed or add body subgraph to root_graph:%s failed", | ||||
root_graph->GetName().c_str()); | root_graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Add while_body_graph failed, node:%s.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Build body graph failed or add body subgraph to root_graph:%s failed", | |||||
root_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_CHK_STATUS_RET(UpdateForBodyInputMapping(while_info), | GE_CHK_STATUS_RET(UpdateForBodyInputMapping(while_info), | ||||
"Update InputMapping for for-body-graph failed, node:%s.", node->GetName().c_str()); | |||||
"[Update][InputMapping] for for-body-graph failed, node:%s.", node->GetName().c_str()); | |||||
// for node has and only has one subgraph | // for node has and only has one subgraph | ||||
GE_CHECK_NOTNULL(node->GetOpDesc()); | GE_CHECK_NOTNULL(node->GetOpDesc()); | ||||
@@ -107,7 +109,9 @@ Status ForPass::BuildForInfo(const ComputeGraphPtr &root_graph, const NodePtr &n | |||||
"in data anchor of op:%s(%s) lack, check invalid", | "in data anchor of op:%s(%s) lack, check invalid", | ||||
FOR_START_INPUT, FOR_LIMIT_INPUT, FOR_DELTA_INPUT, | FOR_START_INPUT, FOR_LIMIT_INPUT, FOR_DELTA_INPUT, | ||||
node->GetName().c_str(), node->GetType().c_str()); | node->GetName().c_str(), node->GetType().c_str()); | ||||
GELOGE(FAILED, "BuildForInfo for %s failed: start/limit/delta is NULL.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] FOR_START_INPUT index:%d or FOR_LIMIT_INPUT index:%d or FOR_DELTA_INPUT index:%d " | |||||
"in data anchor of op:%s(%s) lack", | |||||
FOR_START_INPUT, FOR_LIMIT_INPUT, FOR_DELTA_INPUT, node->GetName().c_str(), node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -116,7 +120,7 @@ Status ForPass::BuildForInfo(const ComputeGraphPtr &root_graph, const NodePtr &n | |||||
std::vector<OutControlAnchorPtr> ctrl_inputs; | std::vector<OutControlAnchorPtr> ctrl_inputs; | ||||
std::vector<InControlAnchorPtr> ctrl_outputs; | std::vector<InControlAnchorPtr> ctrl_outputs; | ||||
if (FindInputsAndOutputs(node, data_inputs, data_outputs, ctrl_inputs, ctrl_outputs) != SUCCESS) { | if (FindInputsAndOutputs(node, data_inputs, data_outputs, ctrl_inputs, ctrl_outputs) != SUCCESS) { | ||||
GELOGE(FAILED, "BuildForInfo for %s failed: find inputs/outputs failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Find][InputsAndOutputs] in node:%s failed.", node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
NodeUtils::UnlinkAll(*node); | NodeUtils::UnlinkAll(*node); | ||||
@@ -128,14 +132,16 @@ Status ForPass::BuildForInfo(const ComputeGraphPtr &root_graph, const NodePtr &n | |||||
if (for_body_name.empty()) { | if (for_body_name.empty()) { | ||||
REPORT_INNER_ERROR("E19999", "Get subgraph name from op:%s(%s) by index 0 failed", | REPORT_INNER_ERROR("E19999", "Get subgraph name from op:%s(%s) by index 0 failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "BuildForInfo for %s failed: sub_graph_name is empty.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][SubGraphName] from op:%s(%s) by index 0 failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ComputeGraphPtr for_body = root_graph->GetSubgraph(for_body_name); | ComputeGraphPtr for_body = root_graph->GetSubgraph(for_body_name); | ||||
if (for_body == nullptr) { | if (for_body == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Get subgraph from graph:%s by name:%s failed", | REPORT_INNER_ERROR("E19999", "Get subgraph from graph:%s by name:%s failed", | ||||
root_graph->GetName().c_str(), for_body_name.c_str()); | root_graph->GetName().c_str(), for_body_name.c_str()); | ||||
GELOGE(FAILED, "BuildForInfo for %s failed: for_body_graph is NULL.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][SubGraph] from graph:%s by name:%s failed", | |||||
root_graph->GetName().c_str(), for_body_name.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -162,13 +168,14 @@ Status ForPass::BuildForInfo(const ComputeGraphPtr &root_graph, const NodePtr &n | |||||
/// | /// | ||||
OutDataAnchorPtr ForPass::FindInputWithIndex(const NodePtr &node, uint32_t index) { | OutDataAnchorPtr ForPass::FindInputWithIndex(const NodePtr &node, uint32_t index) { | ||||
if (node == nullptr) { | if (node == nullptr) { | ||||
GELOGE(FAILED, "FindInputWithIndex failed: node is NULL."); | |||||
GELOGE(FAILED, "[Check][Param] node is nullptr."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
InDataAnchorPtr in_data_anchor = node->GetInDataAnchor(index); | InDataAnchorPtr in_data_anchor = node->GetInDataAnchor(index); | ||||
if (in_data_anchor == nullptr) { | if (in_data_anchor == nullptr) { | ||||
GELOGE(FAILED, "FindInputWithIndex %s:%u failed: in_data_anchor is NULL.", node->GetName().c_str(), index); | |||||
GELOGE(FAILED, "[Get][InDataAnchor] failed, In Data Anchor index:%u in node:%s is nullptr.", | |||||
index, node->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -234,9 +241,8 @@ Status ForPass::TranWhileInfo(const ComputeGraphPtr &graph, const ForInfo &for_i | |||||
std::string i_name = for_name + "_i"; | std::string i_name = for_name + "_i"; | ||||
NodePtr i_node = graph->AddNode(CreateConstDesc(i_name, 0)); | NodePtr i_node = graph->AddNode(CreateConstDesc(i_name, 0)); | ||||
if (i_node == nullptr) { | if (i_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(Const) to graph:%s failed", | |||||
i_name.c_str(), graph->GetName().c_str()); | |||||
GELOGE(FAILED, "TranWhileInfo failed: create i_node failed."); | |||||
REPORT_CALL_ERROR("E19999", "Add node:%s(Const) to graph:%s failed", i_name.c_str(), graph->GetName().c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s(Const) to graph:%s failed", i_name.c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddRePassNode(i_node); | AddRePassNode(i_node); | ||||
@@ -249,7 +255,9 @@ Status ForPass::TranWhileInfo(const ComputeGraphPtr &graph, const ForInfo &for_i | |||||
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | ||||
i_node->GetName().c_str(), i_node->GetType().c_str(), | i_node->GetName().c_str(), i_node->GetType().c_str(), | ||||
identity_node->GetName().c_str(), identity_node->GetType().c_str()); | identity_node->GetName().c_str(), identity_node->GetType().c_str()); | ||||
GELOGE(FAILED, "TranWhileInfo failed: Add data-edge %s:0->%s:0 failed.", i_name.c_str(), identity_name.c_str()); | |||||
GELOGE(FAILED, "[Add][Edge] between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||||
i_node->GetName().c_str(), i_node->GetType().c_str(), | |||||
identity_node->GetName().c_str(), identity_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddRePassNode(identity_node); | AddRePassNode(identity_node); | ||||
@@ -259,21 +267,22 @@ Status ForPass::TranWhileInfo(const ComputeGraphPtr &graph, const ForInfo &for_i | |||||
if (i_input == nullptr) { | if (i_input == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Out data anchor index:0 in op:%s(%s) is nullptr, check invalid", | REPORT_INNER_ERROR("E19999", "Out data anchor index:0 in op:%s(%s) is nullptr, check invalid", | ||||
identity_node->GetName().c_str(), identity_node->GetType().c_str()); | identity_node->GetName().c_str(), identity_node->GetType().c_str()); | ||||
GELOGE(FAILED, "TranWhileInfo failed: i_input is NULL."); | |||||
GELOGE(FAILED, "[Get][OutDataAnchor] failed, Out data anchor index:0 in op:%s(%s) is nullptr", | |||||
identity_node->GetName().c_str(), identity_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
OutDataAnchorPtr range_input = nullptr; | OutDataAnchorPtr range_input = nullptr; | ||||
OutDataAnchorPtr abs_delta_input = nullptr; | OutDataAnchorPtr abs_delta_input = nullptr; | ||||
if (CreateLoopInput(graph, for_info, range_input, abs_delta_input) != SUCCESS) { | if (CreateLoopInput(graph, for_info, range_input, abs_delta_input) != SUCCESS) { | ||||
GELOGE(FAILED, "TranWhileInfo failed: create loop input failed."); | |||||
GELOGE(FAILED, "[Create][LoopInput] failed, graph:%s.", graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
BuildWhileInfo(for_info, i_input, range_input, abs_delta_input, while_info); | BuildWhileInfo(for_info, i_input, range_input, abs_delta_input, while_info); | ||||
if (InsertWhileNode(graph, for_name + "_While", while_info) != SUCCESS) { | if (InsertWhileNode(graph, for_name + "_While", while_info) != SUCCESS) { | ||||
GELOGE(FAILED, "TranWhileInfo failed: insert while node failed."); | |||||
GELOGE(FAILED, "[Insert][WhileNode] in graph:%s failed.", graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -292,7 +301,7 @@ OpDescPtr ForPass::CreateConstDesc(const std::string &name, int32_t value) { | |||||
OpDescPtr const_op_desc = MakeShared<OpDesc>(name, CONSTANT); | OpDescPtr const_op_desc = MakeShared<OpDesc>(name, CONSTANT); | ||||
if (const_op_desc == nullptr) { | if (const_op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(FAILED, "Create op_desc failed, const:%s.", name.c_str()); | |||||
GELOGE(FAILED, "[New][OpDesc] failed."); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -300,21 +309,23 @@ OpDescPtr ForPass::CreateConstDesc(const std::string &name, int32_t value) { | |||||
GeTensorPtr const_value = MakeShared<GeTensor>(data_desc, reinterpret_cast<uint8_t *>(&value), sizeof(int32_t)); | GeTensorPtr const_value = MakeShared<GeTensor>(data_desc, reinterpret_cast<uint8_t *>(&value), sizeof(int32_t)); | ||||
if (const_value == nullptr) { | if (const_value == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | ||||
GELOGE(FAILED, "Create tensor failed, const:%s.", name.c_str()); | |||||
GELOGE(FAILED, "[New][GeTensor] failed"); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (!AttrUtils::SetTensor(const_op_desc, ATTR_NAME_WEIGHTS, const_value)) { | if (!AttrUtils::SetTensor(const_op_desc, ATTR_NAME_WEIGHTS, const_value)) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_WEIGHTS.c_str(), | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_WEIGHTS.c_str(), | ||||
const_op_desc->GetName().c_str(), const_op_desc->GetType().c_str()); | const_op_desc->GetName().c_str(), const_op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Set ATTR_NAME_WEIGHTS failed, const:%s.", name.c_str()); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_WEIGHTS.c_str(), | |||||
const_op_desc->GetName().c_str(), const_op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (const_op_desc->AddOutputDesc("y", data_desc) != GRAPH_SUCCESS) { | if (const_op_desc->AddOutputDesc("y", data_desc) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add ouput desc to op:%s(%s) failed, name:y", | REPORT_CALL_ERROR("E19999", "Add ouput desc to op:%s(%s) failed, name:y", | ||||
const_op_desc->GetName().c_str(), const_op_desc->GetType().c_str()); | const_op_desc->GetName().c_str(), const_op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Add output desc failed, const:%s.", name.c_str()); | |||||
GELOGE(FAILED, "[Add][OutputDesc] to op:%s(%s) failed, name:y", | |||||
const_op_desc->GetName().c_str(), const_op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -360,7 +371,7 @@ Status ForPass::CreateLoopInput(const ComputeGraphPtr &graph, const ForInfo &for | |||||
std::string error_msg; | std::string error_msg; | ||||
if ((graph_builder.Build(error_code, error_msg) == nullptr) || (error_code != GRAPH_SUCCESS)) { | if ((graph_builder.Build(error_code, error_msg) == nullptr) || (error_code != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Add loop input node to graph:%s failed", graph->GetName().c_str()); | REPORT_CALL_ERROR("E19999", "Add loop input node to graph:%s failed", graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Create loop_count node failed: error_code:%u, error_msg:%s.", error_code, error_msg.c_str()); | |||||
GELOGE(FAILED, "[Create][LoopInputNode] failed: error_code:%u, error_msg:%s.", error_code, error_msg.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -373,7 +384,7 @@ Status ForPass::CreateLoopInput(const ComputeGraphPtr &graph, const ForInfo &for | |||||
NodePtr loop_count_node = graph_builder.GetNode(abs_name_1); | NodePtr loop_count_node = graph_builder.GetNode(abs_name_1); | ||||
if ((abs_delta_node == nullptr) || (loop_count_node == nullptr)) { | if ((abs_delta_node == nullptr) || (loop_count_node == nullptr)) { | ||||
REPORT_CALL_ERROR("E19999", "Add loop input node to graph:%s failed", graph->GetName().c_str()); | REPORT_CALL_ERROR("E19999", "Add loop input node to graph:%s failed", graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Create loop node failed: node is NULL."); | |||||
GELOGE(FAILED, "[Create][LoopNode] failed: node is nullptr, graph:%s.", graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -467,14 +478,15 @@ Status ForPass::InsertWhileNode(const ComputeGraphPtr &graph, const std::string | |||||
if (while_node == nullptr) { | if (while_node == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Create while node failed, name:%s.", name.c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
AddRePassNode(while_node); | AddRePassNode(while_node); | ||||
while_info.while_node = while_node; | while_info.while_node = while_node; | ||||
if (BuildWhileLink(while_info) != SUCCESS) { | if (BuildWhileLink(while_info) != SUCCESS) { | ||||
GELOGE(FAILED, "Build while link-edge failed, name:%s.", name.c_str()); | |||||
GELOGE(FAILED, "[Build][WhileLink] failed, node:%s.", while_node->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -500,7 +512,7 @@ Status ForPass::BuildWhileLink(const WhileInfo &while_info) { | |||||
continue; | continue; | ||||
} | } | ||||
GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(peer_out_anchor, in_data_anchor), | GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(peer_out_anchor, in_data_anchor), | ||||
"Add data-edge %s:%d->%s:%zu failed.", | |||||
"[Add][DataEdge] %s:%d->%s:%zu failed.", | |||||
peer_out_anchor->GetOwnerNode()->GetName().c_str(), peer_out_anchor->GetIdx(), | peer_out_anchor->GetOwnerNode()->GetName().c_str(), peer_out_anchor->GetIdx(), | ||||
while_node->GetName().c_str(), i); | while_node->GetName().c_str(), i); | ||||
} | } | ||||
@@ -511,7 +523,7 @@ Status ForPass::BuildWhileLink(const WhileInfo &while_info) { | |||||
GE_CHECK_NOTNULL(out_data_anchor); | GE_CHECK_NOTNULL(out_data_anchor); | ||||
for (auto &peer_in_anchor : while_info.data_outputs[i]) { | for (auto &peer_in_anchor : while_info.data_outputs[i]) { | ||||
GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(out_data_anchor, peer_in_anchor), | GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(out_data_anchor, peer_in_anchor), | ||||
"Add data-edge %s:%zu->%s:%d failed.", | |||||
"[Add][DataEdge] %s:%zu->%s:%d failed.", | |||||
while_node->GetName().c_str(), i + kWhileOutputIndex, | while_node->GetName().c_str(), i + kWhileOutputIndex, | ||||
peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | ||||
} | } | ||||
@@ -521,7 +533,7 @@ Status ForPass::BuildWhileLink(const WhileInfo &while_info) { | |||||
GE_CHECK_NOTNULL(in_ctrl_anchor); | GE_CHECK_NOTNULL(in_ctrl_anchor); | ||||
for (auto &peer_out_anchor : while_info.ctrl_inputs) { | for (auto &peer_out_anchor : while_info.ctrl_inputs) { | ||||
GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(peer_out_anchor, in_ctrl_anchor), | GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(peer_out_anchor, in_ctrl_anchor), | ||||
"Add ctrl-edge %s->%s failed.", | |||||
"[Add][CtrlEdge] %s->%s failed.", | |||||
peer_out_anchor->GetOwnerNode()->GetName().c_str(), | peer_out_anchor->GetOwnerNode()->GetName().c_str(), | ||||
in_ctrl_anchor->GetOwnerNode()->GetName().c_str()); | in_ctrl_anchor->GetOwnerNode()->GetName().c_str()); | ||||
} | } | ||||
@@ -530,7 +542,7 @@ Status ForPass::BuildWhileLink(const WhileInfo &while_info) { | |||||
GE_CHECK_NOTNULL(out_ctrl_anchor); | GE_CHECK_NOTNULL(out_ctrl_anchor); | ||||
for (auto &peer_in_anchor : while_info.ctrl_outputs) { | for (auto &peer_in_anchor : while_info.ctrl_outputs) { | ||||
GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(out_ctrl_anchor, peer_in_anchor), | GE_CHK_GRAPH_STATUS_RET(GraphUtils::AddEdge(out_ctrl_anchor, peer_in_anchor), | ||||
"Add ctrl-edge %s->%s failed.", | |||||
"[Add][CtrlEdge] %s->%s failed.", | |||||
out_ctrl_anchor->GetOwnerNode()->GetName().c_str(), | out_ctrl_anchor->GetOwnerNode()->GetName().c_str(), | ||||
peer_in_anchor->GetOwnerNode()->GetName().c_str()); | peer_in_anchor->GetOwnerNode()->GetName().c_str()); | ||||
} | } | ||||
@@ -585,7 +597,7 @@ ComputeGraphPtr ForPass::BuildCondGraph(WhileInfo &while_info) { | |||||
ComputeGraphPtr cond_graph = graph_builder.Build(error_code, error_msg); | ComputeGraphPtr cond_graph = graph_builder.Build(error_code, error_msg); | ||||
if (cond_graph == nullptr) { | if (cond_graph == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Build graph:%s failed", cond_name.c_str()); | REPORT_CALL_ERROR("E19999", "Build graph:%s failed", cond_name.c_str()); | ||||
GELOGE(FAILED, "Build cond_graph failed: error_code:%u, error_msg:%s.", error_code, error_msg.c_str()); | |||||
GELOGE(FAILED, "[Build][CondGraph] failed: error_code:%u, error_msg:%s.", error_code, error_msg.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -667,13 +679,13 @@ ComputeGraphPtr ForPass::BuildBodyGraph(WhileInfo &while_info) { | |||||
std::string error_msg; | std::string error_msg; | ||||
ComputeGraphPtr body_graph = graph_builder.Build(error_code, error_msg); | ComputeGraphPtr body_graph = graph_builder.Build(error_code, error_msg); | ||||
if (body_graph == nullptr) { | if (body_graph == nullptr) { | ||||
GELOGE(FAILED, "Build body_graph failed: error_code:%u, error_msg:%s.", error_code, error_msg.c_str()); | |||||
GELOGE(FAILED, "[Build][BodyGraph] failed: error_code:%u, error_msg:%s.", error_code, error_msg.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
NodePtr sub_graph_node = graph_builder.GetNode(sub_graph_node_name); | NodePtr sub_graph_node = graph_builder.GetNode(sub_graph_node_name); | ||||
if (sub_graph_node == nullptr) { | if (sub_graph_node == nullptr) { | ||||
GELOGE(FAILED, "Get sub_graph_node failed: name:%s.", sub_graph_node_name.c_str()); | |||||
GELOGE(FAILED, "[Get][Node] by name:%s failed.", sub_graph_node_name.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
while_info.sub_graph_node = sub_graph_node; | while_info.sub_graph_node = sub_graph_node; | ||||
@@ -699,9 +711,8 @@ OpDescPtr ForPass::CreateSubgraphOpDesc(const std::string &name, uint32_t input_ | |||||
OpDescPtr op_desc = op_desc_builder.Build(); | OpDescPtr op_desc = op_desc_builder.Build(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "Build op_desc:%s(%s) failed", | |||||
name.c_str(), PARTITIONEDCALL); | |||||
GELOGE(FAILED, "Create op_desc for subgraph node failed, name:%s.", name.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Build op_desc:%s(%s) failed", name.c_str(), PARTITIONEDCALL); | |||||
GELOGE(FAILED, "[Build][OpDesc] %s(%s) failed", name.c_str(), PARTITIONEDCALL); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -35,14 +35,14 @@ namespace ge { | |||||
Status FuseDataNodesWithCommonInputPass::Run(ge::ComputeGraphPtr graph) { | Status FuseDataNodesWithCommonInputPass::Run(ge::ComputeGraphPtr graph) { | ||||
if (graph == nullptr) { | if (graph == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | ||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "Compute graph is null."); | |||||
GELOGE(GE_GRAPH_PARAM_NULLPTR, "[Check][Param] Compute graph is nullptr."); | |||||
return GE_GRAPH_PARAM_NULLPTR; | return GE_GRAPH_PARAM_NULLPTR; | ||||
} | } | ||||
GELOGD("FuseDataNodesWithCommonInputPass in."); | GELOGD("FuseDataNodesWithCommonInputPass in."); | ||||
// key: subgraph, value:--key: peer out anchor to parent node, --value: parent indexes to parent node | // key: subgraph, value:--key: peer out anchor to parent node, --value: parent indexes to parent node | ||||
map<ComputeGraphPtr, map<OutDataAnchorPtr, set<uint32_t>>> subgraphs_to_need_fuse_nodes_info; | map<ComputeGraphPtr, map<OutDataAnchorPtr, set<uint32_t>>> subgraphs_to_need_fuse_nodes_info; | ||||
if (InitNeedFuseNodesInfo(graph, subgraphs_to_need_fuse_nodes_info) != SUCCESS) { | if (InitNeedFuseNodesInfo(graph, subgraphs_to_need_fuse_nodes_info) != SUCCESS) { | ||||
GELOGE(FAILED, "InitNeedFuseNodesInfo failed."); | |||||
GELOGE(FAILED, "[Init][NeedFuseNodesInfo] for graph:%s failed.", graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return FuseDataNodes(subgraphs_to_need_fuse_nodes_info); | return FuseDataNodes(subgraphs_to_need_fuse_nodes_info); | ||||
@@ -116,7 +116,8 @@ Status FuseDataNodesWithCommonInputPass::FuseDataNodes( | |||||
if (GraphUtils::RemoveNodeWithoutRelink(subgraph, node) != SUCCESS) { | if (GraphUtils::RemoveNodeWithoutRelink(subgraph, node) != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | ||||
node->GetName().c_str(), node->GetType().c_str(), subgraph->GetName().c_str()); | node->GetName().c_str(), node->GetType().c_str(), subgraph->GetName().c_str()); | ||||
GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][Node] %s(%s) without relink in graph:%s failed", | |||||
node->GetName().c_str(), node->GetType().c_str(), subgraph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -37,7 +37,8 @@ using domi::SUCCESS; | |||||
namespace ge { | namespace ge { | ||||
Status GetOriginalFormatPass::Run(ge::ComputeGraphPtr graph) { | Status GetOriginalFormatPass::Run(ge::ComputeGraphPtr graph) { | ||||
GE_CHECK_NOTNULL(graph); | GE_CHECK_NOTNULL(graph); | ||||
GE_RETURN_WITH_LOG_IF_ERROR(SetOriginalFormat(graph), "SetOriginalFormat failed"); | |||||
GE_RETURN_WITH_LOG_IF_ERROR(SetOriginalFormat(graph), | |||||
"[Set][OriginalFormat] for graph:%s failed", graph->GetName().c_str()); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -54,7 +55,8 @@ Status GetOriginalFormatPass::SetOriginalFormat(const ge::ComputeGraphPtr &graph | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_INFERRED_FORMAT.c_str(), | ATTR_NAME_INFERRED_FORMAT.c_str(), | ||||
node_ptr->GetName().c_str(), node_ptr->GetType().c_str()); | node_ptr->GetName().c_str(), node_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "set ATTR_NAME_INFERRED_FORMAT failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_INFERRED_FORMAT.c_str(), | |||||
node_ptr->GetName().c_str(), node_ptr->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
} | } | ||||
@@ -70,13 +72,15 @@ Status GetOriginalFormatPass::SetOriginalFormat(const ge::ComputeGraphPtr &graph | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_FORMAT.c_str(), | ATTR_NAME_FORMAT.c_str(), | ||||
desc_ptr->GetName().c_str(), desc_ptr->GetType().c_str()); | desc_ptr->GetName().c_str(), desc_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "set ATTR_NAME_FORMAT failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_FORMAT.c_str(), | |||||
desc_ptr->GetName().c_str(), desc_ptr->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetInt(desc_ptr, ATTR_NAME_INFERRED_FORMAT, ori_format), | GE_IF_BOOL_EXEC(!AttrUtils::SetInt(desc_ptr, ATTR_NAME_INFERRED_FORMAT, ori_format), | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_INFERRED_FORMAT.c_str(), | ATTR_NAME_INFERRED_FORMAT.c_str(), | ||||
desc_ptr->GetName().c_str(), desc_ptr->GetType().c_str()); | desc_ptr->GetName().c_str(), desc_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "set ATTR_NAME_INFERRED_FORMAT failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_INFERRED_FORMAT.c_str(), | |||||
desc_ptr->GetName().c_str(), desc_ptr->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
continue; | continue; | ||||
} | } | ||||
@@ -142,7 +146,8 @@ Status GetOriginalFormatPass::SetOriginalFormat(const ge::ComputeGraphPtr &graph | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_IGNORE_PRED_FORMAT.c_str(), | ATTR_NAME_IGNORE_PRED_FORMAT.c_str(), | ||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "remove edge failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_IGNORE_PRED_FORMAT.c_str(), | |||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
} | } | ||||
@@ -152,23 +157,27 @@ Status GetOriginalFormatPass::SetOriginalFormat(const ge::ComputeGraphPtr &graph | |||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_FORMAT.c_str(), | ATTR_NAME_FORMAT.c_str(), | ||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "set ATTR_NAME_FORMAT failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_FORMAT.c_str(), | |||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
GE_IF_BOOL_EXEC(!AttrUtils::SetInt(tmp_op_ptr, ATTR_NAME_INFERRED_FORMAT, ori_format), | GE_IF_BOOL_EXEC(!AttrUtils::SetInt(tmp_op_ptr, ATTR_NAME_INFERRED_FORMAT, ori_format), | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_INFERRED_FORMAT.c_str(), | ATTR_NAME_INFERRED_FORMAT.c_str(), | ||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "set ATTR_NAME_INFERRED_FORMAT failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_INFERRED_FORMAT.c_str(), | |||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
} else { | } else { | ||||
int64_t existingFormat = 0; | int64_t existingFormat = 0; | ||||
GE_RETURN_WITH_LOG_IF_FALSE(AttrUtils::GetInt(tmp_op_ptr, ATTR_NAME_FORMAT, existingFormat), | GE_RETURN_WITH_LOG_IF_FALSE(AttrUtils::GetInt(tmp_op_ptr, ATTR_NAME_FORMAT, existingFormat), | ||||
"Get existing_format attr failed"); | |||||
"[Get][Attr] %s from op:%s(%s) failed", ATTR_NAME_FORMAT.c_str(), | |||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | |||||
if (!AttrUtils::SetInt(tmp_op_ptr, ATTR_NAME_INFERRED_FORMAT, existingFormat)) { | if (!AttrUtils::SetInt(tmp_op_ptr, ATTR_NAME_INFERRED_FORMAT, existingFormat)) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", | ||||
ATTR_NAME_INFERRED_FORMAT.c_str(), | ATTR_NAME_INFERRED_FORMAT.c_str(), | ||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | ||||
GELOGE(FAILED, "set ATTR_NAME_INFERRED_FORMAT failed"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_INFERRED_FORMAT.c_str(), | |||||
tmp_op_ptr->GetName().c_str(), tmp_op_ptr->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -177,7 +186,7 @@ Status GetOriginalFormatPass::SetOriginalFormat(const ge::ComputeGraphPtr &graph | |||||
} | } | ||||
bool GetOriginalFormatPass::IsFormatTranspose(const ge::OpDescPtr op_ptr, int32_t ori_format) { | bool GetOriginalFormatPass::IsFormatTranspose(const ge::OpDescPtr op_ptr, int32_t ori_format) { | ||||
GE_CHK_BOOL_EXEC(op_ptr != nullptr, return false, "opdef is nullptr"); | |||||
GE_CHK_BOOL_EXEC(op_ptr != nullptr, return false, "[Check][Param] op_ptr is nullptr"); | |||||
if (op_ptr->GetType() == PERMUTE) { | if (op_ptr->GetType() == PERMUTE) { | ||||
vector<int32_t> index_list; | vector<int32_t> index_list; | ||||
GE_IF_BOOL_EXEC(!AttrUtils::GetListInt(op_ptr, PERMUTE_ATTR_ORDER, index_list), return false); | GE_IF_BOOL_EXEC(!AttrUtils::GetListInt(op_ptr, PERMUTE_ATTR_ORDER, index_list), return false); | ||||
@@ -41,7 +41,7 @@ NodePtr GlobalStepInsertPass::InsertOp(ComputeGraphPtr &compute_graph, | |||||
OpDescPtr op_desc = MakeShared<OpDesc>(node_name, node_type); | OpDescPtr op_desc = MakeShared<OpDesc>(node_name, node_type); | ||||
GE_IF_BOOL_EXEC(op_desc == nullptr, | GE_IF_BOOL_EXEC(op_desc == nullptr, | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(FAILED,"Make OpDesc failed"); | |||||
GELOGE(FAILED,"[New][OpDesc] failed"); | |||||
return nullptr); | return nullptr); | ||||
for (auto &input_desc : input_list) { | for (auto &input_desc : input_list) { | ||||
@@ -49,7 +49,8 @@ NodePtr GlobalStepInsertPass::InsertOp(ComputeGraphPtr &compute_graph, | |||||
if (graph_status != GRAPH_SUCCESS) { | if (graph_status != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Add node:%s intput desc failed, error=%u.", node_name.c_str(), graph_status); | |||||
GELOGE(FAILED, "[Add][InputDesc] to op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
@@ -59,17 +60,19 @@ NodePtr GlobalStepInsertPass::InsertOp(ComputeGraphPtr &compute_graph, | |||||
if (graph_status != GRAPH_SUCCESS) { | if (graph_status != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Add node:%s output desc failed, error=%u.", node_name.c_str(), graph_status); | |||||
GELOGE(FAILED, "[Add][OutputDesc] to op:%s(%s) failed, ret:%u.", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), graph_status); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
GE_IF_BOOL_EXEC(compute_graph == nullptr, GELOGE(FAILED,"compute_graph is nullptr"); return nullptr); | |||||
GE_IF_BOOL_EXEC(compute_graph == nullptr, GELOGE(FAILED,"[Check][Param] compute_graph is nullptr"); return nullptr); | |||||
NodePtr node = compute_graph->AddNode(op_desc); | NodePtr node = compute_graph->AddNode(op_desc); | ||||
GE_IF_BOOL_EXEC(node == nullptr, | GE_IF_BOOL_EXEC(node == nullptr, | ||||
REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), compute_graph->GetName().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str(), compute_graph->GetName().c_str()); | ||||
GELOGE(FAILED, "add node failed, name:%s, type:%s.", node_name.c_str(), node_type.c_str()); | |||||
GELOGE(FAILED, "[Add][Node] %s(%s) to graph:%s failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str(), compute_graph->GetName().c_str()); | |||||
return nullptr); | return nullptr); | ||||
GELOGI("Insert op success, name:%s, type:%s.", node_name.c_str(), node_type.c_str()); | GELOGI("Insert op success, name:%s, type:%s.", node_name.c_str(), node_type.c_str()); | ||||
@@ -107,7 +110,7 @@ Status GlobalStepInsertPass::Run(ComputeGraphPtr compute_graph) { | |||||
NodePtr global_step = InsertOp(compute_graph, VARIABLE, NODE_NAME_GLOBAL_STEP, | NodePtr global_step = InsertOp(compute_graph, VARIABLE, NODE_NAME_GLOBAL_STEP, | ||||
input_desc_list, output_desc_list); | input_desc_list, output_desc_list); | ||||
if (global_step == nullptr) { | if (global_step == nullptr) { | ||||
GELOGE(FAILED, "Add global_step node failed, global_step is null."); | |||||
GELOGE(FAILED, "[Insert][Op] to graph:%s failed.", compute_graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -117,7 +120,9 @@ Status GlobalStepInsertPass::Run(ComputeGraphPtr compute_graph) { | |||||
REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | ||||
global_step->GetName().c_str(), global_step->GetType().c_str(), | global_step->GetName().c_str(), global_step->GetType().c_str(), | ||||
output_node->GetName().c_str(), output_node->GetType().c_str()); | output_node->GetName().c_str(), output_node->GetType().c_str()); | ||||
GELOGE(FAILED, "Add global_step to netoutput edge failed, add_ret=%u.", add_ret); | |||||
GELOGE(FAILED, "[Add][ControlEdge] between op:%s(%s) and op:%s(%s) failed", | |||||
global_step->GetName().c_str(), global_step->GetType().c_str(), | |||||
output_node->GetName().c_str(), output_node->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGD("Add global_step to netoutput edge in graph %u success", compute_graph->GetGraphID()); | GELOGD("Add global_step to netoutput edge in graph %u success", compute_graph->GetGraphID()); | ||||
@@ -36,19 +36,20 @@ Status GuaranteeConstPass::Run(NodePtr &node) { | |||||
string type; | string type; | ||||
Status status_ret = GetOriginalType(node, type); | Status status_ret = GetOriginalType(node, type); | ||||
if (status_ret != SUCCESS) { | if (status_ret != SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Get original type for node:%s failed", | |||||
node->GetName().c_str()); | |||||
GELOGE(status_ret, "GuaranteeConstPass get original type fail."); | |||||
REPORT_CALL_ERROR("E19999", "Get original type for node:%s failed", node->GetName().c_str()); | |||||
GELOGE(status_ret, "[Get][OriginalType] for node:%s failed", node->GetName().c_str()); | |||||
return status_ret; | return status_ret; | ||||
} | } | ||||
if (type != GUARANTEECONST) { | if (type != GUARANTEECONST) { | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
if (node->GetOpDesc()->GetAllInputsDesc().size() != kGuaranteeConstInputsSize) { | if (node->GetOpDesc()->GetAllInputsDesc().size() != kGuaranteeConstInputsSize) { | ||||
REPORT_CALL_ERROR("E19999", "Num:%zu of input desc node:%s(%s) not equal to %u, " | |||||
REPORT_CALL_ERROR("E19999", "Num:%zu of input desc in node:%s(%s) not equal to %u, " | |||||
"check invalid", node->GetOpDesc()->GetAllInputsDesc().size(), | "check invalid", node->GetOpDesc()->GetAllInputsDesc().size(), | ||||
node->GetName().c_str(), node->GetType().c_str(), kGuaranteeConstInputsSize); | node->GetName().c_str(), node->GetType().c_str(), kGuaranteeConstInputsSize); | ||||
GELOGE(PARAM_INVALID, "input size error. Input size:%zu", node->GetOpDesc()->GetAllInputsDesc().size()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Num:%zu of input desc in node:%s(%s) not equal to %u", | |||||
node->GetOpDesc()->GetAllInputsDesc().size(), | |||||
node->GetName().c_str(), node->GetType().c_str(), kGuaranteeConstInputsSize); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
// [Cascade pointer] | // [Cascade pointer] | ||||
@@ -57,12 +58,13 @@ Status GuaranteeConstPass::Run(NodePtr &node) { | |||||
// Input tensor cannot be a resource variable handle. | // Input tensor cannot be a resource variable handle. | ||||
const DataType &input_dtype = in_desc->GetDataType(); | const DataType &input_dtype = in_desc->GetDataType(); | ||||
if (input_dtype == DT_RESOURCE) { | if (input_dtype == DT_RESOURCE) { | ||||
REPORT_CALL_ERROR("E19999", | |||||
"Data type:%s of op:%s(%s) input0 tensor not equal to %s, check invalid", | |||||
REPORT_CALL_ERROR("E19999", "Data type:%s of op:%s(%s) input0 tensor not equal to %s, check invalid", | |||||
TypeUtils::DataTypeToSerialString(input_dtype).c_str(), | TypeUtils::DataTypeToSerialString(input_dtype).c_str(), | ||||
node->GetName().c_str(), node->GetType().c_str(), | node->GetName().c_str(), node->GetType().c_str(), | ||||
TypeUtils::DataTypeToSerialString(DT_RESOURCE).c_str()); | TypeUtils::DataTypeToSerialString(DT_RESOURCE).c_str()); | ||||
GELOGE(FAILED, "Input tensor cannot be a resource variable handle in [%s].", node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Data type:%s of op:%s(%s) input0 tensor not equal to %s", | |||||
TypeUtils::DataTypeToSerialString(input_dtype).c_str(), | |||||
node->GetName().c_str(), node->GetType().c_str(), TypeUtils::DataTypeToSerialString(DT_RESOURCE).c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -116,7 +116,8 @@ Status GetDataDimN(const ge::NodePtr &data_node, ge::Format format, int64_t &bat | |||||
TypeUtils::FormatToSerialString(format), | TypeUtils::FormatToSerialString(format), | ||||
"only format " + TypeUtils::FormatToSerialString(FORMAT_NCHW) + " and " | "only format " + TypeUtils::FormatToSerialString(FORMAT_NCHW) + " and " | ||||
+ TypeUtils::FormatToSerialString(FORMAT_NHWC) + " supported"})); | + TypeUtils::FormatToSerialString(FORMAT_NHWC) + " supported"})); | ||||
GELOGE(PARAM_INVALID, "Not support data format: %s", TypeUtils::FormatToSerialString(format).c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Not support data format:%s, node:%s", | |||||
TypeUtils::FormatToSerialString(format).c_str(), data_node->GetName().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -125,7 +126,8 @@ Status GetDataDimN(const ge::NodePtr &data_node, ge::Format format, int64_t &bat | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, | ||||
{data_node->GetName() + " shape size", | {data_node->GetName() + " shape size", | ||||
to_string(shape.size()), errormsg}); | to_string(shape.size()), errormsg}); | ||||
GELOGE(PARAM_INVALID, "The shape size of this node [%s] which linked dynamic aipp must be in range[3, 4], but is %zu", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] The shape size of this node [%s] " | |||||
"which linked dynamic aipp must be in range[3, 4], but is %zu", | |||||
data_node->GetName().c_str(), shape.size()); | data_node->GetName().c_str(), shape.size()); | ||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -153,7 +155,8 @@ Format GetAndCheckFormat() { | |||||
case domi::DOMI_TENSOR_NHWC: | case domi::DOMI_TENSOR_NHWC: | ||||
return FORMAT_NHWC; | return FORMAT_NHWC; | ||||
default: | default: | ||||
GELOGE(PARAM_INVALID, "Unexpected format found %d", static_cast<int>(GetLocalOmgContext().format)); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Unexpected format found %d", | |||||
static_cast<int>(GetLocalOmgContext().format)); | |||||
return FORMAT_ND; | return FORMAT_ND; | ||||
} | } | ||||
} | } | ||||
@@ -163,6 +166,7 @@ Status AippOp::Init(domi::AippOpParams *aipp_params) { | |||||
aipp_params_ = new (std::nothrow) domi::AippOpParams(); | aipp_params_ = new (std::nothrow) domi::AippOpParams(); | ||||
if (aipp_params_ == nullptr) { | if (aipp_params_ == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New AippOpParams failed"); | REPORT_CALL_ERROR("E19999", "New AippOpParams failed"); | ||||
GELOGE(FAILED, "[New][AippOpParams] failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
aipp_params_->CopyFrom(*aipp_params); | aipp_params_->CopyFrom(*aipp_params); | ||||
@@ -182,10 +186,10 @@ Status AippOp::InsertAippToGraph(ComputeGraphPtr &graph, std::string &aippConfig | |||||
std::vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>> target_edges; | std::vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>> target_edges; | ||||
if (this->ConvertRelatedInputNameToRank() != SUCCESS) { | if (this->ConvertRelatedInputNameToRank() != SUCCESS) { | ||||
GELOGE(FAILED, "AippOp: convert related input name to rank failed."); | |||||
GELOGE(FAILED, "[Call][ConvertRelatedInputNameToRank] failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_CHK_STATUS_RET(this->GetTargetPosition(graph, target_input, target_edges), "Get data nodes position failed"); | |||||
GE_CHK_STATUS_RET(this->GetTargetPosition(graph, target_input, target_edges), "[Get][TargetPosition] failed"); | |||||
std::map<OutDataAnchorPtr, NodePtr> out_anchors_to_aipp; | std::map<OutDataAnchorPtr, NodePtr> out_anchors_to_aipp; | ||||
for (auto &out_in_anchors : target_edges) { | for (auto &out_in_anchors : target_edges) { | ||||
@@ -203,7 +207,12 @@ Status AippOp::InsertAippToGraph(ComputeGraphPtr &graph, std::string &aippConfig | |||||
out_in_anchors.first->GetOwnerNode()->GetType().c_str(), | out_in_anchors.first->GetOwnerNode()->GetType().c_str(), | ||||
out_in_anchors.second->GetOwnerNode()->GetName().c_str(), | out_in_anchors.second->GetOwnerNode()->GetName().c_str(), | ||||
out_in_anchors.second->GetOwnerNode()->GetType().c_str()); | out_in_anchors.second->GetOwnerNode()->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to link edges for aipp node %s", aipp->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Insert][Node] %s(%s) between op:%s(%s) and op:%s:%s failed", | |||||
aipp->GetName().c_str(), aipp->GetType().c_str(), | |||||
out_in_anchors.first->GetOwnerNode()->GetName().c_str(), | |||||
out_in_anchors.first->GetOwnerNode()->GetType().c_str(), | |||||
out_in_anchors.second->GetOwnerNode()->GetName().c_str(), | |||||
out_in_anchors.second->GetOwnerNode()->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -211,7 +220,7 @@ Status AippOp::InsertAippToGraph(ComputeGraphPtr &graph, std::string &aippConfig | |||||
if (GetAippMode() == domi::AippOpParams::dynamic) { | if (GetAippMode() == domi::AippOpParams::dynamic) { | ||||
ret = CreateAippData(aipp); | ret = CreateAippData(aipp); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "Failed to create aipp data for aipp %s data %s", aipp->GetName().c_str(), | |||||
GELOGE(INTERNAL_ERROR, "[Create][AippData] for aipp %s data %s failed", aipp->GetName().c_str(), | |||||
out_in_anchors.first->GetOwnerNode()->GetName().c_str()); | out_in_anchors.first->GetOwnerNode()->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -226,7 +235,7 @@ Status AippOp::InsertAippToGraph(ComputeGraphPtr &graph, std::string &aippConfig | |||||
aipp->GetName().c_str(), aipp->GetType().c_str(), | aipp->GetName().c_str(), aipp->GetType().c_str(), | ||||
out_in_anchors.second->GetOwnerNode()->GetName().c_str(), | out_in_anchors.second->GetOwnerNode()->GetName().c_str(), | ||||
out_in_anchors.second->GetOwnerNode()->GetType().c_str()); | out_in_anchors.second->GetOwnerNode()->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to link aipp %s to the peer node %s", aipp->GetName().c_str(), | |||||
GELOGE(INTERNAL_ERROR, "[Call][LinkFrom] Failed to link aipp %s to the peer node %s", aipp->GetName().c_str(), | |||||
out_in_anchors.second->GetOwnerNode()->GetName().c_str()); | out_in_anchors.second->GetOwnerNode()->GetName().c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -242,7 +251,7 @@ NodePtr AippOp::CreateAipp(const OutDataAnchorPtr &out_anchor, | |||||
auto aipp_opdesc_ptr = MakeShared<OpDesc>(current_name, AIPP); | auto aipp_opdesc_ptr = MakeShared<OpDesc>(current_name, AIPP); | ||||
if (aipp_opdesc_ptr == nullptr) { | if (aipp_opdesc_ptr == nullptr) { | ||||
REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | ||||
GELOGE(OUT_OF_MEMORY, "Failed to alloc aipp desc, name %s", current_name.c_str()); | |||||
GELOGE(OUT_OF_MEMORY, "[New][OpDesc] failed, name %s", current_name.c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -271,8 +280,8 @@ NodePtr AippOp::CreateAipp(const OutDataAnchorPtr &out_anchor, | |||||
REPORT_CALL_ERROR("E19999", "Update the output desc from node:%s(%s) to aipp:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Update the output desc from node:%s(%s) to aipp:%s(%s) failed", | ||||
node_desc->GetName().c_str(), node_desc->GetType().c_str(), | node_desc->GetName().c_str(), node_desc->GetType().c_str(), | ||||
aipp_opdesc_ptr->GetName().c_str(), aipp_opdesc_ptr->GetType().c_str()); | aipp_opdesc_ptr->GetName().c_str(), aipp_opdesc_ptr->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to update the output desc from node %s to aipp %s", node_desc->GetName().c_str(), | |||||
aipp_opdesc_ptr->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Call][UpdateInputDesc] Failed to update the output desc from node %s to aipp %s", | |||||
node_desc->GetName().c_str(), aipp_opdesc_ptr->GetName().c_str()); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -283,25 +292,33 @@ Status AippOp::AddAippAttrbutes(const OpDescPtr &op_desc, const std::string &aip | |||||
GeAttrValue::NAMED_ATTRS aipp_attr; | GeAttrValue::NAMED_ATTRS aipp_attr; | ||||
ConvertParamToAttr(aipp_attr); | ConvertParamToAttr(aipp_attr); | ||||
GE_CHK_BOOL_RET_STATUS(AttrUtils::SetNamedAttrs(op_desc, ATTR_NAME_AIPP, aipp_attr), | GE_CHK_BOOL_RET_STATUS(AttrUtils::SetNamedAttrs(op_desc, ATTR_NAME_AIPP, aipp_attr), | ||||
INTERNAL_ERROR, "Set name attrs for aipp node failed"); | |||||
INTERNAL_ERROR, "[Set][NamedAttrs] %s for aipp node:%s failed", ATTR_NAME_AIPP.c_str(), | |||||
op_desc->GetName().c_str()); | |||||
GE_CHK_BOOL_RET_STATUS(AttrUtils::SetStr(op_desc, kAippConfigPath, aipp_cfg_path), | GE_CHK_BOOL_RET_STATUS(AttrUtils::SetStr(op_desc, kAippConfigPath, aipp_cfg_path), | ||||
INTERNAL_ERROR, "Set config file path attr for aipp node failed"); | |||||
INTERNAL_ERROR, "[Set][Attr] config file path for aipp node:%s failed", | |||||
op_desc->GetName().c_str()); | |||||
std::vector<std::string> empty_names; | std::vector<std::string> empty_names; | ||||
GE_CHK_BOOL_RET_STATUS(AttrUtils::SetListStr(op_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, empty_names), | GE_CHK_BOOL_RET_STATUS(AttrUtils::SetListStr(op_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, empty_names), | ||||
INTERNAL_ERROR, "Set ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES attr for aipp node failed"); | |||||
INTERNAL_ERROR, "[Set][Attr] %s for aipp node:%s failed", | |||||
ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES.c_str(), op_desc->GetName().c_str()); | |||||
GE_CHK_BOOL_RET_STATUS(AttrUtils::SetInt(op_desc, kCurrentAippIndex, index), | GE_CHK_BOOL_RET_STATUS(AttrUtils::SetInt(op_desc, kCurrentAippIndex, index), | ||||
INTERNAL_ERROR, "Set kCurrentAippIndex attr for aipp node failed"); | |||||
INTERNAL_ERROR, "[Set][Attr] %s for aipp node:%s failed", kCurrentAippIndex, | |||||
op_desc->GetName().c_str()); | |||||
// add input/output desc | // add input/output desc | ||||
GeTensorDesc tensor; | GeTensorDesc tensor; | ||||
GE_CHK_GRAPH_STATUS_RET(op_desc->AddInputDesc("images", tensor), "Failed to add input images for aipp node"); | |||||
GE_CHK_GRAPH_STATUS_RET(op_desc->AddInputDesc("images", tensor), | |||||
"[Add][InputDesc] images for aipp node:%s failed", op_desc->GetName().c_str()); | |||||
if (GetAippMode() == domi::AippOpParams::dynamic) { | if (GetAippMode() == domi::AippOpParams::dynamic) { | ||||
GE_CHK_GRAPH_STATUS_RET(op_desc->AddOptionalInputDesc("params", tensor), "Failed to add params for aipp node"); | |||||
GE_CHK_GRAPH_STATUS_RET(op_desc->AddOptionalInputDesc("params", tensor), | |||||
"[Call][AddOptionalInputDesc] Failed to add params for aipp node:%s", | |||||
op_desc->GetName().c_str()); | |||||
} | } | ||||
GE_CHK_GRAPH_STATUS_RET(op_desc->AddOutputDesc("features", tensor), "Failed to add output features for aipp node"); | |||||
GE_CHK_GRAPH_STATUS_RET(op_desc->AddOutputDesc("features", tensor), | |||||
"[Add][OutputDesc] features for aipp node:%s failed", op_desc->GetName().c_str()); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -335,7 +352,7 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr | |||||
std::set<uint32_t> &edge_indexes) { | std::set<uint32_t> &edge_indexes) { | ||||
auto data_node = FindDataByIndex(graph, rank); | auto data_node = FindDataByIndex(graph, rank); | ||||
if (data_node == nullptr) { | if (data_node == nullptr) { | ||||
GELOGE(PARAM_INVALID, "Get target input node for rank %d failed", rank); | |||||
GELOGE(PARAM_INVALID, "[Call][FindDataByIndex] Get target input node for rank %d failed", rank); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
data_node_linked_aipp = data_node; | data_node_linked_aipp = data_node; | ||||
@@ -345,7 +362,7 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr | |||||
if (ge::AttrUtils::GetStr(data_opdesc, ATTR_ATC_USER_DEFINE_DATATYPE, set_dt_str)) { | if (ge::AttrUtils::GetStr(data_opdesc, ATTR_ATC_USER_DEFINE_DATATYPE, set_dt_str)) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10034", {"opname"}, {data_opdesc->GetName()}); | ErrorManager::GetInstance().ATCReportErrMessage("E10034", {"opname"}, {data_opdesc->GetName()}); | ||||
GELOGE(INTERNAL_ERROR, | GELOGE(INTERNAL_ERROR, | ||||
"This input op [%s] is linked to aipp, can not be set to fp16, " | |||||
"[Get][Attr] This input op [%s] is linked to aipp, can not be set to fp16, " | |||||
"please check your atc parameter --insert_op_conf, --input_fp16_nodes.", | "please check your atc parameter --insert_op_conf, --input_fp16_nodes.", | ||||
data_opdesc->GetName().c_str()); | data_opdesc->GetName().c_str()); | ||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
@@ -364,7 +381,8 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr | |||||
if (!AttrUtils::SetNamedAttrs(data_opdesc, ATTR_NAME_AIPP, aipp_attr)) { | if (!AttrUtils::SetNamedAttrs(data_opdesc, ATTR_NAME_AIPP, aipp_attr)) { | ||||
REPORT_INNER_ERROR("E19999", "Set Attr:%s for op:%s(%s) failed", ATTR_NAME_AIPP.c_str(), | REPORT_INNER_ERROR("E19999", "Set Attr:%s for op:%s(%s) failed", ATTR_NAME_AIPP.c_str(), | ||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Set name attrs for Data node failed. id: %d", rank); | |||||
GELOGE(INTERNAL_ERROR, "[Set][Attr] %s for op:%s(%s) failed", ATTR_NAME_AIPP.c_str(), | |||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -397,15 +415,15 @@ Status AippOp::GetStaticTargetNode(const ComputeGraphPtr &graph, NodePtr &data_n | |||||
REPORT_INNER_ERROR("E19999", "The data node %s has switchn node flag, but the value of attr:%s is empty, " | REPORT_INNER_ERROR("E19999", "The data node %s has switchn node flag, but the value of attr:%s is empty, " | ||||
"check invalid", data_node->GetName().c_str(), | "check invalid", data_node->GetName().c_str(), | ||||
kMbatchSwitchnName); | kMbatchSwitchnName); | ||||
GELOGE(INTERNAL_ERROR, "The data node %s has switchn node flag, but the value is empty", | |||||
data_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] The data node %s has switchn node flag, but the value of attr:%s is empty", | |||||
data_node->GetName().c_str(), kMbatchSwitchnName); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
auto switchn = graph->FindNode(related_node_name); | auto switchn = graph->FindNode(related_node_name); | ||||
if (switchn == nullptr) { | if (switchn == nullptr) { | ||||
REPORT_INNER_ERROR("E19999", "The data node %s has switchn node %s, but can not find it on the graph, " | REPORT_INNER_ERROR("E19999", "The data node %s has switchn node %s, but can not find it on the graph, " | ||||
"check invalid", data_node->GetName().c_str(), related_node_name.c_str()); | "check invalid", data_node->GetName().c_str(), related_node_name.c_str()); | ||||
GELOGE(INTERNAL_ERROR, "The data node %s has switchn node %s, but can not find it on the graph", | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] The data node %s has switchn node %s, but can not find it on the graph", | |||||
data_node->GetName().c_str(), related_node_name.c_str()); | data_node->GetName().c_str(), related_node_name.c_str()); | ||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -474,7 +492,7 @@ Status AippOp::GetTargetPosition(ComputeGraphPtr graph, NodePtr &target_input, | |||||
const uint32_t related_input_rank = aipp_params_->related_input_rank(); | const uint32_t related_input_rank = aipp_params_->related_input_rank(); | ||||
auto ret = GetAndCheckTarget(graph, related_input_rank, target_input, edge_indexes); | auto ret = GetAndCheckTarget(graph, related_input_rank, target_input, edge_indexes); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "Get target input node for rank %u failed", related_input_rank); | |||||
GELOGE(ret, "[Get][TargetInputNode] for rank %u failed", related_input_rank); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -497,13 +515,14 @@ Status AippOp::GetTargetPosition(ComputeGraphPtr graph, NodePtr &target_input, | |||||
REPORT_INNER_ERROR("E19999", "Subgraph:%s of op:%s(%s) not find in graph:%s, check invalid", | REPORT_INNER_ERROR("E19999", "Subgraph:%s of op:%s(%s) not find in graph:%s, check invalid", | ||||
name.c_str(), func_desc->GetName().c_str(), func_desc->GetType().c_str(), | name.c_str(), func_desc->GetName().c_str(), func_desc->GetType().c_str(), | ||||
graph->GetName().c_str()); | graph->GetName().c_str()); | ||||
GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "Subgraph not found, name: %s", name.c_str()); | |||||
GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "[Get][Subgraph] failed, Subgraph:%s of op:%s(%s) not find in graph:%s", | |||||
name.c_str(), func_desc->GetName().c_str(), func_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return GE_GRAPH_EMPTY_SUBGRAPH; | return GE_GRAPH_EMPTY_SUBGRAPH; | ||||
} | } | ||||
auto data_node = FindDataByIndex(subgraph, related_input_rank); | auto data_node = FindDataByIndex(subgraph, related_input_rank); | ||||
if (data_node == nullptr) { | if (data_node == nullptr) { | ||||
GELOGE(PARAM_INVALID, "Get target input node for rank %d failed", related_input_rank); | |||||
GELOGE(PARAM_INVALID, "[Get][TargetInputNode] for rank %d failed", related_input_rank); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -699,14 +718,16 @@ Status AippOp::GenerateOpDesc(OpDescPtr op_desc) { | |||||
(op_desc->AddInputDesc(GeTensorDesc()) != GRAPH_SUCCESS)) { | (op_desc->AddInputDesc(GeTensorDesc()) != GRAPH_SUCCESS)) { | ||||
REPORT_CALL_ERROR("E19999", "Add input desc into op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add input desc into op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "failed to add input desc"); | |||||
GELOGE(FAILED, "[Add][InputDesc] into op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (op_desc->AddOutputDesc(GeTensorDesc()) != GRAPH_SUCCESS) { | if (op_desc->AddOutputDesc(GeTensorDesc()) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add output desc into op:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Add output desc into op:%s(%s) failed", | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "add output desc failed."); | |||||
GELOGE(FAILED, "[Add][OutputDesc] into op:%s(%s) failed", | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GeAttrValue::NAMED_ATTRS aipp_attrs; | GeAttrValue::NAMED_ATTRS aipp_attrs; | ||||
@@ -715,7 +736,8 @@ Status AippOp::GenerateOpDesc(OpDescPtr op_desc) { | |||||
GE_IF_BOOL_EXEC(!AttrUtils::SetNamedAttrs(op_desc, ATTR_NAME_AIPP, aipp_attrs), | GE_IF_BOOL_EXEC(!AttrUtils::SetNamedAttrs(op_desc, ATTR_NAME_AIPP, aipp_attrs), | ||||
REPORT_INNER_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_AIPP.c_str(), | REPORT_INNER_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_AIPP.c_str(), | ||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "failed to set ATTR_NAME_AIPP"); | |||||
GELOGE(FAILED, "[Set][Attr] %s to op:%s(%s) failed", ATTR_NAME_AIPP.c_str(), | |||||
op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return FAILED); | return FAILED); | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -791,7 +813,7 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { | |||||
auto ori_data_format = GetAndCheckFormat(); | auto ori_data_format = GetAndCheckFormat(); | ||||
if (ori_data_format != FORMAT_NCHW && ori_data_format != FORMAT_NHWC) { | if (ori_data_format != FORMAT_NCHW && ori_data_format != FORMAT_NHWC) { | ||||
string format_str = TypeUtils::FormatToSerialString(ori_data_format); | string format_str = TypeUtils::FormatToSerialString(ori_data_format); | ||||
GELOGE(PARAM_INVALID, "when dynamic aipp, input_format must be NCHW or NHWC, but [%s] format is %s", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] when dynamic aipp, input_format must be NCHW or NHWC, but [%s] format is %s", | |||||
data_node->GetName().c_str(), format_str.c_str()); | data_node->GetName().c_str(), format_str.c_str()); | ||||
string reason = "format must be NCHW or NHWC in dynamic aipp process"; | string reason = "format must be NCHW or NHWC in dynamic aipp process"; | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E19014", {"opname", "value", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E19014", {"opname", "value", "reason"}, | ||||
@@ -897,7 +919,8 @@ Status AippOp::AddNodeToGraph(const NodePtr &aipp_node, int64_t max_dynamic_aipp | |||||
if (stat1 != GRAPH_SUCCESS || stat2 != GRAPH_SUCCESS || stat3 != GRAPH_SUCCESS) { | if (stat1 != GRAPH_SUCCESS || stat2 != GRAPH_SUCCESS || stat3 != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Add and Update InputDesc to op:%s(%s) failed, index:%d", | REPORT_CALL_ERROR("E19999", "Add and Update InputDesc to op:%s(%s) failed, index:%d", | ||||
aipp_node->GetName().c_str(), aipp_node->GetType().c_str(), kAippParamsInputIndex); | aipp_node->GetName().c_str(), aipp_node->GetType().c_str(), kAippParamsInputIndex); | ||||
GELOGE(INTERNAL_ERROR, "node process desc failed!"); | |||||
GELOGE(INTERNAL_ERROR, "[Update][InputDesc] to op:%s(%s) failed, index:%d", | |||||
aipp_node->GetName().c_str(), aipp_node->GetType().c_str(), kAippParamsInputIndex); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
// aipp_node should have two input data but now tbe only one input | // aipp_node should have two input data but now tbe only one input | ||||
@@ -907,7 +930,10 @@ Status AippOp::AddNodeToGraph(const NodePtr &aipp_node, int64_t max_dynamic_aipp | |||||
aipp_data_node_ptr->GetName().c_str(), aipp_data_node_ptr->GetType().c_str(), | aipp_data_node_ptr->GetName().c_str(), aipp_data_node_ptr->GetType().c_str(), | ||||
kAippDataOutputIndex, aipp_node->GetName().c_str(), aipp_node->GetType().c_str(), | kAippDataOutputIndex, aipp_node->GetName().c_str(), aipp_node->GetType().c_str(), | ||||
kAippParamsInputIndex); | kAippParamsInputIndex); | ||||
GELOGE(INTERNAL_ERROR, "Add Anchor anchor between aipp data node and aipp failed!"); | |||||
GELOGE(INTERNAL_ERROR, "[Add][Edge] between op:%s(%s)(out_index:%u) and op:%s(%s)(in_index:%u) failed", | |||||
aipp_data_node_ptr->GetName().c_str(), aipp_data_node_ptr->GetType().c_str(), | |||||
kAippDataOutputIndex, aipp_node->GetName().c_str(), aipp_node->GetType().c_str(), | |||||
kAippParamsInputIndex); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -69,23 +69,23 @@ Status InsertNewOpUtil::Parse(const char *conf_path) { | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
GE_CHK_BOOL_RET_STATUS(ReadProtoFromText(conf_path, insert_op_conf_.get()), FAILED, "Read AIPP conf file error: %s", | |||||
conf_path); | |||||
GE_CHK_BOOL_RET_STATUS(ReadProtoFromText(conf_path, insert_op_conf_.get()), FAILED, | |||||
"[Read][Proto] from file:%s failed", conf_path); | |||||
GE_CHK_STATUS_RET(CheckPositionNotRepeat(), "Check insert position of op failed"); | |||||
GE_CHK_STATUS_RET(CheckPositionNotRepeat(), "[Check][InsertPosition] of op failed"); | |||||
for (int i = 0; i < insert_op_conf_->aipp_op_size(); i++) { | for (int i = 0; i < insert_op_conf_->aipp_op_size(); i++) { | ||||
domi::AippOpParams *aipp_op_params = insert_op_conf_->mutable_aipp_op(i); | domi::AippOpParams *aipp_op_params = insert_op_conf_->mutable_aipp_op(i); | ||||
std::unique_ptr<AippOp> aipp_op(new (std::nothrow) AippOp()); | std::unique_ptr<AippOp> aipp_op(new (std::nothrow) AippOp()); | ||||
GE_CHECK_NOTNULL(aipp_op); | GE_CHECK_NOTNULL(aipp_op); | ||||
GE_CHK_STATUS_RET(aipp_op->Init(aipp_op_params), "Aipp op init failed."); | |||||
GE_CHK_STATUS_RET(aipp_op->Init(aipp_op_params), "[Call][Init] Aipp op init failed."); | |||||
insert_ops_.push_back(std::move(aipp_op)); | insert_ops_.push_back(std::move(aipp_op)); | ||||
} | } | ||||
for (auto &dynamic_op : insert_ops_) { | for (auto &dynamic_op : insert_ops_) { | ||||
GE_CHECK_NOTNULL(dynamic_op); | GE_CHECK_NOTNULL(dynamic_op); | ||||
GE_CHK_STATUS_RET(dynamic_op->ValidateParams(), "Validate insert_op config file failed"); | |||||
GE_CHK_STATUS_RET(dynamic_op->SetDefaultParams(), "Set default value of insert_op failed"); | |||||
GE_CHK_STATUS_RET(dynamic_op->ValidateParams(), "[Call][ValidateParams] Validate insert_op config file failed"); | |||||
GE_CHK_STATUS_RET(dynamic_op->SetDefaultParams(), "[Call][SetDefaultParams] Set default value of insert_op failed"); | |||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -94,12 +94,13 @@ Status InsertNewOpUtil::Parse(const char *conf_path) { | |||||
Status InsertNewOpUtil::InsertAippOps(ComputeGraphPtr &graph, std::string &aippConfigPath) { | Status InsertNewOpUtil::InsertAippOps(ComputeGraphPtr &graph, std::string &aippConfigPath) { | ||||
GE_CHECK_NOTNULL(graph); | GE_CHECK_NOTNULL(graph); | ||||
for (uint32_t index = 0; index < insert_ops_.size(); ++index) { | for (uint32_t index = 0; index < insert_ops_.size(); ++index) { | ||||
GE_CHK_STATUS_RET(insert_ops_[index]->InsertAippToGraph(graph, aippConfigPath, index), "insert op to graph failed"); | |||||
GE_CHK_STATUS_RET(insert_ops_[index]->InsertAippToGraph(graph, aippConfigPath, index), | |||||
"[Insert][Op] to graph failed"); | |||||
} | } | ||||
GE_CHK_STATUS_RET(CheckGraph(graph), "after inserting all ops, check graph failed"); | |||||
GE_CHK_STATUS_RET(CheckGraph(graph), "[Check][Graph] failed after inserting all ops"); | |||||
GE_CHK_GRAPH_STATUS_RET(graph->TopologicalSorting(), "after insert dynamic op, sort graph failed"); | |||||
GE_CHK_GRAPH_STATUS_RET(graph->TopologicalSorting(), "[Sort][Graph] failed after insert dynamic op"); | |||||
ClearNewOps(); | ClearNewOps(); | ||||
@@ -189,7 +190,7 @@ Status InsertNewOpUtil::CheckPositionNotRepeat() { | |||||
ret = CheckInputNamePositionNotRepeat(); | ret = CheckInputNamePositionNotRepeat(); | ||||
} | } | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "Check position not repeat failed."); | |||||
GELOGE(FAILED, "[Check][Position] not repeat failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -257,8 +258,10 @@ Status InsertNewOpUtil::GetAippParams(const std::unique_ptr<domi::AippOpParams> | |||||
const OpDescPtr tmpOpPtr = aipp_node->GetOpDesc(); | const OpDescPtr tmpOpPtr = aipp_node->GetOpDesc(); | ||||
GE_CHECK_NOTNULL(tmpOpPtr); | GE_CHECK_NOTNULL(tmpOpPtr); | ||||
GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(tmpOpPtr, ATTR_NAME_AIPP, aipp_attr), FAILED, | GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(tmpOpPtr, ATTR_NAME_AIPP, aipp_attr), FAILED, | ||||
"Aipp node should contain param aipp!"); | |||||
GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, aippParams.get()), "get aipp params failed"); | |||||
"[Get][Attr] %s from Aipp node:%s failed", | |||||
ATTR_NAME_AIPP.c_str(), tmpOpPtr->GetName().c_str()); | |||||
GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, aippParams.get()), | |||||
"[Convert][AippParams] get aipp params failed"); | |||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -309,7 +312,8 @@ Status InsertNewOpUtil::FindMaxSizeNode(const ComputeGraphPtr &graph, const Node | |||||
REPORT_INNER_ERROR("E19999", "Subgraph:%s of op:%s(%s) not find in graph:%s, check invalid", | REPORT_INNER_ERROR("E19999", "Subgraph:%s of op:%s(%s) not find in graph:%s, check invalid", | ||||
name.c_str(), func_desc->GetName().c_str(), | name.c_str(), func_desc->GetName().c_str(), | ||||
func_desc->GetType().c_str(), graph->GetName().c_str()); | func_desc->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "Subgraph not found, name: %s", name.c_str()); | |||||
GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "[Get][SubGraph] failed, Subgraph:%s of op:%s(%s) not find in graph:%s", | |||||
name.c_str(), func_desc->GetName().c_str(), func_desc->GetType().c_str(), graph->GetName().c_str()); | |||||
return GE_GRAPH_EMPTY_SUBGRAPH; | return GE_GRAPH_EMPTY_SUBGRAPH; | ||||
} | } | ||||
@@ -331,7 +335,8 @@ Status InsertNewOpUtil::FindMaxSizeNode(const ComputeGraphPtr &graph, const Node | |||||
REPORT_INNER_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | REPORT_INNER_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | ||||
ATTR_NAME_PARENT_NODE_INDEX.c_str(), | ATTR_NAME_PARENT_NODE_INDEX.c_str(), | ||||
src_op->GetName().c_str(), src_op->GetType().c_str()); | src_op->GetName().c_str(), src_op->GetType().c_str()); | ||||
GELOGE(FAILED, "Parent index not found, name: %s", src_op->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][Attr] %s of op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(), | |||||
src_op->GetName().c_str(), src_op->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -384,16 +389,16 @@ Status InsertNewOpUtil::UpdateCaseNode(const ComputeGraphPtr &graph, const NodeP | |||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Update OutputDesc to op:%s(%s) failed, index:0", | REPORT_CALL_ERROR("E19999", "Update OutputDesc to op:%s(%s) failed, index:0", | ||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to update data %s output using case %s", data->GetName().c_str(), | |||||
case_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Update][OutputDesc] to op:%s(%s) failed, index:0", | |||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
ret = data_opdesc->UpdateInputDesc(0, *input_desc); | ret = data_opdesc->UpdateInputDesc(0, *input_desc); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Update InputDesc to op:%s(%s) failed, index:0", | REPORT_CALL_ERROR("E19999", "Update InputDesc to op:%s(%s) failed, index:0", | ||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to update data %s input using case %s", data->GetName().c_str(), | |||||
case_node->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Update][InputDesc] to op:%s(%s) failed, index:0", | |||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -416,14 +421,16 @@ Status InsertNewOpUtil::UpdatePrevNodeByAipp(NodePtr &node, std::set<NodePtr> &s | |||||
if (graph_ret != GRAPH_SUCCESS) { | if (graph_ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Get input size of op:%s(%s), index:0, failed", | REPORT_CALL_ERROR("E19999", "Get input size of op:%s(%s), index:0, failed", | ||||
aipp_op_desc->GetName().c_str(), aipp_op_desc->GetType().c_str()); | aipp_op_desc->GetName().c_str(), aipp_op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "UpdateOutputDesc fail, graph_ret:%d", graph_ret); | |||||
GELOGE(FAILED, "[Get][InputSize] of op:%s(%s), index:0, failed", | |||||
aipp_op_desc->GetName().c_str(), aipp_op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGI("Get input size [%ld] from aipp [%s].", size, aipp_op_desc->GetName().c_str()); | GELOGI("Get input size [%ld] from aipp [%s].", size, aipp_op_desc->GetName().c_str()); | ||||
if (size == 0) { | if (size == 0) { | ||||
REPORT_CALL_ERROR("E19999", "Tensor size of op:%s(%s) is 0, input_index:0, check invalid", | REPORT_CALL_ERROR("E19999", "Tensor size of op:%s(%s) is 0, input_index:0, check invalid", | ||||
aipp_op_desc->GetName().c_str(), aipp_op_desc->GetType().c_str()); | aipp_op_desc->GetName().c_str(), aipp_op_desc->GetType().c_str()); | ||||
GELOGE(FAILED, "Can not get size from aipp [%s]", aipp_op_desc->GetName().c_str()); | |||||
GELOGE(FAILED, "[Check][Param] Tensor size of op:%s(%s) is 0, input_index:0", | |||||
aipp_op_desc->GetName().c_str(), aipp_op_desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
(void)AttrUtils::SetInt(aipp_input, ATTR_NAME_INPUT_ORIGIN_SIZE, size); | (void)AttrUtils::SetInt(aipp_input, ATTR_NAME_INPUT_ORIGIN_SIZE, size); | ||||
@@ -511,16 +518,16 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt | |||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Update OutputDesc to op:%s(%s) failed, index:0", | REPORT_CALL_ERROR("E19999", "Update OutputDesc to op:%s(%s) failed, index:0", | ||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to update data %s output using switchn %s", data->GetName().c_str(), | |||||
switchn->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Update][OutputDesc] to op:%s(%s) failed, index:0", | |||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
ret = data_opdesc->UpdateInputDesc(0, *input_desc); | ret = data_opdesc->UpdateInputDesc(0, *input_desc); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Update InputDesc to op:%s(%s) failed, index:0", | REPORT_CALL_ERROR("E19999", "Update InputDesc to op:%s(%s) failed, index:0", | ||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to update data %s input using switchn %s", data->GetName().c_str(), | |||||
switchn->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Update][InputDesc] to op:%s(%s) failed, index:0", | |||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
// Update attr _mbatch_origin_input_dims for data when it is linked to aipp | // Update attr _mbatch_origin_input_dims for data when it is linked to aipp | ||||
@@ -563,8 +570,8 @@ Status InsertNewOpUtil::GetDataRelatedNode(NodePtr &node, std::map<NodePtr, std: | |||||
std::unique_ptr<domi::AippOpParams> aipp_params(new (std::nothrow) domi::AippOpParams()); | std::unique_ptr<domi::AippOpParams> aipp_params(new (std::nothrow) domi::AippOpParams()); | ||||
ge::GeAttrValue::NAMED_ATTRS aipp_attr; | ge::GeAttrValue::NAMED_ATTRS aipp_attr; | ||||
GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(data_op, ATTR_NAME_AIPP, aipp_attr), ACL_ERROR_GE_AIPP_NOT_EXIST, | GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(data_op, ATTR_NAME_AIPP, aipp_attr), ACL_ERROR_GE_AIPP_NOT_EXIST, | ||||
"Data node do not contain param aipp!"); | |||||
GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, aipp_params.get()), "get aipp params failed"); | |||||
"[Get][Attr] %s from op:%s failed", ATTR_NAME_AIPP.c_str(), data_op->GetName().c_str()); | |||||
GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, aipp_params.get()), "[Get][AippParams] failed"); | |||||
for (auto out_data_anchor : node->GetAllOutDataAnchors()) { | for (auto out_data_anchor : node->GetAllOutDataAnchors()) { | ||||
GE_CHECK_NOTNULL(out_data_anchor); | GE_CHECK_NOTNULL(out_data_anchor); | ||||
@@ -621,7 +628,8 @@ Status InsertNewOpUtil::GetAllAipps(const NodePtr &data_node, const NodePtr &nod | |||||
REPORT_INNER_ERROR("E19999", "Subgraph:%s of op:%s(%s) not find in graph:%s, check invalid", | REPORT_INNER_ERROR("E19999", "Subgraph:%s of op:%s(%s) not find in graph:%s, check invalid", | ||||
name.c_str(), op->GetName().c_str(), | name.c_str(), op->GetName().c_str(), | ||||
op->GetType().c_str(), graph->GetName().c_str()); | op->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "Subgraph not found, name: %s", name.c_str()); | |||||
GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "[Get][SubGraph] Subgraph:%s of op:%s(%s) not find in graph:%s", | |||||
name.c_str(), op->GetName().c_str(), op->GetType().c_str(), graph->GetName().c_str()); | |||||
return GE_GRAPH_EMPTY_SUBGRAPH; | return GE_GRAPH_EMPTY_SUBGRAPH; | ||||
} | } | ||||
@@ -635,7 +643,8 @@ Status InsertNewOpUtil::GetAllAipps(const NodePtr &data_node, const NodePtr &nod | |||||
REPORT_INNER_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | REPORT_INNER_ERROR("E19999", "Get Attr:%s of op:%s(%s) failed", | ||||
ATTR_NAME_PARENT_NODE_INDEX.c_str(), | ATTR_NAME_PARENT_NODE_INDEX.c_str(), | ||||
src_op->GetName().c_str(), src_op->GetType().c_str()); | src_op->GetName().c_str(), src_op->GetType().c_str()); | ||||
GELOGE(FAILED, "Parent index not found, name: %s", src_op->GetName().c_str()); | |||||
GELOGE(FAILED, "[Get][Attr] %s of op:%s(%s) failed", | |||||
ATTR_NAME_PARENT_NODE_INDEX.c_str(), src_op->GetName().c_str(), src_op->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
auto data = node->GetInDataNodes().at(parent_index); | auto data = node->GetInDataNodes().at(parent_index); | ||||
@@ -774,10 +783,11 @@ Status InsertNewOpUtil::SetModelInputDims(NodePtr &data_node, NodePtr &aipp_node | |||||
} | } | ||||
GELOGD("After set N or H/W to -1, the model input dims: %s.", formats::JoinToString(model_input_dims).c_str()); | GELOGD("After set N or H/W to -1, the model input dims: %s.", formats::JoinToString(model_input_dims).c_str()); | ||||
if (!AttrUtils::SetListInt(data_opdesc, ATTR_NAME_INPUT_DIMS, model_input_dims)) { | if (!AttrUtils::SetListInt(data_opdesc, ATTR_NAME_INPUT_DIMS, model_input_dims)) { | ||||
REPORT_INNER_ERROR("E19999", "Set Attr:%s of op:%s(%s) failed", | |||||
REPORT_INNER_ERROR("E19999", "Set Attr:%s on op:%s(%s) failed", | |||||
ATTR_NAME_INPUT_DIMS.c_str(), | ATTR_NAME_INPUT_DIMS.c_str(), | ||||
data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | ||||
GELOGE(FAILED, "SetListInt of %s failed.", ATTR_NAME_INPUT_DIMS.c_str()); | |||||
GELOGE(FAILED, "[Set][Attr] %s on op:%s(%s) failed", | |||||
ATTR_NAME_INPUT_DIMS.c_str(), data_opdesc->GetName().c_str(), data_opdesc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -105,8 +105,9 @@ Status CheckSequenceOfData(ComputeGraphPtr &graph, const vector<NodePtr> &data_n | |||||
REPORT_INNER_ERROR("E19999", "Count:%zu of data_nodes in graph:%s should be equal to " | REPORT_INNER_ERROR("E19999", "Count:%zu of data_nodes in graph:%s should be equal to " | ||||
"input_shape count:%zu from option, check invalid", | "input_shape count:%zu from option, check invalid", | ||||
data_nodes.size(), graph->GetName().c_str(), GetLocalOmgContext().user_input_dims.size()); | data_nodes.size(), graph->GetName().c_str(), GetLocalOmgContext().user_input_dims.size()); | ||||
GELOGE(PARAM_INVALID, "The count of input shape:%zu should be equal to the count of data num:%zu.", | |||||
GetLocalOmgContext().user_input_dims.size(), data_nodes.size()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Count:%zu of data_nodes in graph:%s should be equal to " | |||||
"input_shape count:%zu from option", | |||||
data_nodes.size(), graph->GetName().c_str(), GetLocalOmgContext().user_input_dims.size()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
for (size_t i = 0; i < data_nodes.size(); ++i) { | for (size_t i = 0; i < data_nodes.size(); ++i) { | ||||
@@ -127,9 +128,11 @@ Status CheckSequenceOfData(ComputeGraphPtr &graph, const vector<NodePtr> &data_n | |||||
formats::JoinToString(output_shape).c_str(), | formats::JoinToString(output_shape).c_str(), | ||||
GetLocalOmgContext().user_input_dims.at(i).first.c_str(), | GetLocalOmgContext().user_input_dims.at(i).first.c_str(), | ||||
formats::JoinToString(dynamic_dims).c_str(), graph->GetName().c_str()); | formats::JoinToString(dynamic_dims).c_str(), graph->GetName().c_str()); | ||||
GELOGE(PARAM_INVALID, "The output shape of %s is %s, the input shape from options of %s is %s.", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] The output shape of %s is %s, " | |||||
"the input shape from options of %s is %s, graph:%s", | |||||
data_node->GetName().c_str(), formats::JoinToString(output_shape).c_str(), | data_node->GetName().c_str(), formats::JoinToString(output_shape).c_str(), | ||||
GetLocalOmgContext().user_input_dims.at(i).first.c_str(), formats::JoinToString(dynamic_dims).c_str()); | |||||
GetLocalOmgContext().user_input_dims.at(i).first.c_str(), | |||||
formats::JoinToString(dynamic_dims).c_str(), graph->GetName().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
for (size_t j = 0; j < dynamic_dims.size(); ++j) { | for (size_t j = 0; j < dynamic_dims.size(); ++j) { | ||||
@@ -139,8 +142,10 @@ Status CheckSequenceOfData(ComputeGraphPtr &graph, const vector<NodePtr> &data_n | |||||
formats::JoinToString(dynamic_dims).c_str(), | formats::JoinToString(dynamic_dims).c_str(), | ||||
formats::JoinToString(output_shape).c_str(), data_node->GetName().c_str(), kDynmaicDims, | formats::JoinToString(output_shape).c_str(), data_node->GetName().c_str(), kDynmaicDims, | ||||
j, graph->GetName().c_str()); | j, graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Value of input shape %s should be equal to %s.", | |||||
formats::JoinToString(dynamic_dims).c_str(), formats::JoinToString(output_shape).c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] Value of input shape %s from option and output shape %s of data op:%s " | |||||
"should be equal to %d, index:%zu, graph:%s", | |||||
formats::JoinToString(dynamic_dims).c_str(), formats::JoinToString(output_shape).c_str(), | |||||
data_node->GetName().c_str(), kDynmaicDims, j, graph->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
@@ -154,7 +159,8 @@ Status CheckSequenceOfGetnext(ComputeGraphPtr &graph, const vector<NodePtr> &get | |||||
REPORT_INNER_ERROR("E19999", "Not support dynamic dims when a graph with multi getnext nodes, graph:%s, " | REPORT_INNER_ERROR("E19999", "Not support dynamic dims when a graph with multi getnext nodes, graph:%s, " | ||||
"num of getnext node:%zu, check invalid", | "num of getnext node:%zu, check invalid", | ||||
graph->GetName().c_str(), getnext_sink_node.size()); | graph->GetName().c_str(), getnext_sink_node.size()); | ||||
GELOGE(PARAM_INVALID, "Not support dynamic dims when a graph with multi getnext nodes."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Not support dynamic dims when a graph with multi getnext nodes, graph:%s, " | |||||
"num of getnext node:%zu", graph->GetName().c_str(), getnext_sink_node.size()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
auto data_node = getnext_sink_node.at(0); | auto data_node = getnext_sink_node.at(0); | ||||
@@ -163,11 +169,12 @@ Status CheckSequenceOfGetnext(ComputeGraphPtr &graph, const vector<NodePtr> &get | |||||
GE_CHECK_NOTNULL(op_desc); | GE_CHECK_NOTNULL(op_desc); | ||||
size_t data_count = data_node->GetAllOutDataAnchors().size() / kDivisionConst; | size_t data_count = data_node->GetAllOutDataAnchors().size() / kDivisionConst; | ||||
if (data_count != GetLocalOmgContext().user_input_dims.size()) { | if (data_count != GetLocalOmgContext().user_input_dims.size()) { | ||||
REPORT_INNER_ERROR("E19999", "Output desc count of %s is %zu, should be equal to count of input shape: %zu, " | |||||
REPORT_INNER_ERROR("E19999", "Output desc count of %s is %zu, should be equal to count of input shape:%zu, " | |||||
"graph:%s, check invalid", op_desc->GetName().c_str(), data_count, | "graph:%s, check invalid", op_desc->GetName().c_str(), data_count, | ||||
GetLocalOmgContext().user_input_dims.size(), graph->GetName().c_str()); | GetLocalOmgContext().user_input_dims.size(), graph->GetName().c_str()); | ||||
GELOGE(PARAM_INVALID, "Output count of %s is %zu, should be equal to count of input shape: %zu", | |||||
op_desc->GetName().c_str(), data_count, GetLocalOmgContext().user_input_dims.size()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Output desc count of %s is %zu, " | |||||
"should be equal to count of input shape:%zu, graph:%s", op_desc->GetName().c_str(), | |||||
data_count, GetLocalOmgContext().user_input_dims.size(), graph->GetName().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
for (size_t i = 0; i < data_count; ++i) { | for (size_t i = 0; i < data_count; ++i) { | ||||
@@ -186,9 +193,10 @@ Status CheckSequenceOfGetnext(ComputeGraphPtr &graph, const vector<NodePtr> &get | |||||
formats::JoinToString(dynamic_dims).c_str(), | formats::JoinToString(dynamic_dims).c_str(), | ||||
GetLocalOmgContext().user_input_dims.at(i).first.c_str(), | GetLocalOmgContext().user_input_dims.at(i).first.c_str(), | ||||
graph->GetName().c_str()); | graph->GetName().c_str()); | ||||
GELOGE(PARAM_INVALID, "the output_shape of %s is %s, the input_shape from options of %s is %s.", | |||||
data_node->GetName().c_str(), formats::JoinToString(output_shape).c_str(), | |||||
GetLocalOmgContext().user_input_dims.at(i).first.c_str(), formats::JoinToString(dynamic_dims).c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] The %zu output_shape of %s is %s not equal to the input_shape:%s " | |||||
"from options of %s, graph:%s", i, data_node->GetName().c_str(), | |||||
formats::JoinToString(output_shape).c_str(), formats::JoinToString(dynamic_dims).c_str(), | |||||
GetLocalOmgContext().user_input_dims.at(i).first.c_str(), graph->GetName().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
for (size_t j = 0; j < dynamic_dims.size(); ++j) { | for (size_t j = 0; j < dynamic_dims.size(); ++j) { | ||||
@@ -198,8 +206,10 @@ Status CheckSequenceOfGetnext(ComputeGraphPtr &graph, const vector<NodePtr> &get | |||||
formats::JoinToString(dynamic_dims).c_str(), | formats::JoinToString(dynamic_dims).c_str(), | ||||
formats::JoinToString(output_shape).c_str(), data_node->GetName().c_str(), kDynmaicDims, | formats::JoinToString(output_shape).c_str(), data_node->GetName().c_str(), kDynmaicDims, | ||||
j, graph->GetName().c_str()); | j, graph->GetName().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "value of input_shape %s should be equal to %s.", | |||||
formats::JoinToString(dynamic_dims).c_str(), formats::JoinToString(output_shape).c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Check][Param] Value of input shape %s from option and output shape %s of data op:%s " | |||||
"should be equal to %d, index:%zu, graph:%s", formats::JoinToString(dynamic_dims).c_str(), | |||||
formats::JoinToString(output_shape).c_str(), data_node->GetName().c_str(), kDynmaicDims, | |||||
j, graph->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
@@ -215,26 +225,26 @@ Status CheckSequenceOfOptions(ComputeGraphPtr &graph, vector<NodePtr> &data_node | |||||
} | } | ||||
if (DistinguishGetNextAndData(graph, data_nodes, getnext_nosink_nodes, getnext_sink_nodes) != SUCCESS) { | if (DistinguishGetNextAndData(graph, data_nodes, getnext_nosink_nodes, getnext_sink_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "DistinguishGetNextAndData failed."); | |||||
GELOGE(PARAM_INVALID, "[Call][DistinguishGetNextAndData] failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (GetLocalOmgContext().dynamic_node_type == DATA) { | if (GetLocalOmgContext().dynamic_node_type == DATA) { | ||||
GELOGD("Users want data nodes to be dynamic."); | GELOGD("Users want data nodes to be dynamic."); | ||||
if (CheckSequenceOfData(graph, data_nodes) != SUCCESS) { | if (CheckSequenceOfData(graph, data_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "Failed to check sequence of data nodes."); | |||||
GELOGE(PARAM_INVALID, "[Check][Sequence] Of Data nodes failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} else { | } else { | ||||
GELOGD("Users want getnext nodes to be dynamic."); | GELOGD("Users want getnext nodes to be dynamic."); | ||||
if (!getnext_nosink_nodes.empty()) { | if (!getnext_nosink_nodes.empty()) { | ||||
if (CheckSequenceOfData(graph, getnext_nosink_nodes) != SUCCESS) { | if (CheckSequenceOfData(graph, getnext_nosink_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "Failed to check sequence of getnext nosink nodes."); | |||||
GELOGE(PARAM_INVALID, "[Check][Sequence] of getnext nosink nodes failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} else { | } else { | ||||
if (CheckSequenceOfGetnext(graph, getnext_sink_nodes) != SUCCESS) { | if (CheckSequenceOfGetnext(graph, getnext_sink_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "Failed to check sequence of getnext sink nodes."); | |||||
GELOGE(PARAM_INVALID, "[Check][Sequence] of getnext sink nodes failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -248,8 +258,9 @@ Status UpdateNameOfData(ComputeGraphPtr &graph, const vector<NodePtr> &data_node | |||||
REPORT_INNER_ERROR("E19999", "Count:%zu of data_nodes in graph:%s should be equal to " | REPORT_INNER_ERROR("E19999", "Count:%zu of data_nodes in graph:%s should be equal to " | ||||
"input_shape count:%zu from option, check invalid", | "input_shape count:%zu from option, check invalid", | ||||
data_nodes.size(), graph->GetName().c_str(), GetLocalOmgContext().user_input_dims.size()); | data_nodes.size(), graph->GetName().c_str(), GetLocalOmgContext().user_input_dims.size()); | ||||
GELOGE(PARAM_INVALID, "count of data_nodes: %zu should be equal to input_shape count: %zu.", | |||||
data_nodes.size(), GetLocalOmgContext().user_input_dims.size()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Count:%zu of data_nodes in graph:%s should be equal to " | |||||
"input_shape count:%zu from option", | |||||
data_nodes.size(), graph->GetName().c_str(), GetLocalOmgContext().user_input_dims.size()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
for (size_t i = 0; i < data_nodes.size(); ++i) { | for (size_t i = 0; i < data_nodes.size(); ++i) { | ||||
@@ -265,7 +276,8 @@ Status UpdateNameOfGetnext(ComputeGraphPtr &graph, const vector<NodePtr> &getnex | |||||
REPORT_INNER_ERROR("E19999", "Not support dynamic dims when a graph with multi getnext nodes, graph:%s, " | REPORT_INNER_ERROR("E19999", "Not support dynamic dims when a graph with multi getnext nodes, graph:%s, " | ||||
"num of getnext node:%zu, check invalid", | "num of getnext node:%zu, check invalid", | ||||
graph->GetName().c_str(), getnext_sink_nodes.size()); | graph->GetName().c_str(), getnext_sink_nodes.size()); | ||||
GELOGE(PARAM_INVALID, "Not support dynamic dims when a graph with multi getnext nodes."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Not support dynamic dims when a graph with multi getnext nodes, graph:%s, " | |||||
"num of getnext node:%zu", graph->GetName().c_str(), getnext_sink_nodes.size()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
auto input_node = getnext_sink_nodes.at(0); | auto input_node = getnext_sink_nodes.at(0); | ||||
@@ -275,11 +287,12 @@ Status UpdateNameOfGetnext(ComputeGraphPtr &graph, const vector<NodePtr> &getnex | |||||
// user want getnext dynamic, just getnext or data+getnext_sink | // user want getnext dynamic, just getnext or data+getnext_sink | ||||
size_t data_count = input_node->GetAllOutDataAnchors().size() / kDivisionConst; | size_t data_count = input_node->GetAllOutDataAnchors().size() / kDivisionConst; | ||||
if (data_count != GetLocalOmgContext().user_input_dims.size()) { | if (data_count != GetLocalOmgContext().user_input_dims.size()) { | ||||
REPORT_INNER_ERROR("E19999", "Output desc count of %s is %zu, should be equal to count of input shape: %zu, " | |||||
REPORT_INNER_ERROR("E19999", "Output desc count of %s is %zu, should be equal to count of input shape:%zu, " | |||||
"graph:%s, check invalid", op_desc->GetName().c_str(), data_count, | "graph:%s, check invalid", op_desc->GetName().c_str(), data_count, | ||||
GetLocalOmgContext().user_input_dims.size(), graph->GetName().c_str()); | GetLocalOmgContext().user_input_dims.size(), graph->GetName().c_str()); | ||||
GELOGE(PARAM_INVALID, "Output count of %s is %zu, should be equal to count of input shape: %zu", | |||||
op_desc->GetName().c_str(), data_count, GetLocalOmgContext().user_input_dims.size()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param]Output desc count of %s is %zu, " | |||||
"should be equal to count of input shape:%zu, graph:%s", op_desc->GetName().c_str(), data_count, | |||||
GetLocalOmgContext().user_input_dims.size(), graph->GetName().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -302,19 +315,21 @@ Status UpdateNameOfInputShape(ComputeGraphPtr &graph, const vector<NodePtr> &dat | |||||
if (GetLocalOmgContext().dynamic_node_type == DATA) { | if (GetLocalOmgContext().dynamic_node_type == DATA) { | ||||
GELOGD("Users want data nodes to be dynamic."); | GELOGD("Users want data nodes to be dynamic."); | ||||
if (UpdateNameOfData(graph, data_nodes) != SUCCESS) { | if (UpdateNameOfData(graph, data_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "Failed to update first value of input shape of data nodes."); | |||||
GELOGE(PARAM_INVALID, "[Call][UpdateNameOfData] update first value of input shape of data nodes failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} else { | } else { | ||||
GELOGD("Users want getnext nodes to be dynamic."); | GELOGD("Users want getnext nodes to be dynamic."); | ||||
if (!getnext_nosink_nodes.empty()) { | if (!getnext_nosink_nodes.empty()) { | ||||
if (UpdateNameOfData(graph, getnext_nosink_nodes) != SUCCESS) { | if (UpdateNameOfData(graph, getnext_nosink_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "Failed to update first value of input shape of getnext nosink nodes."); | |||||
GELOGE(PARAM_INVALID, | |||||
"[Call][UpdateNameOfData] update first value of input shape of getnext nosink nodes failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} else { | } else { | ||||
if (UpdateNameOfGetnext(graph, getnext_sink_nodes) != SUCCESS) { | if (UpdateNameOfGetnext(graph, getnext_sink_nodes) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "Failed to update first value of input shape of getnext sink nodes."); | |||||
GELOGE(PARAM_INVALID, | |||||
"[Call][UpdateNameOfGetnext] update first value of input shape of getnext sink nodes failed."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -340,7 +355,8 @@ Status DeleteIdentityInsertByAdapter(ComputeGraphPtr &graph) { | |||||
if (GraphUtils::RemoveNodeWithoutRelink(graph, dst_node) != GRAPH_SUCCESS) { | if (GraphUtils::RemoveNodeWithoutRelink(graph, dst_node) != GRAPH_SUCCESS) { | ||||
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) from graph:%s failed", | REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) from graph:%s failed", | ||||
dst_node->GetName().c_str(), dst_node->GetType().c_str(), graph->GetName().c_str()); | dst_node->GetName().c_str(), dst_node->GetType().c_str(), graph->GetName().c_str()); | ||||
GELOGE(FAILED, "Remove Identity node %s failed.", dst_node->GetName().c_str()); | |||||
GELOGE(FAILED, "[Remove][Node] %s(%s) from graph:%s failed", | |||||
dst_node->GetName().c_str(), dst_node->GetType().c_str(), graph->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -365,8 +381,8 @@ Status CheckNegativeCountOfOptions(const std::vector<std::vector<int64_t>> &shap | |||||
if (shapes.at(i).size() != negative_count) { | if (shapes.at(i).size() != negative_count) { | ||||
REPORT_INNER_ERROR("E19999", "gear num of dynamic_dims is %zu should be equal to num:%zu from option, " | REPORT_INNER_ERROR("E19999", "gear num of dynamic_dims is %zu should be equal to num:%zu from option, " | ||||
"check invalid", shapes.at(i).size(), negative_count); | "check invalid", shapes.at(i).size(), negative_count); | ||||
GELOGE(PARAM_INVALID, "Each gear num of dynamic_dims is %zu should be equal to %zu.", shapes.at(i).size(), | |||||
negative_count); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] gear num of dynamic_dims is %zu should be equal to num:%zu from option", | |||||
shapes.at(i).size(), negative_count); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -443,7 +459,7 @@ Status ParserDataToDynamicInfo(const vector<vector<int64_t>> &shapes, | |||||
if (tmp_index >= dynamic_gear_info.size()) { | if (tmp_index >= dynamic_gear_info.size()) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10045", {"name", "shape"}, {data_name, formats::JoinToString(data_shape)}); | "E10045", {"name", "shape"}, {data_name, formats::JoinToString(data_shape)}); | ||||
GELOGE(PARAM_INVALID, "Data: %s shape: %s make dynamic dims overflow", data_name.c_str(), | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Data:%s shape:%s make dynamic dims overflow", data_name.c_str(), | |||||
formats::JoinToString(data_shape).c_str()); | formats::JoinToString(data_shape).c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -452,7 +468,8 @@ Status ParserDataToDynamicInfo(const vector<vector<int64_t>> &shapes, | |||||
} else { | } else { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10046", {"name", "shape"}, {data_name, formats::JoinToString(data_shape)}); | "E10046", {"name", "shape"}, {data_name, formats::JoinToString(data_shape)}); | ||||
GELOGE(PARAM_INVALID, "Dynamic dims num of data: %s shape: %s can not be more than one gear dynamic info size", | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Dynamic dims num of data: %s shape: %s " | |||||
"can not be more than one gear dynamic info size", | |||||
data_name.c_str(), formats::JoinToString(data_shape).c_str()); | data_name.c_str(), formats::JoinToString(data_shape).c_str()); | ||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -477,7 +494,7 @@ Status CheckDynamicParams(const vector<vector<int64_t>> &shapes) { | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10035", {"shapesize", "minshapesize"}, {std::to_string(shapes.size()), std::to_string(kMinShapesCount - 1)}); | "E10035", {"shapesize", "minshapesize"}, {std::to_string(shapes.size()), std::to_string(kMinShapesCount - 1)}); | ||||
GELOGE(PARAM_INVALID, | GELOGE(PARAM_INVALID, | ||||
"Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims]'s " | |||||
"[Check][Param] Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims]'s " | |||||
"value size [%zu] must be greater than [%d].", | "value size [%zu] must be greater than [%d].", | ||||
shapes.size(), kMinShapesCount - 1); | shapes.size(), kMinShapesCount - 1); | ||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
@@ -486,7 +503,7 @@ Status CheckDynamicParams(const vector<vector<int64_t>> &shapes) { | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10036", {"shapesize", "maxshapesize"}, {std::to_string(shapes.size()), std::to_string(kMaxShapesCount + 1)}); | "E10036", {"shapesize", "maxshapesize"}, {std::to_string(shapes.size()), std::to_string(kMaxShapesCount + 1)}); | ||||
GELOGE(PARAM_INVALID, | GELOGE(PARAM_INVALID, | ||||
"Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims]'s " | |||||
"[Check][Param] Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims]'s " | |||||
"value size [%zu] must be less than [%d].", | "value size [%zu] must be less than [%d].", | ||||
shapes.size(), kMaxShapesCount + 1); | shapes.size(), kMaxShapesCount + 1); | ||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
@@ -498,7 +515,7 @@ Status CheckDynamicParams(const vector<vector<int64_t>> &shapes) { | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E10037", {"shapesize1", "shapesize2"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10037", {"shapesize1", "shapesize2"}, | ||||
{std::to_string(shape_size), std::to_string(shape.size())}); | {std::to_string(shape_size), std::to_string(shape.size())}); | ||||
GELOGE(PARAM_INVALID, | GELOGE(PARAM_INVALID, | ||||
"Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims]'s " | |||||
"[Check][Param] Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims]'s " | |||||
"value size must be same, first group's size is %zu and another's is %zu.", | "value size must be same, first group's size is %zu and another's is %zu.", | ||||
shape_size, shape.size()); | shape_size, shape.size()); | ||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
@@ -506,7 +523,7 @@ Status CheckDynamicParams(const vector<vector<int64_t>> &shapes) { | |||||
for (auto dim : shape) { | for (auto dim : shape) { | ||||
if (dim <= 0) { | if (dim <= 0) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10038", {"dim"}, {std::to_string(dim)}); | ErrorManager::GetInstance().ATCReportErrMessage("E10038", {"dim"}, {std::to_string(dim)}); | ||||
GELOGE(PARAM_INVALID, "Invalid dim %ld, all dims must be greater than 0", dim); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Invalid dim %ld, all dims must be greater than 0", dim); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -514,8 +531,8 @@ Status CheckDynamicParams(const vector<vector<int64_t>> &shapes) { | |||||
} | } | ||||
if (shapes_set.size() != shapes.size()) { | if (shapes_set.size() != shapes.size()) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10039"); | ErrorManager::GetInstance().ATCReportErrMessage("E10039"); | ||||
GELOGE(PARAM_INVALID, | |||||
"Input parameter[--dynamic_batch_size, --dynamic_image_size or --dynamic_dims] exist duplicate shapes."); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Input parameter[--dynamic_batch_size, " | |||||
"--dynamic_image_size or --dynamic_dims] exist duplicate shapes."); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -537,9 +554,8 @@ Status CalcShape(const std::vector<int64_t> &batch_shape, GeShape &data_shape) { | |||||
"E19012", {"function", "reason"}, | "E19012", {"function", "reason"}, | ||||
{"CalcShape", "the batch shape count " + std::to_string(batch_shape.size()) + | {"CalcShape", "the batch shape count " + std::to_string(batch_shape.size()) + | ||||
" does not match the data shape " + data_shape.ToString()}); | " does not match the data shape " + data_shape.ToString()}); | ||||
GELOGE(PARAM_INVALID, | |||||
"Failed to calc tensor shape, the batch shape count %zu, does not match the data shape %s", | |||||
batch_shape.size(), data_shape.ToString().c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Failed to calc tensor shape, the batch shape count %zu, " | |||||
"does not match the data shape %s", batch_shape.size(), data_shape.ToString().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
data_shape.SetDim(i, batch_shape[batch_shape_index++]); | data_shape.SetDim(i, batch_shape[batch_shape_index++]); | ||||
@@ -550,8 +566,8 @@ Status CalcShape(const std::vector<int64_t> &batch_shape, GeShape &data_shape) { | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E19012", {"function", "reason"}, {"CalcShape", "the batch shape count " + std::to_string(batch_shape.size()) + | "E19012", {"function", "reason"}, {"CalcShape", "the batch shape count " + std::to_string(batch_shape.size()) + | ||||
" does not match the data shape " + data_shape.ToString()}); | " does not match the data shape " + data_shape.ToString()}); | ||||
GELOGE(PARAM_INVALID, "Failed to calc tensor shape, the batch shape count %zu, does not match the data shape %s", | |||||
batch_shape.size(), data_shape.ToString().c_str()); | |||||
GELOGE(PARAM_INVALID, "[Check][Param] Failed to calc tensor shape, the batch shape count %zu, " | |||||
"does not match the data shape %s", batch_shape.size(), data_shape.ToString().c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -578,7 +594,8 @@ Status StampDynamicType(const OpDescPtr &op_desc) { | |||||
if (!AttrUtils::SetInt(op_desc, ATTR_DYNAMIC_TYPE, dynamic_type)) { | if (!AttrUtils::SetInt(op_desc, ATTR_DYNAMIC_TYPE, dynamic_type)) { | ||||
REPORT_CALL_ERROR("E19999", "Set Attr:%s to node:%s(%s) failed", | REPORT_CALL_ERROR("E19999", "Set Attr:%s to node:%s(%s) failed", | ||||
ATTR_DYNAMIC_TYPE.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ATTR_DYNAMIC_TYPE.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str()); | ||||
GELOGE(INTERNAL_ERROR, "Failed to add dynamic type attr for node %s", op_desc->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Set][Attr] %s to node:%s(%s) failed", | |||||
ATTR_DYNAMIC_TYPE.c_str(), op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -597,9 +614,8 @@ bool CheckDynamicBatchShape(const vector<int64_t> &shape, const string &data_nam | |||||
if (shape[i] < 1) { | if (shape[i] < 1) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10018", {"index", "shape"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10018", {"index", "shape"}, | ||||
{std::to_string(i), std::to_string(shape[i])}); | {std::to_string(i), std::to_string(shape[i])}); | ||||
GELOGE(ge::PARAM_INVALID, | |||||
"Only batch N can be -1 when set --dynamic_batch_size, current data: %s shape[%zu] is %ld", | |||||
data_name.c_str(), i, shape[i]); | |||||
GELOGE(ge::PARAM_INVALID, "[Check][Param] Only batch N can be -1 when set --dynamic_batch_size, " | |||||
"current data: %s shape[%zu] is %ld", data_name.c_str(), i, shape[i]); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -635,8 +651,8 @@ bool CheckDynamicImageSizeShape(const vector<int64_t> &shape, const string &data | |||||
return true; | return true; | ||||
} else { | } else { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10019"); | ErrorManager::GetInstance().ATCReportErrMessage("E10019"); | ||||
GELOGE(ge::PARAM_INVALID, | |||||
"--input_shape's shape is invalid, only height and width can be -1 when set --dynamic_image_size."); | |||||
GELOGE(ge::PARAM_INVALID, "[Check][Param] --input_shape's shape is invalid, only height and width can be -1 " | |||||
"when set --dynamic_image_size."); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -1 +1 @@ | |||||
Subproject commit 567381faaff179106abafb264ba696f45c4d2b43 | |||||
Subproject commit 7cb171b9c511fec57ccc0ad746ef2126267fe18b |
@@ -1 +1 @@ | |||||
Subproject commit 9226f9532a3884490b03e48df5d7aa02611e21f4 | |||||
Subproject commit 8d44bebfeeb71b793bc7325acc95345090789e19 |