| @@ -61,7 +61,9 @@ std::string TransOpBreadthFusionPass::GetNodeId(const int anchor_index, const No | |||
| bool trans_format = false; | |||
| bool trans_shape = false; | |||
| GE_IF_BOOL_EXEC(node == nullptr || node->GetOpDesc() == nullptr, GELOGE(FAILED, "node is null"); return ""); | |||
| GE_IF_BOOL_EXEC(node == nullptr || node->GetOpDesc() == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param node or its op_desc is nullptr, check invalid"); | |||
| GELOGE(FAILED, "node is null"); return ""); | |||
| if (node->GetType() == CAST) { | |||
| trans_data_type = true; | |||
| } else if (node->GetType() == TRANSPOSE || node->GetType() == TRANSPOSED || node->GetType() == EXPANDDIMS) { | |||
| @@ -82,6 +82,7 @@ graphStatus TransOpDepthFusionPass::RecursiveInDepth(const InDataAnchorPtr &dst_ | |||
| if (dst_in_anchor == nullptr || dst_in_anchor->GetOwnerNode() == nullptr || | |||
| dst_in_anchor->GetOwnerNode()->GetOpDesc() == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param dst_in_anchor related node info has nullptr, check invalid"); | |||
| GELOGE(FAILED, "parameter is null."); | |||
| return GRAPH_FAILED; | |||
| } | |||
| @@ -257,11 +258,13 @@ graphStatus TransOpDepthFusionPass::RelinkEdges(const OutDataAnchorPtr &new_out_ | |||
| const OutDataAnchorPtr &old_out_anchor, | |||
| const InDataAnchorPtr &in_data_anchor) { | |||
| if (new_out_anchor == nullptr || old_out_anchor == nullptr || in_data_anchor == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param anchor info has nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "new_out_anchor or old_out_anchor or in_data_anchor is nullptr"); | |||
| return GRAPH_FAILED; | |||
| } | |||
| if (new_out_anchor->GetOwnerNode() == nullptr || old_out_anchor->GetOwnerNode() == nullptr || | |||
| in_data_anchor->GetOwnerNode() == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param anchor info owner node has nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "anchor's owner node is nullptr"); | |||
| return GRAPH_FAILED; | |||
| } | |||
| @@ -305,11 +308,14 @@ graphStatus TransOpDepthFusionPass::RemoveNode(const NodePtr &node, const ge::Co | |||
| return GRAPH_FAILED; | |||
| } | |||
| if (GraphUtils::IsolateNode(node, {0}) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate node:%s(%s) failed", node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Isolate removed node: %s, type: %s failed", node->GetName().c_str(), | |||
| node->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != GRAPH_SUCCESS) { | |||
| 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()); | |||
| GELOGE(INTERNAL_ERROR, "Remove node: %s, type: %s without relink failed", node->GetName().c_str(), | |||
| node->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| @@ -99,6 +99,9 @@ Status TransOpNearbyAllreduceFusionPass::RemoveNearbyPairedTransOps(const NodePt | |||
| auto in_data_anchors = node->GetAllInDataAnchors(); | |||
| auto out_data_anchors = node->GetAllOutDataAnchors(); | |||
| if (in_data_anchors.size() != out_data_anchors.size()) { | |||
| REPORT_INNER_ERROR("E19999", "In data anchors size:%zu not equal to out data anchors size:%zu in node:%s(%s), " | |||
| "check invalid", in_data_anchors.size(), out_data_anchors.size(), | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "in and out data anchor size are not equal, node=%s, in_size=%zu, out_size=%zu", | |||
| node->GetName().c_str(), in_data_anchors.size(), out_data_anchors.size()); | |||
| return FAILED; | |||
| @@ -143,6 +146,8 @@ Status TransOpNearbyAllreduceFusionPass::RemoveNearbyPairedTransOps(const NodePt | |||
| // delete in_node | |||
| if (IsolateAndDeleteNode(in_node, {0}) != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||
| in_node->GetName().c_str(), in_node->GetType().c_str()); | |||
| GELOGE(FAILED, "remove node %s failed", in_node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -150,6 +155,8 @@ Status TransOpNearbyAllreduceFusionPass::RemoveNearbyPairedTransOps(const NodePt | |||
| // delete out_node | |||
| if (IsolateAndDeleteNode(out_node, {0}) != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||
| out_node->GetName().c_str(), out_node->GetType().c_str()); | |||
| GELOGE(FAILED, "remove node %s failed", out_node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -162,9 +169,13 @@ Status TransOpNearbyAllreduceFusionPass::RemoveNearbyPairedTransOps(const NodePt | |||
| auto input_desc = in_node->GetOpDesc()->GetInputDesc(0); | |||
| auto output_desc = out_node->GetOpDesc()->GetOutputDesc(0); | |||
| if (node->GetOpDesc()->UpdateInputDesc(static_cast<uint32_t>(i), input_desc) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Update input:%zu desc in op:%s(%s) failed", | |||
| i, node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "UpdateInputDesc fail."); | |||
| } | |||
| if (node->GetOpDesc()->UpdateOutputDesc(static_cast<uint32_t>(i), output_desc) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Update output:%zu desc in op:%s(%s) failed", | |||
| i, node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "UpdateOutputDesc"); | |||
| } | |||
| GELOGI("successfully remove paired transop (%s and %s) for node %s", | |||
| @@ -172,6 +172,12 @@ Status TransOpSymmetryEliminationPass::EliminateTransOp(NodePtr &src_node, const | |||
| // 1.Unlink T1->T2 | |||
| auto ret = src_out_anchor->Unlink(dst_in_anchor); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", | |||
| "Op:%s(%s) out index:%d unlink from op:%s(%s) in index:%d failed", | |||
| src_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| src_out_anchor->GetOwnerNode()->GetType().c_str(), src_out_anchor->GetIdx(), | |||
| dst_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_in_anchor->GetOwnerNode()->GetType().c_str(), dst_in_anchor->GetIdx()); | |||
| GELOGE(FAILED, "Unlink data anchor from %s to %s.", src_node->GetName().c_str(), dst_node->GetName().c_str()); | |||
| return ret; | |||
| } | |||
| @@ -183,6 +189,11 @@ Status TransOpSymmetryEliminationPass::EliminateTransOp(NodePtr &src_node, const | |||
| auto pre_normal_node = in_anchor->GetPeerOutAnchor()->GetOwnerNode(); | |||
| ret = GraphUtils::AddEdge(in_anchor->GetPeerOutAnchor(), dst_in_anchor); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||
| pre_normal_node->GetName().c_str(), pre_normal_node->GetType().c_str(), | |||
| in_anchor->GetPeerOutAnchor()->GetIdx(), | |||
| dst_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| dst_in_anchor->GetOwnerNode()->GetType().c_str(), dst_in_anchor->GetIdx()); | |||
| GELOGE(FAILED, "Add data edge from %s to %s failed.", pre_normal_node->GetName().c_str(), | |||
| dst_node->GetName().c_str()); | |||
| return ret; | |||
| @@ -190,6 +201,9 @@ Status TransOpSymmetryEliminationPass::EliminateTransOp(NodePtr &src_node, const | |||
| // 3.Copy in-control/data-in-control from T1->T2 | |||
| ret = GraphUtils::CopyInCtrlEdges(src_node, dst_node); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Copy in control edge from node:%s(%s) to node:%s(%s) failed", | |||
| src_node->GetName().c_str(), src_node->GetType().c_str(), | |||
| dst_node->GetName().c_str(), dst_node->GetType().c_str()); | |||
| GELOGE(FAILED, "Copy control edge from %s to %s failed.", src_node->GetName().c_str(), dst_node->GetName().c_str()); | |||
| return ret; | |||
| } | |||
| @@ -198,6 +212,9 @@ Status TransOpSymmetryEliminationPass::EliminateTransOp(NodePtr &src_node, const | |||
| if (in_node->GetName() == pre_normal_node->GetName()) { continue; } | |||
| ret = GraphUtils::AddEdge(in_node->GetOutControlAnchor(), dst_node->GetInControlAnchor()); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| in_node->GetName().c_str(), in_node->GetType().c_str(), | |||
| dst_node->GetName().c_str(), dst_node->GetType().c_str()); | |||
| GELOGE(FAILED, "Add control edge from %s to %s failed.", in_node->GetName().c_str(), dst_node->GetName().c_str()); | |||
| return ret; | |||
| } | |||
| @@ -205,6 +222,8 @@ Status TransOpSymmetryEliminationPass::EliminateTransOp(NodePtr &src_node, const | |||
| // 5.IsolateAndDelete T2, A will link to B automatically, and all control edge will also relink. | |||
| ret = IsolateAndDeleteNode(dst_node, {0}); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||
| dst_node->GetName().c_str(), dst_node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Isolate removed node: %s, type: %s failed", dst_node->GetName().c_str(), | |||
| dst_node->GetType().c_str()); | |||
| return ret; | |||
| @@ -223,6 +242,9 @@ Status TransOpSymmetryEliminationPass::RemoveTransOpWithoutOutput(NodePtr &pre_n | |||
| // 6.1 Copy out control to pre normal node | |||
| Status ret = GraphUtils::CopyOutCtrlEdges(trans_node, pre_node); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Copy out control edge from node:%s(%s) to node:%s(%s) failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str(), | |||
| pre_node->GetName().c_str(), pre_node->GetType().c_str()); | |||
| GELOGE(FAILED, "Copy control edge from %s to %s failed.", trans_node->GetName().c_str(), | |||
| pre_node->GetName().c_str()); | |||
| return ret; | |||
| @@ -230,6 +252,8 @@ Status TransOpSymmetryEliminationPass::RemoveTransOpWithoutOutput(NodePtr &pre_n | |||
| // 6.2 Isolate and delete T1 | |||
| ret = IsolateAndDeleteNode(trans_node, {}); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate and delete node:%s(%s) failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Isolate removed node: %s, type: %s failed", trans_node->GetName().c_str(), | |||
| trans_node->GetType().c_str()); | |||
| return ret; | |||
| @@ -63,7 +63,10 @@ void TransOpWithoutReshapeFusionPass::SetRemainNode( | |||
| continue; | |||
| } | |||
| GELOGI("SetRemainNode node is %s", op_desc->GetName().c_str()); | |||
| GE_IF_BOOL_EXEC(!op_desc->SetExtAttr(kRemainNode, true), GELOGE(INTERNAL_ERROR, "set ext attr failed"); return); | |||
| GE_IF_BOOL_EXEC(!op_desc->SetExtAttr(kRemainNode, true), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", kRemainNode, | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set ext attr failed"); return); | |||
| } | |||
| } | |||
| @@ -74,17 +77,29 @@ bool TransOpWithoutReshapeFusionPass::FormatContinuousCheck(const OutDataAnchorP | |||
| return false; | |||
| } | |||
| auto in_node = in_anchor->GetOwnerNode(); | |||
| GE_IF_BOOL_EXEC(in_node == nullptr, GELOGE(INTERNAL_ERROR, "in_node is null"); return false); | |||
| GE_IF_BOOL_EXEC(in_node == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param in_anchor's owner node is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "in_node is null"); return false); | |||
| auto in_op = in_node->GetOpDesc(); | |||
| auto out_owner_node = out_anchor->GetOwnerNode(); | |||
| GE_IF_BOOL_EXEC(out_owner_node == nullptr, GELOGE(INTERNAL_ERROR, "out_owner_node is null"); return false); | |||
| GE_IF_BOOL_EXEC(out_owner_node == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param out_anchor's owner node is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "out_owner_node is null"); return false); | |||
| auto out_op = out_owner_node->GetOpDesc(); | |||
| GE_IF_BOOL_EXEC(in_op == nullptr, GELOGE(INTERNAL_ERROR, "in_op is null"); return false); | |||
| GE_IF_BOOL_EXEC(out_op == nullptr, GELOGE(INTERNAL_ERROR, "out_op is null"); return false); | |||
| GE_IF_BOOL_EXEC(in_op == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param in_anchor's owner op_desc is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "in_op is null"); return false); | |||
| GE_IF_BOOL_EXEC(out_op == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param out_anchor's owner op_desc is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "out_op is null"); return false); | |||
| auto in_op_desc = in_op->GetInputDescPtr(in_anchor->GetIdx()); | |||
| auto out_op_desc = out_op->GetOutputDescPtr(out_anchor->GetIdx()); | |||
| GE_IF_BOOL_EXEC(in_op_desc == nullptr, GELOGE(INTERNAL_ERROR, "in_op_desc is null"); return false); | |||
| GE_IF_BOOL_EXEC(out_op_desc == nullptr, GELOGE(INTERNAL_ERROR, "out_op_desc is null"); return false); | |||
| GE_IF_BOOL_EXEC(in_op_desc == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param in_anchor corresponding tensor is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "in_op_desc is null"); return false); | |||
| GE_IF_BOOL_EXEC(out_op_desc == nullptr, | |||
| REPORT_INNER_ERROR("E19999", "Param out_anchor corresponding tensor is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "out_op_desc is null"); return false); | |||
| if (!ShapeEqualCheck(in_op_desc->GetShape(), out_op_desc->GetShape())) { | |||
| return false; | |||
| } | |||
| @@ -357,6 +372,9 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkSubGraphControlEdges( | |||
| GELOGI("add control edge.src:%s, dst:%s", out_owner_node->GetName().c_str(), in_owner_node->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(out_owner_node->GetOutControlAnchor(), in_owner_node->GetInControlAnchor()) != | |||
| GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), | |||
| in_owner_node->GetName().c_str(), in_owner_node->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -365,6 +383,9 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkSubGraphControlEdges( | |||
| GELOGI("add out data 2 in contorl edge.src:%s, dst:%s", out_owner_node->GetName().c_str(), | |||
| in_owner_node->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(out_anchor, in_owner_node->GetInControlAnchor()) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), | |||
| in_owner_node->GetName().c_str(), in_owner_node->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -392,6 +413,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdgesWhenDescNotChange | |||
| GELOGI("add control edge.src:%s, dst:%s, dst idx:%d", out_owner_node->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | |||
| if (GraphUtils::AddEdge(out_owner_node->GetOutControlAnchor(), peer_in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -401,6 +426,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdgesWhenDescNotChange | |||
| GELOGI("add control edge.src:%s, src idx:%d, dst:%s", peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_out_anchor->GetIdx(), in_owner_node->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(peer_out_anchor, in_owner_node->GetInControlAnchor()) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_out_anchor->GetOwnerNode()->GetType().c_str(), | |||
| in_owner_node->GetName().c_str(), in_owner_node->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -410,6 +439,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdgesWhenDescNotChange | |||
| GELOGI("add out control 2 in data edge.src:%s, dst:%s, dst idx:%d", out_owner_node->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | |||
| if (GraphUtils::AddEdge(out_owner_node->GetOutControlAnchor(), peer_in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -419,6 +452,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdgesWhenDescNotChange | |||
| GELOGI("add out data 2 in control edge.src:%s, dst:%s, dst idx:%d", out_owner_node->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), peer_in_anchor->GetIdx()); | |||
| if (GraphUtils::AddEdge(out_anchor, peer_in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -443,6 +480,9 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkNodesWhenDescNotChanged( | |||
| GELOGI("relink node.src node:%s, src idx:%d, dst node:%s, dst idx:%d", out_owner_node->GetName().c_str(), | |||
| out_anchor->GetIdx(), in_owner_node->GetName().c_str(), in_anchor->GetIdx()); | |||
| if (GraphUtils::AddEdge(out_anchor, in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), out_anchor->GetIdx(), | |||
| in_owner_node->GetName().c_str(), in_owner_node->GetType().c_str(), in_anchor->GetIdx()); | |||
| GELOGE(GRAPH_FAILED, "add edge failed!src:%s, src idx:%d, dst:%s, dst idx:%d", out_owner_node->GetName().c_str(), | |||
| out_anchor->GetIdx(), in_owner_node->GetName().c_str(), in_anchor->GetIdx()); | |||
| return GRAPH_FAILED; | |||
| @@ -466,16 +506,21 @@ OpDescPtr TransOpWithoutReshapeFusionPass::GetFormatTransferOp(const GeTensorDes | |||
| format_transfer_op_name << "fusion_format_transfer_" << fusion_format_transfer_op_count; | |||
| OpDescPtr format_transfer_op = MakeShared<OpDesc>(format_transfer_op_name.str().c_str(), TRANSDATA); | |||
| if (format_transfer_op == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | |||
| GELOGE(INTERNAL_ERROR, "new format transfer op failed!"); | |||
| return nullptr; | |||
| } | |||
| GE_IF_BOOL_EXEC(!AttrUtils::SetInt(format_transfer_op, ATTR_NAME_INPUT_FORMAT, | |||
| static_cast<int64_t>(format_trans_input_desc.GetFormat())), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INPUT_FORMAT.c_str(), | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set ATTR_NAME_INPUT_FORMAT failed"); | |||
| return nullptr); | |||
| GE_IF_BOOL_EXEC(!AttrUtils::SetInt(format_transfer_op, ATTR_NAME_OUTPUT_FORMAT, | |||
| static_cast<int64_t>(format_trans_output_desc.GetFormat())), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_OUTPUT_FORMAT.c_str(), | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set ATTR_NAME_OUTPUT_FORMAT failed"); | |||
| return nullptr); | |||
| @@ -483,22 +528,32 @@ OpDescPtr TransOpWithoutReshapeFusionPass::GetFormatTransferOp(const GeTensorDes | |||
| string dst_format = TypeUtils::FormatToSerialString(format_trans_output_desc.GetFormat()); | |||
| GE_IF_BOOL_EXEC(!AttrUtils::SetStr(format_transfer_op, kAttrNameSrcFormat, src_format), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", kAttrNameSrcFormat, | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set kAttrNameSrcFormat failed"); | |||
| return nullptr); | |||
| GE_IF_BOOL_EXEC(!AttrUtils::SetStr(format_transfer_op, kAttrNameDstFormat, dst_format), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", kAttrNameDstFormat, | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set kAttrNameDstFormat failed"); | |||
| return nullptr); | |||
| GE_IF_BOOL_EXEC(format_transfer_op->AddInputDesc(format_trans_input_desc) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "add input desc failed"); | |||
| return nullptr); | |||
| GE_IF_BOOL_EXEC(format_transfer_op->AddOutputDesc(format_trans_output_desc) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add ouput desc to op:%s(%s) failed", | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "add output desc failed"); | |||
| return nullptr); | |||
| GE_IF_BOOL_EXEC(!ge::AttrUtils::SetBool(format_transfer_op, ATTR_NEED_COMPILE, true), | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NEED_COMPILE.c_str(), | |||
| format_transfer_op->GetName().c_str(), format_transfer_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set ext attr failed"); | |||
| return nullptr); | |||
| return format_transfer_op; | |||
| @@ -515,6 +570,7 @@ OpDescPtr TransOpWithoutReshapeFusionPass::GetCastOp(const GeTensorDesc &cast_in | |||
| auto cast_op = ge::OpDescUtils::GetOpDescFromOperator(node_op); | |||
| node_op.BreakConnect(); | |||
| if (cast_op == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "Create operator:%s(%s) failed", cast_op_name.str().c_str(), CAST); | |||
| GELOGE(INTERNAL_ERROR, "new cast op failed!"); | |||
| return nullptr; | |||
| } | |||
| @@ -522,29 +578,41 @@ OpDescPtr TransOpWithoutReshapeFusionPass::GetCastOp(const GeTensorDesc &cast_in | |||
| const int default_output_index = 0; | |||
| if (cast_op->GetInputsSize() == 0) { | |||
| GE_IF_BOOL_EXEC(cast_op->AddInputDesc(cast_input_desc) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add input desc to op:%s(%s) failed", | |||
| cast_op->GetName().c_str(), cast_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "add input desc failed"); | |||
| return nullptr); | |||
| } else { | |||
| GE_IF_BOOL_EXEC(cast_op->UpdateInputDesc(default_input_index, cast_input_desc) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Update input:%d desc of op:%s(%s) failed", default_input_index, | |||
| cast_op->GetName().c_str(), cast_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "update input desc failed"); | |||
| return nullptr); | |||
| } | |||
| if (cast_op->GetOutputsSize() == 0) { | |||
| GE_IF_BOOL_EXEC(cast_op->AddOutputDesc(cast_output_desc) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Add output desc to op:%s(%s) failed", | |||
| cast_op->GetName().c_str(), cast_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "add output desc failed"); | |||
| return nullptr); | |||
| } else { | |||
| GE_IF_BOOL_EXEC(cast_op->UpdateOutputDesc(default_output_index, cast_output_desc) != GRAPH_SUCCESS, | |||
| REPORT_CALL_ERROR("E19999", "Update output:%d desc of op:%s(%s) failed", default_output_index, | |||
| cast_op->GetName().c_str(), cast_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "update output desc failed"); | |||
| return nullptr); | |||
| } | |||
| if (!AttrUtils::SetInt(cast_op, CAST_ATTR_DST_TYPE, static_cast<int64_t>(cast_output_desc.GetDataType()))) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", CAST_ATTR_DST_TYPE.c_str(), | |||
| cast_op->GetName().c_str(), cast_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set dst_type attr failed"); | |||
| return nullptr; | |||
| } | |||
| if (!AttrUtils::SetBool(cast_op, ATTR_NEED_COMPILE, true)) { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NEED_COMPILE.c_str(), | |||
| cast_op->GetName().c_str(), cast_op->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "set need_compile attr failed"); | |||
| return nullptr; | |||
| } | |||
| @@ -879,6 +947,8 @@ graphStatus TransOpWithoutReshapeFusionPass::AddTransNode(const ComputeGraphPtr | |||
| trans_node = graph->AddNode(transop); | |||
| if (trans_node == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s failed", | |||
| transop->GetName().c_str(), transop->GetType().c_str(), graph->GetName().c_str()); | |||
| GELOGE(GRAPH_FAILED, "add node failed!"); | |||
| return GRAPH_FAILED; | |||
| } | |||
| @@ -945,6 +1015,9 @@ graphStatus TransOpWithoutReshapeFusionPass::InsertNewTransOp(const ComputeGraph | |||
| GELOGI("add edge.src:%s, src idx:%d, dst:%s", out_anchor->GetOwnerNode()->GetName().c_str(), out_anchor->GetIdx(), | |||
| new_trans_nodes.front()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(out_anchor, new_trans_nodes.front()->GetInAnchor(0)) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| out_owner_node->GetName().c_str(), out_owner_node->GetType().c_str(), out_anchor->GetIdx(), | |||
| new_trans_nodes.front()->GetName().c_str(), new_trans_nodes.front()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } else { | |||
| auto old_peer_in_anchor = begin_out.second; | |||
| @@ -957,6 +1030,9 @@ graphStatus TransOpWithoutReshapeFusionPass::InsertNewTransOp(const ComputeGraph | |||
| new_trans_nodes.back()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(new_trans_nodes.front()->GetOutAnchor(0), new_trans_nodes.back()->GetInAnchor(0)) != | |||
| GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:0) failed", | |||
| new_trans_nodes.front()->GetName().c_str(), new_trans_nodes.front()->GetType().c_str(), | |||
| new_trans_nodes.back()->GetName().c_str(), new_trans_nodes.back()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } else { | |||
| auto old_peer_out_anchor = end_in.first; | |||
| @@ -967,6 +1043,9 @@ graphStatus TransOpWithoutReshapeFusionPass::InsertNewTransOp(const ComputeGraph | |||
| GELOGI("add edge.src:%s, dst:%s, dst idx:%d", new_trans_nodes.back()->GetName().c_str(), | |||
| in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetIdx()); | |||
| if (GraphUtils::AddEdge(new_trans_nodes.back()->GetOutAnchor(0), in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| new_trans_nodes.front()->GetName().c_str(), new_trans_nodes.front()->GetType().c_str(), | |||
| in_owner_node->GetName().c_str(), in_owner_node->GetType().c_str(), in_anchor->GetIdx()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| @@ -977,6 +1056,7 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdge(const int index, | |||
| const vector<NodePtr> &new_trans_nodes) { | |||
| GE_CHECK_NOTNULL(out_anchor); | |||
| if (new_trans_nodes.front() == nullptr || new_trans_nodes.back() == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param new_trans_nodes front or back is nullptr, check invalid"); | |||
| return GRAPH_FAILED; | |||
| } | |||
| if (sub_graph_has_control_edge_[index]) { | |||
| @@ -984,6 +1064,9 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdge(const int index, | |||
| new_trans_nodes.front()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(out_anchor->GetOwnerNode()->GetOutControlAnchor(), | |||
| new_trans_nodes.front()->GetInControlAnchor()) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| out_anchor->GetOwnerNode()->GetName().c_str(), out_anchor->GetOwnerNode()->GetType().c_str(), | |||
| new_trans_nodes.front()->GetName().c_str(), new_trans_nodes.front()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -993,6 +1076,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdge(const int index, | |||
| GELOGI("add control edge.src:%s, dst:%s", new_trans_nodes.back()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(new_trans_nodes.back()->GetOutControlAnchor(), peer_in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| new_trans_nodes.back()->GetName().c_str(), new_trans_nodes.back()->GetType().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -1002,6 +1089,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdge(const int index, | |||
| GELOGI("add control edge.src:%s, dst:%s", peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| new_trans_nodes.front()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(peer_out_anchor, new_trans_nodes.front()->GetInControlAnchor()) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_out_anchor->GetOwnerNode()->GetType().c_str(), | |||
| new_trans_nodes.front()->GetName().c_str(), new_trans_nodes.front()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -1011,6 +1102,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdge(const int index, | |||
| GELOGI("add control edge.src:%s, dst:%s", new_trans_nodes.back()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(new_trans_nodes.back()->GetOutControlAnchor(), peer_in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| new_trans_nodes.back()->GetName().c_str(), new_trans_nodes.back()->GetType().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetType().c_str()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -1020,6 +1115,10 @@ graphStatus TransOpWithoutReshapeFusionPass::RelinkControlEdge(const int index, | |||
| GELOGI("add control edge.src:%s, dst:%s", new_trans_nodes.back()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str()); | |||
| if (GraphUtils::AddEdge(new_trans_nodes.back()->GetOutDataAnchor(0), peer_in_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:0) and op:%s(%s)(index:%d) failed", | |||
| new_trans_nodes.back()->GetName().c_str(), new_trans_nodes.back()->GetType().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_in_anchor->GetOwnerNode()->GetType().c_str(), peer_in_anchor->GetIdx()); | |||
| return GRAPH_FAILED; | |||
| } | |||
| } | |||
| @@ -1081,6 +1180,7 @@ graphStatus TransOpWithoutReshapeFusionPass::GetSubGraphsBetweenNormalNode( | |||
| vector<std::pair<OutDataAnchorPtr, InDataAnchorPtr>> &nodes_list) { | |||
| graphStatus ret = GRAPH_SUCCESS; | |||
| if (out_anchor == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param out_anchor is nullptr, check invalid"); | |||
| return GRAPH_FAILED; | |||
| } | |||
| @@ -34,11 +34,13 @@ const char *const kAttrNameSrcFormat = "src_format"; | |||
| namespace ge { | |||
| Status TransposeTransDataPass::Run(NodePtr &node) { | |||
| if (node == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | |||
| GELOGE(PARAM_INVALID, "param [node] must not be null."); | |||
| return PARAM_INVALID; | |||
| } | |||
| auto op_desc = node->GetOpDesc(); | |||
| if (op_desc == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param node's op_desc is nullptr, check invalid"); | |||
| GELOGE(PARAM_INVALID, "OpDesc of param [node] must not be null."); | |||
| return PARAM_INVALID; | |||
| } | |||
| @@ -77,6 +79,7 @@ Status TransposeTransDataPass::Run(NodePtr &node) { | |||
| GE_CHECK_NOTNULL(out_node); | |||
| OpDescPtr out_op_desc = out_node->GetOpDesc(); | |||
| if (out_op_desc == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "OpDesc in node is nullptr, check invalid"); | |||
| GELOGE(FAILED, "OpDesc of out data node of [%s] must not be null.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -111,6 +114,10 @@ Status TransposeTransDataPass::CheckOneInAndOneOutDataAnchor(NodePtr &node) cons | |||
| // Trans op has one input data node, maybe has N output data nodes | |||
| uint32_t in_data_node_nums = node->GetInDataNodes().size(); | |||
| if (in_data_anchor_nums != 1 || out_data_anchor_nums != 1 || in_data_node_nums != 1) { | |||
| REPORT_INNER_ERROR("E19999", "In data anchor num:%u, out data anchor num:%u, in data node num:%u of node:%s(%s) " | |||
| "must be all equal to 1, check invalid", | |||
| in_data_anchor_nums, out_data_anchor_nums, in_data_node_nums, | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "[%s] %s has %u in %u out data anchor, has %u in data node.", node->GetType().c_str(), | |||
| node->GetName().c_str(), in_data_anchor_nums, out_data_anchor_nums, in_data_node_nums); | |||
| return FAILED; | |||
| @@ -122,6 +129,8 @@ Status TransposeTransDataPass::RemoveTranspose(NodePtr &node) { | |||
| GE_CHECK_NOTNULL(node); | |||
| ComputeGraphPtr graph = node->GetOwnerComputeGraph(); | |||
| if (graph == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Owner graph of node:%s(%s) is nullptr, check invalid", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "[%s] The owner graph must not be null.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -146,6 +155,8 @@ Status TransposeTransDataPass::RemoveTranspose(NodePtr &node) { | |||
| } | |||
| AddNodeDeleted(node); | |||
| if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != GRAPH_SUCCESS) { | |||
| 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()); | |||
| GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -101,6 +101,8 @@ Status UnusedArgsCleanPass::ClassifyDataNodes(const ComputeGraphPtr &graph, cons | |||
| for (const auto &name : func_desc->GetSubgraphInstanceNames()) { | |||
| const auto &subgraph = graph->GetSubgraph(name); | |||
| if (subgraph == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "Get subgraph from graph:%s by name:%s failed", | |||
| graph->GetName().c_str(), name.c_str()); | |||
| GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "Subgraph not found, name: %s", name.c_str()); | |||
| return GE_GRAPH_EMPTY_SUBGRAPH; | |||
| } | |||
| @@ -113,6 +115,8 @@ Status UnusedArgsCleanPass::ClassifyDataNodes(const ComputeGraphPtr &graph, cons | |||
| uint32_t parent_index = 0; | |||
| if (!AttrUtils::GetInt(data->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(), | |||
| data->GetName().c_str(), data->GetType().c_str()); | |||
| GELOGE(FAILED, "Parent index not found, name: %s", data->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -150,6 +154,8 @@ Status UnusedArgsCleanPass::UpdateInputTensor(const map<ComputeGraphPtr, map<uin | |||
| const auto data = it->second; | |||
| if (!AttrUtils::SetInt(data->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, update_index)) { | |||
| REPORT_CALL_ERROR("E19999", "Get Attr:%s from op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(), | |||
| data->GetName().c_str(), data->GetType().c_str()); | |||
| GELOGE(FAILED, "Set parent index failed, name: %s", data->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -27,10 +27,12 @@ namespace ge { | |||
| /// | |||
| Status UnusedConstPass::Run(NodePtr &node) { | |||
| if (node == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | |||
| GELOGE(FAILED, "parameter is null."); | |||
| return FAILED; | |||
| } | |||
| if (node->GetOpDesc() == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param node's op_desc is nullptr, check invalid"); | |||
| GELOGE(PARAM_INVALID, "param [opDesc] must not be null."); | |||
| return PARAM_INVALID; | |||
| } | |||
| @@ -61,6 +61,8 @@ Status VarIsInitializedOpPass::CheckSrcNode(const NodePtr &node, bool &inited) c | |||
| GE_CHECK_NOTNULL(node); | |||
| auto input_nodes = node->GetInDataNodes(); | |||
| if (input_nodes.size() != kVarIsInitializedIOCnt) { | |||
| REPORT_INNER_ERROR("E19999", "In data node num:%zu of node:%s(%s) not equal to %d, check invalid", | |||
| input_nodes.size(), node->GetName().c_str(), node->GetType().c_str(), kVarIsInitializedIOCnt); | |||
| GELOGE(FAILED, | |||
| "[%s] Node input data nodes size [%zu] is not equal 1.", | |||
| node->GetName().c_str(), | |||
| @@ -73,6 +75,9 @@ Status VarIsInitializedOpPass::CheckSrcNode(const NodePtr &node, bool &inited) c | |||
| auto input_node_name = input_node->GetName(); | |||
| auto input_node_type = input_node->GetType(); | |||
| if (input_node_type != VARIABLE) { | |||
| REPORT_INNER_ERROR("E19999", "Index:%d In data node of node:%s(%s), type:%s not %s, check invalid", | |||
| kVarIsInitVarInputIndex, node->GetName().c_str(), node->GetType().c_str(), | |||
| input_node_type.c_str(), VARIABLE); | |||
| GELOGE(FAILED, "[%s] Src node %s is not Variable, is %s.", node->GetName().c_str(), input_node_name.c_str(), | |||
| input_node_type.c_str()); | |||
| return FAILED; | |||
| @@ -95,6 +100,7 @@ Status VarIsInitializedOpPass::CreateConstant(NodePtr &node, OpDescPtr &op_desc, | |||
| // 1. create Constant OpDesc | |||
| op_desc = MakeShared<OpDesc>(node->GetName().c_str(), CONSTANT); | |||
| if (op_desc == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New OpDesc failed"); | |||
| GELOGE(FAILED, "[%s] Make shared of Constant op desc failed.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -102,6 +108,7 @@ Status VarIsInitializedOpPass::CreateConstant(NodePtr &node, OpDescPtr &op_desc, | |||
| // 2. get OpDesc of VarIsInitializedOp | |||
| OpDescPtr original_op_desc = node->GetOpDesc(); | |||
| if (original_op_desc == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "OpDesc in node is nullptr, check invalid"); | |||
| GELOGE(FAILED, "[%s] Op desc must not be null.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -111,10 +118,13 @@ Status VarIsInitializedOpPass::CreateConstant(NodePtr &node, OpDescPtr &op_desc, | |||
| bool val = inited; | |||
| GeTensorPtr const_tensor_ptr = MakeShared<GeTensor>(original_desc, reinterpret_cast<uint8_t *>(&val), sizeof(bool)); | |||
| if (const_tensor_ptr == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New GeTensor failed"); | |||
| GELOGE(FAILED, "[%s] Make shared of Constant tensor failed.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| if (!AttrUtils::SetTensor(op_desc, ATTR_NAME_WEIGHTS, const_tensor_ptr)) { | |||
| 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()); | |||
| GELOGE(INTERNAL_ERROR, "get ATTR_NAME_WEIGHTS failed"); | |||
| return FAILED; | |||
| } | |||
| @@ -131,6 +141,9 @@ Status VarIsInitializedOpPass::ProcessInAnchor(NodePtr &node, NodePtr &new_node) | |||
| auto out_anchors = node->GetAllOutDataAnchors(); | |||
| if ((in_anchors.size() != kVarIsInitializedIOCnt) || | |||
| (out_anchors.size() != kVarIsInitializedIOCnt)) { | |||
| REPORT_INNER_ERROR("E19999", "In data anchor num:%zu and out data anchor num:%zu of node:%s(%s), " | |||
| "must botch equal to %d, check invalid", in_anchors.size(), out_anchors.size(), | |||
| node->GetName().c_str(), node->GetType().c_str(), kVarIsInitializedIOCnt); | |||
| GELOGE(FAILED, | |||
| "[%s] Node input/output data anchors" | |||
| " size [%lu][%lu] is not all equal 1.", | |||
| @@ -144,22 +157,36 @@ Status VarIsInitializedOpPass::ProcessInAnchor(NodePtr &node, NodePtr &new_node) | |||
| auto peer_out_anchor = in_anchor->GetPeerOutAnchor(); | |||
| GE_CHECK_NOTNULL(peer_out_anchor); | |||
| if (GraphUtils::RemoveEdge(in_anchor, peer_out_anchor) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Remove edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%d) failed", | |||
| in_anchor->GetOwnerNode()->GetName().c_str(), in_anchor->GetOwnerNode()->GetType().c_str(), | |||
| in_anchor->GetIdx(), | |||
| peer_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| peer_out_anchor->GetOwnerNode()->GetType().c_str(), peer_out_anchor->GetIdx()); | |||
| GELOGE(FAILED, "[%s] Remove in data edge failed.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| auto src_node = peer_out_anchor->GetOwnerNode(); | |||
| if (GraphUtils::AddEdge(src_node->GetOutControlAnchor(), new_node->GetInControlAnchor()) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add control edge between op:%s(%s) and op:%s(%s) failed", | |||
| src_node->GetName().c_str(), src_node->GetType().c_str(), | |||
| new_node->GetName().c_str(), new_node->GetType().c_str()); | |||
| GELOGE(FAILED, "Failed to link control edges from var %s to new const %s", | |||
| src_node->GetName().c_str(), new_node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| if (GraphUtils::MoveInCtrlEdges(node, new_node) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Move in control edge from node:%s(%s) to node:%s(%s) failed", | |||
| node->GetName().c_str(), node->GetType().c_str(), | |||
| new_node->GetName().c_str(), new_node->GetType().c_str()); | |||
| GELOGE(FAILED, "Failed to move in ctrl edges from %s to new const", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| if (GraphUtils::MoveOutCtrlEdges(node, new_node) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Move out control edge from node:%s(%s) to node:%s(%s) failed", | |||
| node->GetName().c_str(), node->GetType().c_str(), | |||
| new_node->GetName().c_str(), new_node->GetType().c_str()); | |||
| GELOGE(FAILED, "Failed to move out ctrl edges from %s to new const", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -177,6 +204,9 @@ Status VarIsInitializedOpPass::ChangeNodeToConstant(NodePtr &node, bool inited) | |||
| NodePtr const_node = graph->AddNodeFront(constant_op_desc); | |||
| if (const_node == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "Add node:%s(%s) to graph:%s front failed", | |||
| constant_op_desc->GetName().c_str(), constant_op_desc->GetType().c_str(), | |||
| graph->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -185,11 +215,16 @@ Status VarIsInitializedOpPass::ChangeNodeToConstant(NodePtr &node, bool inited) | |||
| } | |||
| if (NodeUtils::MoveOutputEdges(node, const_node) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Move out edge from node:%s(%s) to node:%s(%s) failed", | |||
| node->GetName().c_str(), node->GetType().c_str(), | |||
| const_node->GetName().c_str(), const_node->GetType().c_str()); | |||
| GELOGE(FAILED, "[%s] Move output edges to new node failed.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| if (GraphUtils::RemoveNodeWithoutRelink(graph, node) != SUCCESS) { | |||
| 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()); | |||
| GELOGE(FAILED, "[%s] RemoveNodeWithoutRelink failed.", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -263,6 +298,7 @@ Status VarIsInitializedOpPass::UpdateInitedVars(const NodePtr &node) { | |||
| std::set<int64_t> *VarIsInitializedOpPass::CreateInitedVars() { | |||
| std::unique_ptr<std::set<int64_t>> inited_vars_keeper(new(std::nothrow) std::set<int64_t>()); | |||
| if (inited_vars_keeper == nullptr) { | |||
| REPORT_CALL_ERROR("E19999", "New set failed"); | |||
| GELOGE(OUT_OF_MEMORY, "Failed to alloc set memory"); | |||
| return nullptr; | |||
| } | |||
| @@ -47,6 +47,9 @@ Status ByPassTransNode(NodePtr &trans_node, NodePtr &ref_node) { | |||
| GELOGD("Begin to bypass trans node %s", trans_node->GetName().c_str()); | |||
| auto ret = GraphUtils::CopyInCtrlEdges(trans_node, ref_node); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Copy in control edge from node:%s(%s) to node:%s(%s) failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str(), | |||
| ref_node->GetName().c_str(), ref_node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, | |||
| "Failed to move control edges from trans " | |||
| "node %s to var-ref %s", | |||
| @@ -55,6 +58,8 @@ Status ByPassTransNode(NodePtr &trans_node, NodePtr &ref_node) { | |||
| } | |||
| auto ref_in_anchor = ref_node->GetInDataAnchor(0); | |||
| if (ref_in_anchor == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no input anchor, check invalid", | |||
| ref_node->GetName().c_str(), ref_node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, | |||
| "The variable ref node %s does not have an " | |||
| "input anchor", | |||
| @@ -64,6 +69,8 @@ Status ByPassTransNode(NodePtr &trans_node, NodePtr &ref_node) { | |||
| ref_in_anchor->UnlinkAll(); | |||
| auto trans_in_anchor = trans_node->GetInDataAnchor(0); | |||
| if (trans_in_anchor == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no input anchor, check invalid", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, | |||
| "Failed to get the in data anchor from trans" | |||
| " node %s type %s", | |||
| @@ -79,6 +86,11 @@ Status ByPassTransNode(NodePtr &trans_node, NodePtr &ref_node) { | |||
| } else { | |||
| ret = GraphUtils::AddEdge(prev_trans_node_out_anchor, ref_in_anchor); | |||
| if (ret != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:0) failed", | |||
| prev_trans_node_out_anchor->GetOwnerNode()->GetName().c_str(), | |||
| prev_trans_node_out_anchor->GetOwnerNode()->GetType().c_str(), | |||
| prev_trans_node_out_anchor->GetIdx(), | |||
| ref_node->GetName().c_str(), ref_node->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, | |||
| "Failed to add edge between ref node %s " | |||
| "and the prev node of trans node %s", | |||
| @@ -115,6 +127,7 @@ bool IsTransSupport(const TransNodeInfo &trans_info) { | |||
| Status VariableOpPass::Run(ge::ComputeGraphPtr graph) { | |||
| if (graph == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param graph is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "Failed to run variable op pass, null graph"); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -124,6 +137,7 @@ Status VariableOpPass::Run(ge::ComputeGraphPtr graph) { | |||
| GetContext().SessionId(), graph_id); | |||
| if (var_accelerate_ctrl_ == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "The variable accelerate control is nullptr, check invalid"); | |||
| GELOGE(INTERNAL_ERROR, "Failed to run var op pass, the variable accelerate control is null"); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -174,11 +188,15 @@ Status VariableOpPass::Run(ge::ComputeGraphPtr graph) { | |||
| ret = VarManager::Instance(graph->GetSessionID())->SetTransRoad(node->GetName(), fusion_road); | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Set Trans road for node:%s(%s) failed, session_id:%lu", | |||
| node->GetName().c_str(), node->GetType().c_str(), graph->GetSessionID()); | |||
| GELOGE(INTERNAL_ERROR, "Failed to update the format fusion road for var %s", node->GetName().c_str()); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| ret = VarManager::Instance(graph->GetSessionID())->SetChangedGraphId(node->GetName(), graph_id); | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Update graph_id:%u for node:%s(%s) failed, session_id:%lu", | |||
| graph_id, node->GetName().c_str(), node->GetType().c_str(), graph->GetSessionID()); | |||
| GELOGE(INTERNAL_ERROR, "Failed to update the graph id for var %s", node->GetName().c_str()); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -210,10 +228,14 @@ Status VariableOpPass::DealFusion(const ge::NodePtr &var_node) { | |||
| trans_node->GetType().c_str(), var_node->GetName().c_str()); | |||
| if (GraphUtils::IsolateNode(trans_node, {0}) != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate node:%s(%s) failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str()); | |||
| return GE_GRAPH_VARIABLE_OP_PASS_FAILED; | |||
| } | |||
| if (GraphUtils::RemoveNodeWithoutRelink(graph, trans_node) != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str(), graph->GetName().c_str()); | |||
| return GE_GRAPH_VARIABLE_OP_PASS_FAILED; | |||
| } | |||
| } | |||
| @@ -245,9 +267,13 @@ Status VariableOpPass::DealFusion(const ge::NodePtr &var_node) { | |||
| " one output data nodes, isolate and remove it.", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str(), ref_node->GetName().c_str()); | |||
| if (GraphUtils::IsolateNode(trans_node, {0}) != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate node:%s(%s) failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str()); | |||
| return GE_GRAPH_VARIABLE_OP_PASS_FAILED; | |||
| } | |||
| if (GraphUtils::RemoveNodeWithoutRelink(graph, trans_node) != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | |||
| trans_node->GetName().c_str(), trans_node->GetType().c_str(), graph->GetName().c_str()); | |||
| return GE_GRAPH_VARIABLE_OP_PASS_FAILED; | |||
| } | |||
| } | |||
| @@ -365,6 +391,7 @@ Status VariableOpPass::CheckVariableRefLegally(const ge::NodePtr &var_node, bool | |||
| Status VariableOpPass::UpdateVarAndRefOutputFormatInfo(const GeTensorDesc &final_output, const ge::NodePtr &node) { | |||
| if (node == nullptr || node->GetOpDesc() == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param node or its op_desc is nullptr, check invalid"); | |||
| GELOGE(FAILED, "node or opdesc is nullptr"); | |||
| return FAILED; | |||
| } | |||
| @@ -377,6 +404,8 @@ Status VariableOpPass::UpdateVarAndRefOutputFormatInfo(const GeTensorDesc &final | |||
| auto node_desc = node->GetOpDesc()->GetOutputDesc(0); | |||
| CopyVariableFormatDataTypeAndShape(final_output, node_desc); | |||
| if (node->GetOpDesc()->UpdateOutputDesc(0, node_desc) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Update ouput:0 desc in op:%s(%s) failed", | |||
| node->GetName().c_str(), node->GetType().c_str()); | |||
| GELOGE(FAILED, "update output desc fail."); | |||
| return FAILED; | |||
| } | |||
| @@ -460,6 +489,10 @@ Status VariableOpPass::CheckVarAndVarRefAreAlike(const NodePtr &var_node, const | |||
| GELOGD("var_ref_node_trans_nodes size is %zu.", var_ref_node_trans_nodes.size()); | |||
| if (var_ref_node_trans_nodes.size() > 1) { | |||
| REPORT_INNER_ERROR("E19999", "In data node num:%zu of node:%s(%s) bigger than 1, check invalid", | |||
| var_ref_node_trans_nodes.size(), | |||
| var_ref_node->GetName().c_str(), var_ref_node->GetType().c_str()); | |||
| GELOGE(GE_GRAPH_VARIABLE_OP_PASS_FAILED, "var_ref_node_trans_nodes.size() > 1."); | |||
| return GE_GRAPH_VARIABLE_OP_PASS_FAILED; | |||
| } | |||
| @@ -525,6 +558,7 @@ void VariableOpPass::CopyVariableFormatDataTypeAndShape(const GeTensorDesc &src_ | |||
| Status VariableOpPass::CheckIfCouldBeOptimized(const ge::NodePtr &node, bool &flag, VarTransRoad &fusion_road) { | |||
| if (node == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid"); | |||
| return FAILED; | |||
| } | |||
| bool is_matched = false; | |||
| @@ -602,6 +636,8 @@ Status VariableOpPass::RenewVarDesc(ge::ComputeGraphPtr &graph) { | |||
| GE_CHECK_NOTNULL(node->GetOpDesc()); | |||
| ret = ge::VarManager::Instance(graph->GetSessionID())->RenewCurVarDesc(node->GetName(), node->GetOpDesc()); | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Renew descriptor for node:%s(%s) failed, session_id:%lu", | |||
| node->GetName().c_str(), node->GetType().c_str(), graph->GetSessionID()); | |||
| GELOGE(FAILED, "var manager renew var[%s] descriptor failed!", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -626,6 +662,8 @@ Status VariableOpPass::RenewVarDesc(uint64_t session_id, const NodePtr &node, co | |||
| GE_CHECK_NOTNULL(node->GetOpDesc()); | |||
| Status ret = ge::VarManager::Instance(session_id)->RenewCurVarDesc(node->GetName(), node->GetOpDesc()); | |||
| if (ret != SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Renew descriptor for node:%s(%s) failed, session_id:%lu", | |||
| node->GetName().c_str(), node->GetType().c_str(), session_id); | |||
| GELOGE(FAILED, "var manager renew var[%s] descriptor failed!", node->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -35,6 +35,8 @@ Status VariableRefDeleteOpPass::Run(ge::ComputeGraphPtr graph) { | |||
| continue; | |||
| } | |||
| if (all_var_names.count(ref_var_src_var_name) == 0) { | |||
| REPORT_INNER_ERROR("E19999", "Can not find source variable[%s] of variable ref[%s], check invalid", | |||
| ref_var_src_var_name.c_str(), node->GetName().c_str()); | |||
| GELOGE(FAILED, "Can not find source variable[%s] of variable ref[%s]", ref_var_src_var_name.c_str(), | |||
| node->GetName().c_str()); | |||
| return FAILED; | |||
| @@ -53,6 +55,8 @@ Status VariableRefDeleteOpPass::DealVariableRef(ge::ComputeGraphPtr &graph, ge:: | |||
| GE_CHECK_NOTNULL(variable_ref); | |||
| auto inAnchor0 = variable_ref->GetInDataAnchor(0); | |||
| if (inAnchor0 == nullptr) { | |||
| REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no input anchor, check invalid", | |||
| variable_ref->GetName().c_str(), variable_ref->GetType().c_str()); | |||
| GELOGE(FAILED, "variable_ref [%s] no input", variable_ref->GetName().c_str()); | |||
| return FAILED; | |||
| } | |||
| @@ -73,17 +77,23 @@ Status VariableRefDeleteOpPass::DealVariableRef(ge::ComputeGraphPtr &graph, ge:: | |||
| GELOGI("[%s-%d]: add attr [REF_VAR_SRC_VAR_NAME: %s ] ", peer_node->GetName().c_str(), index, | |||
| ref_var_src_var_name.c_str()); | |||
| } else { | |||
| REPORT_CALL_ERROR("E19999", "Set Attr:%s to output:%d desc of op:%s(%s) failed", REF_VAR_SRC_VAR_NAME.c_str(), | |||
| index, op_desc->GetName().c_str(), op_desc->GetType().c_str()); | |||
| GELOGE(FAILED, "[%s-%d]: add attr [REF_VAR_SRC_VAR_NAME: %s ] failed", peer_node->GetName().c_str(), index, | |||
| ref_var_src_var_name.c_str()); | |||
| return FAILED; | |||
| } | |||
| // remove variable_ref | |||
| if (GraphUtils::IsolateNode(variable_ref, {0}) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Isolate node:%s(%s) failed", | |||
| variable_ref->GetName().c_str(), variable_ref->GetType().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Isolate removed node: %s, type: %s failed", variable_ref->GetName().c_str(), | |||
| variable_ref->GetType().c_str()); | |||
| return FAILED; | |||
| } | |||
| if (GraphUtils::RemoveNodeWithoutRelink(graph, variable_ref) != GRAPH_SUCCESS) { | |||
| REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) without relink in graph:%s failed", | |||
| variable_ref->GetName().c_str(), variable_ref->GetType().c_str(), graph->GetName().c_str()); | |||
| GELOGE(INTERNAL_ERROR, "Remove node: %s, type: %s without relink failed", variable_ref->GetName().c_str(), | |||
| variable_ref->GetType().c_str()); | |||
| return FAILED; | |||