Pre Merge pull request !1475 from 王笑天/master

pull/1475/MERGE
王笑天 4 years ago committed by Gitee
commit 16118128ec

@ -334,6 +334,9 @@ Status PassUtils::UnlinkNodeWithControlCopy(NodePtr &node, int index) {
auto father_node = out_data_anchor->GetOwnerNode(); auto father_node = out_data_anchor->GetOwnerNode();
// link father_node's in control nodes to node // link father_node's in control nodes to node
if (GraphUtils::CopyInCtrlEdges(father_node, node) != GRAPH_SUCCESS) { if (GraphUtils::CopyInCtrlEdges(father_node, node) != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Copy in control edge from node:%s(%s) to node:%s(%s) failed",
father_node->GetName().c_str(), father_node->GetType().c_str(),
node->GetName().c_str(), node->GetType().c_str());
return FAILED; return FAILED;
} }
return SUCCESS; return SUCCESS;

File diff suppressed because it is too large Load Diff

@ -47,7 +47,9 @@ Status SavePass::Run(ge::ComputeGraphPtr graph) {
out_index.emplace_back(out_anchor->GetIdx()); out_index.emplace_back(out_anchor->GetIdx());
ge::OpDescPtr op_desc = peer_node->GetOpDesc(); ge::OpDescPtr op_desc = peer_node->GetOpDesc();
GE_IF_BOOL_EXEC(!ge::AttrUtils::SetStr(op_desc, kVarAttrVarIsSave, kVarIsSave), GE_IF_BOOL_EXEC(!ge::AttrUtils::SetStr(op_desc, kVarAttrVarIsSave, kVarIsSave),
GELOGE(INTERNAL_ERROR, "get kVarAttrVarIsSave failed"); return INTERNAL_ERROR); REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", kVarAttrVarIsSave,
op_desc->GetName().c_str(), op_desc->GetType().c_str());
GELOGE(INTERNAL_ERROR, "get kVarAttrVarIsSave failed"); return INTERNAL_ERROR);
} }
} }
} }
@ -65,6 +67,8 @@ Status SavePass::Run(ge::ComputeGraphPtr graph) {
for (auto &node_ptr : del_nodes) { for (auto &node_ptr : del_nodes) {
auto ret = graph->RemoveNode(node_ptr); auto ret = graph->RemoveNode(node_ptr);
if (ret != SUCCESS) { if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Remove node:%s(%s) from graph:%s failed",
node_ptr->GetName().c_str(), node_ptr->GetType().c_str(), graph->GetName().c_str());
GELOGE(ret, "GraphUtils::RemoveNodeWithoutRelink failed."); GELOGE(ret, "GraphUtils::RemoveNodeWithoutRelink failed.");
return ret; return ret;
} }

@ -54,6 +54,8 @@ Status SetInputOutputOffsetPass::SetInputOffsetForFusion(const std::vector<int64
std::vector<int64_t> input_offset_of_node; std::vector<int64_t> input_offset_of_node;
input_offset_of_node = op_desc->GetInputOffset(); input_offset_of_node = op_desc->GetInputOffset();
if (input_offset_of_node.size() < i) { if (input_offset_of_node.size() < i) {
REPORT_INNER_ERROR("E19999", "Input offsets size:%zu of node:%s(%s) < index:%zu, check invalid",
input_offset_of_node.size(), op_desc->GetName().c_str(), op_desc->GetType().c_str(), i);
GELOGE(PARAM_INVALID, "not get input_offset of %zu", i); GELOGE(PARAM_INVALID, "not get input_offset of %zu", i);
return PARAM_INVALID; return PARAM_INVALID;
} }
@ -77,10 +79,15 @@ Status SetInputOutputOffsetPass::SetInputOffsetForFusion(const std::vector<int64
int64_t relative_offset = input_offset - out_offset; int64_t relative_offset = input_offset - out_offset;
zero_copy_relative_offset.emplace_back(relative_offset); zero_copy_relative_offset.emplace_back(relative_offset);
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(data_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset), GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(data_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed",
ATTR_ZERO_COPY_BASIC_OFFSET.c_str(),
data_op_desc->GetName().c_str(), data_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed.");
return FAILED); return FAILED);
GE_CHK_BOOL_EXEC( GE_CHK_BOOL_EXEC(
ge::AttrUtils::SetListInt(data_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset), ge::AttrUtils::SetListInt(data_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_ZERO_COPY_RELATIVE_OFFSET.c_str(),
data_op_desc->GetName().c_str(), data_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed.");
return FAILED); return FAILED);
} }
@ -115,10 +122,15 @@ Status SetInputOutputOffsetPass::SetInputOffsetForHcom(const ge::NodePtr &node,
zero_copy_basic_offset.emplace_back(output_offset); zero_copy_basic_offset.emplace_back(output_offset);
zero_copy_relative_offset.emplace_back(relative_offset); zero_copy_relative_offset.emplace_back(relative_offset);
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(in_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset), GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(in_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed",
ATTR_ZERO_COPY_BASIC_OFFSET.c_str(),
in_op_desc->GetName().c_str(), in_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed.");
return FAILED); return FAILED);
GE_CHK_BOOL_EXEC( GE_CHK_BOOL_EXEC(
ge::AttrUtils::SetListInt(in_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset), ge::AttrUtils::SetListInt(in_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_ZERO_COPY_RELATIVE_OFFSET.c_str(),
in_op_desc->GetName().c_str(), in_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed.");
return FAILED); return FAILED);
} }
@ -159,6 +171,9 @@ Status SetInputOutputOffsetPass::SetOutputOffsetForConcat(const NodePtr &node) {
output_offset_of_concat = op_desc->GetOutputOffset(); output_offset_of_concat = op_desc->GetOutputOffset();
// phony_concat has one output // phony_concat has one output
GE_IF_BOOL_EXEC(output_offset_of_concat.size() != 1, GE_IF_BOOL_EXEC(output_offset_of_concat.size() != 1,
REPORT_INNER_ERROR("E19999", "Output offsets size:%zu of node:%s(%s) not equal to 1, check invalid",
output_offset_of_concat.size(),
op_desc->GetName().c_str(), op_desc->GetType().c_str());
GELOGE(PARAM_INVALID, "%s should has one output.", node->GetName().c_str()); GELOGE(PARAM_INVALID, "%s should has one output.", node->GetName().c_str());
return PARAM_INVALID); return PARAM_INVALID);
NodePtr net_output = node->GetOutDataNodes().at(0); NodePtr net_output = node->GetOutDataNodes().at(0);
@ -186,9 +201,14 @@ Status SetInputOutputOffsetPass::SetOutputOffsetForConcat(const NodePtr &node) {
zero_copy_relative_offset.emplace_back(relative_offset); zero_copy_relative_offset.emplace_back(relative_offset);
} }
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset), GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_ZERO_COPY_BASIC_OFFSET.c_str(),
out_op_desc->GetName().c_str(), out_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed.");
return FAILED); return FAILED);
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset), GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed",
ATTR_ZERO_COPY_RELATIVE_OFFSET.c_str(),
out_op_desc->GetName().c_str(), out_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed.");
return FAILED); return FAILED);
return SUCCESS; return SUCCESS;
@ -232,9 +252,14 @@ Status SetInputOutputOffsetPass::SetOutputOffsetForHcom(const NodePtr &node, con
} }
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset), GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_ZERO_COPY_BASIC_OFFSET.c_str(),
out_op_desc->GetName().c_str(), out_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_basic_offset failed.");
return FAILED); return FAILED);
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset), GE_CHK_BOOL_EXEC(ge::AttrUtils::SetListInt(out_op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset),
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed",
ATTR_ZERO_COPY_RELATIVE_OFFSET.c_str(),
out_op_desc->GetName().c_str(), out_op_desc->GetType().c_str());
GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed."); GELOGE(FAILED, "SetListInt of zero_copy_relative_offset failed.");
return FAILED); return FAILED);
return SUCCESS; return SUCCESS;

@ -29,6 +29,8 @@ Status SnapshotPass::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 OriginalType of op:%s(%s) failed",
node->GetName().c_str(), node->GetType().c_str());
GELOGE(status_ret, "SnapshotPass get original type failed."); GELOGE(status_ret, "SnapshotPass get original type failed.");
return status_ret; return status_ret;
} }

@ -20,12 +20,15 @@
namespace ge { namespace ge {
Status StopGradientPass::Run(NodePtr &node) { Status StopGradientPass::Run(NodePtr &node) {
if (node == nullptr) { if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid");
GELOGE(FAILED, "parameter is null."); GELOGE(FAILED, "parameter is null.");
return FAILED; return FAILED;
} }
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 OriginalType of op:%s(%s) failed",
node->GetName().c_str(), node->GetType().c_str());
GELOGE(status_ret, "StopGradientPass get original type failed."); GELOGE(status_ret, "StopGradientPass get original type failed.");
return status_ret; return status_ret;
} }

@ -144,6 +144,8 @@ Status SubexpressionMigrationPass::ClassifyDataNodes(const ComputeGraphPtr &grap
for (const auto &name : func_desc->GetSubgraphInstanceNames()) { for (const auto &name : func_desc->GetSubgraphInstanceNames()) {
const auto &subgraph = graph->GetSubgraph(name); const auto &subgraph = graph->GetSubgraph(name);
if (subgraph == nullptr) { if (subgraph == nullptr) {
REPORT_INNER_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()); GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "Subgraph not found, name: %s", name.c_str());
return GE_GRAPH_EMPTY_SUBGRAPH; return GE_GRAPH_EMPTY_SUBGRAPH;
} }
@ -156,6 +158,8 @@ Status SubexpressionMigrationPass::ClassifyDataNodes(const ComputeGraphPtr &grap
uint32_t parent_index = 0; uint32_t parent_index = 0;
if (!AttrUtils::GetInt(data->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { 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()); GELOGE(FAILED, "Parent index not found, name: %s", data->GetName().c_str());
return FAILED; return FAILED;
} }
@ -229,6 +233,7 @@ bool SubexpressionMigrationPass::IsParallelNodeSame(const map<ComputeGraphPtr, m
const auto &data_nodes = it->second; const auto &data_nodes = it->second;
auto data_it = data_nodes.find(node_idx); auto data_it = data_nodes.find(node_idx);
if (data_it == data_nodes.end()) { if (data_it == data_nodes.end()) {
REPORT_INNER_ERROR("E19999", "Find node in data_nodes by index:%u failed", node_idx);
GELOGE(FAILED, "Data: %s not fount, index: %u", base_node->GetName().c_str(), node_idx); GELOGE(FAILED, "Data: %s not fount, index: %u", base_node->GetName().c_str(), node_idx);
return false; return false;
} }
@ -238,12 +243,15 @@ bool SubexpressionMigrationPass::IsParallelNodeSame(const map<ComputeGraphPtr, m
const auto &in_anchors = out_anchor->GetPeerInDataAnchors(); const auto &in_anchors = out_anchor->GetPeerInDataAnchors();
const auto &in_anchor = in_anchors.at(anchor_idx); const auto &in_anchor = in_anchors.at(anchor_idx);
if (in_anchor == nullptr) { if (in_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Index:%u anchor not exist in out:%u data anchor's peer of node:%s(%s)",
node_idx, kDataOutIndex, work_data->GetName().c_str(), work_data->GetType().c_str());
GELOGE(FAILED, "Data anchor size: %u, anchor size: %zu", anchor_idx, in_anchors.size()); GELOGE(FAILED, "Data anchor size: %u, anchor size: %zu", anchor_idx, in_anchors.size());
return false; return false;
} }
const auto &work_node = in_anchor->GetOwnerNode(); const auto &work_node = in_anchor->GetOwnerNode();
if (work_node == nullptr) { if (work_node == nullptr) {
REPORT_INNER_ERROR("E19999", "Owner node of anchor is nullptr, check invalid");
GELOGE(FAILED, "Data: %s not found, index: %u", base_node->GetName().c_str(), node_idx); GELOGE(FAILED, "Data: %s not found, index: %u", base_node->GetName().c_str(), node_idx);
return false; return false;
} }
@ -338,17 +346,22 @@ Status SubexpressionMigrationPass::AppendParallelNode(map<ComputeGraphPtr, map<u
OpDescBuilder op_builder(data_name, DATA); OpDescBuilder op_builder(data_name, DATA);
const OpDescPtr op_desc = op_builder.AddInput("x").AddOutput("y").Build(); const OpDescPtr op_desc = op_builder.AddInput("x").AddOutput("y").Build();
if (op_desc == nullptr) { if (op_desc == nullptr) {
REPORT_CALL_ERROR("E19999", "Build op:%s(%s) failed", data_name.c_str(), DATA);
GELOGE(OUT_OF_MEMORY, "Create multi-batch case desc failed"); GELOGE(OUT_OF_MEMORY, "Create multi-batch case desc failed");
return OUT_OF_MEMORY; return OUT_OF_MEMORY;
} }
uint32_t data_index = item.second - kCaseInputBase; uint32_t data_index = item.second - kCaseInputBase;
if (!AttrUtils::SetInt(op_desc, ATTR_NAME_INDEX, data_index)) { if (!AttrUtils::SetInt(op_desc, ATTR_NAME_INDEX, data_index)) {
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INDEX.c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str());
GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str()); GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str());
return FAILED; return FAILED;
} }
if (!AttrUtils::SetInt(op_desc, ATTR_NAME_PARENT_NODE_INDEX, item.second)) { if (!AttrUtils::SetInt(op_desc, ATTR_NAME_PARENT_NODE_INDEX, item.second)) {
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_PARENT_NODE_INDEX.c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str());
GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str()); GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str());
return FAILED; return FAILED;
} }
@ -392,12 +405,14 @@ Status SubexpressionMigrationPass::DetachParallelNode(const map<uint32_t, NodePt
for (uint32_t i = 0; i < detach->GetAllOutDataAnchorsSize(); ++i) { for (uint32_t i = 0; i < detach->GetAllOutDataAnchorsSize(); ++i) {
auto it_idx = outputs.find(i); auto it_idx = outputs.find(i);
if (it_idx == outputs.end()) { if (it_idx == outputs.end()) {
REPORT_INNER_ERROR("E19999", "Node: %s parent index %u not found, check invalid", detach->GetName().c_str(), i);
GELOGE(FAILED, "Node: %s parent index %u not found", detach->GetName().c_str(), i); GELOGE(FAILED, "Node: %s parent index %u not found", detach->GetName().c_str(), i);
return FAILED; return FAILED;
} }
auto it_data = graph_datas.find(it_idx->second); auto it_data = graph_datas.find(it_idx->second);
if (it_data == graph_datas.end()) { if (it_data == graph_datas.end()) {
REPORT_INNER_ERROR("E19999", "Node: %s parent index %u not found, check invalid", detach->GetName().c_str(), i);
GELOGE(FAILED, "Node: %s parent index %u not found", detach->GetName().c_str(), i); GELOGE(FAILED, "Node: %s parent index %u not found", detach->GetName().c_str(), i);
return FAILED; return FAILED;
} }
@ -444,6 +459,7 @@ Status SubexpressionMigrationPass::AttachParallelNode(const ComputeGraphPtr &gra
for (uint32_t i = 0; i < attach->GetAllInDataAnchorsSize(); ++i) { for (uint32_t i = 0; i < attach->GetAllInDataAnchorsSize(); ++i) {
auto it_idx = inputs.find(i); auto it_idx = inputs.find(i);
if (it_idx == inputs.end()) { if (it_idx == inputs.end()) {
REPORT_INNER_ERROR("E19999", "Node: %s parent index %u not found, check invalid", attach->GetName().c_str(), i);
GELOGE(FAILED, "Node: %s parent index %u not found", attach->GetName().c_str(), i); GELOGE(FAILED, "Node: %s parent index %u not found", attach->GetName().c_str(), i);
return FAILED; return FAILED;
} }
@ -505,6 +521,7 @@ Status SubexpressionMigrationPass::MoveNodeToParent(const ComputeGraphPtr &graph
uint32_t anchor_idx, const map<uint32_t, uint32_t> &inputs, uint32_t anchor_idx, const map<uint32_t, uint32_t> &inputs,
const map<uint32_t, uint32_t> &outputs) { const map<uint32_t, uint32_t> &outputs) {
if (inputs.empty()) { if (inputs.empty()) {
REPORT_INNER_ERROR("E19999", "Param inputs is empty, check invalid");
GELOGE(FAILED, "Graph: %s, inputs is empty", graph->GetName().c_str()); GELOGE(FAILED, "Graph: %s, inputs is empty", graph->GetName().c_str());
return FAILED; return FAILED;
} }
@ -516,6 +533,8 @@ Status SubexpressionMigrationPass::MoveNodeToParent(const ComputeGraphPtr &graph
const auto &subnodes = groups.second; const auto &subnodes = groups.second;
auto it = subnodes.find(base_index); auto it = subnodes.find(base_index);
if (it == subnodes.end()) { if (it == subnodes.end()) {
REPORT_INNER_ERROR("E19999", "Index:%u data node not found in graph:%s, check invalid",
base_index, subgraph->GetName().c_str());
GELOGE(FAILED, "Graph: %s, Data: %u node not found", subgraph->GetName().c_str(), base_index); GELOGE(FAILED, "Graph: %s, Data: %u node not found", subgraph->GetName().c_str(), base_index);
return FAILED; return FAILED;
} }
@ -525,12 +544,15 @@ Status SubexpressionMigrationPass::MoveNodeToParent(const ComputeGraphPtr &graph
const auto &in_anchors = out_anchor->GetPeerInDataAnchors(); const auto &in_anchors = out_anchor->GetPeerInDataAnchors();
const auto &in_anchor = in_anchors.at(anchor_idx); const auto &in_anchor = in_anchors.at(anchor_idx);
if (in_anchor == nullptr) { if (in_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Index:%u anchor not exist in out:%u data anchor's peer of node:%s(%s)",
anchor_idx, kDataOutIndex, base_data->GetName().c_str(), base_data->GetType().c_str());
GELOGE(FAILED, "Data anchor index: %u, anchor size: %zu", anchor_idx, in_anchors.size()); GELOGE(FAILED, "Data anchor index: %u, anchor size: %zu", anchor_idx, in_anchors.size());
return FAILED; return FAILED;
} }
move_node = in_anchor->GetOwnerNode(); move_node = in_anchor->GetOwnerNode();
if (move_node == nullptr) { if (move_node == nullptr) {
REPORT_INNER_ERROR("E19999", "Owner node of anchor is nullptr, check invalid");
GELOGE(FAILED, "Data: %s not found, index: %u", base_data->GetName().c_str(), base_index); GELOGE(FAILED, "Data: %s not found, index: %u", base_data->GetName().c_str(), base_index);
return FAILED; return FAILED;
} }

@ -141,6 +141,8 @@ Status SubgraphConstMigrationPass::ClassifyGraphNodes(const ComputeGraphPtr &gra
for (const auto &name : func_desc->GetSubgraphInstanceNames()) { for (const auto &name : func_desc->GetSubgraphInstanceNames()) {
const auto &subgraph = graph->GetSubgraph(name); const auto &subgraph = graph->GetSubgraph(name);
if (subgraph == nullptr) { if (subgraph == nullptr) {
REPORT_INNER_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()); GELOGE(GE_GRAPH_EMPTY_SUBGRAPH, "Subgraph not found, name: %s", name.c_str());
return GE_GRAPH_EMPTY_SUBGRAPH; return GE_GRAPH_EMPTY_SUBGRAPH;
} }
@ -152,6 +154,8 @@ Status SubgraphConstMigrationPass::ClassifyGraphNodes(const ComputeGraphPtr &gra
if (node->GetType() == DATA) { if (node->GetType() == DATA) {
uint32_t parent_index = kInvalidParent; uint32_t parent_index = kInvalidParent;
if (!AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { if (!AttrUtils::GetInt(node->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(),
node->GetName().c_str(), node->GetType().c_str());
return FAILED; return FAILED;
} }
@ -326,17 +330,22 @@ Status SubgraphConstMigrationPass::AppendParallelNode(const NodePtr &func_node,
OpDescBuilder op_builder(data_name, DATA); OpDescBuilder op_builder(data_name, DATA);
const auto op_desc = op_builder.AddInput("x").AddOutput("y").Build(); const auto op_desc = op_builder.AddInput("x").AddOutput("y").Build();
if (op_desc == nullptr) { if (op_desc == nullptr) {
REPORT_CALL_ERROR("E19999", "Build op:%s(%s) failed", data_name.c_str(), DATA);
GELOGE(OUT_OF_MEMORY, "Create multi-batch subgraph data desc failed"); GELOGE(OUT_OF_MEMORY, "Create multi-batch subgraph data desc failed");
return OUT_OF_MEMORY; return OUT_OF_MEMORY;
} }
uint32_t data_index = parent_index - kCaseInputBase; uint32_t data_index = parent_index - kCaseInputBase;
if (!AttrUtils::SetInt(op_desc, ATTR_NAME_INDEX, data_index)) { if (!AttrUtils::SetInt(op_desc, ATTR_NAME_INDEX, data_index)) {
REPORT_CALL_ERROR("E19999", "Set Attr:%s to op:%s(%s) failed", ATTR_NAME_INDEX.c_str(),
op_desc->GetName().c_str(), op_desc->GetType().c_str());
GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str()); GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str());
return FAILED; return FAILED;
} }
if (!AttrUtils::SetInt(op_desc, ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { if (!AttrUtils::SetInt(op_desc, 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(),
op_desc->GetName().c_str(), op_desc->GetType().c_str());
GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str()); GELOGE(FAILED, "Parent index not found, name: %s", op_desc->GetName().c_str());
return FAILED; return FAILED;
} }
@ -460,6 +469,8 @@ Status SubgraphConstMigrationPass::MoveNodeToParent(const ComputeGraphPtr &graph
const map<ComputeGraphPtr, map<uint32_t, NodePtr>> &all_data_nodes, const map<ComputeGraphPtr, map<uint32_t, NodePtr>> &all_data_nodes,
const string &node_key, uint32_t parent_index) { const string &node_key, uint32_t parent_index) {
if (node_key.empty() || parent_index == kInvalidParent) { if (node_key.empty() || parent_index == kInvalidParent) {
REPORT_INNER_ERROR("E19999", "Param node_key is empty or param parent_index is 0x%X, check invalid",
kInvalidParent);
GELOGE(FAILED, "Graph: %s, node key: %s, parent index: %u invalid", GELOGE(FAILED, "Graph: %s, node key: %s, parent index: %u invalid",
graph->GetName().c_str(), node_key.c_str(), parent_index); graph->GetName().c_str(), node_key.c_str(), parent_index);
return FAILED; return FAILED;
@ -470,6 +481,8 @@ Status SubgraphConstMigrationPass::MoveNodeToParent(const ComputeGraphPtr &graph
const auto &subgraph = item.first; const auto &subgraph = item.first;
const auto it_const = item.second.find(node_key); const auto it_const = item.second.find(node_key);
if (it_const == item.second.end()) { if (it_const == item.second.end()) {
REPORT_INNER_ERROR("E19999", "Const node name:%s not found in graph:%s, check invalid",
node_key.c_str(), subgraph->GetName().c_str());
GELOGE(FAILED, "Graph: %s, Const: %s node not found", subgraph->GetName().c_str(), node_key.c_str()); GELOGE(FAILED, "Graph: %s, Const: %s node not found", subgraph->GetName().c_str(), node_key.c_str());
return FAILED; return FAILED;
} }
@ -477,11 +490,15 @@ Status SubgraphConstMigrationPass::MoveNodeToParent(const ComputeGraphPtr &graph
const auto it_nodes = all_data_nodes.find(subgraph); const auto it_nodes = all_data_nodes.find(subgraph);
if (it_nodes == all_data_nodes.end()) { if (it_nodes == all_data_nodes.end()) {
REPORT_INNER_ERROR("E19999", "Const node name:%s not found in graph:%s, check invalid",
node_key.c_str(), subgraph->GetName().c_str());
GELOGE(FAILED, "Graph: %s, Const: %s node not found", subgraph->GetName().c_str(), node_key.c_str()); GELOGE(FAILED, "Graph: %s, Const: %s node not found", subgraph->GetName().c_str(), node_key.c_str());
return FAILED; return FAILED;
} }
const auto it_data = it_nodes->second.find(parent_index); const auto it_data = it_nodes->second.find(parent_index);
if (it_data == it_nodes->second.end()) { if (it_data == it_nodes->second.end()) {
REPORT_INNER_ERROR("E19999", "Const node name:%s not found in graph:%s, check invalid",
node_key.c_str(), subgraph->GetName().c_str());
GELOGE(FAILED, "Graph: %s, Const: %s node not found", subgraph->GetName().c_str(), node_key.c_str()); GELOGE(FAILED, "Graph: %s, Const: %s node not found", subgraph->GetName().c_str(), node_key.c_str());
return FAILED; return FAILED;
} }

@ -94,6 +94,8 @@ Status SubgraphPass::SubgraphInputNode(const ComputeGraphPtr &graph, const NodeP
uint32_t parent_index = 0; uint32_t parent_index = 0;
if (!AttrUtils::GetInt(node->GetOpDesc(), ATTR_NAME_PARENT_NODE_INDEX, parent_index)) { if (!AttrUtils::GetInt(node->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(),
node->GetName().c_str(), node->GetType().c_str());
GELOGE(FAILED, "Get attr PARENT_NODE_INDEX failed, node:%s.", node->GetName().c_str()); GELOGE(FAILED, "Get attr PARENT_NODE_INDEX failed, node:%s.", node->GetName().c_str());
return FAILED; return FAILED;
} }
@ -208,6 +210,8 @@ Status SubgraphPass::WhileBodySubgraph(const ComputeGraphPtr &graph, const NodeP
// index of body_subgraph is 1 // index of body_subgraph is 1
ComputeGraphPtr while_body = NodeUtils::GetSubgraph(*node, 1); ComputeGraphPtr while_body = NodeUtils::GetSubgraph(*node, 1);
if (while_body == nullptr) { if (while_body == nullptr) {
REPORT_INNER_ERROR("E19999", "While_body of node:%s(%s) is nullptr, check invalid",
node->GetName().c_str(), node->GetType().c_str());
GELOGE(FAILED, "while_body of %s is NULL.", node->GetName().c_str()); GELOGE(FAILED, "while_body of %s is NULL.", node->GetName().c_str());
return FAILED; return FAILED;
} }
@ -242,12 +246,16 @@ Status SubgraphPass::WhileBodySubgraph(const ComputeGraphPtr &graph, const NodeP
if (output_node == nullptr) { if (output_node == nullptr) {
output_node = n; output_node = n;
} else { } else {
REPORT_INNER_ERROR("E19999", "While_body graph:%s exists multi NetOutput nodes, check invalid",
while_body->GetName().c_str());
GELOGE(FAILED, "while_body %s exists multi NetOutput nodes.", while_body->GetName().c_str()); GELOGE(FAILED, "while_body %s exists multi NetOutput nodes.", while_body->GetName().c_str());
return FAILED; return FAILED;
} }
} }
} }
if (output_node == nullptr) { if (output_node == nullptr) {
REPORT_INNER_ERROR("E19999", "While_body graph:%s has no output, check invalid",
while_body->GetName().c_str());
GELOGE(FAILED, "while_body %s has no output.", while_body->GetName().c_str()); GELOGE(FAILED, "while_body %s has no output.", while_body->GetName().c_str());
return FAILED; return FAILED;
} }
@ -462,6 +470,10 @@ Status SubgraphPass::InsertMemcpyNode(const ComputeGraphPtr &graph, const OutDat
(void)AttrUtils::SetBool(op_desc, ATTR_NO_NEED_CONSTANT_FOLDING, false); (void)AttrUtils::SetBool(op_desc, ATTR_NO_NEED_CONSTANT_FOLDING, false);
(void)AttrUtils::SetBool(op_desc, ATTR_NAME_CANNOT_BE_DELETED, true); (void)AttrUtils::SetBool(op_desc, ATTR_NAME_CANNOT_BE_DELETED, true);
if (GraphUtils::InsertNodeAfter(out_anchor, in_anchors, graph->AddNode(op_desc)) != GRAPH_SUCCESS) { if (GraphUtils::InsertNodeAfter(out_anchor, in_anchors, graph->AddNode(op_desc)) != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Insert Cast node %s(%s) after %s(%s) failed",
op_desc->GetName().c_str(), op_desc->GetType().c_str(),
out_anchor->GetOwnerNode()->GetName().c_str(),
out_anchor->GetOwnerNode()->GetType().c_str());
GELOGE(FAILED, "Insert IDENTITY node %s after %s failed.", name.c_str(), in_node->GetName().c_str()); GELOGE(FAILED, "Insert IDENTITY node %s after %s failed.", name.c_str(), in_node->GetName().c_str());
return FAILED; return FAILED;
} }
@ -481,6 +493,9 @@ Status SubgraphPass::InsertMemcpyNode(const ComputeGraphPtr &graph, const OutDat
Status SubgraphPass::InsertNodeBetween(const OutDataAnchorPtr &src, const std::vector<InDataAnchorPtr> &dsts, Status SubgraphPass::InsertNodeBetween(const OutDataAnchorPtr &src, const std::vector<InDataAnchorPtr> &dsts,
const NodePtr &insert_node, uint32_t input_index, uint32_t output_index) { const NodePtr &insert_node, uint32_t input_index, uint32_t output_index) {
if (GraphUtils::AddEdge(src, insert_node->GetInDataAnchor(input_index)) != GRAPH_SUCCESS) { if (GraphUtils::AddEdge(src, insert_node->GetInDataAnchor(input_index)) != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%u) failed",
src->GetOwnerNode()->GetName().c_str(), src->GetOwnerNode()->GetType().c_str(), src->GetIdx(),
insert_node->GetName().c_str(), insert_node->GetType().c_str(), input_index);
GELOGE(FAILED, "Add data_edge %s:%d->%s:%u failed.", GELOGE(FAILED, "Add data_edge %s:%d->%s:%u failed.",
src->GetOwnerNode()->GetName().c_str(), src->GetIdx(), insert_node->GetName().c_str(), input_index); src->GetOwnerNode()->GetName().c_str(), src->GetIdx(), insert_node->GetName().c_str(), input_index);
return FAILED; return FAILED;
@ -490,6 +505,12 @@ Status SubgraphPass::InsertNodeBetween(const OutDataAnchorPtr &src, const std::v
dst->GetOwnerNode()->GetName().c_str()); dst->GetOwnerNode()->GetName().c_str());
if ((GraphUtils::RemoveEdge(src, dst) != GRAPH_SUCCESS) || if ((GraphUtils::RemoveEdge(src, dst) != GRAPH_SUCCESS) ||
(GraphUtils::AddEdge(insert_node->GetOutDataAnchor(output_index), dst) != GRAPH_SUCCESS)) { (GraphUtils::AddEdge(insert_node->GetOutDataAnchor(output_index), dst) != GRAPH_SUCCESS)) {
REPORT_CALL_ERROR("E19999", "Remove edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%u) or "
"Add edge between op:%s(%s)(index:%d) and op:%s(%s)(index:%u) failed",
src->GetOwnerNode()->GetName().c_str(), src->GetOwnerNode()->GetType().c_str(), src->GetIdx(),
dst->GetOwnerNode()->GetName().c_str(), dst->GetOwnerNode()->GetType().c_str(), dst->GetIdx(),
insert_node->GetName().c_str(), insert_node->GetType().c_str(), output_index,
dst->GetOwnerNode()->GetName().c_str(), dst->GetOwnerNode()->GetType().c_str(), dst->GetIdx());
GELOGE(FAILED, "Replace data_edge %s:%d->%s:%d by %s:%u->%s:%d failed.", GELOGE(FAILED, "Replace data_edge %s:%d->%s:%d by %s:%u->%s:%d failed.",
src->GetOwnerNode()->GetName().c_str(), src->GetIdx(), src->GetOwnerNode()->GetName().c_str(), src->GetIdx(),
dst->GetOwnerNode()->GetName().c_str(), dst->GetIdx(), dst->GetOwnerNode()->GetName().c_str(), dst->GetIdx(),

@ -50,6 +50,8 @@ bool IsSwitchInWhileLoop(const NodePtr &node) {
std::vector<std::pair<NodePtr, InDataAnchorPtr>> GetOutDataNodesByIndex(const NodePtr &node, int index) { std::vector<std::pair<NodePtr, InDataAnchorPtr>> GetOutDataNodesByIndex(const NodePtr &node, int index) {
auto out_anchor = node->GetOutDataAnchor(index); auto out_anchor = node->GetOutDataAnchor(index);
if (out_anchor == nullptr) { if (out_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no index:%d out data anchor, check invalid",
node->GetName().c_str(), node->GetType().c_str(), index);
GELOGE(PARAM_INVALID, "Failed to get out data nodes of index %d from node %s, the anchor does not exists", index, GELOGE(PARAM_INVALID, "Failed to get out data nodes of index %d from node %s, the anchor does not exists", index,
node->GetName().c_str()); node->GetName().c_str());
return {}; return {};
@ -84,18 +86,23 @@ NodePtr AddIdentityAfterNode(const NodePtr &node, int index) {
auto node_desc = node->GetOpDesc(); auto node_desc = node->GetOpDesc();
if (node_desc == nullptr) { if (node_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "OpDesc in node is nullptr, check invalid");
GELOGE(INTERNAL_ERROR, "Failed to add identity after node %s index %d, the op desc is null", GELOGE(INTERNAL_ERROR, "Failed to add identity after node %s index %d, the op desc is null",
node->GetName().c_str(), index); node->GetName().c_str(), index);
return nullptr; return nullptr;
} }
auto tensor = node_desc->GetOutputDescPtr(index); auto tensor = node_desc->GetOutputDescPtr(index);
if (tensor == nullptr) { if (tensor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no index:%d output tensor, check invalid",
node_desc->GetName().c_str(), node_desc->GetType().c_str(), index);
GELOGE(INTERNAL_ERROR, "Failed to find the tensor by index %d from node %s, can not add the identity node", index, GELOGE(INTERNAL_ERROR, "Failed to find the tensor by index %d from node %s, can not add the identity node", index,
node->GetName().c_str()); node->GetName().c_str());
return nullptr; return nullptr;
} }
auto anchor = node->GetOutDataAnchor(index); auto anchor = node->GetOutDataAnchor(index);
if (anchor == nullptr) { if (anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no index:%d out data anchor, check invalid",
node->GetName().c_str(), node->GetType().c_str(), index);
GELOGE(OUT_OF_MEMORY, "Failed to add identity after node %s index %d, the out anchor does not exists", GELOGE(OUT_OF_MEMORY, "Failed to add identity after node %s index %d, the out anchor does not exists",
node->GetName().c_str(), index); node->GetName().c_str(), index);
return nullptr; return nullptr;
@ -104,6 +111,7 @@ NodePtr AddIdentityAfterNode(const NodePtr &node, int index) {
auto identity_opdesc = auto identity_opdesc =
MakeShared<OpDesc>("SwitchDataEdgesByPass_Identity_" + std::to_string(identity_counter), IDENTITY); MakeShared<OpDesc>("SwitchDataEdgesByPass_Identity_" + std::to_string(identity_counter), IDENTITY);
if (identity_opdesc == nullptr) { if (identity_opdesc == nullptr) {
REPORT_CALL_ERROR("E19999", "New OpDesc failed");
GELOGE(OUT_OF_MEMORY, "Failed to add identity after node %s index %d", node->GetName().c_str(), index); GELOGE(OUT_OF_MEMORY, "Failed to add identity after node %s index %d", node->GetName().c_str(), index);
return nullptr; return nullptr;
} }
@ -111,6 +119,9 @@ NodePtr AddIdentityAfterNode(const NodePtr &node, int index) {
auto ret2 = identity_opdesc->AddOutputDesc("y", *tensor); auto ret2 = identity_opdesc->AddOutputDesc("y", *tensor);
auto identity = node->GetOwnerComputeGraph()->AddNode(identity_opdesc); auto identity = node->GetOwnerComputeGraph()->AddNode(identity_opdesc);
if (ret1 != GRAPH_SUCCESS || ret2 != GRAPH_SUCCESS || identity == nullptr) { if (ret1 != GRAPH_SUCCESS || ret2 != GRAPH_SUCCESS || identity == nullptr) {
REPORT_CALL_ERROR("E19999", "Add input ouput desc to op:%s(%s) failed or add it to graph:%s failed",
identity_opdesc->GetName().c_str(), identity_opdesc->GetType().c_str(),
node->GetOwnerComputeGraph()->GetName().c_str());
GELOGE(OUT_OF_MEMORY, "Failed to add identity after node %s index %d", node->GetName().c_str(), index); GELOGE(OUT_OF_MEMORY, "Failed to add identity after node %s index %d", node->GetName().c_str(), index);
return nullptr; return nullptr;
} }
@ -124,18 +135,23 @@ NodePtr AddMemcpyBeforeNode(const NodePtr &node, int index) {
auto node_desc = node->GetOpDesc(); auto node_desc = node->GetOpDesc();
if (node_desc == nullptr) { if (node_desc == nullptr) {
REPORT_INNER_ERROR("E19999", "OpDesc in node is nullptr, check invalid");
GELOGE(INTERNAL_ERROR, "Failed to add memcpy before node %s index %d, null op desc", node->GetName().c_str(), GELOGE(INTERNAL_ERROR, "Failed to add memcpy before node %s index %d, null op desc", node->GetName().c_str(),
index); index);
return nullptr; return nullptr;
} }
auto tensor = node_desc->GetInputDescPtr(index); auto tensor = node_desc->GetInputDescPtr(index);
if (tensor == nullptr) { if (tensor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no index:%d input tensor, check invalid",
node_desc->GetName().c_str(), node_desc->GetType().c_str(), index);
GELOGE(INTERNAL_ERROR, "Failed to find the tensor by index %d from node %s, can not add the memcpy node", index, GELOGE(INTERNAL_ERROR, "Failed to find the tensor by index %d from node %s, can not add the memcpy node", index,
node->GetName().c_str()); node->GetName().c_str());
return nullptr; return nullptr;
} }
auto anchor = node->GetInDataAnchor(index); auto anchor = node->GetInDataAnchor(index);
if (anchor == nullptr) { if (anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no index:%d in data anchor, check invalid",
node->GetName().c_str(), node->GetType().c_str(), index);
GELOGE(INTERNAL_ERROR, "Failed to add memcpy before node %s index %d, the in anchor does not exists", GELOGE(INTERNAL_ERROR, "Failed to add memcpy before node %s index %d, the in anchor does not exists",
node->GetName().c_str(), index); node->GetName().c_str(), index);
return nullptr; return nullptr;
@ -143,6 +159,7 @@ NodePtr AddMemcpyBeforeNode(const NodePtr &node, int index) {
auto memcpy_opdesc = MakeShared<OpDesc>("SwitchDataEdgesByPass_Memcpy_" + std::to_string(counter), MEMCPYASYNC); auto memcpy_opdesc = MakeShared<OpDesc>("SwitchDataEdgesByPass_Memcpy_" + std::to_string(counter), MEMCPYASYNC);
if (memcpy_opdesc == nullptr) { if (memcpy_opdesc == nullptr) {
REPORT_CALL_ERROR("E19999", "New OpDesc failed");
GELOGE(OUT_OF_MEMORY, "Failed to add memcpy before node %s index %d", node->GetName().c_str(), index); GELOGE(OUT_OF_MEMORY, "Failed to add memcpy before node %s index %d", node->GetName().c_str(), index);
return nullptr; return nullptr;
} }
@ -150,6 +167,9 @@ NodePtr AddMemcpyBeforeNode(const NodePtr &node, int index) {
auto ret2 = memcpy_opdesc->AddOutputDesc(*tensor); auto ret2 = memcpy_opdesc->AddOutputDesc(*tensor);
auto memcpy_node = node->GetOwnerComputeGraph()->AddNode(memcpy_opdesc); auto memcpy_node = node->GetOwnerComputeGraph()->AddNode(memcpy_opdesc);
if (ret1 != GRAPH_SUCCESS || ret2 != GRAPH_SUCCESS || memcpy_node == nullptr) { if (ret1 != GRAPH_SUCCESS || ret2 != GRAPH_SUCCESS || memcpy_node == nullptr) {
REPORT_CALL_ERROR("E19999", "Add input ouput desc to op:%s(%s) failed or add it to graph:%s failed",
memcpy_opdesc->GetName().c_str(), memcpy_opdesc->GetType().c_str(),
node->GetOwnerComputeGraph()->GetName().c_str());
GELOGE(OUT_OF_MEMORY, "Failed to add memcpy before node %s index %d", node->GetName().c_str(), index); GELOGE(OUT_OF_MEMORY, "Failed to add memcpy before node %s index %d", node->GetName().c_str(), index);
return nullptr; return nullptr;
} }

@ -31,6 +31,7 @@ const int kDefaultInputIndex = -1;
bool ParsePred(const ConstGeTensorPtr &tensor) { bool ParsePred(const ConstGeTensorPtr &tensor) {
if (tensor == nullptr) { if (tensor == nullptr) {
REPORT_INNER_ERROR("E19999", "Param tensor is nullptr, check invalid");
GELOGE(FAILED, "parameter is null."); GELOGE(FAILED, "parameter is null.");
return false; return false;
} }
@ -65,6 +66,8 @@ bool ParseOutDataAnchors(const NodePtr &node, const NodePtr &pred_node, OutDataA
OutDataAnchorPtr &inactive_out_data_anchor) { OutDataAnchorPtr &inactive_out_data_anchor) {
auto tensors = OpDescUtils::MutableWeights(pred_node); auto tensors = OpDescUtils::MutableWeights(pred_node);
if (tensors.empty()) { if (tensors.empty()) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no weight, check invalid",
pred_node->GetName().c_str(), pred_node->GetType().c_str());
return false; return false;
} }
@ -72,6 +75,7 @@ bool ParseOutDataAnchors(const NodePtr &node, const NodePtr &pred_node, OutDataA
int inactive_output_index = pred_value ? 0 : 1; int inactive_output_index = pred_value ? 0 : 1;
if (node == nullptr) { if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid");
GELOGE(FAILED, "parameter is null."); GELOGE(FAILED, "parameter is null.");
return false; return false;
} }
@ -91,6 +95,7 @@ bool ParseOutDataAnchors(const NodePtr &node, const NodePtr &pred_node, OutDataA
Status SwitchDeadBranchElimination::DeleteSwitchNode(NodePtr &node, NodePtr &pred_node, Status SwitchDeadBranchElimination::DeleteSwitchNode(NodePtr &node, NodePtr &pred_node,
const OutDataAnchorPtr &active_out_data_anchor) { const OutDataAnchorPtr &active_out_data_anchor) {
if (node == nullptr || active_out_data_anchor == nullptr) { if (node == nullptr || active_out_data_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node or active_out_data_anchor is nullptr, check invalid");
GELOGE(FAILED, "parameter is null."); GELOGE(FAILED, "parameter is null.");
return FAILED; return FAILED;
} }
@ -102,6 +107,9 @@ Status SwitchDeadBranchElimination::DeleteSwitchNode(NodePtr &node, NodePtr &pre
// link pred's in control nodes to switch // link pred's in control nodes to switch
if (GraphUtils::CopyInCtrlEdges(pred_node, node) != GRAPH_SUCCESS) { if (GraphUtils::CopyInCtrlEdges(pred_node, node) != GRAPH_SUCCESS) {
REPORT_CALL_ERROR("E19999", "Copy in control edge from node:%s(%s) to node:%s(%s) failed",
pred_node->GetName().c_str(), pred_node->GetType().c_str(),
node->GetName().c_str(), node->GetType().c_str());
return FAILED; return FAILED;
} }
// Remove link between pred and switch // Remove link between pred and switch
@ -114,6 +122,8 @@ Status SwitchDeadBranchElimination::DeleteSwitchNode(NodePtr &node, NodePtr &pre
std::vector<int> switch_io_map = {kDefaultInputIndex, kDefaultInputIndex}; std::vector<int> switch_io_map = {kDefaultInputIndex, kDefaultInputIndex};
size_t out_index = static_cast<size_t>(active_out_data_anchor->GetIdx()); size_t out_index = static_cast<size_t>(active_out_data_anchor->GetIdx());
if (out_index >= switch_io_map.size()) { if (out_index >= switch_io_map.size()) {
REPORT_INNER_ERROR("E19999", "Out index:%zu of node:%s(%s) >= %zu, check invalid", out_index,
node->GetName().c_str(), node->GetType().c_str(), switch_io_map.size());
GELOGE(FAILED, "[%s] out index check failed, out_index:%zu.", node->GetName().c_str(), out_index); GELOGE(FAILED, "[%s] out index check failed, out_index:%zu.", node->GetName().c_str(), out_index);
return FAILED; return FAILED;
} }
@ -123,6 +133,7 @@ Status SwitchDeadBranchElimination::DeleteSwitchNode(NodePtr &node, NodePtr &pre
Status SwitchDeadBranchElimination::Run(NodePtr &node) { Status SwitchDeadBranchElimination::Run(NodePtr &node) {
if (node == nullptr) { if (node == nullptr) {
REPORT_INNER_ERROR("E19999", "Param node is nullptr, check invalid");
GELOGE(PARAM_INVALID, "Param [node] must not be null."); GELOGE(PARAM_INVALID, "Param [node] must not be null.");
return PARAM_INVALID; return PARAM_INVALID;
} }
@ -168,6 +179,8 @@ Status SwitchDeadBranchElimination::Run(NodePtr &node) {
std::vector<NodePtr> end_nodes; std::vector<NodePtr> end_nodes;
Status ret = PassUtils::RemoveInactiveBranchToMerge(inactive_out_data_anchor, del_nodes, end_nodes); Status ret = PassUtils::RemoveInactiveBranchToMerge(inactive_out_data_anchor, del_nodes, end_nodes);
if (ret != SUCCESS) { if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Remove inactive branch from node:%s(%s) to merge failed",
node->GetName().c_str(), node->GetType().c_str());
return ret; return ret;
} }

@ -45,11 +45,15 @@ Status GetPredNode(const NodePtr &switch_node, PredNodeAndOut &pred_node_index)
GE_CHECK_NOTNULL(switch_node); GE_CHECK_NOTNULL(switch_node);
auto pred_in_anchor = switch_node->GetInDataAnchor(kSwitchPredIndex); auto pred_in_anchor = switch_node->GetInDataAnchor(kSwitchPredIndex);
if (pred_in_anchor == nullptr) { if (pred_in_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s) has no index:%d in data anchor, check invalid",
switch_node->GetName().c_str(), switch_node->GetType().c_str(), kSwitchPredIndex);
GELOGE(INTERNAL_ERROR, "Failed to get pred node for switch %s, no pred anchor", switch_node->GetName().c_str()); GELOGE(INTERNAL_ERROR, "Failed to get pred node for switch %s, no pred anchor", switch_node->GetName().c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
auto pred_node_anchor = pred_in_anchor->GetPeerOutAnchor(); auto pred_node_anchor = pred_in_anchor->GetPeerOutAnchor();
if (pred_node_anchor == nullptr) { if (pred_node_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s)'s index:%d in data anchor, its peer anchor is nullptr, check invalid",
switch_node->GetName().c_str(), switch_node->GetType().c_str(), kSwitchPredIndex);
GELOGE(INTERNAL_ERROR, GELOGE(INTERNAL_ERROR,
"Failed to get pred node for switch %s, node peer out anchor", "Failed to get pred node for switch %s, node peer out anchor",
switch_node->GetName().c_str()); switch_node->GetName().c_str());
@ -57,6 +61,8 @@ Status GetPredNode(const NodePtr &switch_node, PredNodeAndOut &pred_node_index)
} }
auto pred_node = pred_node_anchor->GetOwnerNode(); auto pred_node = pred_node_anchor->GetOwnerNode();
if (pred_node == nullptr) { if (pred_node == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s)'s index:%d in data anchor, its peer node is nullptr, check invalid",
switch_node->GetName().c_str(), switch_node->GetType().c_str(), kSwitchPredIndex);
GELOGE(INTERNAL_ERROR, GELOGE(INTERNAL_ERROR,
"Failed to get pred node for switch %s, null node", "Failed to get pred node for switch %s, null node",
switch_node->GetName().c_str()); switch_node->GetName().c_str());
@ -89,11 +95,15 @@ Status SwitchLogicRemovePass::Run(NodePtr &node) {
} }
for (auto &in_anchor : out_anchor->GetPeerInDataAnchors()) { for (auto &in_anchor : out_anchor->GetPeerInDataAnchors()) {
if (in_anchor == nullptr) { if (in_anchor == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s)'s index:%d out data anchor, its peer anchors has nullptr, "
"check invalid", node->GetName().c_str(), node->GetType().c_str(), i);
GELOGE(INTERNAL_ERROR, "The in-anchor from out anchor %d node %s is null", i, node->GetName().c_str()); GELOGE(INTERNAL_ERROR, "The in-anchor from out anchor %d node %s is null", i, node->GetName().c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
auto dst_node = in_anchor->GetOwnerNode(); auto dst_node = in_anchor->GetOwnerNode();
if (dst_node == nullptr) { if (dst_node == nullptr) {
REPORT_INNER_ERROR("E19999", "Node:%s(%s)'s index:%d out data anchor, its peer nodes has nullptr, "
"check invalid", node->GetName().c_str(), node->GetType().c_str(), i);
GELOGE(INTERNAL_ERROR, "The peer node from out anchor %d node %s is null", i, node->GetName().c_str()); GELOGE(INTERNAL_ERROR, "The peer node from out anchor %d node %s is null", i, node->GetName().c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
@ -143,6 +153,8 @@ Status SwitchLogicRemovePass::RemoveSwitchNodeLogically(int parent_index, NodePt
std::vector<NodePtr> end_nodes; std::vector<NodePtr> end_nodes;
auto ret = PassUtils::RemoveInactiveBranchToMerge(out_anchor, deleted_nodes, end_nodes); auto ret = PassUtils::RemoveInactiveBranchToMerge(out_anchor, deleted_nodes, end_nodes);
if (ret != SUCCESS) { if (ret != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Remove inactive branch from node:%s(%s) to merge failed",
switch_node->GetName().c_str(), switch_node->GetType().c_str());
return ret; return ret;
} }

File diff suppressed because it is too large Load Diff

@ -31,6 +31,7 @@ Status TransOpBreadthFusionPass::Run(ge::ComputeGraphPtr graph) {
// breadth fusion pass requires new topologic // breadth fusion pass requires new topologic
Status ret_topo = graph->TopologicalSorting(); Status ret_topo = graph->TopologicalSorting();
if (ret_topo != SUCCESS) { if (ret_topo != SUCCESS) {
REPORT_CALL_ERROR("E19999", "Topological sorting for graph:%s failed", graph->GetName().c_str());
GELOGE(ret_topo, "TopologicalSorting the merged graph failed."); GELOGE(ret_topo, "TopologicalSorting the merged graph failed.");
return ret_topo; return ret_topo;
} }

Loading…
Cancel
Save