From bdf6cf91cb45dce39ecc3b7bef522decc479a7fa Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 18:08:00 +0800 Subject: [PATCH] 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; \ } \