From cd44f8ba0140829466afe380eb64ae54fd56e643 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Tue, 16 Mar 2021 16:13:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E6=95=B4?= =?UTF-8?q?=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 2 +- ge/ir_build/atc_ir_common.cc | 187 ++++++++++++------- ge/ir_build/ge_ir_build.cc | 91 +++++---- 3 files changed, 172 insertions(+), 108 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index a2db431b..62dd9ec2 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -35,7 +35,7 @@ Status HostCpuEngine::Initialize(const std::map &options) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "[Init][HostCpuEngine] fail for new HostCpuOpsKernelInfoStore."); - RRPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); + REPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); return FAILED; } } diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index ff156c75..28787048 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -78,7 +78,8 @@ Status CheckInputFormat(const string &input_format) { if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format, "input format is invalid!"}); - GELOGE(ge::PARAM_INVALID, "input format [%s] is invalid!", input_format.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputParam]input format [%s] is invalid!", input_format.c_str()); + REPORT_CALL_ERROR("E19999", "CheckInputFormat failed, input_format [%s] is invalid!", input_format.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -91,7 +92,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map vector shape = iter->second; if (shape.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10012"); - GELOGE(ge::PARAM_INVALID, "--input_shape's shape size can not be less than 1 when set --dynamic_batch_size."); + GELOGE(ge::PARAM_INVALID, "[Check][Param] shape size can not be less than 1 when set --dynamic_batch_size."); return false; } @@ -107,7 +108,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map if (size == 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10031"); - GELOGE(ge::PARAM_INVALID, "At least one batch n must be equal to -1 when set --dynamic_batch_size."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]At least one batch n must be equal to -1 when set --dynamic_batch_size."); return false; } @@ -115,8 +116,10 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map if (!isdigit(c) && (c != ',') && (c != ' ')) { ErrorManager::GetInstance().ATCReportErrMessage( "E10033", {"value", "reason"}, {dynamic_batch_size, kDynamicBatchSizeError}); - GELOGE(ge::PARAM_INVALID, "Input parameter[--dynamic_batch_size]'s value[%s] is invalid. reason: %s", - dynamic_batch_size.c_str(), kDynamicBatchSizeError); + GELOGE(ge::PARAM_INVALID, "[Check][Param] dynamic_batch_size:%s is invalid. reason: %s", + dynamic_batch_size.c_str(), kDynamicBatchSizeError); + REPORT_INNER_ERROR("E19999", "CheckDynamicBatchSizeInputShapeValid failed.dynamic_batch_size:%s is invalid. reason: %s", + dynamic_batch_size.c_str(), kDynamicBatchSizeError); return false; } } @@ -129,7 +132,9 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map bool CheckDynamicImagesizeInputShapeValid(map> shape_map, const std::string input_format, std::string &dynamic_image_size) { if (!input_format.empty() && !ge::TypeUtils::IsFormatValid(input_format.c_str())) { - GELOGE(ge::PARAM_INVALID, "user input format [%s] is not found!", input_format.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][Param] input_format [%s] invalid.", input_format.c_str()); + REPORT_INNER_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, input_format [%s] invalid.", + input_format.c_str()); return false; } int32_t size = 0; @@ -139,8 +144,8 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map if (shape.size() != DIM_DEFAULT_SIZE) { if (std::count(shape.begin(), shape.end(), kDynamicInputDim) > 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10019"); - GELOGE(ge::PARAM_INVALID, - "--input_shape's shape is invalid, only height and width can be -1 when set --dynamic_image_size."); + GELOGE(ge::PARAM_INVALID, + "[Check][Param] shape invalid, only height and width can be -1 when set --dynamic_image_size."); return false; } continue; @@ -159,7 +164,7 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map if (size == 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10019"); GELOGE(ge::PARAM_INVALID, - "--input_shape's shape is invalid, only height and width can be -1 when set --dynamic_image_size."); + "[Check][Param]shape invalid, only height and width can be -1 when set --dynamic_image_size."); return false; } @@ -174,9 +179,10 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map ErrorManager::GetInstance().ATCReportErrMessage("E10020", {"DynamicImageSizeNum"}, {std::to_string(kDynamicImageSizeNum)}); GELOGE(ge::PARAM_INVALID, - "--dynamic_image_size's number of dimensions of each " - "group must be %ld.", - kDynamicImageSizeNum); + "[Check][Param]dynamic_image_size invalid value:%s number of dimensions of each group must be %ld.", + dynamic_image_size.c_str(), kDynamicImageSizeNum); + REPORT_INNER_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, dynamic_image_size invalid value:%s number of dimensions of each group must be %ld.", + dynamic_image_size.c_str(), kDynamicImageSizeNum); return false; } } @@ -190,7 +196,7 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format.c_str(), "input_format must be ND when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "input_format must be ND when set dynamic_dims."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]input_format must be ND when set dynamic_dims."); return false; } @@ -201,7 +207,8 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_shape's dim", std::to_string(shapes.size()), "Dim num must within [1, 4] when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "Dim num must within [%zu, %zu] when set dynamic_dims.", kMinNDDimNum, kMaxNDDimNum); + GELOGE(ge::PARAM_INVALID, "[Check][Param]Dim num must within [%zu, %zu] when set dynamic_dims.", + kMinNDDimNum, kMaxNDDimNum); return false; } dynamic_dim += std::count(shapes.begin(), shapes.end(), kDynamicInputDim); @@ -210,12 +217,14 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_shape's dynamic dim num", "0", "at least one dim should be -1 when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "input_shape's shape is invalid, at least one dim should be -1 when set dynamic_dims."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]input_shape invalid, at least one dim should be -1 when set dynamic_dims."); return false; } if (!CheckAndParseDynamicDims(dynamic_dim, dynamic_dims)) { - GELOGE(ge::PARAM_INVALID, "Check and parse dynamic dims: %s failed.", dynamic_dims.c_str()); + GELOGE(ge::PARAM_INVALID, "[CheckAndParse][DynamicDims]: %s failed.", dynamic_dims.c_str()); + REPORT_CALL_ERROR("E19999", "CheckAndParseDynamicDims failed,dynamic_dim:%d dynamic_dims:%s", + dynamic_dim,dynamic_dims.c_str()); return false; } @@ -228,7 +237,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims", dynamic_dims.c_str(), "dynamic_dims can not be empty"}); - GELOGE(ge::PARAM_INVALID, "dynamic_dims can not be empty."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims can not be empty."); return false; } // Different parameter sets are split by ';' @@ -236,7 +245,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims if (split_set.size() > kMaxDynamicDimNum) { ErrorManager::GetInstance().ATCReportErrMessage( "E10042", {"parameter", "reason"}, {"dynamic_dims", "dynamic_dims's num of parameter set can not exceed 100"}); - GELOGE(ge::PARAM_INVALID, "dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); + REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); return false; } for (auto split_dim : split_set) { @@ -245,8 +255,10 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10042", {"parameter", "reason"}, {"dynamic_dims", "Each gear setting needs to be consistent with the number of -1 in the inputshape"}); - GELOGE(ge::PARAM_INVALID, "Input parameter --dynamic_dims parse failed, " - "reason: Each gear setting needs to be consistent with the number of -1 in the inputshape."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims:%s invalid. " + "reason: Each gear setting needs to be consistent with the number of -1 in the inputshape.", dynamic_dims.c_str()); + + REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); return false; } for (auto dim : one_set) { @@ -255,7 +267,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); - GELOGE(ge::PARAM_INVALID, "dynamic_dims's parameter must be positive integer."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); + REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); return false; } } @@ -271,15 +284,17 @@ bool StringToLongNoThrow(const string &str, long &val) { } catch (const std::invalid_argument) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, - "Parse input parameter [--input_shape_range]'s shape range[%s] failed, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + REPORT_INNER_ERROR("E19999", "StringToLongNoThrow failed, str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); } catch (const std::out_of_range) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, - "Parse input parameter [--input_shape_range]'s shape range[%s] failed, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + REPORT_INNER_ERROR("E19999", "StringToLongNoThrow failed str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); } return false; } @@ -296,9 +311,10 @@ bool ParseSingleShapeRange(std::string &shape_range, vector> shape_range_val; if (!ParseSingleShapeRange(shape_range_str, shape_range_val)) { - GELOGE(PARAM_INVALID, "Parse single shape range %s error.", shape_range_str.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param] shape_range_str: %s invalid.", shape_range_str.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, shape_range_str: %s invalid.", shape_range_str.c_str()); return false; } shape_range_map.emplace(make_pair(StringUtils::Trim(shape_range_pair_vec[0]), shape_range_val)); @@ -395,7 +418,7 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (param_size > 1) { ErrorManager::GetInstance().ATCReportErrMessage("E10009", {"parameter0", "parameter1", "parameter2"}, {"dynamic_batch_size", "dynamic_image_size", "dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); + GELOGE(ge::PARAM_INVALID, "[Parse][Param]dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); return ge::PARAM_INVALID; } @@ -403,7 +426,8 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (!input_shape_range.empty()) { std::map>> shape_range_map; if(!ParseInputShapeRange(input_shape_range, shape_range_map)) { - GELOGE(ge::PARAM_INVALID, "Failed to parse input shape range: %s", input_shape_range.c_str()); + GELOGE(ge::PARAM_INVALID, "[Parse][Param]input_shape_range: %s invalid.", input_shape_range.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, input_shape_range: %s invalid.", input_shape_range.c_str()); return ge::PARAM_INVALID; } } @@ -415,33 +439,40 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i is_dynamic_input = true; if (input_shape.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {"input_shape"}); - GELOGE(ge::PARAM_INVALID, "The input_shape can not be empty in dynamic input size scenario."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]The input_shape can not be empty in dynamic input size scenario."); return ge::PARAM_INVALID; } if (!ParseInputShape(input_shape, shape_map, user_shape_map, is_dynamic_input)) { - GELOGE(ge::PARAM_INVALID, "Failed to parse input shape: %s", input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Parse][InputShape]input_shape: %s invalid.", input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShape failed, input_shape: %s invalid.", input_shape.c_str()); return ge::PARAM_INVALID; } if (!dynamic_batch_size.empty()) { if (!CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size)) { - GELOGE(ge::PARAM_INVALID, "Check dynamic batch size input shape failed: %s", input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape] input_shape: %s invalid.", input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "CheckDynamicBatchSizeInputShapeValid failed, input_shape: %s invalid.", input_shape.c_str()); return ge::PARAM_INVALID; } } if (!dynamic_image_size.empty()) { if (!CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size)) { - GELOGE(ge::PARAM_INVALID, "Check dynamic image size input shape failed: %s", input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] input_shape: %s invalid. dynamic_image_size:%d ", + input_shape.c_str(), dynamic_image_size); + REPORT_CALL_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, input_shape: %s invalid. dynamic_image_size:%d ", + input_shape.c_str(), dynamic_image_size); return ge::PARAM_INVALID; } } if (!dynamic_dims.empty()) { if (!CheckDynamicDimsInputShapeValid(shape_map, input_format, dynamic_dims)) { - GELOGE(ge::PARAM_INVALID, "Check dynamic dims: %s of input shape: %s failed.", dynamic_dims.c_str(), - input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicDimsInputShape]: %s of input shape: %s failed.", dynamic_dims.c_str(), + input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "CheckDynamicDimsInputShapeValid failed, input_shape: %s invalid. dynamic_dims:%s ", + input_shape.c_str(), dynamic_dims.c_str()); return ge::PARAM_INVALID; } } @@ -492,7 +523,8 @@ bool ParseInputShape(const string &input_shape, map> &sh if (!isdigit(c)) { ErrorManager::GetInstance().ATCReportErrMessage("E10002", {"shape", "reason", "sample"}, {shape, kDigitError, kInputShapeSample2}); - GELOGE(PARAM_INVALID, "--input_shape's shape value[%s] is not digit", shape_value_str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]input_shape:%s invalid", shape_value_str.c_str()); + REPORT_CALL_ERROR("E19999", "isdigit return false, input_shape:%s invalid", shape_value_str.c_str()); return false; } } @@ -537,7 +569,8 @@ Status CheckOutputTypeParamValid(const std::string output_type) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); GELOGE(ge::PARAM_INVALID, - "Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); + "[Check][Param]Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); + REPORT_INNER_ERROR("E19999", "CheckOutputTypeParamValid failed, output_type: %s invalid.", output_type.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -549,7 +582,8 @@ Status CheckBufferOptimizeParamValid(const std::string buffer_optimize) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--buffer_optimize", buffer_optimize, kBufferOptimizeSupport}); GELOGE(ge::PARAM_INVALID, - "Invalid value for --buffer_optimize[%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); + "[Check][Param]Invalid value for --buffer_optimize[%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); + REPORT_INNER_ERROR("E19999", "CheckBufferOptimizeParamValid failed, buffer_optimize: %s invalid.", buffer_optimize.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -558,21 +592,23 @@ Status CheckBufferOptimizeParamValid(const std::string buffer_optimize) { Status CheckCompressWeightParamValid(const std::string enable_compress_weight, const std::string compress_weight_conf) { if ((!compress_weight_conf.empty()) && (!CheckInputPathValid(compress_weight_conf, "--compress_weight_conf"))) { - GELOGE(ge::PARAM_INVALID, "compress weight config file not found, file_name:%s", compress_weight_conf.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][Param]compress weight config file not found, file_name:%s", compress_weight_conf.c_str()); + REPORT_INNER_ERROR("E19999", "CheckCompressWeightParamValid failed, compress_weight_conf: %s invalid.", compress_weight_conf.c_str()); return ge::PARAM_INVALID; } if ((enable_compress_weight != "") && (enable_compress_weight != "true") && (enable_compress_weight != "false")) { ErrorManager::GetInstance().ATCReportErrMessage( "E10005", {"parameter", "value"}, {"enable_compress_weight", enable_compress_weight}); GELOGE(ge::PARAM_INVALID, - "Input parameter[--enable_compress_weight]'s value[%s] must be true or false.", enable_compress_weight.c_str()); + "[Check][Param]enable_compress_weight:%s must be true or false.", enable_compress_weight.c_str()); + REPORT_INNER_ERROR("E19999", "CheckCompressWeightParamValid failed, enable_compress_weight: %s invalid.", enable_compress_weight.c_str()); return ge::PARAM_INVALID; } if ((enable_compress_weight == "true") && (!compress_weight_conf.empty())) { ErrorManager::GetInstance().ATCReportErrMessage("E10047", {"parameter0", "parameter1"}, {"enable_compress_weight", "compress_weight_conf"}); - GELOGE(ge::PARAM_INVALID, "enable_compress_weight and compress_weight_conf can not both exist!!"); + GELOGE(ge::PARAM_INVALID, "[Check][Param]enable_compress_weight and compress_weight_conf can not both exist!!"); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -582,7 +618,8 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype) { if ((!keep_dtype.empty()) && (!CheckInputPathValid(keep_dtype, "--keep_dtype"))) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--keep_dtype", keep_dtype, kKeepDtypeError}); - GELOGE(ge::PARAM_INVALID, "keep dtype config file not found, file_name:%s", keep_dtype.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputPath] file not found, file_name:%s", keep_dtype.c_str()); + REPORT_CALL_ERROR("E19999", "CheckInputPathValid failed, file not found, file_name:%s", keep_dtype.c_str()); return ge::PARAM_INVALID; } @@ -604,11 +641,13 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { } else if (log == "error") { ret = dlog_setlevel(-1, DLOG_ERROR, 1); } else { - GELOGE(ge::PARAM_INVALID, "invalid value for log:%s, only support debug, info, warning, error, null", log.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][LogParam]log:%s invalid, only support debug, info, warning, error, null", log.c_str()); + REPORT_INNER_ERROR("E19999", "CheckLogParamValidAndSetLogLevel failed, log:%s invalid", log.c_str()); return ret; } if (ret != 0) { - GELOGE(ge::PARAM_INVALID, "Log setlevel fail !"); + GELOGE(ge::PARAM_INVALID, "[Check][LogParam]Log setlevel fail !"); + REPORT_INNER_ERROR("E19999", "CheckLogParamValidAndSetLogLevel failed, log:%s invalid", log.c_str()); } return ret; } @@ -616,7 +655,8 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { if ((!insert_op_conf.empty()) && (!CheckInputPathValid(insert_op_conf, "--insert_op_conf"))) { - GELOGE(ge::PARAM_INVALID, "insert op config file not found: %s", insert_op_conf.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputPath]file not found: %s", insert_op_conf.c_str()); + REPORT_CALL_ERROR("E19999", "CheckInputPathValid failed, file not found: %s", insert_op_conf.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -625,7 +665,9 @@ Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { Status CheckDisableReuseMemoryParamValid(const std::string disable_reuse_memory) { if ((disable_reuse_memory != "") && (disable_reuse_memory != "0") && (disable_reuse_memory != "1")) { ErrorManager::GetInstance().ATCReportErrMessage("E10006", {"parameter"}, {"disable_reuse_memory"}); - GELOGE(ge::PARAM_INVALID, "Input parameter[--disable_reuse_memory]'s value must be 1 or 0."); + GELOGE(ge::PARAM_INVALID, "[Check][DisableReuseMemoryParam]disable_reuse_memory must be 1 or 0."); + REPORT_INNER_ERROR("E19999", "CheckDisableReuseMemoryParamValid failed, disable_reuse_memory:%s invalid.", + disable_reuse_memory.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -635,8 +677,10 @@ Status CheckEnableSingleStreamParamValid(const std::string enable_single_stream) if ((enable_single_stream != "") && (enable_single_stream != "true") && (enable_single_stream != "false")) { ErrorManager::GetInstance().ATCReportErrMessage( "E10005", {"parameter", "value"}, {"enable_single_stream", enable_single_stream}); - GELOGE(ge::PARAM_INVALID, "Input parameter[--enable_single_stream]'s value[%s] must be true or false.", - enable_single_stream.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][EnableSingleStreamParam]enable_single_stream:%s must be true or false.", + enable_single_stream.c_str()); + REPORT_INNER_ERROR("E19999", "CheckEnableSingleStreamParamValid failed, enable_single_stream:%s invalid.", + enable_single_stream.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -647,7 +691,9 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: if (optypelist_for_implmode != "" && op_select_implmode == "") { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kCompressWeightError}); - GELOGE(ge::PARAM_INVALID, "Invalid value for --op_select_implmode[%s], %s.", + GELOGE(ge::PARAM_INVALID, "[Check][ImplmodeParam]op_select_implmode:%s invalid, %s.", + op_select_implmode.c_str(),kCompressWeightError); + REPORT_INNER_ERROR("E19999", "CheckImplmodeParamValid failed, op_select_implmode:%s invalid, %s.", op_select_implmode.c_str(), kCompressWeightError); return ge::PARAM_INVALID; } @@ -659,10 +705,12 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kSelectImplmodeError}); - GELOGE(ge::PARAM_INVALID, "Invalid value for --op_select_implmode[%s], %s.", + GELOGE(ge::PARAM_INVALID, "[Check][ImplmodeParam]Invalid value for --op_select_implmode[%s], %s.", + op_select_implmode.c_str(), kSelectImplmodeError); + REPORT_INNER_ERROR("E19999", "CheckImplmodeParamValid failed, op_select_implmode:%s invalid, %s.", op_select_implmode.c_str(), kSelectImplmodeError); return ge::PARAM_INVALID; - } + }op_select_implmode[%s] } return ge::SUCCESS; @@ -725,7 +773,8 @@ Status UpdateDataOpShapeRange(const OpDescPtr &op, if (iter != shape_range_map.end()) { auto cur_shape_range = iter->second; if (TensorUtils::CheckShapeByShapeRange(origin_shape, cur_shape_range) != SUCCESS) { - GELOGE(PARAM_INVALID, "[%s] Check shape by shape range failed.", op->GetName().c_str()); + GELOGE(PARAM_INVALID, "[Check][OpDescPtr][%s] Check shape by shape range failed.", data_op_name.c_str()); + REPORT_CALL_ERROR("E19999", "CheckShapeByShapeRange failed, op invalid, op_name=%s.", data_op_name.c_str()); return PARAM_INVALID; } for (size_t idx = 0; idx < cur_shape_range.size(); idx++) { @@ -753,7 +802,8 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co map>> shape_range_map; if (!ParseInputShapeRange(input_shape_range, shape_range_map)) { - GELOGE(PARAM_INVALID, "Parse input shape range failed."); + GELOGE(PARAM_INVALID, "[Parse][InputShapeRange] input_shape_range:%s invalid.", input_shape_range.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, input_shape_range:%s invalid.", input_shape_range.c_str()); return PARAM_INVALID; } @@ -763,7 +813,8 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co GE_CHECK_NOTNULL(op); if (op->GetType() == DATA) { if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { - GELOGE(FAILED, "Update data op [%s] input shape range failed.", op->GetName().c_str()); + GELOGE(FAILED, "[Update][Data] op[%s] invalid.", op->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "UpdateDataOpShapeRange failed, op[%s] invalid.", op->GetName().c_str()); return FAILED; } } diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index bd1be318..67a2664b 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -85,21 +85,21 @@ static graphStatus CheckGlobalOptions(std::map &global ? IR_OPTION_DISABLE_REUSE_MEMORY_DEFAULT : global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY]; GE_CHK_BOOL_EXEC(ge::CheckDisableReuseMemoryParamValid(disable_reuse_memory) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check disable_reuse_memory failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][DisableReuseMemory] failed!"); global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY] = disable_reuse_memory; // check buffer_optimize std::string buffer_optimize = global_options.find(ge::ir_option::BUFFER_OPTIMIZE) == global_options.end() ? IR_OPTION_BUFFER_OPTIMIZE_DEFAULT : global_options[ge::ir_option::BUFFER_OPTIMIZE]; GE_CHK_BOOL_EXEC(ge::CheckBufferOptimizeParamValid(buffer_optimize) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check buffer optimize failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][BufferOptimize] failed!"); global_options[ge::ir_option::BUFFER_OPTIMIZE] = buffer_optimize; // check enable_single_stream std::string enable_single_stream = global_options.find(ge::ir_option::ENABLE_SINGLE_STREAM) == global_options.end() ? "" : global_options[ge::ir_option::ENABLE_SINGLE_STREAM]; GE_CHK_BOOL_EXEC(ge::CheckEnableSingleStreamParamValid(enable_single_stream) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check enable single stream failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][EnableSingleStream] failed!"); // check compress_weight std::string enable_compress_weight = global_options.find(ge::ir_option::ENABLE_COMPRESS_WEIGHT) == global_options.end() @@ -109,7 +109,7 @@ static graphStatus CheckGlobalOptions(std::map &global ? "" : global_options[ge::ir_option::COMPRESS_WEIGHT_CONF]; GE_CHK_BOOL_EXEC(ge::CheckCompressWeightParamValid(enable_compress_weight, compress_weight_conf) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check compress weight failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][CompressWeight] failed!"); global_options[ge::ir_option::ENABLE_COMPRESS_WEIGHT] = (enable_compress_weight == "true") ? ge::kEnableCompressWeightTrue : ge::kEnableCompressWeightFalse; @@ -124,7 +124,7 @@ static graphStatus CheckGlobalOptions(std::map &global : global_options[ge::ir_option::OP_SELECT_IMPL_MODE]; GE_CHK_BOOL_EXEC( ge::CheckImplmodeParamValid(optypelist_for_implmode, op_select_implmode) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check optypelist_for_implmode and op_select_implmode failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][Implmode] failed!"); global_options[ge::ir_option::OP_SELECT_IMPL_MODE] = op_select_implmode; // set precision mode default value @@ -144,7 +144,8 @@ static void GetOpsProtoPath(string &opsproto_path) { string path = path_env; string file_path = RealPath(path.c_str()); if (file_path.empty()) { - GELOGE(FAILED, "File path %s is invalid.", path.c_str()); + GELOGE(FAILED, "[Check][Path] %s is invalid.", path.c_str()); + REPORT_INNER_ERROR("E19999", "GetOpsProtoPath failed, %s is invalid.", path.c_str()); return; } opsproto_path = (path + "/op_proto/custom/" + ":") + (path + "/op_proto/built-in/"); @@ -172,7 +173,7 @@ graphStatus aclgrphBuildInitializeImpl(std::map &globa GELOGD("Enter aclgrphInitialize start!"); // check global options if (CheckGlobalOptions(global_options) != GRAPH_SUCCESS) { - GELOGE(GRAPH_PARAM_INVALID, "Check global options falied!"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Global Options] falied!"); return GRAPH_PARAM_INVALID; } @@ -186,7 +187,7 @@ graphStatus aclgrphBuildInitializeImpl(std::map &globa GELOGI("aclgrphInitialize start!"); auto ret = ge::GELib::Initialize(global_options); if (ret != ge::SUCCESS) { - GELOGE(ret, "GE initialize failed!"); + GELOGE(ret, "[Init][GELib] failed!"); return GRAPH_FAILED; } } @@ -211,7 +212,7 @@ graphStatus aclgrphBuildInitialize(std::map &global_ std::map tmp_global_options; for (auto &option : global_options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { - GELOGE(GRAPH_FAILED, "AclgrphBuildInitialize option is nullptr."); + GELOGE(GRAPH_FAILED, "[Check][Options]AclgrphBuildInitialize option is nullptr."); return GRAPH_FAILED; } std::string key = option.first.GetString(); @@ -281,7 +282,8 @@ graphStatus Impl::InferShapePrepare(const ComputeGraphPtr &compute_graph) { auto ret = prepare_infershape.Run(compute_graph); if ((ret != SUCCESS) && (ret != NOT_CHANGED)) { - GELOGE(ret, "Prepair for infershape failed, ret:%d", ret); + GELOGE(ret, "[Prepair][InferShape] failed, ret:%d", ret); + REPORT_CALL_ERROR("E19999", "PassManager::Run falied,ret:%d", ret); return ret; } GELOGD("Prepair for infershape success!"); @@ -297,12 +299,12 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { vector>> user_shape_map; if (!input_shape.empty()) { GE_CHK_BOOL_EXEC(ParseInputShape(input_shape, shape_map, user_shape_map, true), - return GRAPH_PARAM_INVALID, "Parse input shape failed!"); + return GRAPH_PARAM_INVALID, "[Parse][InputShape] failed!"); } std::map>> shape_range_map; if (!input_shape_range.empty()) { GE_CHK_BOOL_EXEC(ParseInputShapeRange(input_shape_range, shape_range_map), - return GRAPH_PARAM_INVALID, "Parse input shape range failed."); + return GRAPH_PARAM_INVALID, "[Parse][InputShapeRange] failed."); } auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); @@ -312,11 +314,12 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { GE_CHECK_NOTNULL(op); if (op->GetType() == DATA) { if (UpdateDataOpShape(op, shape_map) != SUCCESS) { - GELOGE(GRAPH_FAILED, "Update data op [%s] shape failed.", op->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Update][DataOpShape] op[%s] failed.", op->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "UpdateDataOpShape failed, op[%s].", op->GetName().c_str()); return GRAPH_FAILED; } if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { - GELOGE(GRAPH_FAILED, "Update data op [%s] shape range failed.", op->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Update][DataOpShapeRange] op[%s] failed.", op->GetName().c_str()); return GRAPH_FAILED; } } @@ -331,8 +334,10 @@ graphStatus Impl::CheckOptions(const std::map &options if (it == ge::ir_option::ir_builder_suppported_options.end()) { auto it_lx_fusion = ir_builder_supported_options_for_lx_fusion.find(ele.first); if (it_lx_fusion == ir_builder_supported_options_for_lx_fusion.end()) { - GELOGE(GRAPH_PARAM_INVALID, "input options include unsupported option(%s).Please check!", - ele.first.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Options] unsupported option(%s).Please check!", + ele.first.c_str()); + REPORT_INNER_ERROR("E19999", "CheckOptions failed, unsupported option(%s).Please check!", + ele.first.c_str()); return GRAPH_PARAM_INVALID; } } @@ -343,7 +348,8 @@ graphStatus Impl::CheckOptions(const std::map &options auto it = options_.find(BUILD_MODE); if (it != options_.end() && !(it->second.empty())) { if (build_mode_options.find(it->second) == build_mode_options.end()) { - GELOGE(GRAPH_PARAM_INVALID, "Build mode:%s is unsupported. Please check!", it->second.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Mode]:%s is unsupported. Please check!", it->second.c_str()); + REPORT_INNER_ERROR("E19999", "CheckOptions failed, %s is unsupported. Please check!", it->second.c_str()); return GRAPH_PARAM_INVALID; } build_mode = it->second; @@ -351,12 +357,13 @@ graphStatus Impl::CheckOptions(const std::map &options it = options_.find(BUILD_STEP); if (it != options_.end() && !(it->second.empty())) { if (build_step_options.find(it->second) == build_step_options.end()) { - GELOGE(GRAPH_PARAM_INVALID, "Build step:%s is unsupported. Please check!", it->second.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Step]:%s is unsupported. Please check!", it->second.c_str()); + REPORT_INNER_ERROR("E19999", "CheckOptions failed, %s is unsupported. Please check!", it->second.c_str()); return GRAPH_PARAM_INVALID; } } else { if (build_mode == BUILD_MODE_TUNING) { - GELOGE(GRAPH_PARAM_INVALID, "Build mode tuning must specify build step. Please check!"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Mode] tuning must specify build step. Please check!"); return GRAPH_PARAM_INVALID; } } @@ -376,7 +383,7 @@ graphStatus Impl::Init(const Graph &graph, const std::map(string(IR_OPTION_MODE), to_string(0))); @@ -448,7 +455,7 @@ graphStatus Impl::Init(const Graph &graph, const std::mapsecond; } else { - GELOGE(GRAPH_PARAM_INVALID, "Input format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", + GELOGE(GRAPH_PARAM_INVALID, "[Check][Param]input_format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); + REPORT_INNER_ERROR("E19999", "InitDomiOmgContext failed, input_format %s not support.", input_format.c_str()); return GRAPH_PARAM_INVALID; } } @@ -564,7 +572,8 @@ 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, "Failed to parse input shape: %s", input_shape.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape] Failed, shape: %s", input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShape failed, shape: %s", input_shape.c_str()) return GRAPH_PARAM_INVALID; } return GRAPH_SUCCESS; @@ -585,7 +594,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map tmp_build_options; for (auto &option : build_options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { - GELOGE(GRAPH_FAILED, "AclgrphBuildInitialize option is nullptr."); + GELOGE(GRAPH_FAILED, "[Check][Options]AclgrphBuildInitialize option is nullptr."); return GRAPH_FAILED; } std::string key = option.first.GetString(); @@ -601,7 +610,7 @@ graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &m ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); GELOGD("Enter aclmdlSaveModel process!"); if (model.data.get() == nullptr || model.length == 0) { - GELOGE(GRAPH_PARAM_INVALID, "input model is illegal"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][ModelBufferData] model is illegal"); return GRAPH_PARAM_INVALID; } return FileSaver::SaveToFile((output_file + ".om"), reinterpret_cast(model.data.get()), @@ -612,11 +621,11 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); GELOGD("Enter aclmdlSaveModel process!"); if (model.data.get() == nullptr || model.length == 0) { - GELOGE(GRAPH_PARAM_INVALID, "Input model is illegal"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][ModelBufferData]model is illegal"); return GRAPH_PARAM_INVALID; } if (output_file == nullptr) { - GELOGE(GRAPH_PARAM_INVALID, "Output file is nullptr."); + GELOGE(GRAPH_PARAM_INVALID, "[Check][output_file]file is nullptr."); return GRAPH_PARAM_INVALID; } std::string str_output_file = output_file; @@ -641,7 +650,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz GE_CHECK_NOTNULL(file); if (len > PATH_MAX || len != strlen(file) || strlen(file) == 0) { - GELOGE(GRAPH_PARAM_INVALID, "File path invalid."); + GELOGE(GRAPH_PARAM_INVALID, "[Check][File Path]file invalid."); return GRAPH_PARAM_INVALID; } @@ -675,7 +684,8 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz char path[PATH_MAX] = {0}; if (realpath(file_path.c_str(), path) == nullptr) { - GELOGE(GRAPH_PARAM_INVALID, "Dump file path:%s is invalid.", file); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Dump File] path:%s is invalid.", file); + REPORT_INNER_ERROR("E19999", "aclgrphDumpGraph failed, %s is invalid.", file); return GRAPH_PARAM_INVALID; } @@ -710,7 +720,7 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vectorAddInputDesc(tensor_desc) != ge::GRAPH_SUCCESS) { - GELOGE(ge::FAILED, "AddInputDesc fail."); + GELOGE(ge::FAILED, "[Add][InputDesc] fail."); return ge::FAILED; } input_tensors.emplace_back(tensor_desc); @@ -734,7 +744,8 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector