From f61c7934fe875f8be78803d90a78dd5fc1cbc916 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Mon, 12 Apr 2021 20:51:01 +0800 Subject: [PATCH 01/16] update geloge message --- ge/ir_build/ge_ir_build.cc | 2 +- ge/session/omg.cc | 170 +++++++++++++++++++++---------------- 2 files changed, 100 insertions(+), 72 deletions(-) diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 336102d4..af813a4a 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -574,7 +574,7 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in } if (!ParseInputShape(input_shape, omg_context_.input_dims, omg_context_.user_input_dims, is_dynamic_input)) { - GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape:input_shape] Failed, shape: %s", input_shape.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape:InputShape] Failed, shape: %s", input_shape.c_str()); return GRAPH_PARAM_INVALID; } return GRAPH_SUCCESS; diff --git a/ge/session/omg.cc b/ge/session/omg.cc index 961bc8c7..1aec2ed4 100755 --- a/ge/session/omg.cc +++ b/ge/session/omg.cc @@ -86,7 +86,8 @@ static bool CheckInputTrueOrFalse(const std::string &s, const std::string &atc_p return true; } else { ErrorManager::GetInstance().ATCReportErrMessage("E10005", {"parameter", "value"}, {atc_param, s}); - GELOGE(PARAM_INVALID, "Input parameter[--%s]'s value[%s] must be true or false.", atc_param.c_str(), s.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--%s]'s value[%s] must be true or false.", + atc_param.c_str(), s.c_str()); return false; } } @@ -110,9 +111,8 @@ static Status CheckInputShapeNode(const ComputeGraphPtr &graph, bool is_dynamic_ GE_CHECK_NOTNULL(tensor_desc); for (auto dim : tensor_desc->GetShape().GetDims()) { if (dim < 0) { - GELOGE(PARAM_INVALID, - "Input op [%s] shape %ld is negative, maybe you should set input_shape to specify its shape", - node->GetName().c_str(), dim); + GELOGE(PARAM_INVALID, "[Check][Param]Input op [%s] shape %ld is negative, " + "maybe you should set input_shape to specify its shape", node->GetName().c_str(), dim); const string reason = "maybe you should set input_shape to specify its shape"; ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {node->GetName(), to_string(dim), reason}); @@ -127,12 +127,14 @@ static Status CheckInputShapeNode(const ComputeGraphPtr &graph, bool is_dynamic_ ge::NodePtr node = graph->FindNode(node_name); if (node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"input_shape", node_name}); - GELOGE(PARAM_INVALID, "Input parameter[--input_shape]'s opname[%s] is not exist in model", node_name.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_shape]'s opname[%s] is not exist in model", + node_name.c_str()); return PARAM_INVALID; } if (node->GetType() != DATA) { ErrorManager::GetInstance().ATCReportErrMessage("E10017", {"parameter", "opname"}, {"input_shape", node_name}); - GELOGE(PARAM_INVALID, "Input parameter[--input_shape]'s opname[%s] is not a input opname", node_name.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_shape]'s opname[%s] is not a input opname", + node_name.c_str()); return PARAM_INVALID; } } @@ -160,8 +162,8 @@ static Status CheckInputFp16Nodes(const ComputeGraphPtr &graph, const string &in for (auto &s : adjust_fp16_format_vec) { StringUtils::Trim(s); if (!CheckInputTrueOrFalse(s, "is_input_adjust_hw_layout")) { - GELOGE(PARAM_INVALID, "Invalid Param, is_input_adjust_hw_layout only support true/false: but is [%s]", - is_input_adjust_hw_layout.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid Param, is_input_adjust_hw_layout only support true/false:" + "but is [%s]", is_input_adjust_hw_layout.c_str()); return PARAM_INVALID; } } @@ -176,7 +178,7 @@ static Status CheckInputFp16Nodes(const ComputeGraphPtr &graph, const string &in if (node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"input_fp16_nodes", input_fp16_nodes_vec[i]}); - GELOGE(PARAM_INVALID, "Input parameter[--input_fp16_nodes]'s opname[%s] is not exist in model", + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_fp16_nodes]'s opname[%s] is not exist in model", input_fp16_nodes_vec[i].c_str()); return PARAM_INVALID; } @@ -185,7 +187,7 @@ static Status CheckInputFp16Nodes(const ComputeGraphPtr &graph, const string &in if (op_desc->GetType() != DATA) { ErrorManager::GetInstance().ATCReportErrMessage("E10017", {"parameter", "opname"}, {"input_fp16_nodes", input_fp16_nodes_vec[i]}); - GELOGE(PARAM_INVALID, "Input parameter[--input_fp16_nodes]'s opname[%s] is not a input opname", + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--input_fp16_nodes]'s opname[%s] is not a input opname", input_fp16_nodes_vec[i].c_str()); return PARAM_INVALID; } @@ -205,8 +207,8 @@ static Status ParseOutputFp16NodesFormat(const string &is_output_fp16) { for (auto &is_fp16 : node_format_vec) { StringUtils::Trim(is_fp16); if (!CheckInputTrueOrFalse(is_fp16, "is_output_adjust_hw_layout")) { - GELOGE(PARAM_INVALID, "Invalid Param, is_output_adjust_hw_layout only support true/false: but is [%s]", - is_output_fp16.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid Param, is_output_adjust_hw_layout " + "only support true/false: but is [%s]", is_output_fp16.c_str()); return PARAM_INVALID; } if (is_fp16 == "false") { @@ -263,7 +265,8 @@ void FindParserSo(const string &path, vector &file_list, string &caffe_p Status SetOutFormatAndDataTypeAttr(ge::OpDescPtr op_desc, const ge::Format format, const ge::DataType data_type) { if (op_desc == nullptr) { - GELOGE(domi::FAILED, "Input op desc invalid."); + REPORT_INNER_ERROR("E19999", "param op_desc is nullptr, check invalid."); + GELOGE(domi::FAILED, "[Check][Param]Input op desc invalid."); return domi::FAILED; } (void)ge::AttrUtils::SetInt(op_desc, ATTR_NAME_NET_OUTPUT_FORMAT, format); @@ -274,7 +277,7 @@ Status SetOutFormatAndDataTypeAttr(ge::OpDescPtr op_desc, const ge::Format forma bool CheckDigitStr(std::string &str) { for (char c : str) { if (!isdigit(c)) { - GELOGE(domi::FAILED, "value[%s] is not positive integer", str.c_str()); + GELOGE(domi::FAILED, "[Check][Param]value[%s] is not positive integer", str.c_str()); return false; } } @@ -284,18 +287,18 @@ bool CheckDigitStr(std::string &str) { Status StringToInt(std::string &str, int32_t &value) { try { if (!CheckDigitStr(str)) { - GELOGE(PARAM_INVALID, "Invalid of digit string: %s ", str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid of digit string: %s ", str.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--output_type", str, "is not positive integer"}); return PARAM_INVALID; } value = stoi(str); } catch (std::invalid_argument &) { - GELOGE(PARAM_INVALID, "Invalid of digit string: %s, catch invalid_argument.", str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid of digit string: %s, catch invalid_argument.", str.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10014", {"parameter", "value"}, {"--output_type", str}); return PARAM_INVALID; } catch (std::out_of_range &) { - GELOGE(PARAM_INVALID, "Invalid of digit string: %s, catch out_of_range.", str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid of digit string: %s, catch out_of_range.", str.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10013", {"parameter", "value"}, {"--output_type", str}); return PARAM_INVALID; } @@ -314,7 +317,8 @@ Status VerifyOutputTypeAndOutNodes(std::vector &out_type_vec) { if (out_nodes_info.find(out_type_vec[i]) == out_nodes_info.end()) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--output_type", out_type_vec[i], kOutputTypeError}); - GELOGE(domi::FAILED, "Invalid value for --output_type[%s], %s.", out_type_vec[i].c_str(), kOutputTypeError); + GELOGE(domi::FAILED, "[Check][Param]Invalid value for --output_type[%s], %s.", + out_type_vec[i].c_str(), kOutputTypeError); return domi::FAILED; } } @@ -326,7 +330,8 @@ Status CheckOutPutDataTypeSupport(const std::string &output_type) { if (it == output_type_str_to_datatype.end()) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); - GELOGE(PARAM_INVALID, "Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid value for --output_type[%s], %s.", + output_type.c_str(), kOutputTypeSupport); return domi::FAILED; } return domi::SUCCESS; @@ -344,7 +349,7 @@ Status ParseOutputType(const std::string &output_type, std::mapsecond; @@ -383,7 +390,7 @@ Status CheckOutNode(ge::OpDescPtr op_desc, int32_t index) { int32_t out_size = op_desc->GetOutputsSize(); if (index < 0 || index >= out_size) { GELOGE(domi::FAILED, - "out_node [%s] output index:%d must be smaller " + "[Check][Param]out_node [%s] output index:%d must be smaller " "than node output size:%d and can not be negative!", op_desc->GetName().c_str(), index, out_size); std::string fail_reason = "output index:" + to_string(index) + " must be smaller than output size:" + @@ -403,7 +410,7 @@ Status GetDefaultOutInfo(ge::ComputeGraphPtr &compute_graph, if (out_node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"out_nodes", default_out_nodes[i].first}); - GELOGE(domi::FAILED, "Can not find src node (%s) in graph.", default_out_nodes[i].first.c_str()); + GELOGE(domi::FAILED, "[Check][Param]Can not find src node (%s) in graph.", default_out_nodes[i].first.c_str()); return domi::FAILED; } output_nodes_info.push_back(std::make_pair(out_node, default_out_nodes[i].second)); @@ -432,7 +439,7 @@ Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const std::map> output_node_dt_map; if (!output_type.empty()) { if (ParseOutputType(output_type, output_node_dt_map) != SUCCESS) { - GELOGE(domi::FAILED, "Parse output_type failed."); + GELOGE(domi::FAILED, "[Parse][output_type] failed."); return domi::FAILED; } } @@ -443,13 +450,13 @@ Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const if (out_node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage("E10016", {"parameter", "opname"}, {"out_nodes", user_out_nodes[i].first}); - GELOGE(domi::FAILED, "Can not find src node (%s) in graph.", user_out_nodes[i].first.c_str()); + GELOGE(domi::FAILED, "[Check][Param]Can not find src node (%s) in graph.", user_out_nodes[i].first.c_str()); return domi::FAILED; } auto op_desc = out_node->GetOpDesc(); GE_CHECK_NOTNULL(op_desc); if (CheckOutNode(op_desc, user_out_nodes[i].second) != SUCCESS) { - GELOGE(domi::FAILED, "Check out node (%s) fail.", user_out_nodes[i].first.c_str()); + GELOGE(domi::FAILED, "[Check][OutNode] (%s) fail.", user_out_nodes[i].first.c_str()); return domi::FAILED; } @@ -475,7 +482,7 @@ Status SetOutputNodeInfo(ge::Graph &graph, const std::string &output_type, const // default output node (leaf) if (user_out_nodes.empty()) { if (GetDefaultOutInfo(compute_graph, output_nodes_info) != SUCCESS) { - GELOGE(domi::FAILED, "Get default output info failed."); + GELOGE(domi::FAILED, "[Get][DefaultOutInfo] failed."); return domi::FAILED; } } @@ -513,7 +520,8 @@ void GetOutputNodesNameAndIndex(std::vector> &ou Status GetOutputLeaf(NodePtr node, std::vector> &output_nodes_info) { ge::OpDescPtr tmpDescPtr = node->GetOpDesc(); if (tmpDescPtr == nullptr) { - GELOGE(domi::FAILED, "Get outnode op desc fail."); + REPORT_INNER_ERROR("E19999", "param node has no opdesc."); + GELOGE(domi::FAILED, "[Check][Param]Get outnode op desc fail."); return domi::FAILED; } size_t size = tmpDescPtr->GetOutputsSize(); @@ -527,7 +535,8 @@ Status GetOutputLeaf(NodePtr node, std::vector> for (auto in_anchor : in_anchors) { auto out_anchor = in_anchor->GetPeerOutAnchor(); if (out_anchor == nullptr) { - GELOGE(domi::FAILED, "Get leaf node op desc fail."); + REPORT_INNER_ERROR("E19999", "GetPeerOutAnchor return nullptr, node:%s.", node->GetName().c_str()); + GELOGE(domi::FAILED, "[Invoke][GetPeerOutAnchor]Get leaf node op desc fail."); return domi::FAILED; } auto out_node = out_anchor->GetOwnerNode(); @@ -557,8 +566,10 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format, if (iter != ge::input_format_str_to_geformat.end()) { domi::GetContext().format = iter->second; } else { - GELOGE(PARAM_INVALID, "Input format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", - input_format.c_str()); + REPORT_INNER_ERROR("E19999", "param input_format:%s is not support, " + "expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]Input format %s not support, " + "expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); return PARAM_INVALID; } } @@ -572,9 +583,9 @@ Status InitDomiOmgContext(const string &input_shape, const string &input_format, map> &shape_map = domi::GetContext().input_dims; if (!ge::ParseInputShape(input_shape, domi::GetContext().input_dims, domi::GetContext().user_input_dims, - is_dynamic_input) || - shape_map.empty()) { - GELOGE(PARAM_INVALID, "Failed to parse input shape: %s", input_shape.c_str()); + is_dynamic_input) || shape_map.empty()) { + REPORT_CALL_ERROR("E19999", "ParseInputShape failed for %s", input_shape.c_str()); + GELOGE(PARAM_INVALID, "[Parse][InputShape] %s failed.", input_shape.c_str()); return PARAM_INVALID; } @@ -601,7 +612,7 @@ Status ParseOutNodes(const string &out_nodes) { "E10001", {"parameter", "value", "reason"}, {"--out_nodes", node, "the correct format is \"node_name1:0;node_name1:1;node_name2:0\""}); GELOGE(PARAM_INVALID, - "The input format of --out_nodes is invalid, the correct format is " + "[Parse][Param]The input format of --out_nodes is invalid, the correct format is " "\"node_name1:0;node_name1:1;node_name2:0\", while the actual input is %s.", node.c_str()); return PARAM_INVALID; @@ -609,15 +620,16 @@ Status ParseOutNodes(const string &out_nodes) { if (!domi::GetContext().user_out_nodes_top_vec.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--out_nodes", out_nodes, "is not all index or top_name"}); - GELOGE(PARAM_INVALID, - "This out_nodes str must be all index or top_name, while the actual input is %s", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]This out_nodes str must be all index or top_name, " + "while the actual input is %s", out_nodes.c_str()); return PARAM_INVALID; } // stoi: The method may throw an exception: invalid_argument/out_of_range if (!CheckDigitStr(key_value_v[1])) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--out_nodes", out_nodes, "is not positive integer"}); - GELOGE(PARAM_INVALID, "This str must be digit string, while the actual input is %s", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]This str must be digit string, while the actual input is %s", + out_nodes.c_str()); return PARAM_INVALID; } @@ -635,11 +647,11 @@ Status ParseOutNodes(const string &out_nodes) { } } } catch (std::invalid_argument &) { - GELOGE(PARAM_INVALID, "Invalid of out_nodes: %s ", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]Invalid of out_nodes: %s ", out_nodes.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10014", {"parameter", "value"}, {"--out_nodes", out_nodes}); return PARAM_INVALID; } catch (std::out_of_range &) { - GELOGE(PARAM_INVALID, "Invalid of out_nodes: %s ", out_nodes.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param]Invalid of out_nodes: %s ", out_nodes.c_str()); ErrorManager::GetInstance().ATCReportErrMessage("E10013", {"parameter", "value"}, {"--out_nodes", out_nodes}); return PARAM_INVALID; } @@ -657,7 +669,8 @@ static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op for (const NodePtr &node : graph->GetAllNodes()) { auto op_desc = node->GetOpDesc(); if (op_desc == nullptr) { - GELOGE(PARAM_INVALID, "Invalid parameter for opDesc."); + REPORT_INNER_ERROR("E19999", "param graph's node has no opdesc."); + GELOGE(PARAM_INVALID, "[Check][Param]Invalid parameter for opDesc."); return PARAM_INVALID; } graphNodeTypes[op_desc->GetType()] = ""; @@ -666,7 +679,7 @@ static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op if (propertiesMap.empty()) { ErrorManager::GetInstance().ATCReportErrMessage( "E10003", {"parameter", "value", "reason"}, {"op_name_map", op_conf, "the file content is empty"}); - GELOGE(PARAM_INVALID, "op_name_map file content is empty, please check file!"); + GELOGE(PARAM_INVALID, "[Check][Param]op_name_map file content is empty, please check file!"); return PARAM_INVALID; } for (auto iter = propertiesMap.begin(); iter != propertiesMap.end(); iter++) { @@ -674,7 +687,8 @@ static Status CheckOpNameMap(const ComputeGraphPtr &graph, const std::string &op ErrorManager::GetInstance().ATCReportErrMessage( "E10003", {"parameter", "value", "reason"}, {"op_name_map", op_conf, "type[" + iter->second + "] is not found in model"}); - GELOGE(PARAM_INVALID, "Invalid parameter for op_name_map."); return PARAM_INVALID;); + GELOGE(PARAM_INVALID, "[Find][NodeType]Invalid parameter for op_name_map."); + return PARAM_INVALID;); } return SUCCESS; } @@ -711,15 +725,16 @@ FMK_FUNC_HOST_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::mapCreateModelParser(type); - GE_CHK_BOOL_RET_STATUS(model_parser != nullptr, FAILED, "ATC create model parser ret fail, type:%d.", type); - + if (model_parser == nullptr) { + REPORT_INNER_ERROR("E19999", "CreateModelParser failed, type:%d", type); + GELOGE(FAILED, "[Create][ModelParser] ret fail, type:%d.", type); + return FAILED; + } UpdateParserCtxWithOmgCtx(); Status ret = model_parser->Parse(model_file, graph); UpdateOmgCtxWithParserCtx(); @@ -749,7 +768,8 @@ FMK_FUNC_HOST_VISIBILITY Status ParseGraph(ge::Graph &graph, const std::map(model.model_data); model.model_data = nullptr; @@ -941,7 +963,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js status = omFileLoadHelper.GetModelPartition(MODEL_DEF, ir_part); if (status != ge::GRAPH_SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); - GELOGE(ge::FAILED, "Get model part failed."); + GELOGE(ge::FAILED, "[Get][ModelPartition] failed."); if (model.model_data != nullptr) { delete[] reinterpret_cast(model.model_data); model.model_data = nullptr; @@ -967,13 +989,13 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js } else { ret = INTERNAL_ERROR; ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); - GELOGE(ret, "ReadProtoFromArray failed."); + GELOGE(ret, "[Read][Proto]From Array failed."); } } else { ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "ParseModelContent failed because of invalid om file. Please check --om param."); + "[Parse][ModelContent] failed because of invalid om file. Please check --om param."); } if (model.model_data != nullptr) { @@ -984,7 +1006,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertOm(const char *model_file, const char *js } catch (const std::exception &e) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Convert om model to json failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "Convert om model to json failed, exception message : %s.", e.what()); + GELOGE(FAILED, "[Save][Model]Convert om model to json failed, exception message : %s.", e.what()); return FAILED; } } @@ -1003,7 +1025,8 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const }; if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "LoadFromFile failed."); + REPORT_CALL_ERROR("E19999", "LoadFromFile failed."); + GELOGE(ret, "[Invoke][LoadFromFile] failed."); return ret; } @@ -1015,7 +1038,7 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const if (!flag) { free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); - GELOGE(FAILED, "ParseFromString failed."); + GELOGE(FAILED, "[Invoke][ParseFromString] failed."); return FAILED; } GetGroupName(model_def); @@ -1024,7 +1047,8 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const ret = ModelSaver::SaveJsonToFile(json_file, j); if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "Save json to file fail."); + REPORT_CALL_ERROR("E19999", "SaveJsonToFile failed."); + GELOGE(ret, "[Save][Json] to file fail."); return ret; } free_model_data(&model.model_data); @@ -1033,12 +1057,12 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertPbtxtToJson(const char *model_file, const free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what()); + GELOGE(FAILED, "[Invoke][ParseFromString] failed. exception message : %s", e.what()); return FAILED; } catch (const std::exception &e) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Convert pbtxt to json failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "Convert pbtxt to json failed, exception message : %s.", e.what()); + GELOGE(FAILED, "[Save][pbtxt]Convert pbtxt to json failed, exception message : %s.", e.what()); return FAILED; } } @@ -1047,16 +1071,19 @@ FMK_FUNC_HOST_VISIBILITY Status ConvertFwkModelToJson(const domi::FrameworkType const char *json_file) { if (framework == domi::CAFFE || framework == domi::TENSORFLOW || framework == domi::ONNX) { auto model_parser = ModelParserFactory::Instance()->CreateModelParser(framework); - GE_CHK_BOOL_RET_STATUS(model_parser != nullptr, FAILED, "ATC create model parser ret fail, framework:%d.", - framework); + if (model_parser == nullptr) { + REPORT_INNER_ERROR("E19999", "CreateModelParser failed, framework:%d.", framework); + GELOGE(FAILED, "[Create][ModelParser] ret fail, framework:%d.", framework); + return FAILED; + } return model_parser->ToJson(model_file, json_file); } ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--framework", std::to_string(framework), "only support 0(Caffe) 3(TensorFlow) 5(Onnx)"}); - GELOGE(PARAM_INVALID, "Input parameter[--framework] is mandatory and it's value must be: 0(Caffe) 3(TensorFlow) " - "or 5(Onnx)."); + GELOGE(PARAM_INVALID, "[Check][Param]Input parameter[--framework] is mandatory " + "and it's value must be: 0(Caffe) 3(TensorFlow) or 5(Onnx)."); return PARAM_INVALID; } @@ -1072,7 +1099,8 @@ FMK_FUNC_HOST_VISIBILITY Status DumpInfershapeJson(const ge::Graph &graph, const if (buffer.GetData() != nullptr) { std::string str(reinterpret_cast(buffer.GetData()), buffer.GetSize()); if (!ge_proto.ParseFromString(str)) { - GELOGE(GRAPH_FAILED, "parse from string failed."); + REPORT_CALL_ERROR("E19999", "ParseFromString failed."); + GELOGE(GRAPH_FAILED, "[Invoke][ParseFromString] failed."); return FAILED; } From 7ed6aa738ea6a3302456a1af2ba7767d62748c43 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Wed, 14 Apr 2021 22:09:30 +0800 Subject: [PATCH 02/16] bugfix for release memory --- ge/graph/load/model_manager/model_manager.cc | 6 +----- ge/graph/manager/graph_manager.cc | 10 ++++++++++ ge/graph/manager/graph_manager_utils.h | 5 ++++- ge/hybrid/executor/hybrid_model_async_executor.cc | 6 ++---- ge/model/ge_root_model.h | 10 ++++++---- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index 6114467c..cdb8e4bb 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -341,11 +341,7 @@ Status ModelManager::LoadModelOnline(uint32_t &model_id, const shared_ptr davinci_model = MakeShared(0, listener); - if (davinci_model == nullptr) { - REPORT_CALL_ERROR("E19999", "New DavinciModel fail, model_id:%u", model_id); - GELOGE(FAILED, "davinci_model is nullptr"); - return FAILED; - } + GE_CHECK_NOTNULL(davinci_model); davinci_model->SetProfileTime(MODEL_LOAD_START, (timespec.tv_sec * kTimeSpecNano + timespec.tv_nsec)); // 1000 ^ 3 converts second to nanosecond davinci_model->SetId(model_id); diff --git a/ge/graph/manager/graph_manager.cc b/ge/graph/manager/graph_manager.cc index f2b4211d..1315376c 100755 --- a/ge/graph/manager/graph_manager.cc +++ b/ge/graph/manager/graph_manager.cc @@ -125,6 +125,7 @@ const uint32_t kInitGraphCount = 1; const uint32_t kNotAdded = 0; const uint32_t kStartAdd = 1; const uint32_t kDoneAdded = 2; +const uint32_t kNeverLoaded = 0; bool IsTailingOptimization() { string is_tailing_optimization_option; @@ -2748,6 +2749,15 @@ void GraphManager::ReleaseMemory(const GeModelPtr &ge_model, GraphNodePtr &graph GELOGI("CheckAndReleaseMemory UnloadGraph[%u], model[%u] success.", graph_id, model_id); } graph_node->SetLoadFlag(false); + // Allow model to be loaded agagin without adding graph again + graph_node->SetLoadCount(graph_node->GetLoadRecord()); + graph_node->SetLoadRecord(kNeverLoaded); + GeRootModelPtr ge_root_model = graph_node->GetGeRootModel(); + if (ge_root_model == nullptr) { + GELOGW("ge_root_model is null, graph_id:%u", graph_id); + return; + } + ge_root_model->ClearAllModelId(); rt_ret = rtDeviceReset(GetContext().DeviceId()); if (rt_ret != RT_ERROR_NONE) { REPORT_CALL_ERROR("E19999", "Call rtDeviceReset failed, device_id:%u, when GraphManager %s", diff --git a/ge/graph/manager/graph_manager_utils.h b/ge/graph/manager/graph_manager_utils.h index ffbc20cf..bebba93e 100644 --- a/ge/graph/manager/graph_manager_utils.h +++ b/ge/graph/manager/graph_manager_utils.h @@ -178,9 +178,12 @@ class GraphNode { void SetSemSize(uint32_t size) { sem_.SetMaxSize(size); } uint32_t GetLoadCount() const { return load_count_; } + void SetLoadCount(uint32_t count) { load_count_ = count; } + uint32_t GetLoadRecord() const { return load_record_; } + void SetLoadRecord(uint32_t record) { load_record_ = record; } + void IncreaseLoadRecord() { ++load_record_; } void IncreaseLoadCount(); void DecreaseLoadCount() { --load_count_; } - void IncreaseLoadRecord() { ++load_record_; } // run graph asynchronous listener std::shared_ptr graph_run_async_listener_; diff --git a/ge/hybrid/executor/hybrid_model_async_executor.cc b/ge/hybrid/executor/hybrid_model_async_executor.cc index f3f1e1f5..1fed16a5 100644 --- a/ge/hybrid/executor/hybrid_model_async_executor.cc +++ b/ge/hybrid/executor/hybrid_model_async_executor.cc @@ -150,10 +150,8 @@ Status HybridModelAsyncExecutor::RunInternal() { Status ret = data_inputer_->Pop(data_wrapper); // Model indeedly start running SetRunningFlag(true); - if (data_wrapper == nullptr || ret != SUCCESS) { - GELOGI("data_wrapper is null!, ret = %u", ret); - continue; - } + GE_IF_BOOL_EXEC(data_wrapper == nullptr || ret != SUCCESS, GELOGI("data_wrapper is null!, ret = %u", ret); + continue); GELOGI("Getting the input data, model_id:%u", model_id_); GE_IF_BOOL_EXEC(!run_flag_, break); diff --git a/ge/model/ge_root_model.h b/ge/model/ge_root_model.h index 8c44272d..b8ff7b7a 100755 --- a/ge/model/ge_root_model.h +++ b/ge/model/ge_root_model.h @@ -40,12 +40,14 @@ class GeRootModel { } uint32_t GetModelId() const { return model_id_; } - std::vector GetAllModelId() const { return model_ids_; } - void SetModelName(const std::string &model_name) { model_name_ = model_name; } - + const std::string &GetModelName() const { return model_name_; } - + + std::vector GetAllModelId() const { return model_ids_; } + + void ClearAllModelId() { model_ids_.clear(); } + Status CheckIsUnknownShape(bool &is_dynamic_shape); void SetRootGraph(ComputeGraphPtr graph) { root_graph_ = graph; } From c938b65a7131d62b9b73fee5c226688fb65de163 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Apr 2021 19:38:31 +0800 Subject: [PATCH 03/16] Add dump_task_src in ge_executor. --- ge/executor/CMakeLists.txt | 9 +++++++-- metadef | 2 +- parser | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 2fca1aa6..7108fc46 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -4,11 +4,16 @@ set(PROTO_LIST "${METADEF_DIR}/proto/insert_op.proto" "${METADEF_DIR}/proto/task.proto" "${METADEF_DIR}/proto/op_mapping_info.proto" +) + +set(DUMP_PROTO_LIST "${METADEF_DIR}/proto/dump_task.proto" ) protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) protobuf_generate(ge_static PROTO_STATIC_SRCS PROTO_STATIC_HDRS ${PROTO_LIST}) +protobuf_generate(ge DUMP_PROTO_SRCS DUMP_PROTO_HDRS ${DUMP_PROTO_LIST}) +protobuf_generate(ge_static DUMP_PROTO_STATIC_SRCS DUMP_PROTO_STATIC_HDRS ${DUMP_PROTO_LIST}) set(SRC_LIST "ge_executor.cc" @@ -164,7 +169,7 @@ set(SRC_LIST ) ######## libge_executor.a ######## -add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS}) +add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS} ${DUMP_PROTO_STATIC_SRCS}) target_compile_options(ge_executor PRIVATE $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common> @@ -212,7 +217,7 @@ target_link_libraries(ge_executor PRIVATE ) ######## libge_executor.so ######## -add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS}) +add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS} ${DUMP_PROTO_SRCS}) target_compile_options(ge_executor_shared PRIVATE -fno-common diff --git a/metadef b/metadef index 72984c62..09c002f7 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 72984c62e434da09f8ea7d7a4fd4a365e0b6f42c +Subproject commit 09c002f7a564fa9f763292189cbb7156a63f7df6 diff --git a/parser b/parser index 88c66a63..6f894277 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 88c66a63b382bb54b338859e44b6321da979b22e +Subproject commit 6f894277aac964e1541800d7e04efe77d4433720 From d5c6b1418b64a831dcd13969c27b05f46daee84e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Apr 2021 20:16:56 +0800 Subject: [PATCH 04/16] Add dump_task_src in ge_executor. --- ge/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 89745019..44a2732c 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -11,6 +11,7 @@ elseif (ENABLE_D) endif () set(PROTO_LIST + "${METADEF_DIR}/proto/dump_task.proto" "${METADEF_DIR}/proto/fusion_model.proto" "${GE_CODE_DIR}/ge/proto/optimizer_priority.proto" ) From 1316bb9f03065bc4fec379d1df50bbed3001ab6d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Apr 2021 21:44:34 +0800 Subject: [PATCH 05/16] Add op_mapping_info_src in ge_executor. --- ge/CMakeLists.txt | 2 +- ge/executor/CMakeLists.txt | 2 +- metadef | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ge/CMakeLists.txt b/ge/CMakeLists.txt index 44a2732c..6e0e9235 100755 --- a/ge/CMakeLists.txt +++ b/ge/CMakeLists.txt @@ -12,6 +12,7 @@ endif () set(PROTO_LIST "${METADEF_DIR}/proto/dump_task.proto" + "${METADEF_DIR}/proto/op_mapping_info.proto" "${METADEF_DIR}/proto/fusion_model.proto" "${GE_CODE_DIR}/ge/proto/optimizer_priority.proto" ) @@ -26,7 +27,6 @@ set(PROTO_HEADER_LIST "${METADEF_DIR}/proto/insert_op.proto" "${METADEF_DIR}/proto/ge_ir.proto" "${METADEF_DIR}/proto/fwk_adapter.proto" - "${METADEF_DIR}/proto/op_mapping_info.proto" ) protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 7108fc46..3094429f 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -3,11 +3,11 @@ set(PROTO_LIST "${METADEF_DIR}/proto/ge_ir.proto" "${METADEF_DIR}/proto/insert_op.proto" "${METADEF_DIR}/proto/task.proto" - "${METADEF_DIR}/proto/op_mapping_info.proto" ) set(DUMP_PROTO_LIST "${METADEF_DIR}/proto/dump_task.proto" + "${METADEF_DIR}/proto/op_mapping_info.proto" ) protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) diff --git a/metadef b/metadef index 09c002f7..c4043a0f 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit 09c002f7a564fa9f763292189cbb7156a63f7df6 +Subproject commit c4043a0f9976396c0e62e0e4a9afac2d29e15522 From e12eec60851846741adb5fc8fe0ccccec74f4375 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Apr 2021 15:37:31 +0800 Subject: [PATCH 06/16] Change dump proto to static lib. --- ge/executor/CMakeLists.txt | 42 ++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 3094429f..054080ec 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -12,8 +12,37 @@ set(DUMP_PROTO_LIST protobuf_generate(ge PROTO_SRCS PROTO_HDRS ${PROTO_LIST}) protobuf_generate(ge_static PROTO_STATIC_SRCS PROTO_STATIC_HDRS ${PROTO_LIST}) -protobuf_generate(ge DUMP_PROTO_SRCS DUMP_PROTO_HDRS ${DUMP_PROTO_LIST}) -protobuf_generate(ge_static DUMP_PROTO_STATIC_SRCS DUMP_PROTO_STATIC_HDRS ${DUMP_PROTO_LIST}) +protobuf_generate(ge_dump DUMP_PROTO_SRCS DUMP_PROTO_HDRS ${DUMP_PROTO_LIST}) + +############ libge_proto_dump.a ############ +add_library(ge_proto_dump STATIC + ${DUMP_PROTO_SRCS} +) + +target_compile_definitions(ge_proto_dump PRIVATE + PROTOBUF_INLINE_NOT_IN_HEADERS=0 + google=ascend_private + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> +) + +target_compile_options(ge_proto_dump PRIVATE + -O2 + -fno-common + -fvisibility=hidden + $<$,$>:/MTd> + $<$,$>:/MT> +) + +target_link_libraries(ge_proto_dump PRIVATE + $ + ascend_protobuf +) + +target_link_options(ge_proto_dump PRIVATE + -Wl,-Bsymbolic +) +################################################################## set(SRC_LIST "ge_executor.cc" @@ -169,7 +198,7 @@ set(SRC_LIST ) ######## libge_executor.a ######## -add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS} ${DUMP_PROTO_STATIC_SRCS}) +add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS}) target_compile_options(ge_executor PRIVATE $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common> @@ -199,6 +228,7 @@ target_include_directories(ge_executor SYSTEM PRIVATE ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/ge_dump ${CMAKE_BINARY_DIR}/proto/ge_static #### yellow zone #### ${GE_CODE_DIR}/../inc @@ -212,12 +242,13 @@ target_link_libraries(ge_executor PRIVATE json ascend_protobuf_static c_sec + ge_proto_dump $<$>:-lrt> -ldl ) ######## libge_executor.so ######## -add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS} ${DUMP_PROTO_SRCS}) +add_library(ge_executor_shared SHARED ${SRC_LIST} ${PROTO_HDRS}) target_compile_options(ge_executor_shared PRIVATE -fno-common @@ -245,6 +276,7 @@ target_include_directories(ge_executor_shared PRIVATE ${METADEF_DIR}/inc/external/graph ${METADEF_DIR}/inc/graph ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/proto/ge_dump ${CMAKE_BINARY_DIR}/proto/ge #### yellow zone #### ${GE_CODE_DIR}/../inc @@ -255,12 +287,14 @@ target_include_directories(ge_executor_shared PRIVATE target_link_options(ge_executor_shared PRIVATE -Wl,-Bsymbolic + -Wl,--exclude-libs,ALL ) target_link_libraries(ge_executor_shared PRIVATE $ msprofiler static_mmpa + ge_proto_dump -Wl,--no-as-needed ge_common runtime From a8cebac5c6e0c75829a784b3c150824c046ad187 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Apr 2021 17:54:58 +0800 Subject: [PATCH 07/16] Add graph.so in bule. --- build.sh | 6 ++++++ ge/executor/CMakeLists.txt | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 7b1c0792..138db9cc 100644 --- a/build.sh +++ b/build.sh @@ -250,6 +250,7 @@ generate_package() NNENGINE_PATH="plugin/nnengine/ge_config" OPSKERNEL_PATH="plugin/opskernel" + ACL_LIB=("libgraph.so") ATC_LIB=("libc_sec.so" "libge_common.so" "libge_compiler.so" "libgraph.so" "libregister.so" "liberror_manager.so") FWK_LIB=("libge_common.so" "libge_runner.so" "libgraph.so" "libregister.so" "liberror_manager.so") PLUGIN_OPSKERNEL=("libge_local_engine.so" "libge_local_opskernel_builder.so" "libhost_cpu_engine.so" "libhost_cpu_opskernel_builder.so" "optimizer_priority.pbtxt") @@ -303,6 +304,11 @@ generate_package() find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${FWK_PATH} \; done + for lib in "${ACL_LIB[@]}"; + do + find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ACL_PATH} \; + done + for lib in "${ATC_LIB[@]}"; do find ${OUTPUT_PATH}/${GRAPHENGINE_LIB_PATH} -maxdepth 1 -name "$lib" -exec cp -f {} ${OUTPUT_PATH}/${ATC_PATH} \; diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index 054080ec..c78e06bd 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -198,7 +198,7 @@ set(SRC_LIST ) ######## libge_executor.a ######## -add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS}) +add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS} ${DUMP_PROTO_SRCS}) target_compile_options(ge_executor PRIVATE $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common> @@ -242,7 +242,6 @@ target_link_libraries(ge_executor PRIVATE json ascend_protobuf_static c_sec - ge_proto_dump $<$>:-lrt> -ldl ) From 5f07dbd7b26862971e44080fddb48e520d9acefd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 16 Apr 2021 18:19:39 +0800 Subject: [PATCH 08/16] Add graph.so in bule. --- ge/executor/CMakeLists.txt | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index c78e06bd..d215b7ef 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -42,6 +42,35 @@ target_link_libraries(ge_proto_dump PRIVATE target_link_options(ge_proto_dump PRIVATE -Wl,-Bsymbolic ) + +add_library(ge_proto_dump_static STATIC + ${DUMP_PROTO_SRCS} +) + +target_compile_definitions(ge_proto_dump_static PRIVATE + PROTOBUF_INLINE_NOT_IN_HEADERS=0 + google=ascend_private + $,OS_TYPE=WIN,OS_TYPE=0> + $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> +) + +target_compile_options(ge_proto_dump_static PRIVATE + -O2 + -fno-common + -fvisibility=hidden + $<$,$>:/MTd> + $<$,$>:/MT> +) + +target_link_libraries(ge_proto_dump_static PRIVATE + $ + ascend_protobuf_static +) + +target_link_options(ge_proto_dump_static PRIVATE + -Wl,-Bsymbolic +) + ################################################################## set(SRC_LIST @@ -198,7 +227,7 @@ set(SRC_LIST ) ######## libge_executor.a ######## -add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS} ${DUMP_PROTO_SRCS}) +add_library(ge_executor STATIC ${SRC_LIST} ${PROTO_STATIC_HDRS}) target_compile_options(ge_executor PRIVATE $<$,$>:-fvisibility=hidden -O2 -Werror -Wno-deprecated-declarations -fno-common> @@ -241,6 +270,7 @@ target_link_libraries(ge_executor PRIVATE $ json ascend_protobuf_static + ge_proto_dump_static c_sec $<$>:-lrt> -ldl From 6cdea5a3d91514ac1951c56b1c3a03d6c7a9f7b9 Mon Sep 17 00:00:00 2001 From: dingshihao2 Date: Fri, 16 Apr 2021 19:21:06 +0800 Subject: [PATCH 09/16] fix gen_mask control-edges bug --- ge/graph/passes/link_gen_mask_nodes_pass.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index 14f5dfc3..27b12ffc 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -28,7 +28,10 @@ using std::vector; namespace ge { namespace { +<<<<<<< Updated upstream const size_t kGenMaskInputIndex = 1; +======= +>>>>>>> Stashed changes const size_t kDefaultMaxParallelNum = 1; } // namespace @@ -105,8 +108,18 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vectorGetInDataNodes(); +<<<<<<< Updated upstream if (in_data_nodes.size() > kGenMaskInputIndex) { NodePtr &gen_mask = in_data_nodes.at(kGenMaskInputIndex); +======= + for (auto &in_data_node : in_data_nodes) { + // node gen_mask is located at different place in the fused node + if (in_data_node->GetName().find(DROPOUTGENMASK) == in_data_node->GetName().npos) { + continue; + } + NodePtr &gen_mask = in_data_node; + +>>>>>>> Stashed changes if ((gen_mask->GetOpDesc() == nullptr) || (gen_mask->GetOpDesc()->HasAttr(ATTR_NAME_STREAM_LABEL))) { continue; } From 1a492ec8927417d7ed6d9232a816583fa1ca3859 Mon Sep 17 00:00:00 2001 From: dingshihao2 Date: Fri, 16 Apr 2021 19:23:20 +0800 Subject: [PATCH 10/16] fix gen_mask control-edges bug --- ge/graph/passes/link_gen_mask_nodes_pass.cc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index 27b12ffc..2788bc43 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -28,10 +28,6 @@ using std::vector; namespace ge { namespace { -<<<<<<< Updated upstream -const size_t kGenMaskInputIndex = 1; -======= ->>>>>>> Stashed changes const size_t kDefaultMaxParallelNum = 1; } // namespace @@ -108,10 +104,6 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vectorGetInDataNodes(); -<<<<<<< Updated upstream - if (in_data_nodes.size() > kGenMaskInputIndex) { - NodePtr &gen_mask = in_data_nodes.at(kGenMaskInputIndex); -======= for (auto &in_data_node : in_data_nodes) { // node gen_mask is located at different place in the fused node if (in_data_node->GetName().find(DROPOUTGENMASK) == in_data_node->GetName().npos) { @@ -119,7 +111,6 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vector>>>>>> Stashed changes if ((gen_mask->GetOpDesc() == nullptr) || (gen_mask->GetOpDesc()->HasAttr(ATTR_NAME_STREAM_LABEL))) { continue; } From dfd18d346574172ac74a7337eba462ea42ac3080 Mon Sep 17 00:00:00 2001 From: dingshihao2 Date: Fri, 16 Apr 2021 20:16:52 +0800 Subject: [PATCH 11/16] fix gen_mask control-edges bug --- ge/graph/passes/link_gen_mask_nodes_pass.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index 2788bc43..8dfd447d 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -28,6 +28,7 @@ using std::vector; namespace ge { namespace { +const size_t kGenMaskInputIndex = 1; const size_t kDefaultMaxParallelNum = 1; } // namespace @@ -104,12 +105,14 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vectorGetInDataNodes(); - for (auto &in_data_node : in_data_nodes) { - // node gen_mask is located at different place in the fused node - if (in_data_node->GetName().find(DROPOUTGENMASK) == in_data_node->GetName().npos) { - continue; + if (in_data_nodes.size() > kGenMaskInputIndex) { + NodePtr &gen_mask = in_data_nodes.at(kGenMaskInputIndex); + for (auto &in_data_node : in_data_nodes) { + // node gen_mask is located at different place in the fused node + if (in_data_node->GetName().find(DROPOUTGENMASK) != in_data_node->GetName().npos) { + gen_mask = in_data_node; + } } - NodePtr &gen_mask = in_data_node; if ((gen_mask->GetOpDesc() == nullptr) || (gen_mask->GetOpDesc()->HasAttr(ATTR_NAME_STREAM_LABEL))) { continue; From 5f8812eefdc914d182c033086b361182feee9af7 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 17 Apr 2021 10:05:27 +0800 Subject: [PATCH 12/16] Proto_dump link ascend_protobuf_static. --- ge/executor/CMakeLists.txt | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/ge/executor/CMakeLists.txt b/ge/executor/CMakeLists.txt index d215b7ef..a664e93a 100644 --- a/ge/executor/CMakeLists.txt +++ b/ge/executor/CMakeLists.txt @@ -35,42 +35,13 @@ target_compile_options(ge_proto_dump PRIVATE ) target_link_libraries(ge_proto_dump PRIVATE - $ - ascend_protobuf -) - -target_link_options(ge_proto_dump PRIVATE - -Wl,-Bsymbolic -) - -add_library(ge_proto_dump_static STATIC - ${DUMP_PROTO_SRCS} -) - -target_compile_definitions(ge_proto_dump_static PRIVATE - PROTOBUF_INLINE_NOT_IN_HEADERS=0 - google=ascend_private - $,OS_TYPE=WIN,OS_TYPE=0> - $<$:SECUREC_USING_STD_SECURE_LIB=0 NOMINMAX> -) - -target_compile_options(ge_proto_dump_static PRIVATE - -O2 - -fno-common - -fvisibility=hidden - $<$,$>:/MTd> - $<$,$>:/MT> -) - -target_link_libraries(ge_proto_dump_static PRIVATE $ ascend_protobuf_static ) -target_link_options(ge_proto_dump_static PRIVATE +target_link_options(ge_proto_dump PRIVATE -Wl,-Bsymbolic ) - ################################################################## set(SRC_LIST @@ -270,7 +241,7 @@ target_link_libraries(ge_executor PRIVATE $ json ascend_protobuf_static - ge_proto_dump_static + ge_proto_dump c_sec $<$>:-lrt> -ldl From 8858e2280704ea632da5df8df079f56b9825bc8f Mon Sep 17 00:00:00 2001 From: dingshihao2 Date: Sat, 17 Apr 2021 14:30:42 +0800 Subject: [PATCH 13/16] fix gen_mask control-edges bug --- ge/graph/passes/link_gen_mask_nodes_pass.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index 8dfd447d..b9adc51b 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -111,6 +111,8 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vectorGetName().find(DROPOUTGENMASK) != in_data_node->GetName().npos) { gen_mask = in_data_node; + GELOGD("The fused node type [%s], paired with input node name [%s].", node->GetType(), gen_mask->GetName()); + break; } } From 3d4573e8af57004c833bd93ee77e227172237420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=A3=8A?= Date: Sat, 17 Apr 2021 14:53:04 +0800 Subject: [PATCH 14/16] update submodule index --- metadef | 2 +- parser | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metadef b/metadef index c4043a0f..4cf2633a 160000 --- a/metadef +++ b/metadef @@ -1 +1 @@ -Subproject commit c4043a0f9976396c0e62e0e4a9afac2d29e15522 +Subproject commit 4cf2633a8f2290dee165ab11f8d6b8a07cba1412 diff --git a/parser b/parser index 6f894277..a41249dc 160000 --- a/parser +++ b/parser @@ -1 +1 @@ -Subproject commit 6f894277aac964e1541800d7e04efe77d4433720 +Subproject commit a41249dc9b50e4c4988eb62a662b7df29ac24ee7 From 0eacf6dfcdc13fbbfc6c575376c44a2f5ad524f4 Mon Sep 17 00:00:00 2001 From: dingshihao2 Date: Sat, 17 Apr 2021 14:59:16 +0800 Subject: [PATCH 15/16] fix gen_mask control-edges bug --- ge/graph/passes/link_gen_mask_nodes_pass.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ge/graph/passes/link_gen_mask_nodes_pass.cc b/ge/graph/passes/link_gen_mask_nodes_pass.cc index b9adc51b..e00ede45 100755 --- a/ge/graph/passes/link_gen_mask_nodes_pass.cc +++ b/ge/graph/passes/link_gen_mask_nodes_pass.cc @@ -111,7 +111,8 @@ void LinkGenMaskNodesPass::GetAllGenMaskNodes(ComputeGraphPtr graph, vectorGetName().find(DROPOUTGENMASK) != in_data_node->GetName().npos) { gen_mask = in_data_node; - GELOGD("The fused node type [%s], paired with input node name [%s].", node->GetType(), gen_mask->GetName()); + GELOGD("The fused node type [%s], paired with the input node name [%s].", + node->GetType().c_str(), gen_mask->GetName().c_str()); break; } } From 2865bcff6cb69c0c6664f0690ab6e9e3ff002f33 Mon Sep 17 00:00:00 2001 From: stormchasingg <837008578@qq.com> Date: Sun, 18 Apr 2021 21:34:11 +0800 Subject: [PATCH 16/16] fix gen_mask control-edges bug --- tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc b/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc index 511ddece..716cc91d 100644 --- a/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc +++ b/tests/ut/ge/graph/passes/link_gen_mask_nodes_pass_unittest.cc @@ -43,7 +43,7 @@ ut::GraphBuilder Graph1Builder() { ut::GraphBuilder builder = ut::GraphBuilder("g1"); auto const1 = builder.AddNode("const1", "Const", 0, 1); auto const2 = builder.AddNode("const2", "Const", 0, 1); - auto gen_mask1 = builder.AddNode("gen_mask1", "DropOutGenMask", 2, 1); + auto gen_mask1 = builder.AddNode("gen_mask1_DropOutGenMask", "DropOutGenMask", 2, 1); auto gen_mask2 = builder.AddNode("gen_mask2", "DropOutGenMaskV3", 2, 1); auto gen_mask3 = builder.AddNode("gen_mask3", "DropOutGenMaskV3D", 2, 1); auto do_mask1 = builder.AddNode("do_mask1", "DropOutDoMask", 3, 1); @@ -106,6 +106,6 @@ TEST_F(UtestLinkGenMaskNodesPass, link_gen_mask_nodes_pass_success) { auto out_ctrl_nodes = gen_mask2->GetOutControlNodes(); EXPECT_EQ(out_ctrl_nodes.size(), 1); auto out_ctrl_node = out_ctrl_nodes.at(0); - EXPECT_EQ(out_ctrl_node->GetName(), "gen_mask1"); + EXPECT_EQ(out_ctrl_node->GetName(), "gen_mask1_DropOutGenMask"); } } // namespace ge