Browse Source

modified: ge/graph/passes/compile_nodes_pass.cc

modified:   ge/graph/passes/folding_pass.cc
	modified:   ge/graph/passes/unused_const_pass.cc
	modified:   inc/framework/common/debug/log.h
pull/614/head
zhaoxinxin 5 years ago
parent
commit
a7c9928531
4 changed files with 26 additions and 16 deletions
  1. +7
    -7
      ge/graph/passes/compile_nodes_pass.cc
  2. +11
    -6
      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)); kernel_to_compile_nodes.insert(std::make_pair(kernel_lib_name, node_vec));
} }
} else { } else {
GELOGE(GRAPH_FAILED, "Get node:%s, type:%s supported kernel failed.", node->GetName().c_str(),
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; return GRAPH_FAILED;
} }
} }
@@ -99,8 +99,8 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
(void)instance->DNNEngineManagerObj().GetDNNEngineName(node); (void)instance->DNNEngineManagerObj().GetDNNEngineName(node);
kernel_lib_name = op_desc->GetOpKernelLibName(); kernel_lib_name = op_desc->GetOpKernelLibName();
if (kernel_lib_name.empty()) { 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; return GRAPH_FAILED;
} }
} }
@@ -130,8 +130,8 @@ graphStatus CompileNodesPass::GetSupportedKernel(const NodePtr &node, const std:
return GRAPH_SUCCESS; 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_FAILED;
} }
return GRAPH_SUCCESS; return GRAPH_SUCCESS;
@@ -173,7 +173,7 @@ graphStatus CompileNodesPass::CompileNodes(const std::shared_ptr<GELib> instance
} }
auto ret = kernel_info->CompileOp(kernel_nodes.second); auto ret = kernel_info->CompileOp(kernel_nodes.second);
if (ret != GRAPH_SUCCESS) { 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; return GRAPH_FAILED;
} }
} }


+ 11
- 6
ge/graph/passes/folding_pass.cc View File

@@ -173,10 +173,7 @@ Status FoldingPass::DealWithInNodes(NodePtr &node) {
continue; continue;
} }
auto in_node = in_node_anchor->GetOwnerNode(); auto in_node = in_node_anchor->GetOwnerNode();
if (in_node == nullptr) {
continue;
}
if ((in_node->GetType() == SWITCH) || (in_node->GetType() == REFSWITCH)) {
if ((in_node->GetType() == SWITCH) || (in_node->GetType() == REFSWITCH) || (in_node->GetType() == SWITCHN)) {
GELOGI("The in_node name is %s, and node type is %s.", in_node->GetName().c_str(), in_node->GetType().c_str()); GELOGI("The in_node name is %s, and node type is %s.", in_node->GetName().c_str(), in_node->GetType().c_str());
auto ret = in_node_anchor->Unlink(in_data_anchor); auto ret = in_node_anchor->Unlink(in_data_anchor);
if (ret != SUCCESS) { if (ret != SUCCESS) {
@@ -188,7 +185,7 @@ Status FoldingPass::DealWithInNodes(NodePtr &node) {
node->GetName().c_str()); node->GetName().c_str());
auto identity_name = node->GetName() + "_ctrl_identity_" + std::to_string(in_data_anchor->GetIdx()); auto identity_name = node->GetName() + "_ctrl_identity_" + std::to_string(in_data_anchor->GetIdx());
auto identity = auto identity =
AddIdentityNodeToGraph(identity_name, node->GetOpDesc()->GetInputDesc(in_data_anchor->GetIdx()), graph);
AddIdentityNodeToGraph(identity_name, node->GetOpDesc()->GetInputDesc(in_data_anchor->GetIdx()), graph);
if (identity == nullptr) { if (identity == nullptr) {
GELOGE(INTERNAL_ERROR, "Failed to add identity node to graph."); GELOGE(INTERNAL_ERROR, "Failed to add identity node to graph.");
return INTERNAL_ERROR; return INTERNAL_ERROR;
@@ -241,6 +238,14 @@ Status FoldingPass::AddConstNode(NodePtr &node, IndexsToAnchors indexes_to_ancho
node->GetName().c_str(), index); node->GetName().c_str(), index);
return INTERNAL_ERROR; 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(), 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); node->GetName().c_str(), node->GetType().c_str(), index);
// add new const to re-pass node // add new const to re-pass node
@@ -328,4 +333,4 @@ Status FoldingPass::ConnectNodeToInAnchor(InDataAnchorPtr &in_anchor, NodePtr &n
AddRePassNodesWithInOut(node); AddRePassNodesWithInOut(node);
return SUCCESS; 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."); GELOGD("op type is unused const.");
return IsolateAndDeleteNode(node, {-1}); 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; 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) \ #define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \
{ \ { \
GELOGE(_status, "%s", 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) \ #define GE_CHK_LOG_AND_ERRORMSG(expr, _status, errormsg) \
@@ -266,7 +266,7 @@
bool b = (expr); \ bool b = (expr); \
if (!b) { \ if (!b) { \
GELOGE(_status, "%s", errormsg); \ GELOGE(_status, "%s", errormsg); \
ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {errormsg}); \
return _status; \ return _status; \
} \ } \
} while (0) } while (0)


Loading…
Cancel
Save