Browse Source

Pre Merge pull request !614 from zhaoxinxin/development

pull/614/MERGE
zhaoxinxin Gitee 5 years ago
parent
commit
c4949f6537
4 changed files with 24 additions and 12 deletions
  1. +7
    -7
      ge/graph/passes/compile_nodes_pass.cc
  2. +9
    -2
      ge/graph/passes/folding_pass.cc
  3. +6
    -1
      ge/graph/passes/unused_const_pass.cc
  4. +2
    -2
      inc/framework/common/debug/log.h

+ 7
- 7
ge/graph/passes/compile_nodes_pass.cc View File

@@ -70,8 +70,8 @@ graphStatus CompileNodesPass::Run(ComputeGraphPtr graph) {
kernel_to_compile_nodes.insert(std::make_pair(kernel_lib_name, node_vec));
}
} else {
GELOGE(GRAPH_FAILED, "Get node:%s, type:%s supported kernel failed.", node->GetName().c_str(),
node->GetType().c_str());
GE_ERRORLOG_AND_ERRORMSG(GRAPH_FAILED, "Get node:%s, type:%s supported kernel failed.", node->GetName().c_str(),
node->GetType().c_str());
return GRAPH_FAILED;
}
}
@@ -99,8 +99,8 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
(void)instance->DNNEngineManagerObj().GetDNNEngineName(node);
kernel_lib_name = op_desc->GetOpKernelLibName();
if (kernel_lib_name.empty()) {
GELOGE(GRAPH_FAILED, "Get node:%s, type:%s kernel lib failed.", node->GetName().c_str(),
op_desc->GetType().c_str());
GE_ERRORLOG_AND_ERRORMSG(GRAPH_FAILED, "Get node:%s, type:%s kernel lib failed.", node->GetName().c_str(),
op_desc->GetType().c_str());
return GRAPH_FAILED;
}
}
@@ -130,8 +130,8 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
return GRAPH_SUCCESS;
}
}
GELOGE(GRAPH_FAILED, "Cannot find kernel lib support node:%s, type:%s , get kernel lib failed.",
node->GetName().c_str(), op_desc->GetType().c_str());
GE_ERRORLOG_AND_ERRORMSG(GRAPH_FAILED, "Cannot find kernel lib support node:%s, type:%s , get kernel lib failed.",
node->GetName().c_str(), op_desc->GetType().c_str());
return GRAPH_FAILED;
}
return GRAPH_SUCCESS;
@@ -173,7 +173,7 @@ graphStatus CompileNodesPass::CompileNodes(const std::shared_ptr<GELib> instance
}
auto ret = kernel_info->CompileOp(kernel_nodes.second);
if (ret != GRAPH_SUCCESS) {
GELOGE(ret, "Compile op failed, kernel name is %s", kernel_nodes.first.c_str());
GE_ERRORLOG_AND_ERRORMSG(ret, "Compile op failed, kernel name is %s", kernel_nodes.first.c_str());
return GRAPH_FAILED;
}
}


+ 9
- 2
ge/graph/passes/folding_pass.cc View File

@@ -84,7 +84,6 @@ NodePtr AddConstNodeToGraph(GeTensorPtr &tensor, ComputeGraphPtr &graph) {
}

GE_IF_BOOL_EXEC(graph == nullptr, GELOGW("input param graph is null"); return nullptr);
(void) AttrUtils::SetListStr(const_desc, ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, std::move(std::vector<std::string>()));
return graph->AddNodeFront(const_desc);
}

@@ -241,6 +240,14 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho
node->GetName().c_str(), index);
return INTERNAL_ERROR;
}

vector<string> curr_origin_op_names;
(void)AttrUtils::GetListStr(node->GetOpDesc(), ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, curr_origin_op_names);
if (curr_origin_op_names.empty()) {
(void)AttrUtils::SetListStr(const_node->GetOpDesc(), ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, {node->GetName()});
} else {
(void)AttrUtils::SetListStr(const_node->GetOpDesc(), ATTR_NAME_DATA_DUMP_ORIGIN_OP_NAMES, curr_origin_op_names);
}
GELOGI("add const_node:%s, replace node %s, type %s, index %zu.", const_node->GetName().c_str(),
node->GetName().c_str(), node->GetType().c_str(), index);
// add new const to re-pass node
@@ -328,4 +335,4 @@ Status FoldingPass::ConnectNodeToInAnchor(InDataAnchorPtr &in_anchor, NodePtr &n
AddRePassNodesWithInOut(node);
return SUCCESS;
}
} // namespace ge
} // namespace ge

+ 6
- 1
ge/graph/passes/unused_const_pass.cc View File

@@ -40,6 +40,11 @@ Status UnusedConstPass::Run(NodePtr &node) {
GELOGD("op type is unused const.");
return IsolateAndDeleteNode(node, {-1});
}
// remove those const which only has control-in and control-out
if ((op_type == CONSTANT || op_type == CONSTANTOP) && (node->GetOutDataNodesSize() == 0)) {
GELOGD("Remove unused const %s.", node->GetName().c_str());
return IsolateAndDeleteNode(node, {-1});
}
return SUCCESS;
}
} // namespace ge
} // namespace ge

+ 2
- 2
inc/framework/common/debug/log.h View File

@@ -258,7 +258,7 @@
#define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \
{ \
GELOGE(_status, "%s", errormsg); \
ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \
}

#define GE_CHK_LOG_AND_ERRORMSG(expr, _status, errormsg) \
@@ -266,7 +266,7 @@
bool b = (expr); \
if (!b) { \
GELOGE(_status, "%s", errormsg); \
ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \
return _status; \
} \
} while (0)


Loading…
Cancel
Save