From 66b20884dae75815f56dbaf99fc04c13085387a3 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Fri, 13 Nov 2020 17:58:44 +0800 Subject: [PATCH 01/17] error message add --- ge/graph/common/transop_util.cc | 8 +++ ge/graph/common/transop_util.h | 2 + ge/graph/preprocess/graph_preprocess.cc | 64 ++++++++++++++++++++-- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 6 ++ .../preprocess/insert_op/util_insert_aipp_op.cc | 42 ++++++++++---- ge/graph/preprocess/multi_batch_copy_graph.cc | 2 + ge/graph/preprocess/multi_batch_options.cc | 4 ++ 7 files changed, 112 insertions(+), 16 deletions(-) diff --git a/ge/graph/common/transop_util.cc b/ge/graph/common/transop_util.cc index 684ef3dc..f57f56a8 100755 --- a/ge/graph/common/transop_util.cc +++ b/ge/graph/common/transop_util.cc @@ -81,5 +81,13 @@ bool TransOpUtil::CheckPrecisionLoss(const ge::NodePtr &src_node) { return false; } return true; + + std::string TransOpUtil::TransopMapToString() { + std::string buffer; + for (auto it = transop_index_map_.begin(); it != transop_index_map_.end(); ++it) { + buffer += it->first + ","; + } + return buffer.substr(0, buffer.size() -1); + } } } // namespace ge diff --git a/ge/graph/common/transop_util.h b/ge/graph/common/transop_util.h index 8b10ad5c..3332e1fb 100644 --- a/ge/graph/common/transop_util.h +++ b/ge/graph/common/transop_util.h @@ -35,6 +35,8 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY TransOpUtil { static bool CheckPrecisionLoss(const NodePtr &src_node); + static std::string TransopMapToString(); + private: TransOpUtil(); diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 98371426..7049fba1 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -128,6 +128,9 @@ static std::map output_type_str_to_datatype = { {"UINT32", ge::DT_UINT32}, {"UINT64", ge::DT_UINT64}, {"DOUBLE", ge::DT_DOUBLE}}; const char *const kMbatchSwitchnName = "mbatch-switch-name"; +const char *const kConstError1 = "Const is invalid scalar tensor."; +const char *const kConstError2 = "Const is invalid vector scalar."; +const char *const kConstError3 = "Const input data size is not equal with tensor desc shape"; // the size of user defined output datatype or format string after split by ":". const size_t kUserDefinedElementCount = 2; @@ -219,6 +222,9 @@ NodePtr CreateTransNode(const std::string &name, const std::string &node_type, c auto index = TransOpUtil::GetTransOpDataIndex(node_type); if (index < 0) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E19025", {"situation", "reason"}, + {"The trans node type[" + node_type + "]", "it must be " + TransOpUtil::TransopMapToString()}); GELOGE(INTERNAL_ERROR, "The trans node type %s does not exists", node_type.c_str()); return nullptr; } @@ -387,6 +393,8 @@ Status RecoverTransRoadForVar(const NodePtr &var, const VarTransRoad &road) { auto trans_name = var->GetName() + "_trans_" + std::to_string(index++); auto ret = RecoverOneTransNodeForVar(trans_name, *iter, last_node, last_node); if (ret != SUCCESS) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E15001", {"variable", "index", "type"}, {var->GetName(), std::to_string(index), iter->node_type}); GELOGE(INTERNAL_ERROR, "Failed to recover trans node for variable %s, index %d, type %s", var->GetName().c_str(), index, iter->node_type.c_str()); return INTERNAL_ERROR; @@ -419,6 +427,8 @@ Status RecoverTransRoadForVarRef(const std::set &nodes, const VarTransR auto trans_name = var->GetName() + "_trans_" + std::to_string(index++); auto ret = RecoverOneTransNodeForVarRef(trans_name, *iter, last_node, last_node); if (ret != SUCCESS) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E15001", {"variable", "index", "type"}, {var->GetName(), std::to_string(index), iter->node_type}); GELOGE(INTERNAL_ERROR, "Failed to recover trans node for variable %s, index %d, type %s", var->GetName().c_str(), index, iter->node_type.c_str()); return INTERNAL_ERROR; @@ -571,6 +581,8 @@ Status CheckIfDynamicBatchScene(NodePtr &data_node, bool &is_dynamic_batch, Node std::string related_node_name; if (AttrUtils::GetStr(data_node->GetOpDesc(), kMbatchSwitchnName, related_node_name)) { if (related_node_name.empty()) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E15002", {"opname", "value", "reason"}, {data_node->GetName(), "flag", "but the value is empty"}); GELOGE(INTERNAL_ERROR, "The data node %s has switchn node flag, but the value is empty", data_node->GetName().c_str()); return INTERNAL_ERROR; @@ -582,6 +594,9 @@ Status CheckIfDynamicBatchScene(NodePtr &data_node, bool &is_dynamic_batch, Node } } if (switchn_node == nullptr) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E15002", {"opname", "value", "reason"}, + {data_node->GetName(), related_node_name, "but the value is empty"}); GELOGE(INTERNAL_ERROR, "The data node %s has switchn node %s, but can not find it on the graph", data_node->GetName().c_str(), related_node_name.c_str()); return INTERNAL_ERROR; @@ -682,6 +697,10 @@ Status ProcessInputNC1HWC0DynShape(NodePtr &node_ptr, bool &is_dynamic_batch, No ge::GeShape old_shape = input->GetShape(); bool support = ((old_format == FORMAT_NC1HWC0) || (old_format == FORMAT_NCHW) || (old_format == FORMAT_NHWC)); if (!support) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E19014", {"opname", "value", "reason"}, + {op_desc->GetName(), "format[" + TypeUtils::FormatToSerialString(old_format) + "]", + "only support FORMAT_NC1HWC0,FORMAT_NCHW,FORMAT_NHWC"}); GELOGE(INTERNAL_ERROR, "The format [%s] is unsupported", TypeUtils::FormatToSerialString(old_format).c_str()); return FAILED; } @@ -762,6 +781,9 @@ Status GetStorageFormatAndShape(OpDescPtr &op_desc, const GeTensorDescPtr &tenso op_desc->GetName().c_str(), TypeUtils::FormatToSerialString(storage_format).c_str(), formats::JoinToString(storage_shape).c_str()); } else { + ErrorManager::GetInstance().ATCReportErrMessage( + "15003", {"opname", "format"}, + {op_desc->GetName(), TypeUtils::FormatToSerialString(storage_format)}); GELOGE(PARAM_INVALID, "Update node by storage format failed, storage_shape not set. " "node: [%s], storage_format [%s]", op_desc->GetName().c_str(), TypeUtils::FormatToSerialString(storage_format).c_str()); @@ -900,9 +922,14 @@ Status ProcessNetoutputNodeDynShape(NodePtr &node) { // check if is_output_adjust_hw_layout is set if (NeedUpdateFormatByOutputTypeParm(op_desc, index)) { if ((old_format != FORMAT_NCHW) && (old_format != FORMAT_NHWC) && (old_format != FORMAT_NC1HWC0)) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E19014", {"opname", "value", "reason"}, + {op_desc->GetName(), "format[" + TypeUtils::FormatToSerialString(old_format) + "]", + "only support FORMAT_NC1HWC0,FORMAT_NCHW,FORMAT_NHWC"}); GELOGE(INTERNAL_ERROR, "Format is not one of NCHW, NHWC, NC1HWC0."); return FAILED; } + GeTensorDesc old_desc(old_shape, old_format, old_dtype); if (ProcessNetoutputNodeFp16Nc1hwc0DynShape(old_desc, net_output_input_desc, src_node) != SUCCESS) { GELOGE(INTERNAL_ERROR, "Process netoutput fp16 nc1hwc0."); @@ -1035,6 +1062,10 @@ Status GraphPrepare::CheckRefInputNode(const NodePtr &node, const std::string &i } bool is_acceptable = (acceptable_types.find(input_type) != acceptable_types.end()); if (!is_acceptable) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E19014", {"opname", "value", "reason"}, + {op_desc->GetName(), "format[" + TypeUtils::FormatToSerialString(old_format) + "]", + "only support FORMAT_NC1HWC0,FORMAT_NCHW,FORMAT_NHWC"}); GELOGE(PARAM_INVALID, "The ref input of ref node %s[%s] must be ref node or variable, but %s[%s]isn't.", node->GetName().c_str(), node->GetType().c_str(), input_op_desc->GetName().c_str(), input_op_desc->GetType().c_str()); @@ -1127,6 +1158,9 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input) { } if ((index < 0) || (static_cast(index) >= user_input.size())) { + std::string situation = "data op index[" + std::to_string(index) + "]"; + std::string reason = "it must less than user_input size[" + std::to_string(user_input.size()) + "]"; + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, {situation, reason}); GELOGE(PARAM_INVALID, "user_input size = %zu, graph data op index = %ld.", user_input.size(), index); return FAILED; } @@ -1139,6 +1173,9 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input) { if (need_check_internal_format) { bool is_internal = TypeUtils::IsInternalFormat(format) || TypeUtils::IsInternalFormat(origin_format); if (is_internal) { + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, + {"Input format[" + TypeUtils::FormatToSerialString(format).c_str() + "] or origin_format[" + + TypeUtils::FormatToSerialString(origin_format).c_str() + "]", "it is not support"}); GELOGE(PARAM_INVALID, "Input format %s or origin_format %s is not support.", TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::FormatToSerialString(origin_format).c_str()); @@ -1150,6 +1187,8 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input) { uint32_t length = 1; bool type_ret = TypeUtils::GetDataTypeLength(data_type, length); if (!type_ret) { + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, + {"Input datatype[" + TypeUtils::DataTypeToSerialString(data_type) + "]", "it is not support"}); GELOGE(PARAM_INVALID, "Input datatype %s is not support.", TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; @@ -1164,6 +1203,10 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input) { return FAILED); bool size_check = (size != 0 && shape_size != size); if (size_check) { + std::string situation = "input data size[" + std::to_string(size) + + "] and shape_size[" + std::to_string(size) + "]"; + std::string reason = "because size != 0 and shape_size != size"; + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, {situation, reason}); GELOGE(PARAM_INVALID, "input data size =%ld, shape_size =%ld.", size, shape_size); return FAILED; } @@ -1503,6 +1546,8 @@ Status GraphPrepare::VerifyConstOp(const NodePtr &node) { uint32_t length = 1; bool type_ret = TypeUtils::GetDataTypeLength(data_type, length); if (!type_ret) { + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, + {"Input datatype[" + TypeUtils::DataTypeToSerialString(data_type) + "]", "it is not support"}); GELOGE(PARAM_INVALID, "Input datatype %s is not support.", TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } @@ -1512,14 +1557,19 @@ Status GraphPrepare::VerifyConstOp(const NodePtr &node) { if (shape_size == 0) { if (ge_tensor_desc.GetShape().GetDims().size() == 0) { // shape = [], means it's a sclar tensor. - GE_CHK_BOOL_EXEC(data_size / length == 1, return PARAM_INVALID, "Const is invalid scalar tensor."); + GE_CHK_BOOL_EXEC(data_size / length == 1, + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {kConstError1}); + return PARAM_INVALID, kConstError1); } else { // shape = [x, y, 0,...], means it's a vector tensor that value is []. - GE_CHK_BOOL_EXEC(data_size == 0, return PARAM_INVALID, "Const is invalid vector scalar."); + GE_CHK_BOOL_EXEC(data_size == 0, + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {kConstError2}); + return PARAM_INVALID, kConstError2); } } else { - GE_CHK_BOOL_EXEC(data_size == static_cast(shape_size * length) && data_size != 0, return PARAM_INVALID, - "Const input data size is not equal with tensor desc shape"); + GE_CHK_BOOL_EXEC(data_size == static_cast(shape_size * length) && data_size != 0, + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {kConstError3}); + return PARAM_INVALID, kConstError3); } return SUCCESS; } @@ -1543,6 +1593,9 @@ Status GraphPrepare::CheckUserInput(const std::vector &user_input) { return GE_GRAPH_INIT_FAILED; } if ((index < 0) || (static_cast(index) >= user_input.size())) { + std::string situation = "data op index[" + std::to_string(index) + "]"; + std::string reason = "it must less than user_input size[" + std::to_string(user_input.size()) + "]"; + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, {situation, reason}); GELOGE(GE_GRAPH_INIT_FAILED, "user_input size:%zu, data op index:%ld.", user_input.size(), index); return GE_GRAPH_INIT_FAILED; } @@ -1550,6 +1603,9 @@ Status GraphPrepare::CheckUserInput(const std::vector &user_input) { for (size_t i = 0; i < desc.GetShape().GetDimNum(); ++i) { if (desc.GetShape().GetDim(i) < 0) { + std::string situation = "data dim[" + std::to_string(i) + "][" + std::to_string(desc.GetShape().GetDim(i)) + "]" ; + std::string reason = "it need >= 0"; + ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, {situation, reason}); GELOGE(GE_GRAPH_INIT_FAILED, "data dim %zu is not supported, need >= 0, real:%ld.", i, desc.GetShape().GetDim(i)); return GE_GRAPH_INIT_FAILED; diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 729c47de..474145af 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -790,16 +790,22 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { int64_t batch_count = -1; if (GetDataDimN(data_node, ori_data_format, batch_count) != ge::SUCCESS) { + string errormsg = "Get data_node dims and transfer to nchw_dims failed!"; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(PARAM_INVALID, "Get data_node dims and transfer to nchw_dims failed!"); return PARAM_INVALID; } if (batch_count <= 0) { + string errormsg = "Batch count[" + std::to_sting(batch_count) + "] is invalid, it must positive."; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(PARAM_INVALID, "Batch count %ld is invalid", batch_count); return PARAM_INVALID; } int64_t max_dynamic_aipp_size = CalcMaxSize(batch_count); if (max_dynamic_aipp_size < 0) { + string errormsg = "The dynamic aipp size is not positive"; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(PARAM_INVALID, "The dynamic aipp size is not positive."); return PARAM_INVALID; } diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index a1eb104d..8b33885b 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -37,6 +37,16 @@ using domi::AippOpParams; +#define AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(expr, _status, errormsg) \ + do { \ + bool b = (expr); \ + if (!b) { \ + GELOGE(_status, errormsg); \ + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ + return _status; \ + } \ + } while (0) + namespace ge { namespace { const char *const kMbatchSwitchnName = "mbatch-switch-name"; @@ -224,9 +234,10 @@ Status InsertNewOpUtil::CheckGraph(const ComputeGraphPtr &graph) { } } } - GE_CHK_BOOL_RET_STATUS((aippNodes.size() == 0) || (aippNodes.size() == next_nodes_cnt), PARAM_INVALID, - "Can not config part of outputs of Data node to support AIPP, config all " - "of the outputs of Data to support AIPP, or config none of them"); + AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG((aippNodes.size() == 0) || (aippNodes.size() == next_nodes_cnt), + PARAM_INVALID, + "Can not config part of outputs of Data node to support AIPP, config all " + "of the outputs of Data to support AIPP, or config none of them"); std::unique_ptr aippParams(new (std::nothrow) domi::AippOpParams()); GE_CHECK_NOTNULL(aippParams); @@ -238,16 +249,19 @@ Status InsertNewOpUtil::CheckGraph(const ComputeGraphPtr &graph) { GE_CHK_STATUS(GetAippParams(currAippParam, aippNodes[i])); if (aippMode == domi::AippOpParams::static_) { - GE_CHK_BOOL_RET_STATUS(aippParams->input_format() == currAippParam->input_format(), PARAM_INVALID, - "The input_format of all aipp_ops after one Data should be the same"); - GE_CHK_BOOL_RET_STATUS(aippParams->src_image_size_w() == currAippParam->src_image_size_w(), PARAM_INVALID, - "The src_image_size_w of all aipp_ops after one Data should be the same"); - GE_CHK_BOOL_RET_STATUS(aippParams->src_image_size_h() == currAippParam->src_image_size_h(), PARAM_INVALID, - "The src_image_size_h of all aipp_ops after one Data should be the same"); + AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + aippParams->input_format() == currAippParam->input_format(), + PARAM_INVALID, "The input_format of all aipp_ops after one Data should be the same"); + AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + aippParams->src_image_size_w() == currAippParam->src_image_size_w(), + PARAM_INVALID, "The src_image_size_w of all aipp_ops after one Data should be the same"); + AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + aippParams->src_image_size_h() == currAippParam->src_image_size_h(), + PARAM_INVALID, "The src_image_size_h of all aipp_ops after one Data should be the same"); } else { - GE_CHK_BOOL_RET_STATUS(aippParams->max_src_image_size() == currAippParam->max_src_image_size(), - PARAM_INVALID, - "The max_src_image_size of all aipp_ops after one Data should be the same"); + AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + aippParams->max_src_image_size() == currAippParam->max_src_image_size(), + PARAM_INVALID, "The max_src_image_size of all aipp_ops after one Data should be the same"); } }); } @@ -290,6 +304,8 @@ Status InsertNewOpUtil::UpdateDataNodeByAipp(const ComputeGraphPtr &graph) { for (auto &switchn : updated_switchn) { auto data_iter = switchn_names_to_data.find(switchn->GetName()); if (data_iter == switchn_names_to_data.end()) { + string errormesg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(INTERNAL_ERROR, "Failed to find relative data node by switchn %s", switchn->GetName().c_str()); return INTERNAL_ERROR; } @@ -477,6 +493,8 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt } } if (max_index >= switchn->GetOpDesc()->GetOutputsSize()) { + string errormesg = "No max size found from switchn node[" + switchn->GetName()+ "]"; + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(INTERNAL_ERROR, "No max size found from switchn node %s", switchn->GetName().c_str()); return INTERNAL_ERROR; } diff --git a/ge/graph/preprocess/multi_batch_copy_graph.cc b/ge/graph/preprocess/multi_batch_copy_graph.cc index c0ba89f4..8f42ad24 100644 --- a/ge/graph/preprocess/multi_batch_copy_graph.cc +++ b/ge/graph/preprocess/multi_batch_copy_graph.cc @@ -595,6 +595,8 @@ Status MultiBatchGraphCopyer::CheckCopyResult(const std::vector &start_ } auto dims = NodeUtils::GetOutputDesc(*node, kDataOutIndex).GetShape().GetDims(); if (!IsAllDimsPositive(dims)) { + ErrorManager::GetInstance().ATCReportErrMessage("E15004", {"opname", "shape"}, + {node->GetName(), formats::ShapeToString(dims)}); GELOGE(INTERNAL_ERROR, "Failed to copy multi batch graph, the node %s still has unknown shape %s", node->GetName().c_str(), formats::ShapeToString(dims).c_str()); return INTERNAL_ERROR; diff --git a/ge/graph/preprocess/multi_batch_options.cc b/ge/graph/preprocess/multi_batch_options.cc index 9909b0dc..cc0d2d5b 100644 --- a/ge/graph/preprocess/multi_batch_options.cc +++ b/ge/graph/preprocess/multi_batch_options.cc @@ -124,6 +124,8 @@ Status ParserDataToDynmaicInfo(const vector> &shapes, auto tmp_index = cur_data_index; for (size_t i = 0; i < static_cast(dynamic_dims_num); ++i) { if (tmp_index >= dynamic_gear_info.size()) { + ErrorManager::GetInstance().ATCReportErrMessage( + "E10045", {"name", "shape"}, {data_name, formats::JoinToString(data_shape)}); GELOGE(PARAM_INVALID, "Data: %s shape: %s make dynamic dims overflow", data_name.c_str(), formats::JoinToString(data_shape).c_str()); return FAILED; @@ -131,6 +133,8 @@ Status ParserDataToDynmaicInfo(const vector> &shapes, one_gear.push_back(dynamic_gear_info[tmp_index++]); } } else { + ErrorManager::GetInstance().ATCReportErrMessage( + "E10046", {"name", "shape"}, {data_name, formats::JoinToString(data_shape)}); GELOGE(PARAM_INVALID, "Dynamic dims num of data: %s shape: %s can not be more than one gear dynamic info size", data_name.c_str(), formats::JoinToString(data_shape).c_str()); return FAILED; From 55745911a43bc92e9283cf0eecece752d34a49db Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Fri, 13 Nov 2020 18:34:36 +0800 Subject: [PATCH 02/17] error message add --- ge/graph/common/transop_util.cc | 13 +++++++------ ge/graph/preprocess/graph_preprocess.cc | 19 ++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ge/graph/common/transop_util.cc b/ge/graph/common/transop_util.cc index f57f56a8..c86e69dd 100755 --- a/ge/graph/common/transop_util.cc +++ b/ge/graph/common/transop_util.cc @@ -81,13 +81,14 @@ bool TransOpUtil::CheckPrecisionLoss(const ge::NodePtr &src_node) { return false; } return true; +} - std::string TransOpUtil::TransopMapToString() { - std::string buffer; - for (auto it = transop_index_map_.begin(); it != transop_index_map_.end(); ++it) { - buffer += it->first + ","; - } - return buffer.substr(0, buffer.size() -1); +std::string TransOpUtil::TransopMapToString() { + std::string buffer; + for (auto it = transop_index_map_.begin(); it != transop_index_map_.end(); ++it) { + buffer += it->first + " "; } + return buffer; } + } // namespace ge diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 7049fba1..c5fca249 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -128,9 +128,6 @@ static std::map output_type_str_to_datatype = { {"UINT32", ge::DT_UINT32}, {"UINT64", ge::DT_UINT64}, {"DOUBLE", ge::DT_DOUBLE}}; const char *const kMbatchSwitchnName = "mbatch-switch-name"; -const char *const kConstError1 = "Const is invalid scalar tensor."; -const char *const kConstError2 = "Const is invalid vector scalar."; -const char *const kConstError3 = "Const input data size is not equal with tensor desc shape"; // the size of user defined output datatype or format string after split by ":". const size_t kUserDefinedElementCount = 2; @@ -1063,9 +1060,8 @@ Status GraphPrepare::CheckRefInputNode(const NodePtr &node, const std::string &i bool is_acceptable = (acceptable_types.find(input_type) != acceptable_types.end()); if (!is_acceptable) { ErrorManager::GetInstance().ATCReportErrMessage( - "E19014", {"opname", "value", "reason"}, - {op_desc->GetName(), "format[" + TypeUtils::FormatToSerialString(old_format) + "]", - "only support FORMAT_NC1HWC0,FORMAT_NCHW,FORMAT_NHWC"}); + "E15005", {"opname", "optype", "opname1", "optype1"}, + {op_desc->GetName(), node->GetType(), input_op_desc->GetName(), input_op_desc->GetType()}); GELOGE(PARAM_INVALID, "The ref input of ref node %s[%s] must be ref node or variable, but %s[%s]isn't.", node->GetName().c_str(), node->GetType().c_str(), input_op_desc->GetName().c_str(), input_op_desc->GetType().c_str()); @@ -1558,18 +1554,19 @@ Status GraphPrepare::VerifyConstOp(const NodePtr &node) { if (ge_tensor_desc.GetShape().GetDims().size() == 0) { // shape = [], means it's a sclar tensor. GE_CHK_BOOL_EXEC(data_size / length == 1, - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {kConstError1}); - return PARAM_INVALID, kConstError1); + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {"Const is invalid scalar tensor."}); + return PARAM_INVALID, "Const is invalid scalar tensor."); } else { // shape = [x, y, 0,...], means it's a vector tensor that value is []. GE_CHK_BOOL_EXEC(data_size == 0, - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {kConstError2}); + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {"Const is invalid vector scalar."}); return PARAM_INVALID, kConstError2); } } else { GE_CHK_BOOL_EXEC(data_size == static_cast(shape_size * length) && data_size != 0, - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {kConstError3}); - return PARAM_INVALID, kConstError3); + ErrorManager::GetInstance().ATCReportErrMessage( + "E10043", {"reason"}, {"Const input data size is not equal with tensor desc shape"}); + return PARAM_INVALID, "Const input data size is not equal with tensor desc shape"); } return SUCCESS; } From c756068df0aeab881c6b054318043292134eb6e9 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Fri, 13 Nov 2020 18:38:59 +0800 Subject: [PATCH 03/17] error message add --- ge/graph/preprocess/graph_preprocess.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index c5fca249..2d708035 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1560,7 +1560,7 @@ Status GraphPrepare::VerifyConstOp(const NodePtr &node) { // shape = [x, y, 0,...], means it's a vector tensor that value is []. GE_CHK_BOOL_EXEC(data_size == 0, ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {"Const is invalid vector scalar."}); - return PARAM_INVALID, kConstError2); + return PARAM_INVALID, "Const is invalid vector scalar."); } } else { GE_CHK_BOOL_EXEC(data_size == static_cast(shape_size * length) && data_size != 0, From 6c595433be71b820c8947f618931cac25138a435 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Fri, 13 Nov 2020 18:53:55 +0800 Subject: [PATCH 04/17] error message add --- ge/graph/common/transop_util.h | 2 +- ge/graph/preprocess/graph_preprocess.cc | 4 ++-- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 2 +- ge/graph/preprocess/insert_op/util_insert_aipp_op.cc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ge/graph/common/transop_util.h b/ge/graph/common/transop_util.h index 3332e1fb..6284f754 100644 --- a/ge/graph/common/transop_util.h +++ b/ge/graph/common/transop_util.h @@ -35,7 +35,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY TransOpUtil { static bool CheckPrecisionLoss(const NodePtr &src_node); - static std::string TransopMapToString(); + std::string TransopMapToString(); private: TransOpUtil(); diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 2d708035..041d2227 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -1170,8 +1170,8 @@ Status GraphPrepare::UpdateInput(const std::vector &user_input) { bool is_internal = TypeUtils::IsInternalFormat(format) || TypeUtils::IsInternalFormat(origin_format); if (is_internal) { ErrorManager::GetInstance().ATCReportErrMessage("E19025", {"situation", "reason"}, - {"Input format[" + TypeUtils::FormatToSerialString(format).c_str() + "] or origin_format[" + - TypeUtils::FormatToSerialString(origin_format).c_str() + "]", "it is not support"}); + {"Input format[" + TypeUtils::FormatToSerialString(format) + "] or origin_format[" + + TypeUtils::FormatToSerialString(origin_format) + "]", "it is not support"}); GELOGE(PARAM_INVALID, "Input format %s or origin_format %s is not support.", TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::FormatToSerialString(origin_format).c_str()); diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 474145af..8ea1f7a9 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -796,7 +796,7 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { return PARAM_INVALID; } if (batch_count <= 0) { - string errormsg = "Batch count[" + std::to_sting(batch_count) + "] is invalid, it must positive."; + string errormsg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(PARAM_INVALID, "Batch count %ld is invalid", batch_count); return PARAM_INVALID; diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 8b33885b..2f90b6a4 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -304,7 +304,7 @@ Status InsertNewOpUtil::UpdateDataNodeByAipp(const ComputeGraphPtr &graph) { for (auto &switchn : updated_switchn) { auto data_iter = switchn_names_to_data.find(switchn->GetName()); if (data_iter == switchn_names_to_data.end()) { - string errormesg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; + string errormsg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(INTERNAL_ERROR, "Failed to find relative data node by switchn %s", switchn->GetName().c_str()); return INTERNAL_ERROR; @@ -493,7 +493,7 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt } } if (max_index >= switchn->GetOpDesc()->GetOutputsSize()) { - string errormesg = "No max size found from switchn node[" + switchn->GetName()+ "]"; + string errormsg = "No max size found from switchn node[" + switchn->GetName()+ "]"; ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); GELOGE(INTERNAL_ERROR, "No max size found from switchn node %s", switchn->GetName().c_str()); return INTERNAL_ERROR; From 79c1c49964016babb04113adfd8c8669d992a5b5 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Fri, 13 Nov 2020 19:45:04 +0800 Subject: [PATCH 05/17] error message add --- ge/graph/common/transop_util.cc | 4 ++-- ge/graph/common/transop_util.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ge/graph/common/transop_util.cc b/ge/graph/common/transop_util.cc index c86e69dd..9b513fe6 100755 --- a/ge/graph/common/transop_util.cc +++ b/ge/graph/common/transop_util.cc @@ -85,8 +85,8 @@ bool TransOpUtil::CheckPrecisionLoss(const ge::NodePtr &src_node) { std::string TransOpUtil::TransopMapToString() { std::string buffer; - for (auto it = transop_index_map_.begin(); it != transop_index_map_.end(); ++it) { - buffer += it->first + " "; + for (auto &key : Instance().transop_index_map_) { + buffer += key.first + " "; } return buffer; } diff --git a/ge/graph/common/transop_util.h b/ge/graph/common/transop_util.h index 6284f754..3332e1fb 100644 --- a/ge/graph/common/transop_util.h +++ b/ge/graph/common/transop_util.h @@ -35,7 +35,7 @@ class GE_FUNC_HOST_VISIBILITY GE_FUNC_DEV_VISIBILITY TransOpUtil { static bool CheckPrecisionLoss(const NodePtr &src_node); - std::string TransopMapToString(); + static std::string TransopMapToString(); private: TransOpUtil(); From cb7d37caaa7cb3649f5153065e8b5e12d0b59d70 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Fri, 13 Nov 2020 19:54:33 +0800 Subject: [PATCH 06/17] error message add --- ge/graph/preprocess/graph_preprocess.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/preprocess/graph_preprocess.cc b/ge/graph/preprocess/graph_preprocess.cc index 041d2227..16b0e88f 100644 --- a/ge/graph/preprocess/graph_preprocess.cc +++ b/ge/graph/preprocess/graph_preprocess.cc @@ -593,7 +593,7 @@ Status CheckIfDynamicBatchScene(NodePtr &data_node, bool &is_dynamic_batch, Node if (switchn_node == nullptr) { ErrorManager::GetInstance().ATCReportErrMessage( "E15002", {"opname", "value", "reason"}, - {data_node->GetName(), related_node_name, "but the value is empty"}); + {data_node->GetName(), related_node_name, "but can not find it on the graph"}); GELOGE(INTERNAL_ERROR, "The data node %s has switchn node %s, but can not find it on the graph", data_node->GetName().c_str(), related_node_name.c_str()); return INTERNAL_ERROR; From 4788c9a1e0d464959fdc8326231bc92865cfce05 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 16:33:55 +0800 Subject: [PATCH 07/17] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 160 ++++++++++----------- .../preprocess/insert_op/util_insert_aipp_op.cc | 20 +-- inc/framework/common/debug/log.h | 17 +++ 3 files changed, 97 insertions(+), 100 deletions(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 8ea1f7a9..e6b30639 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -53,16 +53,6 @@ } \ } while (0) -#define AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(expr, _status, errormsg) \ - do { \ - bool b = (expr); \ - if (!b) { \ - GELOGE(_status, errormsg); \ - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ - return _status; \ - } \ - } while (0) - namespace { const int32_t DEFAULT_MATRIX_R0C0_YUV2RGB = 298; const int32_t DEFAULT_MATRIX_R0C1_YUV2RGB = 0; @@ -537,87 +527,87 @@ Status AippOp::SetDefaultParams() { Status AippOp::ValidateParams() { GE_CHECK_NOTNULL(aipp_params_); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->aipp_mode() != domi::AippOpParams::undefined, PARAM_INVALID, - "When insert AIPP op, aipp_mode must be configured as static or dynamic "); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->var_reci_chn_0_size() <= 1, PARAM_INVALID, - "The parameter var_reci_chn_0 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->var_reci_chn_1_size() <= 1, PARAM_INVALID, - "The parameter var_reci_chn_1 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->var_reci_chn_2_size() <= 1, PARAM_INVALID, - "The parameter var_reci_chn_2 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->var_reci_chn_3_size() <= 1, PARAM_INVALID, - "The parameter var_reci_chn_3 can not be configed repeatedly"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r0c0_size() <= 1, PARAM_INVALID, - "The parameter matrix_r0c0 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r0c1_size() <= 1, PARAM_INVALID, - "The parameter matrix_r0c1 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r0c2_size() <= 1, PARAM_INVALID, - "The parameter matrix_r0c2 can not be configed repeatedly"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r1c0_size() <= 1, PARAM_INVALID, - "The parameter matrix_r1c0 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r1c1_size() <= 1, PARAM_INVALID, - "The parameter matrix_r1c1 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r1c2_size() <= 1, PARAM_INVALID, - "The parameter matrix_r1c2 can not be configed repeatedly"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r2c0_size() <= 1, PARAM_INVALID, - "The parameter matrix_r2c0 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r2c1_size() <= 1, PARAM_INVALID, - "The parameter matrix_r2c1 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->matrix_r2c2_size() <= 1, PARAM_INVALID, - "The parameter matrix_r2c2 can not be configed repeatedly"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->output_bias_0_size() <= 1, PARAM_INVALID, - "The parameter output_bias_0 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->output_bias_1_size() <= 1, PARAM_INVALID, - "The parameter output_bias_1 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->output_bias_2_size() <= 1, PARAM_INVALID, - "The parameter output_bias_2 can not be configed repeatedly"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->input_bias_0_size() <= 1, PARAM_INVALID, - "The parameter input_bias_0 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->input_bias_1_size() <= 1, PARAM_INVALID, - "The parameter input_bias_1 can not be configed repeatedly"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->input_bias_2_size() <= 1, PARAM_INVALID, - "The parameter input_bias_2 can not be configed repeatedly"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->input_edge_idx_size() <= 1, PARAM_INVALID, - "The parameter input_edge_idx can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->aipp_mode() != domi::AippOpParams::undefined, PARAM_INVALID, + "When insert AIPP op, aipp_mode must be configured as static or dynamic "); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->var_reci_chn_0_size() <= 1, PARAM_INVALID, + "The parameter var_reci_chn_0 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->var_reci_chn_1_size() <= 1, PARAM_INVALID, + "The parameter var_reci_chn_1 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->var_reci_chn_2_size() <= 1, PARAM_INVALID, + "The parameter var_reci_chn_2 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->var_reci_chn_3_size() <= 1, PARAM_INVALID, + "The parameter var_reci_chn_3 can not be configed repeatedly"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r0c0_size() <= 1, PARAM_INVALID, + "The parameter matrix_r0c0 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r0c1_size() <= 1, PARAM_INVALID, + "The parameter matrix_r0c1 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r0c2_size() <= 1, PARAM_INVALID, + "The parameter matrix_r0c2 can not be configed repeatedly"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r1c0_size() <= 1, PARAM_INVALID, + "The parameter matrix_r1c0 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r1c1_size() <= 1, PARAM_INVALID, + "The parameter matrix_r1c1 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r1c2_size() <= 1, PARAM_INVALID, + "The parameter matrix_r1c2 can not be configed repeatedly"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r2c0_size() <= 1, PARAM_INVALID, + "The parameter matrix_r2c0 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r2c1_size() <= 1, PARAM_INVALID, + "The parameter matrix_r2c1 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->matrix_r2c2_size() <= 1, PARAM_INVALID, + "The parameter matrix_r2c2 can not be configed repeatedly"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->output_bias_0_size() <= 1, PARAM_INVALID, + "The parameter output_bias_0 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->output_bias_1_size() <= 1, PARAM_INVALID, + "The parameter output_bias_1 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->output_bias_2_size() <= 1, PARAM_INVALID, + "The parameter output_bias_2 can not be configed repeatedly"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->input_bias_0_size() <= 1, PARAM_INVALID, + "The parameter input_bias_0 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->input_bias_1_size() <= 1, PARAM_INVALID, + "The parameter input_bias_1 can not be configed repeatedly"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->input_bias_2_size() <= 1, PARAM_INVALID, + "The parameter input_bias_2 can not be configed repeatedly"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->input_edge_idx_size() <= 1, PARAM_INVALID, + "The parameter input_edge_idx can not be configed repeatedly"); const domi::AippOpParams::AippMode aipp_mode = aipp_params_->aipp_mode(); if (aipp_mode == domi::AippOpParams::dynamic) { - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + GE_CHK_LOG_AND_ERRORMSG( aipp_params_->max_src_image_size() > 0, PARAM_INVALID, "For dynamic AIPP params, max_src_image_size must be set which number should be greater than 0"); } else { - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->input_format() != domi::AippOpParams::UNDEFINED, PARAM_INVALID, - "Input format of AIPP conf is undefined"); - - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->src_image_size_w() >= 0, PARAM_INVALID, - "Src_image_size_w must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->src_image_size_h() >= 0, PARAM_INVALID, - "Src_image_size_h must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->load_start_pos_w() >= 0, PARAM_INVALID, - "Load_start_pos_w must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->load_start_pos_h() >= 0, PARAM_INVALID, - "Load_start_pos_h must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->crop_size_w() >= 0, PARAM_INVALID, - "Crop_size_w must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->resize_output_w() >= 0, PARAM_INVALID, - "Resize_output_w must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->resize_output_h() >= 0, PARAM_INVALID, - "Resize_output_h must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->left_padding_size() >= 0, PARAM_INVALID, - "Left_padding_size must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->right_padding_size() >= 0, PARAM_INVALID, - "Right_padding_size must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->top_padding_size() >= 0, PARAM_INVALID, - "Top_padding_size must not be configed smaller than 0"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(aipp_params_->bottom_padding_size() >= 0, PARAM_INVALID, - "Bottom_padding_size must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->input_format() != domi::AippOpParams::UNDEFINED, PARAM_INVALID, + "Input format of AIPP conf is undefined"); + + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->src_image_size_w() >= 0, PARAM_INVALID, + "Src_image_size_w must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->src_image_size_h() >= 0, PARAM_INVALID, + "Src_image_size_h must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->load_start_pos_w() >= 0, PARAM_INVALID, + "Load_start_pos_w must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->load_start_pos_h() >= 0, PARAM_INVALID, + "Load_start_pos_h must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->crop_size_w() >= 0, PARAM_INVALID, + "Crop_size_w must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->resize_output_w() >= 0, PARAM_INVALID, + "Resize_output_w must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->resize_output_h() >= 0, PARAM_INVALID, + "Resize_output_h must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->left_padding_size() >= 0, PARAM_INVALID, + "Left_padding_size must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->right_padding_size() >= 0, PARAM_INVALID, + "Right_padding_size must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->top_padding_size() >= 0, PARAM_INVALID, + "Top_padding_size must not be configed smaller than 0"); + GE_CHK_LOG_AND_ERRORMSG(aipp_params_->bottom_padding_size() >= 0, PARAM_INVALID, + "Bottom_padding_size must not be configed smaller than 0"); } return SUCCESS; diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 2f90b6a4..0fd742cd 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -37,16 +37,6 @@ using domi::AippOpParams; -#define AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(expr, _status, errormsg) \ - do { \ - bool b = (expr); \ - if (!b) { \ - GELOGE(_status, errormsg); \ - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ - return _status; \ - } \ - } while (0) - namespace ge { namespace { const char *const kMbatchSwitchnName = "mbatch-switch-name"; @@ -234,7 +224,7 @@ Status InsertNewOpUtil::CheckGraph(const ComputeGraphPtr &graph) { } } } - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG((aippNodes.size() == 0) || (aippNodes.size() == next_nodes_cnt), + GE_CHK_LOG_AND_ERRORMSG((aippNodes.size() == 0) || (aippNodes.size() == next_nodes_cnt), PARAM_INVALID, "Can not config part of outputs of Data node to support AIPP, config all " "of the outputs of Data to support AIPP, or config none of them"); @@ -249,17 +239,17 @@ Status InsertNewOpUtil::CheckGraph(const ComputeGraphPtr &graph) { GE_CHK_STATUS(GetAippParams(currAippParam, aippNodes[i])); if (aippMode == domi::AippOpParams::static_) { - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + GE_CHK_LOG_AND_ERRORMSG( aippParams->input_format() == currAippParam->input_format(), PARAM_INVALID, "The input_format of all aipp_ops after one Data should be the same"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + GE_CHK_LOG_AND_ERRORMSG( aippParams->src_image_size_w() == currAippParam->src_image_size_w(), PARAM_INVALID, "The src_image_size_w of all aipp_ops after one Data should be the same"); - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + GE_CHK_LOG_AND_ERRORMSG( aippParams->src_image_size_h() == currAippParam->src_image_size_h(), PARAM_INVALID, "The src_image_size_h of all aipp_ops after one Data should be the same"); } else { - AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG( + GE_CHK_LOG_AND_ERRORMSG( aippParams->max_src_image_size() == currAippParam->max_src_image_size(), PARAM_INVALID, "The max_src_image_size of all aipp_ops after one Data should be the same"); } diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index 6d449919..965cdb7b 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -253,4 +253,21 @@ exec_expr1; \ } +#define GE_ERRORLOG_AND_ERRORMSG(expr, _status, errormsg) \ + { \ + GELOGE(_status, errormsg); \ + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ + } + + +#define GE_CHK_LOG_AND_ERRORMSG(expr, _status, errormsg) \ + do { \ + bool b = (expr); \ + if (!b) { \ + GELOGE(_status, errormsg); \ + ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ + return _status; \ + } \ + } while (0) + #endif // INC_FRAMEWORK_COMMON_DEBUG_LOG_H_ From a61864bcfc28a80508f790eef0b49d23f7792fad Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 16:40:43 +0800 Subject: [PATCH 08/17] error message add --- inc/framework/common/debug/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index 965cdb7b..92e7bee7 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -253,7 +253,7 @@ exec_expr1; \ } -#define GE_ERRORLOG_AND_ERRORMSG(expr, _status, errormsg) \ +#define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \ { \ GELOGE(_status, errormsg); \ ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ From 9396238bfaf9086b2643e2ad26776636f343903f Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 16:48:07 +0800 Subject: [PATCH 09/17] error message add --- ge/graph/preprocess/insert_op/util_insert_aipp_op.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 0fd742cd..6a2eb333 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -124,10 +124,7 @@ Status InsertNewOpUtil::CheckInputNamePositionNotRepeat() { if (another_item->related_input_name().empty()) { string error_msg = "Can not both set related_input_name and related_input_rank!" " Please ensure param is the same with the first aipp config(related_input_name)."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not both set related_input_rank and related_input_name!" - " Please ensure param is the same with the first aipp config(related_input_name)."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg) return PARAM_INVALID; } if (item->related_input_name() == another_item->related_input_name()) { From 086309d1e9140db26fa0d725982810c9f67bd8a1 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 17:11:55 +0800 Subject: [PATCH 10/17] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 23 +++++++++------------- .../preprocess/insert_op/util_insert_aipp_op.cc | 21 +++++--------------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index e6b30639..e7c1fce7 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -306,9 +306,8 @@ NodePtr AippOp::FindDataByIndex(const ComputeGraphPtr &graph, int rank) { } return node; } - GELOGE(PARAM_INVALID, "Can not find the data node by index %d", rank); string errormsg = "Can not find the data node by aipp parameter related_input_rank " + to_string(rank); - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return nullptr; } Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr &target, @@ -353,10 +352,10 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr } if (!edge_indexes.empty() && (*edge_indexes.rbegin() >= data_node->GetOutDataNodes().size())) { - GELOGE(PARAM_INVALID, "input_edge_idx %u should smaller than out edge size of target input %zu", - *edge_indexes.rbegin(), data_node->GetOutDataNodes().size()); - string errormsg = "The aipp parameter input_edge_idx should be smaller than the target input's outnodes."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); + string errormsg = "The aipp parameter input_edge_idx[" + std::to_string(*edge_indexes.rbegin()) + + "] should be smaller than the target input[" + + std::to_string(data_node->GetOutDataNodes().size()) +"]'s outnodes."; + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } target = data_node; @@ -429,8 +428,7 @@ Status AippOp::ConvertRelatedInputNameToRank() { if (!convert_flag) { string error_msg = "Top name " + related_input_name + "convert rank failed, Please" " ensure top name in aipp config is the top name of data node."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, "Top name[%s] converts rank failed.", related_input_name.c_str()); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } @@ -781,22 +779,19 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { int64_t batch_count = -1; if (GetDataDimN(data_node, ori_data_format, batch_count) != ge::SUCCESS) { string errormsg = "Get data_node dims and transfer to nchw_dims failed!"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, "Get data_node dims and transfer to nchw_dims failed!"); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); return PARAM_INVALID; } if (batch_count <= 0) { string errormsg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, "Batch count %ld is invalid", batch_count); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); return PARAM_INVALID; } int64_t max_dynamic_aipp_size = CalcMaxSize(batch_count); if (max_dynamic_aipp_size < 0) { string errormsg = "The dynamic aipp size is not positive"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, "The dynamic aipp size is not positive."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); return PARAM_INVALID; } diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 6a2eb333..923f0604 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -130,10 +130,7 @@ Status InsertNewOpUtil::CheckInputNamePositionNotRepeat() { if (item->related_input_name() == another_item->related_input_name()) { string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_name" " param is different in different aipp config."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not insert aipp op to the same postion! Please ensure related_input_rank param " - "is different in different aipp config."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } } @@ -153,19 +150,13 @@ Status InsertNewOpUtil::CheckInputRankPositionNoRepeat() { if (!another_item->related_input_name().empty()) { string error_msg = "Can not both set related_input_rank and related_input_name!" " Please ensure param is the same with the first aipp config(related_input_rank)."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not both set related_input_rank and related_input_name!" - " Please ensure param is the same with the first aipp config(related_input_rank)."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } if (item->related_input_rank() == another_item->related_input_rank()) { string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_rank" " param is different in different aipp config."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not insert aipp op to the same postion! Please ensure related_input_rank param " - "is different in different aipp config."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } } @@ -292,8 +283,7 @@ Status InsertNewOpUtil::UpdateDataNodeByAipp(const ComputeGraphPtr &graph) { auto data_iter = switchn_names_to_data.find(switchn->GetName()); if (data_iter == switchn_names_to_data.end()) { string errormsg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(INTERNAL_ERROR, "Failed to find relative data node by switchn %s", switchn->GetName().c_str()); + GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, errormsg); return INTERNAL_ERROR; } GE_RETURN_IF_ERROR(UpdateDataBySwitchN(switchn, data_iter->second)); @@ -481,8 +471,7 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt } if (max_index >= switchn->GetOpDesc()->GetOutputsSize()) { string errormsg = "No max size found from switchn node[" + switchn->GetName()+ "]"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(INTERNAL_ERROR, "No max size found from switchn node %s", switchn->GetName().c_str()); + GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, errormsg); return INTERNAL_ERROR; } auto output_desc = switchn->GetOpDesc()->MutableOutputDesc(max_index); From bdf6cf91cb45dce39ecc3b7bef522decc479a7fa Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 18:08:00 +0800 Subject: [PATCH 11/17] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 8 ++++---- ge/graph/preprocess/insert_op/util_insert_aipp_op.cc | 12 ++++++------ inc/framework/common/debug/log.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index e7c1fce7..7fb127c3 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -307,7 +307,7 @@ NodePtr AippOp::FindDataByIndex(const ComputeGraphPtr &graph, int rank) { return node; } string errormsg = "Can not find the data node by aipp parameter related_input_rank " + to_string(rank); - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return nullptr; } Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr &target, @@ -428,7 +428,7 @@ Status AippOp::ConvertRelatedInputNameToRank() { if (!convert_flag) { string error_msg = "Top name " + related_input_name + "convert rank failed, Please" " ensure top name in aipp config is the top name of data node."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } @@ -779,7 +779,7 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { int64_t batch_count = -1; if (GetDataDimN(data_node, ori_data_format, batch_count) != ge::SUCCESS) { string errormsg = "Get data_node dims and transfer to nchw_dims failed!"; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } if (batch_count <= 0) { @@ -791,7 +791,7 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { int64_t max_dynamic_aipp_size = CalcMaxSize(batch_count); if (max_dynamic_aipp_size < 0) { string errormsg = "The dynamic aipp size is not positive"; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 923f0604..d7ae2e27 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -124,13 +124,13 @@ Status InsertNewOpUtil::CheckInputNamePositionNotRepeat() { if (another_item->related_input_name().empty()) { string error_msg = "Can not both set related_input_name and related_input_rank!" " Please ensure param is the same with the first aipp config(related_input_name)."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg) + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } if (item->related_input_name() == another_item->related_input_name()) { string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_name" " param is different in different aipp config."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } } @@ -150,13 +150,13 @@ Status InsertNewOpUtil::CheckInputRankPositionNoRepeat() { if (!another_item->related_input_name().empty()) { string error_msg = "Can not both set related_input_rank and related_input_name!" " Please ensure param is the same with the first aipp config(related_input_rank)."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } if (item->related_input_rank() == another_item->related_input_rank()) { string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_rank" " param is different in different aipp config."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } } @@ -283,7 +283,7 @@ Status InsertNewOpUtil::UpdateDataNodeByAipp(const ComputeGraphPtr &graph) { auto data_iter = switchn_names_to_data.find(switchn->GetName()); if (data_iter == switchn_names_to_data.end()) { string errormsg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; - GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, errormsg); + GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, error_msg.c_str()); return INTERNAL_ERROR; } GE_RETURN_IF_ERROR(UpdateDataBySwitchN(switchn, data_iter->second)); @@ -471,7 +471,7 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt } if (max_index >= switchn->GetOpDesc()->GetOutputsSize()) { string errormsg = "No max size found from switchn node[" + switchn->GetName()+ "]"; - GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, errormsg); + GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, error_msg.c_str()); return INTERNAL_ERROR; } auto output_desc = switchn->GetOpDesc()->MutableOutputDesc(max_index); diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index 92e7bee7..73990c68 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -255,7 +255,7 @@ #define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \ { \ - GELOGE(_status, errormsg); \ + GELOGE(_status, "%s", errormsg); \ ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ } @@ -264,7 +264,7 @@ do { \ bool b = (expr); \ if (!b) { \ - GELOGE(_status, errormsg); \ + GELOGE(_status, "%s", errormsg); \ ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ return _status; \ } \ From bd1a9dbf1ddd56a8eb79720e1182a545b3203ab0 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 18:10:16 +0800 Subject: [PATCH 12/17] error message add --- inc/framework/common/debug/log.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index 73990c68..b398a5b8 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -255,7 +255,7 @@ #define GE_ERRORLOG_AND_ERRORMSG(_status, errormsg) \ { \ - GELOGE(_status, "%s", errormsg); \ + GELOGE(_status, "%s", errormsg); \ ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ } @@ -264,7 +264,7 @@ do { \ bool b = (expr); \ if (!b) { \ - GELOGE(_status, "%s", errormsg); \ + GELOGE(_status, "%s", errormsg); \ ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ return _status; \ } \ From 692cf7fd3daf522116cac8bb482ffb95d65d7f9f Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 18:29:29 +0800 Subject: [PATCH 13/17] error message add --- inc/framework/common/debug/log.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index b398a5b8..53678cf0 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -83,12 +83,12 @@ } while (0); // If expr is not GRAPH_SUCCESS, print the log and return FAILED -#define GE_CHK_GRAPH_STATUS_RET(expr, ...) \ - do { \ - if ((expr) != ge::GRAPH_SUCCESS) { \ - DOMI_LOGE(__VA_ARGS__); \ - return FAILED; \ - } \ +#define GE_CHK_GRAPH_STATUS_RET(expr, ...) \ + do { \ + if ((expr) != ge::GRAPH_SUCCESS) { \ + DOMI_LOGE(__VA_ARGS__); \ + return FAILED; \ + } \ } while (0); // If expr is not SUCCESS, print the log and execute a custom statement @@ -99,13 +99,13 @@ } while (0); // If expr is not true, print the log and return the specified status -#define GE_CHK_BOOL_RET_STATUS(expr, _status, ...) \ - do { \ - bool b = (expr); \ - if (!b) { \ - GELOGE(_status, __VA_ARGS__); \ - return _status; \ - } \ +#define GE_CHK_BOOL_RET_STATUS(expr, _status, ...) \ + do { \ + bool b = (expr); \ + if (!b) { \ + GELOGE(_status, __VA_ARGS__); \ + return _status; \ + } \ } while (0); // If expr is not true, print the log and return the specified status @@ -259,7 +259,6 @@ ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); \ } - #define GE_CHK_LOG_AND_ERRORMSG(expr, _status, errormsg) \ do { \ bool b = (expr); \ From affd87b88dd611c0ac49fabc85f2e302ba5087d9 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 18:32:26 +0800 Subject: [PATCH 14/17] error message add --- inc/framework/common/debug/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/framework/common/debug/log.h b/inc/framework/common/debug/log.h index 53678cf0..e259f43b 100644 --- a/inc/framework/common/debug/log.h +++ b/inc/framework/common/debug/log.h @@ -28,7 +28,7 @@ #if !defined(__ANDROID__) && !defined(ANDROID) #define DOMI_LOGE(...) GE_LOG_ERROR(GE_MODULE_NAME, ge::FAILED, __VA_ARGS__) #else -#include +#include #if defined(BUILD_VERSION_PERF) #define DOMI_LOGE(fmt, ...) #else From 0c67afc56e17b15fcf6f775731767914efdb56cc Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 18:49:52 +0800 Subject: [PATCH 15/17] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 12 ++++++------ ge/graph/preprocess/insert_op/util_insert_aipp_op.cc | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 7fb127c3..c638f783 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -306,7 +306,7 @@ NodePtr AippOp::FindDataByIndex(const ComputeGraphPtr &graph, int rank) { } return node; } - string errormsg = "Can not find the data node by aipp parameter related_input_rank " + to_string(rank); + string error_msg = "Can not find the data node by aipp parameter related_input_rank " + to_string(rank); GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return nullptr; } @@ -352,7 +352,7 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr } if (!edge_indexes.empty() && (*edge_indexes.rbegin() >= data_node->GetOutDataNodes().size())) { - string errormsg = "The aipp parameter input_edge_idx[" + std::to_string(*edge_indexes.rbegin()) + + string error_msg = "The aipp parameter input_edge_idx[" + std::to_string(*edge_indexes.rbegin()) + "] should be smaller than the target input[" + std::to_string(data_node->GetOutDataNodes().size()) +"]'s outnodes."; GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); @@ -778,19 +778,19 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { int64_t batch_count = -1; if (GetDataDimN(data_node, ori_data_format, batch_count) != ge::SUCCESS) { - string errormsg = "Get data_node dims and transfer to nchw_dims failed!"; + string error_msg = "Get data_node dims and transfer to nchw_dims failed!"; GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } if (batch_count <= 0) { - string errormsg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); + string error_msg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } int64_t max_dynamic_aipp_size = CalcMaxSize(batch_count); if (max_dynamic_aipp_size < 0) { - string errormsg = "The dynamic aipp size is not positive"; + string error_msg = "The dynamic aipp size is not positive"; GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index d7ae2e27..1b926e4b 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -282,7 +282,7 @@ Status InsertNewOpUtil::UpdateDataNodeByAipp(const ComputeGraphPtr &graph) { for (auto &switchn : updated_switchn) { auto data_iter = switchn_names_to_data.find(switchn->GetName()); if (data_iter == switchn_names_to_data.end()) { - string errormsg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; + string error_msg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, error_msg.c_str()); return INTERNAL_ERROR; } @@ -470,7 +470,7 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt } } if (max_index >= switchn->GetOpDesc()->GetOutputsSize()) { - string errormsg = "No max size found from switchn node[" + switchn->GetName()+ "]"; + string error_msg = "No max size found from switchn node[" + switchn->GetName()+ "]"; GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, error_msg.c_str()); return INTERNAL_ERROR; } From 272b16959aef165522e68a593d603d8c7abf18fa Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Mon, 16 Nov 2020 09:21:21 +0800 Subject: [PATCH 16/17] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index c638f783..38d1efcf 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -355,7 +355,7 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr string error_msg = "The aipp parameter input_edge_idx[" + std::to_string(*edge_indexes.rbegin()) + "] should be smaller than the target input[" + std::to_string(data_node->GetOutDataNodes().size()) +"]'s outnodes."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; } target = data_node; @@ -784,7 +784,7 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { } if (batch_count <= 0) { string error_msg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg_c_str()); return PARAM_INVALID; } From 121b9f7a2150d13201450869d169fc7721b0a7cb Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Mon, 16 Nov 2020 09:29:34 +0800 Subject: [PATCH 17/17] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index 38d1efcf..98712a82 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -784,7 +784,7 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { } if (batch_count <= 0) { string error_msg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; - GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg_c_str()); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg.c_str()); return PARAM_INVALID; }