Browse Source

error message add

tags/v1.1.0
wangwenhua1@huawei.com 5 years ago
parent
commit
4788c9a1e0
3 changed files with 97 additions and 100 deletions
  1. +75
    -85
      ge/graph/preprocess/insert_op/ge_aipp_op.cc
  2. +5
    -15
      ge/graph/preprocess/insert_op/util_insert_aipp_op.cc
  3. +17
    -0
      inc/framework/common/debug/log.h

+ 75
- 85
ge/graph/preprocess/insert_op/ge_aipp_op.cc View File

@@ -53,16 +53,6 @@
} \ } \
} while (0) } 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 { namespace {
const int32_t DEFAULT_MATRIX_R0C0_YUV2RGB = 298; const int32_t DEFAULT_MATRIX_R0C0_YUV2RGB = 298;
const int32_t DEFAULT_MATRIX_R0C1_YUV2RGB = 0; const int32_t DEFAULT_MATRIX_R0C1_YUV2RGB = 0;
@@ -537,87 +527,87 @@ Status AippOp::SetDefaultParams() {


Status AippOp::ValidateParams() { Status AippOp::ValidateParams() {
GE_CHECK_NOTNULL(aipp_params_); 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(); const domi::AippOpParams::AippMode aipp_mode = aipp_params_->aipp_mode();
if (aipp_mode == domi::AippOpParams::dynamic) { 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, 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"); "For dynamic AIPP params, max_src_image_size must be set which number should be greater than 0");
} else { } 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; return SUCCESS;


+ 5
- 15
ge/graph/preprocess/insert_op/util_insert_aipp_op.cc View File

@@ -37,16 +37,6 @@


using domi::AippOpParams; 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 ge {
namespace { namespace {
const char *const kMbatchSwitchnName = "mbatch-switch-name"; 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, PARAM_INVALID,
"Can not config part of outputs of Data node to support AIPP, config all " "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"); "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])); GE_CHK_STATUS(GetAippParams(currAippParam, aippNodes[i]));


if (aippMode == domi::AippOpParams::static_) { if (aippMode == domi::AippOpParams::static_) {
AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(
GE_CHK_LOG_AND_ERRORMSG(
aippParams->input_format() == currAippParam->input_format(), aippParams->input_format() == currAippParam->input_format(),
PARAM_INVALID, "The input_format of all aipp_ops after one Data should be the same"); 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(), 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"); 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(), 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"); PARAM_INVALID, "The src_image_size_h of all aipp_ops after one Data should be the same");
} else { } else {
AIPP_RETURN_STATUS_AND_REPROT_ERRORMSG(
GE_CHK_LOG_AND_ERRORMSG(
aippParams->max_src_image_size() == currAippParam->max_src_image_size(), 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"); PARAM_INVALID, "The max_src_image_size of all aipp_ops after one Data should be the same");
} }


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

@@ -253,4 +253,21 @@
exec_expr1; \ 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_ #endif // INC_FRAMEWORK_COMMON_DEBUG_LOG_H_

Loading…
Cancel
Save