From 26ff4788defe47b78f72dfe12980873365d1c287 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 8 Apr 2021 17:24:30 +0800 Subject: [PATCH 01/19] ge log optimize --- ge/analyzer/analyzer.cc | 30 ++++- ge/client/ge_api.cc | 21 +++- ge/common/auth/file_saver.cc | 49 +++++--- ge/common/debug/memory_dumper.cc | 9 +- ge/common/dump/dump_manager.cc | 7 +- ge/common/dump/dump_op.cc | 48 ++++--- ge/common/dump/opdebug_register.cc | 22 ++-- .../format_transfer_hwcn_c1hwncoc0.cc | 2 +- ge/common/ge/op_tiling_manager.cc | 7 +- ge/common/ge/plugin_manager.cc | 7 +- ge/common/helper/model_helper.cc | 138 ++++++++++++++++----- 11 files changed, 248 insertions(+), 92 deletions(-) diff --git a/ge/analyzer/analyzer.cc b/ge/analyzer/analyzer.cc index 528a0265..4930bff2 100755 --- a/ge/analyzer/analyzer.cc +++ b/ge/analyzer/analyzer.cc @@ -104,6 +104,7 @@ ge::Status Analyzer::Initialize() { string real_path = RealPath(kFilePath.c_str()); if (real_path.empty()) { GELOGE(FAILED, "[Check][AnalyzeFilePath]File path is empty, Path invalid."); + REPORT_CALL_ERROR("E19999", "Analyze file path check invalid, it is empty"); return FAILED; } json_file_name_ = real_path + "/" + kAnalyzeFile; @@ -155,12 +156,18 @@ std::shared_ptr Analyzer::GetJsonObject(uint64_t session_id, uint64_t std::lock_guard lg(mutex_); auto iter = graph_infos_.find(session_id); if (iter == graph_infos_.end()) { - GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! graph_id:%lu", session_id, graph_id); + GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! " + "graph_id:%lu", session_id, graph_id); + REPORT_INNER_ERROR("E19999", "Sessin_id %lu does not exist, graph_id %lu", + session_id, graph_id); return nullptr; } else { auto iter1 = (iter->second).find(graph_id); if (iter1 == (iter->second).end()) { - GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%lu does not exist! session_id:%lu.", graph_id, session_id); + GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%lu does not exist! " + "session_id:%lu.", graph_id, session_id); + REPORT_INNER_ERROR("E19999", "Graph_id %lu does not exist, session_id %lu", + graph_id, session_id); return nullptr; } GELOGI("GetJsonObject Success!session_id:%lu graph_id:%lu", session_id, graph_id); @@ -186,11 +193,15 @@ ge::Status Analyzer::CreateAnalyzerFile() { std::lock_guard lg(file_mutex_); int fd = open(json_file_name_.c_str(), O_WRONLY | O_CREAT | O_TRUNC, kFileAuthority); if (fd < 0) { - GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", json_file_name_.c_str()); + GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", + json_file_name_.c_str()); + REPORT_INNER_ERROR("E19999", "Failed to open analyze file %s", json_file_name_.c_str()); return INTERNAL_ERROR; } if (close(fd) != 0) { - GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", json_file_name_.c_str()); + GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", + json_file_name_.c_str()); + REPORT_INNER_ERROR("E19999", "Failed to clsoe analyze file %s", json_file_name_.c_str()); return INTERNAL_ERROR; } is_json_file_create_ = true; @@ -211,7 +222,9 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ std::lock_guard lg(file_mutex_); json_file_.open(json_file_name_, std::ios::app); if (!json_file_.is_open()) { - GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", json_file_name_.c_str()); + GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", + json_file_name_.c_str()); + REPORT_INNER_ERROR("E19999", "Analyze file %s dose not exist"); return PARAM_INVALID; } @@ -222,9 +235,12 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ json_file_ << jsn.dump(kJsonDumpLevel) << std::endl; } catch (nlohmann::detail::type_error &e) { GELOGE(FAILED, - "[Json.dump][GraphInfo]json.dump to analyze file [%s] failed because [%s]," + "[Json.dump][GraphInfo]Dump analyze file [%s] failed because [%s]," "session_id:%lu, graph_id:%lu", json_file_name_.c_str(), e.what(), session_id, graph_id); + REPORT_INNER_ERROR("E19999", "Dump analyze file %s failed because %s, " + "session_id %lu, graph_id %lu", + json_file_name_.c_str(), e.what(), session_id, graph_id); ret_failed = true; } json_file_.close(); @@ -247,6 +263,8 @@ ge::Status Analyzer::DoAnalyze(DataInfo &data_info) { GELOGE(status, "[Check][SaveOpInfo]save op info: desc_name [%s] desc_type [%s] failed!", desc->GetName().c_str(), desc->GetType().c_str()); + REPORT_CALL_ERROR("E19999", "Save op info: desc_name %s, desc_type %s failed", + desc->GetName().c_str(), desc->GetType().c_str()); return FAILED; } // create json file diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 0c63c6e3..48c708e3 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -73,7 +73,8 @@ Status CheckOptionsValid(const std::map &options) { "the job_id [%s] string length: %zu > max string length: %d", job_id_iter->second.c_str(), job_id_iter->second.length(), kMaxStrLen); REPORT_INPUT_ERROR("E10051", std::vector({"id","length"}), - std::vector({job_id_iter->second, std::to_string(kMaxStrLen)})); + std::vector({job_id_iter->second, + std::to_string(kMaxStrLen)})); return FAILED; } } @@ -90,6 +91,7 @@ Status GEInitializeImpl(const std::map &options) { if (ret != SUCCESS) { GELOGE(GE_CLI_INIT_FAILED, "[Init][PathBase]Init failed when pass param path_base:%s", path_base.c_str()); + REPORT_CALL_ERROR("E19999", "Init failed when pass param path_base:%s", path_base.c_str()); return ret; } @@ -112,6 +114,8 @@ Status GEInitializeImpl(const std::map &options) { GELOGE(GE_CLI_INIT_FAILED, "[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", opsproto_path.c_str()); + REPORT_CALL_ERROR("E19999", "Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid", + opsproto_path.c_str()); return FAILED; } @@ -319,6 +323,7 @@ Session::Session(const std::map &options) { sessionId_ = session_id; } else { GELOGE(ret, "[Construct][Session]Failed, error code:%u.", ret); + REPORT_CALL_ERROR("E19999", "Construct session failed, error code:%u.", ret); return; } GELOGT(TRACE_STOP, "Session Constructor finished"); @@ -350,12 +355,14 @@ Session::~Session() { ret = instance_ptr->SessionManagerObj().DestroySession(session_id); } catch (google::protobuf::FatalException &e) { - GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed because get fatalException."); + GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed " + "because get fatalException."); } // check return status, return, update session id if success if (ret != SUCCESS) { GELOGE(ret, "[Destruct][Session]Failed, error code:%u.", ret); + REPORT_CALL_ERROR("E19999", "Destruct session failed, error code:%u.", ret); } GELOGT(TRACE_STOP, "Session Destructor finished"); @@ -492,6 +499,8 @@ Status Session::RemoveGraph(uint32_t graph_id) { GELOGE(ret, "[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " + "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; } GELOGT(TRACE_STOP, "Session RemoveGraph finished"); @@ -569,6 +578,8 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s GELOGE(ret, "[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " + "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; } @@ -615,6 +626,8 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", ret, sessionId_, graph_id); + REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " + "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; } return SUCCESS; @@ -641,6 +654,8 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector &var_names, std::ve Status ret = ge::GELib::GetInstance()->SessionManagerObj().GetVariables(sessionId_, str_var_names, var_values); if (ret != SUCCESS) { GELOGE(ret, "[Get][Variables]Failed, error code:%u, session_id:%lu.", ret, sessionId_); + REPORT_CALL_ERROR("E19999", "Get variables failed, error code:%u, session_id:%lu.", + ret, sessionId_); return FAILED; } return SUCCESS; diff --git a/ge/common/auth/file_saver.cc b/ge/common/auth/file_saver.cc index 3c3b6197..4cad5a31 100755 --- a/ge/common/auth/file_saver.cc +++ b/ge/common/auth/file_saver.cc @@ -33,8 +33,10 @@ const int kFileOpSuccess = 0; namespace ge { Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { if (CheckPath(file_path) != SUCCESS) { - GELOGE(FAILED, "[Check][FilePath]Check output file failed, file_path:%s.", file_path.c_str()); - REPORT_CALL_ERROR("E19999", "Check output file failed, file_path:%s.", file_path.c_str()); + GELOGE(FAILED, "[Check][FilePath]Check output file failed, file_path:%s.", + file_path.c_str()); + REPORT_CALL_ERROR("E19999", "Check output file failed, file_path:%s.", + file_path.c_str()); return FAILED; } @@ -47,7 +49,8 @@ Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { if (fd == EN_INVALID_PARAM || fd == EN_ERROR) { // -1: Failed to open file; - 2: Illegal parameter GELOGE(FAILED, "[Open][File]Failed. mmpa_errno = %d, %s", fd, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Open file failed, mmpa_errno = %d, error:%s.", fd, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Open file failed, mmpa_errno = %d, error:%s.", + fd, strerror(errno)); return FAILED; } return SUCCESS; @@ -64,7 +67,8 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { while (size > size_1g) { write_count = mmWrite(fd, reinterpret_cast(seek), size_1g); if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { - GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); + GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", + write_count, strerror(errno)); REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", write_count, strerror(errno)); return FAILED; @@ -79,7 +83,8 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { // -1: Failed to write to file; - 2: Illegal parameter if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { - GELOGE(FAILED, "[Write][Data]Failed. mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); + GELOGE(FAILED, "[Write][Data]Failed. mmpa_errorno = %ld, error:%s", + write_count, strerror(errno)); REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", write_count, strerror(errno)); return FAILED; @@ -91,8 +96,10 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFileHeader &file_header, const void *data, int len) { if (data == nullptr || len <= 0) { - GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the length[%d] is less than 1.", len); - REPORT_INNER_ERROR("E19999", "Save file failed, model_data is null or the length:%d is less than 1.", len); + GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the " + "length[%d] is less than 1.", len); + REPORT_INNER_ERROR("E19999", "Save file failed, model_data is null or the " + "length:%d is less than 1.", len); return FAILED; } @@ -112,7 +119,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi // Close file if (mmClose(fd) != 0) { // mmClose 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; @@ -150,7 +158,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi // Close file if (mmClose(fd) != EN_OK) { GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; @@ -235,8 +244,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con if (file_path.size() >= MMPA_MAX_PATH) { GELOGE(FAILED, "[Check][FilePath]Failed, file path's length:%zu > mmpa_max_path:%d", file_path.size(), MMPA_MAX_PATH); - REPORT_INNER_ERROR("E19999", "Check file path failed, file path's length:%zu > mmpa_max_path:%d", - file_path.size(), MMPA_MAX_PATH); + REPORT_INNER_ERROR("E19999", "Check file path failed, file path's length:%zu > " + "mmpa_max_path:%d", file_path.size(), MMPA_MAX_PATH); return FAILED; } @@ -266,8 +275,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const ge::ModelData &model, const ModelFileHeader *model_file_header) { if (file_path.empty() || model.model_data == nullptr || model.model_len == 0) { - GELOGE(FAILED, "[Save][File]Incorrect input param, file_path is empty or model_data is nullptr or model_len is 0"); - REPORT_INNER_ERROR("E19999", "Save file failed, at least one of the input parameters(file_path, model_data, model_len) is incorrect"); + GELOGE(FAILED, "[Save][File]Incorrect input param, " + "file_path is empty or model_data is nullptr or model_len is 0"); + REPORT_INNER_ERROR("E19999", "Save file failed, at least one of the " + "input parameters(file_path, model_data, model_len) is incorrect"); return FAILED; } @@ -360,7 +371,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi // Close file if (mmClose(fd) != 0) { // mmClose 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; @@ -369,8 +381,10 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const void *data, int len) { if (data == nullptr || len <= 0) { - GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the length[%d] is less than 1.", len); - REPORT_INNER_ERROR("E19999", "Save file failed, the model_data is null or its length:%d is less than 1.", len); + GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the " + "length[%d] is less than 1.", len); + REPORT_INNER_ERROR("E19999", "Save file failed, the model_data is null or " + "its length:%d is less than 1.", len); return FAILED; } @@ -386,7 +400,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(co // Close file if (mmClose(fd) != 0) { // mmClose 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); - REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); + REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", + ret, strerror(errno)); ret = FAILED; } return ret; diff --git a/ge/common/debug/memory_dumper.cc b/ge/common/debug/memory_dumper.cc index e19d9a95..f500e4cc 100644 --- a/ge/common/debug/memory_dumper.cc +++ b/ge/common/debug/memory_dumper.cc @@ -60,14 +60,16 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::DumpToFile // mmWrite return -1:Failed to write data to file;return -2:Invalid parameter if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Write data failed, errno = %d, error:%s.", mmpa_ret, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Write data failed, errno = %d, error:%s.", + mmpa_ret, strerror(errno)); ret = FAILED; } // Close the file if (mmClose(fd) != EN_OK) { // mmClose return 0: success GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s.", ret, filename); - REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s.", ret, filename); + REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s.", + ret, filename); ret = FAILED; } @@ -110,7 +112,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void // mmWrite return -1:failed to write data to file;return -2:invalid parameter if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Write data to file failed, errno = %d, error:%s.", mmpa_ret, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Write data to file failed, errno = %d, error:%s.", + mmpa_ret, strerror(errno)); return FAILED; } diff --git a/ge/common/dump/dump_manager.cc b/ge/common/dump/dump_manager.cc index 61a60afd..cf2460d0 100644 --- a/ge/common/dump/dump_manager.cc +++ b/ge/common/dump/dump_manager.cc @@ -56,7 +56,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf dump_properties.SetDumpOpSwitch(dump_op_switch); if (dump_op_switch == kDumpoff && dump_config.dump_list.empty()) { dump_properties_map_.emplace(kInferSessionId, dump_properties); - GELOGE(PARAM_INVALID, "Dump list is invalid,dump_op_switch is %s", dump_op_switch.c_str()); + GELOGE(PARAM_INVALID, "[Check][DumpList]Invalid, dump_op_switch is %s", + dump_op_switch.c_str()); + REPORT_INNER_ERROR("E19999", "Dump list check invalid, dump_op_switch is %s", + dump_op_switch.c_str()); return PARAM_INVALID; } @@ -82,7 +85,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf dump_path = dump_config.dump_path; if (dump_path.empty()) { - GELOGE(PARAM_INVALID, "Dump path is empty"); + GELOGE(PARAM_INVALID, "[Check][DumpPath]It is empty"); return PARAM_INVALID; } diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 4456383c..fe0dce9b 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -102,7 +102,8 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { } int64_t output_size = 0; if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Get output size filed"); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output_size %d", output_size); + REPORT_CALL_ERROR("E19999", "Get output_size %d failed", output_size); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get output size in lanch dump op is %ld", output_size); @@ -129,7 +130,8 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { } int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Get output size filed"); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, iutput_size %d", iutput_size); + REPORT_CALL_ERROR("E19999", "Get input size %d failed", input_size); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get input size in lanch dump op is %ld", input_size); @@ -154,30 +156,36 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { size_t proto_size = op_mapping_info.ByteSizeLong(); bool ret = op_mapping_info.SerializeToString(&proto_msg); if (!ret || proto_size == 0) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Protobuf serialize failed, proto_size is %zu", proto_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Serialize][Protobuf]Failed, proto_size is %zu", + proto_size); + REPORT_CALL_ERROR("E19999", "[Serialize][Protobuf]Failed, proto_size is %zu", proto_size); return ACL_ERROR_GE_INTERNAL_ERROR; } rtError_t rt_ret = rtMalloc(&proto_dev_mem_, proto_size, RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMalloc failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMalloc]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMemcpy(proto_dev_mem_, proto_size, proto_msg.c_str(), proto_size, RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMemcpy failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMalloc(&proto_size_dev_mem_, sizeof(size_t), RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMalloc failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMalloc]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMemcpy(proto_size_dev_mem_, sizeof(size_t), &proto_size, sizeof(size_t), RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtMemcpy failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret: 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } @@ -196,7 +204,8 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { nullptr, // no need smDesc stream_); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtCpuKernelLaunch failed,rt_ret:0x%X", rt_ret); + GELOGE(rt_ret, "Call rtCpuKernelLaunch failed, ret:0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret: 0x%X", rt_ret) return RT_ERROR_TO_GE_STATUS(rt_ret); } GELOGI("Kernel launch dump op success"); @@ -230,12 +239,14 @@ Status DumpOp::LaunchDumpOp() { int32_t device_id = 0; rtError_t rt_ret = rtGetDevice(&device_id); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtGetDevice failed, ret = 0x%X, device_id = %d.", rt_ret, device_id); + GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X, device_id %d.", rt_ret, device_id); + REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X, device_id %d.", + rt_ret, device_id); return RT_ERROR_TO_GE_STATUS(rt_ret); } if (device_id < 0) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Check device_id failed, device_id = %d, which should be not less than 0.", - device_id); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][DeviceId]Failed, device_id %d", device_id); + REPORT_INNER_ERROR("E19999","Check device_id %d failed", device_id); return ACL_ERROR_GE_INTERNAL_ERROR; } aicpu::dump::OpMappingInfo op_mapping_info; @@ -265,7 +276,8 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpOutput) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump output failed"); + GELOGE(ret, "[Dump][Output]Failed, ret 0x%X", ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed, ret 0x%X", ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); @@ -273,7 +285,8 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpInput) { auto ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump input failed"); + GELOGE(ret, "[Dump][Input]Failed, ret 0x%X", ret); + REPORT_CALL_ERROR("E19999", "Dump Input failed, ret 0x%X", ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); @@ -281,19 +294,22 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpAll || dump_properties_.IsOpDebugOpen()) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump output failed when in dumping all"); + GELOGE(ret, "[Dump][Output]Failed when in dumping all, ret 0x%X", ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, ret 0x%X", ret); return ret; } ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "Dump input failed when in dumping all"); + GELOGE(ret, "[Dump][Input]Failed when in dumping all, ret 0x%X", ret); + REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, ret 0x%X", ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); } auto ret = ExecutorDumpOp(op_mapping_info); if (ret != SUCCESS) { - GELOGE(ret, "Executor dump op failed"); + GELOGE(ret, "[Dump][Op]Failed, ret 0x%X", ret); + REPORT_CALL_ERROR("E19999", "Executor dump op failed, ret 0x%X", ret); return ret; } return SUCCESS; diff --git a/ge/common/dump/opdebug_register.cc b/ge/common/dump/opdebug_register.cc index aae80cb0..b8f38652 100644 --- a/ge/common/dump/opdebug_register.cc +++ b/ge/common/dump/opdebug_register.cc @@ -27,7 +27,9 @@ Status OpdebugRegister::RegisterDebugForModel(rtModel_t model_handle, uint32_t o GELOGD("Start to register debug for model in overflow"); auto ret = MallocMemForOpdebug(); if (ret != SUCCESS) { - GELOGE(ret, "Malloc memory for opdebug in model overflow failed ,ret:0x%X", ret); + GELOGE(ret, "[Malloc][MemForOpdebug]Failed in model overflow, ret:0x%X", ret); + REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, " + "ret 0x%X", ret); return ret; } uint32_t debug_stream_id = 0; @@ -74,15 +76,18 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de GELOGD("Start to register debug for stream in stream overflow"); auto ret = MallocMemForOpdebug(); if (ret != SUCCESS) { - GELOGE(ret, "Malloc memory for opdebug in stream overflow ,ret:0x%X", ret); - return ret; + GELOGE(ret, "[Malloc][MemForOpdebug]Failed in stream overflow, ret:0x%X", ret); + REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, " + "ret:0x%X", ret); + return ret } uint32_t debug_stream_id = 0; uint32_t debug_task_id = 0; auto rt_ret = rtDebugRegisterForStream(stream, op_debug_mode, op_debug_addr_, &debug_stream_id, &debug_task_id); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtDebugRegisterForStream error, ret: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtDebugRegisterForStream]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtDebugRegisterForStream failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } GELOGD("debug_task_id:%u, debug_stream_id:%u in stream overflow.", debug_task_id, debug_stream_id); @@ -121,7 +126,8 @@ void OpdebugRegister::UnregisterDebugForStream(rtStream_t stream) { Status OpdebugRegister::MallocMemForOpdebug() { rtError_t rt_ret = rtMalloc(&op_debug_addr_, kOpDebugMemorySize, RT_MEMORY_DDR); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtMalloc error, ret: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtMalloc]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } @@ -129,12 +135,14 @@ Status OpdebugRegister::MallocMemForOpdebug() { // For data dump, aicpu needs the pointer to pointer that save the real debug address. rt_ret = rtMalloc(&p2p_debug_addr_, kDebugP2pSize, RT_MEMORY_HBM); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtMalloc error, ret: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtMalloc]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } rt_ret = rtMemcpy(p2p_debug_addr_, sizeof(uint64_t), &debug_addrs_tmp, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(RT_FAILED, "rtMemcpy to p2p_addr error: 0x%X", rt_ret); + GELOGE(RT_FAILED, "[Call][rtMemcpy]To p2p_addr error 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy to p2p_addr error 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } diff --git a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc index 3f2b72c5..1e7f4f19 100755 --- a/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc +++ b/ge/common/formats/format_transfers/format_transfer_hwcn_c1hwncoc0.cc @@ -187,7 +187,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in } } } - } + } } } } diff --git a/ge/common/ge/op_tiling_manager.cc b/ge/common/ge/op_tiling_manager.cc index db959368..8e134fc2 100644 --- a/ge/common/ge/op_tiling_manager.cc +++ b/ge/common/ge/op_tiling_manager.cc @@ -33,7 +33,9 @@ void OpTilingManager::ClearHandles() noexcept { if (mmDlclose(handle.second) != 0) { const char *error = mmDlerror(); GE_IF_BOOL_EXEC(error == nullptr, error = ""); - GELOGE(FAILED, "Failed to close handle of %s: %s", handle.first.c_str(), error); + GELOGE(FAILED, "[Close][Handle]Failed, handle of %s: %s", handle.first.c_str(), error); + REPORT_CALL_ERROR("E19999", "Failed to close handle of %s: %s", + handle.first.c_str(), error); } } handles_.clear(); @@ -50,7 +52,8 @@ std::string OpTilingManager::GetPath() { if (mmRealPath(opp_path_env, resolved_path, MMPA_MAX_PATH) != EN_OK) { ErrorManager::GetInstance().ATCReportErrMessage( "E19024", {"env", "value", "situation"}, {"ASCEND_OPP_PATH", opp_path_env, "loading the tiling lib"}); - GELOGE(PARAM_INVALID, "Failed load tiling lib as env 'ASCEND_OPP_PATH'[%s] is invalid path.", opp_path_env); + GELOGE(PARAM_INVALID, "[Load][TilingLib]Failed, as env 'ASCEND_OPP_PATH'[%s] " + "is invalid path.", opp_path_env); return std::string(); } opp_path = resolved_path; diff --git a/ge/common/ge/plugin_manager.cc b/ge/common/ge/plugin_manager.cc index 4e588f29..8b049c29 100644 --- a/ge/common/ge/plugin_manager.cc +++ b/ge/common/ge/plugin_manager.cc @@ -127,7 +127,7 @@ Status PluginManager::LoadSo(const string &path, const vector &func_chec ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, {"mmDlopen", "shared library path is " + FmtToStr(file_path_dlopen) + ". Errormessage" + FmtToStr(error)}); GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, - "Failed to dlopen the shared library path[%s]. Errormessage[%s]!", + "[DLOpen][SharedLibraryPath]Failed, path[%s]. Errormessage[%s]!", file_path_dlopen.c_str(), error); continue; } @@ -140,14 +140,15 @@ Status PluginManager::LoadSo(const string &path, const vector &func_chec ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, {"mmDlsym", FmtToStr(func_name) + " is skipped since function" + FmtToStr(func_name) + " is not existed!"}); - GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, "%s is skipped since function %s is not existed!", + GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, + "[Check][So]%s is skipped since function %s is not existed!", func_name.c_str(), func_name.c_str()); is_valid = false; break; } } if (!is_valid) { - GE_LOGE_IF(mmDlclose(handle), "Failed to dlclose."); + GE_LOGE_IF(mmDlclose(handle), "[DLClose][Handle]Failed."); continue; } diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 74238bc1..4a7aa24b 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -37,7 +37,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelHelper::~ModelHelper() { ( Status ModelHelper::SaveModelPartition(std::shared_ptr &om_file_save_helper, ModelPartitionType type, const uint8_t *data, size_t size, size_t model_index) { if (size < 1 || size > UINT32_MAX) { - GELOGE(PARAM_INVALID, "Add model partition failed, partition size %zu invalid", size); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu invalid", size); + REPROT_INNER_ERROR("E19999", "Add model partition failed, partition size %zu " + "invalid", size); if (size > UINT32_MAX) { string item = "item"; if (type == MODEL_DEF) { @@ -57,7 +59,8 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr &om_fil return PARAM_INVALID; } if (data == nullptr) { - GELOGE(PARAM_INVALID, "Add model partition failed, data is null"); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, data is null"); + REPORT_INNER_ERROR("E19999", "Add model partition failed, data is null"); return PARAM_INVALID; } ModelPartition partition_model; @@ -65,7 +68,8 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr &om_fil partition_model.size = static_cast(size); partition_model.type = type; if (om_file_save_helper->AddPartition(partition_model, model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "Add model partition failed, partition size %zu", size); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu", size); + REPORT_CALL_ERROR("E19999", "Add model partition failed, partition size %zu", size); return PARAM_INVALID; } return SUCCESS; @@ -106,7 +110,8 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save const GeModelPtr &ge_model, ge::Buffer &model_buffer, size_t model_index) { ModelPtr model_tmp = ge::MakeShared(ge_model->GetName(), ge_model->GetPlatformVersion()); if (model_tmp == nullptr) { - GELOGE(FAILED, "Create Model %s Ptr failed", ge_model->GetName().c_str()); + GELOGE(FAILED, "[Creat][Model]Failed, Model %s Ptr", ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Create Model %s Ptr failed", ge_model->GetName().c_str()); return FAILED; } model_tmp->SetGraph(ge_model->GetGraph()); @@ -114,7 +119,8 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save model_tmp->SetAttr(ge_model->MutableAttrMap()); Status ret = SaveSizeToModelDef(ge_model); if (ret != SUCCESS) { - GELOGE(ret, "SaveSizeToModelDef failed"); + GELOGE(ret, "[Save][SizeToModelDef]Failed, error_code %u", ret); + REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, error_code %u", ret); return ret; } @@ -123,7 +129,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save if (model_buffer.GetSize() > 0) { if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(), model_buffer.GetSize(), model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "Add model graph partition failed"); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model_def size %zu, model_index %zu", + model_buffer.GetSize(), model_index); + REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model_def %zu, " + "model_index %zu", model_buffer.GetSize(), model_index); return PARAM_INVALID; } } @@ -178,17 +187,24 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { std::shared_ptr model_task_def = ge_model->GetModelTaskDefPtr(); if (model_task_def == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Create model task def ptr failed"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr"); + REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr"); return ACL_ERROR_GE_MEMORY_ALLOCATION; } size_t partition_task_size = model_task_def->ByteSizeLong(); GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, - GELOGE(FAILED, "Model_def's byte size (%zu) is invalid!", partition_task_size); + GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu!", + partition_task_size); + REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid," + partition_task_size); return FAILED); task_buffer = ge::Buffer(partition_task_size); if (task_buffer.GetSize() == 0) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc model task def buffer failed"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][ModelTaskDefBuffer]Failed, " + "model def size %zu", partition_task_size); + REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu", + partition_task_size); return ACL_ERROR_GE_MEMORY_ALLOCATION; } (void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast(partition_task_size)); @@ -198,7 +214,10 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), partition_task_size, model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "Add model task def partition failed"); + GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, " + "model_index %zu", partition_task_size, model_index); + REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu " + "model_index %zu", partition_task_size, model_index); return PARAM_INVALID; } return SUCCESS; @@ -218,7 +237,11 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s platform_version.size() + 1); if (err != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, - "ModelHelper SaveModel failed while allocating memory for platform_version."); + "[Save][Model]Failed while allocating memory for platform_version %s, errno %d", + platform_version.c_str(), err); + REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while " + "allocating memory for platform_version %s, errno %d", + platform_version.c_str(), err); return ACL_ERROR_GE_MEMORY_ALLOCATION; } string version = reinterpret_cast(model_header.platform_version); @@ -228,7 +251,11 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size); if (err != EOK) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "ModelHelper SaveModel failed while allocating memory for name"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, + "[Save][Model]Failed while allocating memory for name %s, errno %d", + ge_model->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while allocating memory " + "for name %s,errno %d", ge_model->GetName().c_str(), err); return ACL_ERROR_GE_MEMORY_ALLOCATION; } string model_name = reinterpret_cast(model_header.name); @@ -240,28 +267,38 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f const GeModelPtr &ge_model, ge::Buffer &model_buffer, ge::Buffer &task_buffer, size_t model_index) { if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) { - GELOGE(FAILED, "save model def failed"); + GELOGE(FAILED, "[Save][ModelDef]Failed, model index %zu", model_index); + REPORT_INNER_ERROR("E19999", "ModelHelper save model def failed, model index %zu", + model_index); return FAILED; } if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "save model weights failed"); + GELOGE(FAILED, "[Save][ModelWeights]Failed, model index %zu", model_index); + REPORT_INNER_ERROR("E19999","ModelHelper save mode weights failed, mode index %zu", + model_index); return FAILED; } if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "save model tbe kernel failed"); + GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model index %zu", model_index); + REPORT_INNER_ERROR("E19999", "ModelHelper save model tbe kernel failed, model index %zu", + model_index); return FAILED; } if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "save model cust ai cpu failed"); + GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model index %zu", model_index); + REPORT_INNER_ERROR("E19999", "ModelHelper save model cust aicpu failed, " + "model index %zu", model_index); return FAILED; } if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) { - GELOGE(FAILED, "save task def failed"); + GELOGE(FAILED, "[Save][TaskDef]Failed, model index %zu", model_index); + REPORT_INNER_ERROR("E19999", "ModelHelper save task def failed, model index %zu", + model_index); return FAILED; } return SUCCESS; @@ -272,7 +309,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod const std::string &output_file, ModelBufferData& model) { if (output_file.empty()) { - GELOGE(FAILED, "GraphBuilder SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix"); + REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix"); return FAILED; } @@ -284,19 +322,25 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer); if (ret != SUCCESS) { - GELOGE(ret, "save all model partition failed"); + GELOGE(ret, "[Save][AllModelPartition]Failed, error_code %u", ret); + REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save all model partition failed, " + "error_code %u", ret); return ret; } ret = SaveModelHeader(om_file_save_helper, ge_model); if (ret != SUCCESS) { - GELOGE(ret, "save model header failed"); + GELOGE(ret, "[Save][ModelHeader]Failed, error_code %u", ret); + REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model header failed, " + "error_code %u", ret); return ret; } ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_); if (ret != SUCCESS) { - GELOGE(FAILED, "OmFileSaveHelper SaveModel return fail."); + GELOGE(FAILED, "[Save][Model]Failed, output file %s", output_file.c_str()); + REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model failed, output file %s", + output_file.c_str()); return ret; } return SUCCESS; @@ -310,12 +354,19 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo bool is_unknown_shape) { GE_CHECK_NOTNULL(ge_root_model); - GE_IF_BOOL_EXEC(ge_root_model == nullptr, GELOGE(FAILED, "Ge_root_model is nullptr"); return FAILED); + GE_IF_BOOL_EXEC(ge_root_model == nullptr, + GELOGE(FAILED, "[Check][GERootModel]Ge_root_model is nullptr"); + REPORT_INNER_ERROR("E19999", "Ge_root_model check failed, it is nullptr"); + return FAILED); auto &name_to_ge_model = ge_root_model->GetSubgraphInstanceNameToModel(); - GE_IF_BOOL_EXEC(name_to_ge_model.empty(), GELOGE(FAILED, "Ge_root_model has no sub model"); return FAILED); + GE_IF_BOOL_EXEC(name_to_ge_model.empty(), + GELOGE(FAILED, "[Get][SubModel]Ge_root_model has no sub model"); + REPORT_INNER_ERROR("E19999", "Ge_root_model has no sub model"); + return FAILED); GE_IF_BOOL_EXEC(output_file.empty(), - GELOGE(FAILED, "GraphBuilder SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix"); + REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix"); return FAILED); if (!is_unknown_shape) { @@ -344,7 +395,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo if (model_names.size() > 1) { GELOGD("only save first model MODEL_DEF"); if (SaveModelDef(om_file_save_helper, first_ge_model, model_buffers[cur_index], cur_index) != SUCCESS) { - GELOGE(FAILED, "save model def failed"); + GELOGE(FAILED, "[Save][ModelDef]Failed, model name %s, cur_index %zu", + model_name.c_str(), cur_index); + REPORT_INNER_ERROR("E19999", "Save model %s def failed, cur_index %zu", + model_name.c_str(), cur_index); return FAILED; } ++cur_index; @@ -357,20 +411,27 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffers[cur_index], task_buffers[cur_index], cur_index); if (ret != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Save model %s failed", model_name.c_str()); + GELOGE(INTERNAL_ERROR, "[Save][AllModelPartition]Failed, model name %s, cur_index %zu", + model_name.c_str(), cur_index); + REPORT_INNER_ERROR("E19999", "Save all model %s partition failed, cur_index %zu", + model_name.c_str(), cur_index); return INTERNAL_ERROR; } } auto ret = SaveModelHeader(om_file_save_helper, first_ge_model, model_names.size()); if (ret != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Save model %s header failed", first_ge_model->GetName().c_str()); + GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", first_ge_model->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str()); return INTERNAL_ERROR; } ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_); if (ret != SUCCESS) { - GELOGE(FAILED, "OmFileSaveHelper SaveModel return fail."); + GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model return fail, output_file %s", + output_file.c_str()); + REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s", + output_file.c_str()); return FAILED; } return SUCCESS; @@ -379,13 +440,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file) { if (output_file.empty()) { - GELOGE(FAILED, "SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]Received invalid file name prefix, output_file %s", + output_file.c_str()); + REPORT_CALL_ERROR("E19999", "Save model received invalid file name prefix, output_file %s", + output_file.c_str()); return FAILED; } // Get computegraph from graph auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); if (compute_graph == nullptr) { - GELOGE(FAILED, "SaveModel fail for compute_graph null"); + GELOGE(FAILED, "[Save][Model]Failed for compute_graph null"); + REPORT_CALL_ERROR("E19999", "Save model failed for compute_graph null"); return FAILED; } GE_DUMP(compute_graph, "OriginalGraph"); @@ -407,7 +472,8 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin ge::Buffer model_buffer; ge::graphStatus status = model_ptr->Save(model_buffer); if (status != ge::GRAPH_SUCCESS) { - GELOGE(FAILED, "SaveModel fail for save buffer fail"); + GELOGE(FAILED, "[Save][Model]Failed for save buffer fail"); + REPORT_INNER_ERROR("E19999", "Save model failed for save buffer fail"); return FAILED; } std::shared_ptr om_file_save_helper = ge::MakeShared(); @@ -429,14 +495,20 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(), platform_version.size() + 1); if (err != EOK) { - GELOGE(FAILED, "ModelHelper SaveModel failed for platform_version"); + GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, errno %d", + platform_version.c_str(), err); + REPORT_CALL_ERROR("E19999", "Save model failed for platform_version %s, errno %d", + platform_version.c_str(), err); return FAILED; } size_t name_size = model_ptr->GetName().size(); name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, model_ptr->GetName().c_str(), name_size); if (err != EOK) { - GELOGE(FAILED, "ModelHelper SaveModel memory copy failed"); + GELOGE(FAILED, "[Save][Model]Failed for memory copy %s failed, errno %d", + model_ptr->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "Save model failed for memory copy %s failed, errno %d", + model_ptr->GetName().c_str(), err); return FAILED; } ModelBufferData model; From 9fb2c592588b8acbe7bd4a22d30067b3f068f95d Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Fri, 9 Apr 2021 09:44:31 +0800 Subject: [PATCH 02/19] ge log optimize --- ge/common/helper/model_helper.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 4a7aa24b..d9a8f138 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -38,7 +38,7 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr &om_fil const uint8_t *data, size_t size, size_t model_index) { if (size < 1 || size > UINT32_MAX) { GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu invalid", size); - REPROT_INNER_ERROR("E19999", "Add model partition failed, partition size %zu " + REPORT_INNER_ERROR("E19999", "Add model partition failed, partition size %zu " "invalid", size); if (size > UINT32_MAX) { string item = "item"; @@ -195,7 +195,7 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu!", partition_task_size); - REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid," + REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid,", partition_task_size); return FAILED); @@ -396,9 +396,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo GELOGD("only save first model MODEL_DEF"); if (SaveModelDef(om_file_save_helper, first_ge_model, model_buffers[cur_index], cur_index) != SUCCESS) { GELOGE(FAILED, "[Save][ModelDef]Failed, model name %s, cur_index %zu", - model_name.c_str(), cur_index); + model_names.c_str(), cur_index); REPORT_INNER_ERROR("E19999", "Save model %s def failed, cur_index %zu", - model_name.c_str(), cur_index); + model_names.c_str(), cur_index); return FAILED; } ++cur_index; From e2cd1faa9ab07d37d1e80d0b613a05671142ac4e Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Tue, 13 Apr 2021 17:25:47 +0800 Subject: [PATCH 03/19] ge log optimize --- ge/common/helper/model_cache_helper.cc | 0 ge/common/helper/model_cache_helper.h | 0 ge/common/helper/model_helper.cc | 104 +++++++++++++++++++++++---------- 3 files changed, 74 insertions(+), 30 deletions(-) mode change 100755 => 100644 ge/common/helper/model_cache_helper.cc mode change 100755 => 100644 ge/common/helper/model_cache_helper.h diff --git a/ge/common/helper/model_cache_helper.cc b/ge/common/helper/model_cache_helper.cc old mode 100755 new mode 100644 diff --git a/ge/common/helper/model_cache_helper.h b/ge/common/helper/model_cache_helper.h old mode 100755 new mode 100644 diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index d9a8f138..d22e3b5c 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -518,23 +518,28 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, + "[Load][Model]Model_data is nullptr or model_data_size is 0"); + REPORT_INNER_ERROR("E19999", "Load model failed, Model_data is nullptr or model_data_size is 0"); return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } if (is_assign_model_) { - GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "Model helper has already loaded!"); + GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "[Load][Model]Model helper has already loaded!"); + REPORT_INNER_ERROR("E19999", "Model helper has already loaded"); return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; } if (ReleaseLocalModelData() != SUCCESS) { - GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "ReleaseLocalModelData failed."); + GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "[Release][ModelData]Failed."); + REPORT_INNER_ERROR("E19999", "Release local model data failed"); return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][ModelContent]Failed!"); + REPORT_INNER_ERROR("E19999", "Parse model content failed"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -542,14 +547,16 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c OmFileLoadHelper om_load_helper; status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { - GELOGE(status, "Om_load_helper init failed"); + GELOGE(status, "[Init][OmLoadHelper]Failed"); + REPORT_INNER_ERROR("E19999", "Om_load_helper init failed"); model_addr_tmp_ = nullptr; return status; } auto partition_table = reinterpret_cast(model_addr_tmp_); if (partition_table->num == kOriginalOmPartitionNum) { model_addr_tmp_ = nullptr; - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "om model is error,please use executable om model"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][OmModel]Error, please use executable om model"); + REPORT_CALL_ERROR("E19999", "Om model is error, please use executable om model"); return ACL_ERROR_GE_PARAM_INVALID; } // Encrypt model need to del temp model/no encrypt model don't need to del model @@ -557,7 +564,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c status = GenerateGeModel(om_load_helper); if (status != SUCCESS) { - GELOGE(status, "GenerateGeModel failed"); + GELOGE(status, "[Generate][GEModel]Failed"); + REPORT_INNER_ERROR("E19999", "Generate GE model failed"); return status; } GELOGD("in ModelHelper::LoadModel, is_assign_model_ is setted to true!"); @@ -567,23 +575,29 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "[Load][RootModel]" + "Model_data is nullptr or model_data_size is 0"); + REPORT_INNER_ERROR("E19999", "Load root model failed, model_data is nullptr or its size is 0"); return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } if (is_assign_model_) { - GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "Model helper has already loaded!"); + GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, + "[Load][RootModel]Model helper has already loaded!"); + REPORT_INNER_ERROR("E19999", "Load root model failed, model helper has already loaded"); return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; } if (ReleaseLocalModelData() != SUCCESS) { - GELOGE(INTERNAL_ERROR, "ReleaseLocalModelData failed."); + GELOGE(INTERNAL_ERROR, "[Release][ModelData]Failed."); + REPORT_INNER_ERROR("E19999", "Release local root model data failed"); return INTERNAL_ERROR; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { - GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!"); + REPORT_INNER_ERROR("E19999", "Parse model content failed"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -602,7 +616,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); } if (status != SUCCESS) { - GELOGE(status, "Om_load_helper init failed"); + GELOGE(status, "[Init][OmLoadHelper]Failed"); + REPORT_INNER_ERROR("E19999", "Om_load_helper init failed"); model_addr_tmp_ = nullptr; return status; } @@ -611,7 +626,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod status = GenerateGeRootModel(om_load_helper); if (status != SUCCESS) { - GELOGE(status, "GenerateGeRootModel failed"); + GELOGE(status, "[Generate][GERootModel]Failed"); + REPORT_INNER_ERROR("E19999", "Generate GE root model failed"); return status; } GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); @@ -651,7 +667,8 @@ Status ModelHelper::GenerateGeRootModel(OmFileLoadHelper &om_load_helper) { GE_CHECK_NOTNULL(root_model_); if (!is_unknown_shape_model_) { if (GenerateGeModel(om_load_helper) != SUCCESS) { - GELOGE(FAILED, "GenerateGeModel failed"); + GELOGE(FAILED, "[Generate][GERootModel]Failed"); + REPORT_INNER_ERROR("E19999", "Generate GE root model failed"); return FAILED; } GE_CHECK_NOTNULL(model_); @@ -708,7 +725,10 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper) { ge::Model model; if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Load model failed."); + GELOGE(INTERNAL_ERROR, "[Load][Model]Failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); + REPORT_CALL_ERROR("E19999", "Load model failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); return INTERNAL_ERROR; } @@ -732,7 +752,10 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & ge::Model model; if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "Load model failed."); + GELOGE(INTERNAL_ERROR, "[Load][Model]Failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); + REPORT_CALL_ERROR("E19999", "Load model failed, model_def partition addr:%p, size:%u", + partition_model_def.data, partition_model_def.size); return INTERNAL_ERROR; } @@ -744,7 +767,9 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { - GELOGE(FAILED, "Get weight model partition failed."); + GELOGE(FAILED, "[Get][ModelWeightPartition]Failed, GetWeight size:%u", partition.size); + REPORT_INNER_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", + partition.size); return FAILED; } ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); @@ -757,7 +782,9 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index) { ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) { - GELOGE(FAILED, "Get weight model partition failed."); + GELOGE(FAILED, "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); + REPORT_INNER_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", + partition.size); return FAILED; } ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); @@ -770,14 +797,19 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cu FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper) { ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { - GELOGE(FAILED, "Get task model partition failed."); + GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); + REPORT_INNER_ERRO("E19999", "Get model task partition failed, task_partition size %u", + task_partition.size); return FAILED; } std::shared_ptr task = ge::MakeShared(); GE_CHECK_NOTNULL(task); if (task_partition.size != 0) { if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { - GELOGE(INTERNAL_ERROR, "ReadProtoFromArray failed."); + GELOGE(INTERNAL_ERROR, "[Read][ProtoFromArray]Failed, task_partition size %u", + task_partition.size); + REPORT_CALL_ERROR("E19999", "Read proto from array failed, task_partition size %u", + task_partition.size); return INTERNAL_ERROR; } GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); @@ -792,13 +824,20 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition, mode_index) != SUCCESS) { GELOGE(FAILED, "Get task model partition failed."); + GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size %u, mode_index %zu", + task_partition.size, mode_index); + REPORT_INNER_ERROR("E19999", "Get model task partition failed, " + "task_partition size %u, mode_index %zu", task_partition.size, mode_index); return FAILED; } std::shared_ptr task = ge::MakeShared(); GE_CHECK_NOTNULL(task); if (task_partition.size != 0) { if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { - GELOGE(INTERNAL_ERROR, "ReadProtoFromArray failed."); + GELOGE(INTERNAL_ERROR, "[Read][ProtoFromArray]Failed, task_partition size %u", + task_partition.size); + REPORT_CALL_ERROR("E19999", "Read proto from array failed, task_partition size %u", + task_partition.size); return INTERNAL_ERROR; } GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); @@ -906,7 +945,8 @@ Status ModelHelper::ReleaseLocalModelData() noexcept { if (model_addr_tmp_ != nullptr) { errno_t ret = memset_s(static_cast(model_addr_tmp_), model_len_tmp_, 0, model_len_tmp_); if (ret != EOK) { - GELOGE(FAILED, "Failed to memset memory, error-code %d", ret); + GELOGE(FAILED, "[Memset][Memory]Failed, error-code %d", ret); + REPORT_CALL_ERROR("E19999", "Failed to memset memory, error-code %d", ret); result = FAILED; } delete[] model_addr_tmp_; @@ -955,7 +995,9 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); if (ret != SUCCESS) { - GELOGE(ret, "LoadFromFile failed."); + GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file.c_str(), ret); + REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", + model_file.c_str(), ret); return ret; } std::function callback = [&]() { @@ -973,7 +1015,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "ParseModelContent failed because of invalid om file. Please check --om param."); + "[Parse][ModelContent]Failed because of invalid om file. Please check --om param."); return ret; } @@ -981,7 +1023,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ret = om_load_helper.Init(model_data, model_len); if (ret != SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"}); - GELOGE(ge::FAILED, "Om file init failed."); + GELOGE(ge::FAILED, "[Init][OmFile]Failed."); return ret; } @@ -989,7 +1031,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); if (ret != SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); - GELOGE(ge::FAILED, "Get model part failed."); + GELOGE(ge::FAILED, "[Get][ModelPart]Failed."); return ret; } @@ -997,7 +1039,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef if (!flag) { ret = INTERNAL_ERROR; ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); - GELOGE(ret, "ReadProtoFromArray failed."); + GELOGE(ret, "[Read][ProtoFromArray]Failed."); return ret; } modeldef_size = ir_part.size; @@ -1018,7 +1060,9 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model }; if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "LoadFromFile failed."); + GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file.c_str(), ret); + REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", + model_file.c_str(), ret); return ret; } @@ -1027,7 +1071,7 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model if (!flag) { free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); - GELOGE(FAILED, "ParseFromString failed."); + GELOGE(FAILED, "[Parse][ModelInfo]Failed from string."); return FAILED; } free_model_data(&model.model_data); @@ -1036,7 +1080,7 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what()); + GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message : %s", e.what()); return FAILED; } } From 2dada473edfdcdf32ec7f52207c16bfcbdbc68ed Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Tue, 13 Apr 2021 20:21:55 +0800 Subject: [PATCH 04/19] ge log optimize --- ge/common/helper/model_helper.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index d22e3b5c..f15fb99e 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -395,10 +395,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo if (model_names.size() > 1) { GELOGD("only save first model MODEL_DEF"); if (SaveModelDef(om_file_save_helper, first_ge_model, model_buffers[cur_index], cur_index) != SUCCESS) { - GELOGE(FAILED, "[Save][ModelDef]Failed, model name %s, cur_index %zu", - model_names.c_str(), cur_index); - REPORT_INNER_ERROR("E19999", "Save model %s def failed, cur_index %zu", - model_names.c_str(), cur_index); + GELOGE(FAILED, "[Save][ModelDef]Failed, cur_index %zu", cur_index); + REPORT_INNER_ERROR("E19999", "Save model def failed, cur_index %zu", cur_index); return FAILED; } ++cur_index; @@ -798,7 +796,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); - REPORT_INNER_ERRO("E19999", "Get model task partition failed, task_partition size %u", + REPORT_INNER_ERROR("E19999", "Get model task partition failed, task_partition size %u", task_partition.size); return FAILED; } @@ -995,9 +993,9 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); if (ret != SUCCESS) { - GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file.c_str(), ret); + GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file, ret); REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", - model_file.c_str(), ret); + model_file, ret); return ret; } std::function callback = [&]() { @@ -1060,9 +1058,9 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model }; if (ret != SUCCESS) { free_model_data(&model.model_data); - GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file.c_str(), ret); + GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file, ret); REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", - model_file.c_str(), ret); + model_file, ret); return ret; } From 8159360864fe772d8517536cfddba34fabe9dbaa Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Tue, 13 Apr 2021 20:33:28 +0800 Subject: [PATCH 05/19] ge log optimize --- ge/analyzer/analyzer.cc | 6 +++--- ge/client/ge_api.cc | 10 +++++----- ge/common/auth/file_saver.cc | 4 ++-- ge/common/helper/model_helper.cc | 15 +++++++++------ 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ge/analyzer/analyzer.cc b/ge/analyzer/analyzer.cc index 4930bff2..c4ebd393 100755 --- a/ge/analyzer/analyzer.cc +++ b/ge/analyzer/analyzer.cc @@ -234,9 +234,9 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ try { json_file_ << jsn.dump(kJsonDumpLevel) << std::endl; } catch (nlohmann::detail::type_error &e) { - GELOGE(FAILED, + GELOGE(FAILED, "[Json.dump][GraphInfo]Dump analyze file [%s] failed because [%s]," - "session_id:%lu, graph_id:%lu", + "session_id:%lu, graph_id:%lu", json_file_name_.c_str(), e.what(), session_id, graph_id); REPORT_INNER_ERROR("E19999", "Dump analyze file %s failed because %s, " "session_id %lu, graph_id %lu", @@ -260,7 +260,7 @@ ge::Status Analyzer::DoAnalyze(DataInfo &data_info) { GE_CHECK_NOTNULL(graph_info); auto status = SaveOpInfo(desc, data_info, graph_info); if (status != SUCCESS) { - GELOGE(status, + GELOGE(status, "[Check][SaveOpInfo]save op info: desc_name [%s] desc_type [%s] failed!", desc->GetName().c_str(), desc->GetType().c_str()); REPORT_CALL_ERROR("E19999", "Save op info: desc_name %s, desc_type %s failed", diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 48c708e3..d9441cc2 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -498,7 +498,7 @@ Status Session::RemoveGraph(uint32_t graph_id) { if (ret != SUCCESS) { GELOGE(ret, "[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + ret, sessionId_, graph_id); REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; @@ -568,7 +568,7 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag."); REPORT_INNER_ERROR("E19999", - "RunGraph Failed, GELib instance is nullptr or is not InitFlag."); + "RunGraph Failed, GELib instance is nullptr or is not InitFlag."); return FAILED; } GELOGT(TRACE_RUNNING, "Running Graph"); @@ -577,7 +577,7 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s if (ret != SUCCESS) { GELOGE(ret, "[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + ret, sessionId_, graph_id); REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; @@ -617,7 +617,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); REPORT_INNER_ERROR("E19999", - "Build graph failed, the GELib instance is nullptr or is not InitFlag."); + "Build graph failed, the GELib instance is nullptr or is not InitFlag."); return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); @@ -625,7 +625,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector if (ret != SUCCESS) { GELOGE(ret, "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", - ret, sessionId_, graph_id); + ret, sessionId_, graph_id); REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " "session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); return FAILED; diff --git a/ge/common/auth/file_saver.cc b/ge/common/auth/file_saver.cc index 4cad5a31..cb297d88 100755 --- a/ge/common/auth/file_saver.cc +++ b/ge/common/auth/file_saver.cc @@ -69,8 +69,8 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); - REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", - write_count, strerror(errno)); + REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", + write_count, strerror(errno)); return FAILED; } size -= size_1g; diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index f15fb99e..646f8b2c 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -195,8 +195,8 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu!", partition_task_size); - REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid,", - partition_task_size); + REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid,", + partition_task_size); return FAILED); task_buffer = ge::Buffer(partition_task_size); @@ -365,8 +365,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo REPORT_INNER_ERROR("E19999", "Ge_root_model has no sub model"); return FAILED); GE_IF_BOOL_EXEC(output_file.empty(), - GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix"); - REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid " + "file name prefix"); + REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid " + "file name prefix"); return FAILED); if (!is_unknown_shape) { @@ -516,9 +518,10 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "[Load][Model]Model_data is nullptr or model_data_size is 0"); - REPORT_INNER_ERROR("E19999", "Load model failed, Model_data is nullptr or model_data_size is 0"); + REPORT_INNER_ERROR("E19999", "Load model failed, " + "Model_data is nullptr or model_data_size is 0"); return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } From b731d864112cc22295d7d39ff2acc2ae27757786 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Tue, 13 Apr 2021 20:52:33 +0800 Subject: [PATCH 06/19] ge log optimize --- ge/common/dump/dump_op.cc | 4 ++-- ge/common/dump/opdebug_register.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index fe0dce9b..12a1572f 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -130,7 +130,7 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { } int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, iutput_size %d", iutput_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input_size %d", input_size); REPORT_CALL_ERROR("E19999", "Get input size %d failed", input_size); return ACL_ERROR_GE_INTERNAL_ERROR; } @@ -205,7 +205,7 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { stream_); if (rt_ret != RT_ERROR_NONE) { GELOGE(rt_ret, "Call rtCpuKernelLaunch failed, ret:0x%X", rt_ret); - REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret: 0x%X", rt_ret) + REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret: 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } GELOGI("Kernel launch dump op success"); diff --git a/ge/common/dump/opdebug_register.cc b/ge/common/dump/opdebug_register.cc index b8f38652..c8ca741e 100644 --- a/ge/common/dump/opdebug_register.cc +++ b/ge/common/dump/opdebug_register.cc @@ -79,7 +79,7 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de GELOGE(ret, "[Malloc][MemForOpdebug]Failed in stream overflow, ret:0x%X", ret); REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, " "ret:0x%X", ret); - return ret + return ret; } uint32_t debug_stream_id = 0; From 5c52ec5b96a653c82bd31f20c089c0b3b33bcabe Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Tue, 13 Apr 2021 21:10:14 +0800 Subject: [PATCH 07/19] ge log optimize --- ge/common/helper/model_cache_helper.cc | 0 ge/common/helper/model_cache_helper.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 ge/common/helper/model_cache_helper.cc mode change 100644 => 100755 ge/common/helper/model_cache_helper.h diff --git a/ge/common/helper/model_cache_helper.cc b/ge/common/helper/model_cache_helper.cc old mode 100644 new mode 100755 diff --git a/ge/common/helper/model_cache_helper.h b/ge/common/helper/model_cache_helper.h old mode 100644 new mode 100755 From c6df234185848cf07e7bf55e99f94e78ad585e73 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Wed, 14 Apr 2021 11:27:38 +0800 Subject: [PATCH 08/19] ge log optimize --- ge/common/dump/dump_manager.cc | 1 + ge/common/dump/dump_op.cc | 4 ++-- ge/common/helper/model_helper.cc | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ge/common/dump/dump_manager.cc b/ge/common/dump/dump_manager.cc index cf2460d0..51936260 100644 --- a/ge/common/dump/dump_manager.cc +++ b/ge/common/dump/dump_manager.cc @@ -86,6 +86,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf dump_path = dump_config.dump_path; if (dump_path.empty()) { GELOGE(PARAM_INVALID, "[Check][DumpPath]It is empty"); + REPORT_INNER_ERROR("E19999", "Dump path check is empty"); return PARAM_INVALID; } diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 12a1572f..9a75c786 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -130,8 +130,8 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { } int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input_size %d", input_size); - REPORT_CALL_ERROR("E19999", "Get input size %d failed", input_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input_size %ld", input_size); + REPORT_CALL_ERROR("E19999", "Get input size %ld failed", input_size); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get input size in lanch dump op is %ld", input_size); diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 646f8b2c..38dcd8ac 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -533,14 +533,14 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c if (ReleaseLocalModelData() != SUCCESS) { GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "[Release][ModelData]Failed."); - REPORT_INNER_ERROR("E19999", "Release local model data failed"); + REPORT_CALL_ERROR("E19999", "Release local model data failed"); return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][ModelContent]Failed!"); - REPORT_INNER_ERROR("E19999", "Parse model content failed"); + REPORT_CALL_ERROR("E19999", "Parse model content failed"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -549,7 +549,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { GELOGE(status, "[Init][OmLoadHelper]Failed"); - REPORT_INNER_ERROR("E19999", "Om_load_helper init failed"); + REPORT_CALL_ERROR("E19999", "Om_load_helper init failed"); model_addr_tmp_ = nullptr; return status; } @@ -566,7 +566,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c status = GenerateGeModel(om_load_helper); if (status != SUCCESS) { GELOGE(status, "[Generate][GEModel]Failed"); - REPORT_INNER_ERROR("E19999", "Generate GE model failed"); + REPORT_CALL_ERROR("E19999", "Generate GE model failed"); return status; } GELOGD("in ModelHelper::LoadModel, is_assign_model_ is setted to true!"); @@ -591,7 +591,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod if (ReleaseLocalModelData() != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Release][ModelData]Failed."); - REPORT_INNER_ERROR("E19999", "Release local root model data failed"); + REPORT_CALL_ERROR("E19999", "Release local root model data failed"); return INTERNAL_ERROR; } @@ -618,7 +618,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod } if (status != SUCCESS) { GELOGE(status, "[Init][OmLoadHelper]Failed"); - REPORT_INNER_ERROR("E19999", "Om_load_helper init failed"); + REPORT_CALL_ERROR("E19999", "Om_load_helper init failed"); model_addr_tmp_ = nullptr; return status; } @@ -669,7 +669,7 @@ Status ModelHelper::GenerateGeRootModel(OmFileLoadHelper &om_load_helper) { if (!is_unknown_shape_model_) { if (GenerateGeModel(om_load_helper) != SUCCESS) { GELOGE(FAILED, "[Generate][GERootModel]Failed"); - REPORT_INNER_ERROR("E19999", "Generate GE root model failed"); + REPORT_CALL_ERROR("E19999", "Generate GE root model failed"); return FAILED; } GE_CHECK_NOTNULL(model_); From c0fc6a6c852f1e4120b8f6e990334c6ab4345718 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Wed, 14 Apr 2021 17:12:13 +0800 Subject: [PATCH 09/19] ge log optimize --- ge/client/ge_api.cc | 6 +++--- ge/common/dump/dump_op.cc | 4 ++-- ge/common/helper/model_helper.cc | 7 ++++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index d9441cc2..b1e022a8 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -113,7 +113,7 @@ Status GEInitializeImpl(const std::map &options) { if (!is_proto_init) { GELOGE(GE_CLI_INIT_FAILED, "[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", - opsproto_path.c_str()); + opsproto_path.c_str()); REPORT_CALL_ERROR("E19999", "Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid", opsproto_path.c_str()); return FAILED; @@ -488,7 +488,7 @@ Status Session::RemoveGraph(uint32_t graph_id) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag "); REPORT_INNER_ERROR("E19999", - "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag."); + "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag."); return FAILED; } @@ -614,7 +614,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); REPORT_INNER_ERROR("E19999", "Build graph failed, the GELib instance is nullptr or is not InitFlag."); diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 9a75c786..1fa87b4a 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -102,8 +102,8 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { } int64_t output_size = 0; if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output_size %d", output_size); - REPORT_CALL_ERROR("E19999", "Get output_size %d failed", output_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output_size %ld", output_size); + REPORT_CALL_ERROR("E19999", "Get output_size %ld failed", output_size); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get output size in lanch dump op is %ld", output_size); diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 38dcd8ac..fcf550c6 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -421,7 +421,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo auto ret = SaveModelHeader(om_file_save_helper, first_ge_model, model_names.size()); if (ret != SUCCESS) { - GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", first_ge_model->GetName().c_str()); + GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", + first_ge_model->GetName().c_str()); REPORT_INNER_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str()); return INTERNAL_ERROR; } @@ -576,7 +577,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "[Load][RootModel]" + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "[Load][RootModel] " "Model_data is nullptr or model_data_size is 0"); REPORT_INNER_ERROR("E19999", "Load root model failed, model_data is nullptr or its size is 0"); return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; @@ -1016,7 +1017,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "[Parse][ModelContent]Failed because of invalid om file. Please check --om param."); + "[Parse][ModelContent]Failed because of invalid om file. Please check om param."); return ret; } From 04bac0b6326e598c4196d5946e9c0d70fdc99134 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Wed, 14 Apr 2021 17:37:56 +0800 Subject: [PATCH 10/19] ge log optimize --- ge/analyzer/analyzer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/analyzer/analyzer.cc b/ge/analyzer/analyzer.cc index c4ebd393..95036267 100755 --- a/ge/analyzer/analyzer.cc +++ b/ge/analyzer/analyzer.cc @@ -224,7 +224,7 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ if (!json_file_.is_open()) { GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", json_file_name_.c_str()); - REPORT_INNER_ERROR("E19999", "Analyze file %s dose not exist"); + REPORT_INNER_ERROR("E19999", "Analyze file %s dose not exist", json_file_name_.c_str()); return PARAM_INVALID; } From 2ba7e7b50c12cfaf9561d9a3677329ba9c12891c Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 15 Apr 2021 15:38:18 +0800 Subject: [PATCH 11/19] ge log optimize --- ge/client/ge_api.cc | 25 ++++-- ge/common/dump/dump_op.cc | 5 +- ge/common/dump/opdebug_register.cc | 12 +-- ge/common/helper/model_helper.cc | 163 +++++++++++++++++++++---------------- 4 files changed, 116 insertions(+), 89 deletions(-) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index b1e022a8..975dbf3b 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -357,6 +357,7 @@ Session::~Session() { } catch (google::protobuf::FatalException &e) { GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed " "because get fatalException."); + REPORT_CALL_ERROR("E19999", "Destruct session failed, get fatal exception"); } // check return status, return, update session id if success @@ -486,9 +487,11 @@ Status Session::RemoveGraph(uint32_t graph_id) { std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (!instance_ptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag "); + "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag."); + "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } @@ -566,9 +569,11 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag."); + "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RunGraph Failed, GELib instance is nullptr or is not InitFlag."); + "RunGraph Failed, GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Running Graph"); @@ -615,9 +620,11 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); + "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "Build graph failed, the GELib instance is nullptr or is not InitFlag."); + "Build graph failed, the GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); @@ -641,9 +648,11 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag."); + "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag."); + "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, + session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 1fa87b4a..fe97ae22 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -239,9 +239,8 @@ Status DumpOp::LaunchDumpOp() { int32_t device_id = 0; rtError_t rt_ret = rtGetDevice(&device_id); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X, device_id %d.", rt_ret, device_id); - REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X, device_id %d.", - rt_ret, device_id); + GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } if (device_id < 0) { diff --git a/ge/common/dump/opdebug_register.cc b/ge/common/dump/opdebug_register.cc index c8ca741e..816455a0 100644 --- a/ge/common/dump/opdebug_register.cc +++ b/ge/common/dump/opdebug_register.cc @@ -27,9 +27,9 @@ Status OpdebugRegister::RegisterDebugForModel(rtModel_t model_handle, uint32_t o GELOGD("Start to register debug for model in overflow"); auto ret = MallocMemForOpdebug(); if (ret != SUCCESS) { - GELOGE(ret, "[Malloc][MemForOpdebug]Failed in model overflow, ret:0x%X", ret); - REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, " - "ret 0x%X", ret); + GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for model overflow, ret:0x%X", ret); + REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug " + "for model in overflow, ret 0x%X", ret); return ret; } uint32_t debug_stream_id = 0; @@ -76,9 +76,9 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de GELOGD("Start to register debug for stream in stream overflow"); auto ret = MallocMemForOpdebug(); if (ret != SUCCESS) { - GELOGE(ret, "[Malloc][MemForOpdebug]Failed in stream overflow, ret:0x%X", ret); - REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, " - "ret:0x%X", ret); + GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for stream in overflow, ret:0x%X", ret); + REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug " + "for stream in overflow, ret:0x%X", ret); return ret; } diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index fcf550c6..ddfc02ae 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -119,8 +119,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save model_tmp->SetAttr(ge_model->MutableAttrMap()); Status ret = SaveSizeToModelDef(ge_model); if (ret != SUCCESS) { - GELOGE(ret, "[Save][SizeToModelDef]Failed, error_code %u", ret); - REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, error_code %u", ret); + GELOGE(ret, "[Save][SizeToModelDef]Failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); return ret; } @@ -129,10 +131,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr &om_file_save if (model_buffer.GetSize() > 0) { if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(), model_buffer.GetSize(), model_index) != SUCCESS) { - GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model_def size %zu, model_index %zu", - model_buffer.GetSize(), model_index); - REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model_def %zu, " - "model_index %zu", model_buffer.GetSize(), model_index); + GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model %s, model_def size %zu, model_index %zu", + ge_model->GetName().c_str(), model_buffer.GetSize(), model_index); + REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model %s, model_def %zu, " + "model_index %zu", ge_model->GetName().c_str(), model_buffer.GetSize(), model_index); return PARAM_INVALID; } } @@ -187,24 +189,26 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { std::shared_ptr model_task_def = ge_model->GetModelTaskDefPtr(); if (model_task_def == nullptr) { - GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr"); - REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr"); + GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr, " + "model %s", ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr, model %s", + ge_model->GetName().c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } size_t partition_task_size = model_task_def->ByteSizeLong(); GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, - GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu!", - partition_task_size); - REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid,", - partition_task_size); + GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu, model %s", + partition_task_size, ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid, model %s", + partition_task_size, ge_model->GetName().c_str()); return FAILED); task_buffer = ge::Buffer(partition_task_size); if (task_buffer.GetSize() == 0) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][ModelTaskDefBuffer]Failed, " - "model def size %zu", partition_task_size); - REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu", - partition_task_size); + "model def size %zu, model %s", partition_task_size, ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu " + "model %s", partition_task_size, ge_model->GetName().c_str()); return ACL_ERROR_GE_MEMORY_ALLOCATION; } (void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast(partition_task_size)); @@ -215,9 +219,10 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr &om_file_ if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), partition_task_size, model_index) != SUCCESS) { GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, " - "model_index %zu", partition_task_size, model_index); + "model_index %zu, model %s", partition_task_size, model_index, ge_model->GetName().c_str()); REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu " - "model_index %zu", partition_task_size, model_index); + "model_index %zu, model %s", + partition_task_size, model_index, ge_model->GetName().c_str()); return PARAM_INVALID; } return SUCCESS; @@ -237,11 +242,11 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s platform_version.size() + 1); if (err != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, - "[Save][Model]Failed while allocating memory for platform_version %s, errno %d", - platform_version.c_str(), err); - REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while " + "[Save][Model]Failed while allocating memory for platform_version %s, model %s, errno %d", + platform_version.c_str(), ge_model->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "ModelHelper save model %s failed while " "allocating memory for platform_version %s, errno %d", - platform_version.c_str(), err); + ge_model->GetName().c_str(), platform_version.c_str(), err); return ACL_ERROR_GE_MEMORY_ALLOCATION; } string version = reinterpret_cast(model_header.platform_version); @@ -252,10 +257,10 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size); if (err != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, - "[Save][Model]Failed while allocating memory for name %s, errno %d", + "[Save][Model]Failed while allocating memory for model %s, errno %d", ge_model->GetName().c_str(), err); REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while allocating memory " - "for name %s,errno %d", ge_model->GetName().c_str(), err); + "for model %s,errno %d", ge_model->GetName().c_str(), err); return ACL_ERROR_GE_MEMORY_ALLOCATION; } string model_name = reinterpret_cast(model_header.name); @@ -267,38 +272,43 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f const GeModelPtr &ge_model, ge::Buffer &model_buffer, ge::Buffer &task_buffer, size_t model_index) { if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) { - GELOGE(FAILED, "[Save][ModelDef]Failed, model index %zu", model_index); - REPORT_INNER_ERROR("E19999", "ModelHelper save model def failed, model index %zu", - model_index); + GELOGE(FAILED, "[Save][ModelDef]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model def failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "[Save][ModelWeights]Failed, model index %zu", model_index); - REPORT_INNER_ERROR("E19999","ModelHelper save mode weights failed, mode index %zu", - model_index); + GELOGE(FAILED, "[Save][ModelWeights]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999","ModelHelper save mode weights failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model index %zu", model_index); - REPORT_INNER_ERROR("E19999", "ModelHelper save model tbe kernel failed, model index %zu", - model_index); + GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model tbe kernel failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) { - GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model index %zu", model_index); - REPORT_INNER_ERROR("E19999", "ModelHelper save model cust aicpu failed, " - "model index %zu", model_index); + GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model cust aicpu failed, model %s " + "model index %zu", ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) { - GELOGE(FAILED, "[Save][TaskDef]Failed, model index %zu", model_index); - REPORT_INNER_ERROR("E19999", "ModelHelper save task def failed, model index %zu", - model_index); + GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save task def failed, model %s, model index %zu", + ge_model->GetName().c_str(), model_index); return FAILED; } return SUCCESS; @@ -309,8 +319,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod const std::string &output_file, ModelBufferData& model) { if (output_file.empty()) { - GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix"); - REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix"); + GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix, " + "model %s", ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix, " + "model %s", ge_model->GetName().c_str()); return FAILED; } @@ -322,25 +334,28 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer); if (ret != SUCCESS) { - GELOGE(ret, "[Save][AllModelPartition]Failed, error_code %u", ret); - REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save all model partition failed, " - "error_code %u", ret); + GELOGE(ret, "[Save][AllModelPartition]Failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save all model partition failed, model %s " + "error_code %u", ge_model->GetName().c_str(), ret); return ret; } ret = SaveModelHeader(om_file_save_helper, ge_model); if (ret != SUCCESS) { - GELOGE(ret, "[Save][ModelHeader]Failed, error_code %u", ret); - REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model header failed, " - "error_code %u", ret); + GELOGE(ret, "[Save][ModelHeader]Failed, model %s, error_code %u", + ge_model->GetName().c_str(), ret); + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model header failed, model %s " + "error_code %u", ge_model->GetName().c_str(), ret); return ret; } ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_); if (ret != SUCCESS) { - GELOGE(FAILED, "[Save][Model]Failed, output file %s", output_file.c_str()); - REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model failed, output file %s", - output_file.c_str()); + GELOGE(FAILED, "[Save][Model]Failed, model %s, output file %s", + ge_model->GetName().c_str(), output_file.c_str()); + REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model failed, model %s, " + "output file %s", ge_model->GetName().c_str(), output_file.c_str()); return ret; } return SUCCESS; @@ -413,7 +428,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo if (ret != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Save][AllModelPartition]Failed, model name %s, cur_index %zu", model_name.c_str(), cur_index); - REPORT_INNER_ERROR("E19999", "Save all model %s partition failed, cur_index %zu", + REPORT_CALL_ERROR("E19999", "Save all model %s partition failed, cur_index %zu", model_name.c_str(), cur_index); return INTERNAL_ERROR; } @@ -423,15 +438,15 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo if (ret != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", first_ge_model->GetName().c_str()); - REPORT_INNER_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str()); return INTERNAL_ERROR; } ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_); if (ret != SUCCESS) { - GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model return fail, output_file %s", + GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model eturn fail, output_file %s", output_file.c_str()); - REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s", + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s", output_file.c_str()); return FAILED; } @@ -443,7 +458,7 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin if (output_file.empty()) { GELOGE(FAILED, "[Save][Model]Received invalid file name prefix, output_file %s", output_file.c_str()); - REPORT_CALL_ERROR("E19999", "Save model received invalid file name prefix, output_file %s", + REPORT_INNER_ERROR("E19999", "Save model received invalid file name prefix, output_file %s", output_file.c_str()); return FAILED; } @@ -451,7 +466,7 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); if (compute_graph == nullptr) { GELOGE(FAILED, "[Save][Model]Failed for compute_graph null"); - REPORT_CALL_ERROR("E19999", "Save model failed for compute_graph null"); + REPORT_INNER_ERROR("E19999", "Save model failed for compute_graph null"); return FAILED; } GE_DUMP(compute_graph, "OriginalGraph"); @@ -473,8 +488,10 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin ge::Buffer model_buffer; ge::graphStatus status = model_ptr->Save(model_buffer); if (status != ge::GRAPH_SUCCESS) { - GELOGE(FAILED, "[Save][Model]Failed for save buffer fail"); - REPORT_INNER_ERROR("E19999", "Save model failed for save buffer fail"); + GELOGE(FAILED, "[Save][Model]Failed for save buffer fail, model %s", + model_ptr->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "Save model %s failed for save buffer fail", + model_ptr->GetName().c_str()); return FAILED; } std::shared_ptr om_file_save_helper = ge::MakeShared(); @@ -496,10 +513,10 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(), platform_version.size() + 1); if (err != EOK) { - GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, errno %d", - platform_version.c_str(), err); - REPORT_CALL_ERROR("E19999", "Save model failed for platform_version %s, errno %d", - platform_version.c_str(), err); + GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, model %s, errno %d", + platform_version.c_str(), model_ptr->GetName().c_str(), err); + REPORT_CALL_ERROR("E19999", "Save model %s failed for platform_version %s, errno %d", + model_ptr->GetName().c_str(), platform_version.c_str(), err); return FAILED; } size_t name_size = model_ptr->GetName().size(); @@ -599,7 +616,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!"); - REPORT_INNER_ERROR("E19999", "Parse model content failed"); + REPORT_CALL_ERROR("E19999", "Parse model content failed"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -629,7 +646,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod status = GenerateGeRootModel(om_load_helper); if (status != SUCCESS) { GELOGE(status, "[Generate][GERootModel]Failed"); - REPORT_INNER_ERROR("E19999", "Generate GE root model failed"); + REPORT_CALL_ERROR("E19999", "Generate GE root model failed"); return status; } GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); @@ -770,7 +787,7 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { GELOGE(FAILED, "[Get][ModelWeightPartition]Failed, GetWeight size:%u", partition.size); - REPORT_INNER_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", + REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); return FAILED; } @@ -785,7 +802,7 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cu ModelPartition partition; if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) { GELOGE(FAILED, "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); - REPORT_INNER_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", + REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); return FAILED; } @@ -800,7 +817,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om ModelPartition task_partition; if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); - REPORT_INNER_ERROR("E19999", "Get model task partition failed, task_partition size %u", + REPORT_CALL_ERROR("E19999", "Get model task partition failed, task_partition size %u", task_partition.size); return FAILED; } @@ -1017,7 +1034,8 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ErrorManager::GetInstance().ATCReportErrMessage("E10003", {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); GELOGE(ACL_ERROR_GE_PARAM_INVALID, - "[Parse][ModelContent]Failed because of invalid om file. Please check om param."); + "[Parse][ModelContent]Failed because of invalid om file %s, please check om param", + model_file); return ret; } @@ -1025,7 +1043,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ret = om_load_helper.Init(model_data, model_len); if (ret != SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"}); - GELOGE(ge::FAILED, "[Init][OmFile]Failed."); + GELOGE(ge::FAILED, "[Init][OmFile]Failed, model_file %s", model_file); return ret; } @@ -1033,7 +1051,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); if (ret != SUCCESS) { ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); - GELOGE(ge::FAILED, "[Get][ModelPart]Failed."); + GELOGE(ge::FAILED, "[Get][ModelPart]Failed, model_file %s", model_file); return ret; } @@ -1041,7 +1059,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef if (!flag) { ret = INTERNAL_ERROR; ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); - GELOGE(ret, "[Read][ProtoFromArray]Failed."); + GELOGE(ret, "[Read][ProtoFromArray]Failed, model_file %s", model_file); return ret; } modeldef_size = ir_part.size; @@ -1073,7 +1091,7 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model if (!flag) { free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); - GELOGE(FAILED, "[Parse][ModelInfo]Failed from string."); + GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, model_file %s", model_file); return FAILED; } free_model_data(&model.model_data); @@ -1082,7 +1100,8 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model free_model_data(&model.model_data); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" + std::string(e.what()) + "]"}); - GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message : %s", e.what()); + GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message %s, model_file %s", + e.what(), model_file); return FAILED; } } From ddd7f907f069336ff4973036a4e438c99a7b0039 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 15 Apr 2021 15:44:59 +0800 Subject: [PATCH 12/19] ge log optimize --- ge/client/ge_api.cc | 2 +- ge/common/helper/model_helper.cc | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 975dbf3b..3a07fb18 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -651,7 +651,7 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector &om_file_ if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), partition_task_size, model_index) != SUCCESS) { GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, " - "model_index %zu, model %s", partition_task_size, model_index, ge_model->GetName().c_str()); + "model_index %zu, model %s", + partition_task_size, model_index, ge_model->GetName().c_str()); REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu " "model_index %zu, model %s", partition_task_size, model_index, ge_model->GetName().c_str()); @@ -242,8 +243,8 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr &om_file_s platform_version.size() + 1); if (err != EOK) { GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, - "[Save][Model]Failed while allocating memory for platform_version %s, model %s, errno %d", - platform_version.c_str(), ge_model->GetName().c_str(), err); + "[Save][Model]Failed while allocating memory for platform_version %s, model %s, " + "errno %d", platform_version.c_str(), ge_model->GetName().c_str(), err); REPORT_CALL_ERROR("E19999", "ModelHelper save model %s failed while " "allocating memory for platform_version %s, errno %d", ge_model->GetName().c_str(), platform_version.c_str(), err); @@ -275,7 +276,7 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f GELOGE(FAILED, "[Save][ModelDef]Failed, model %s, model index %zu", ge_model->GetName().c_str(), model_index); REPORT_CALL_ERROR("E19999", "ModelHelper save model def failed, model %s, model index %zu", - ge_model->GetName().c_str(), model_index); + ge_model->GetName().c_str(), model_index); return FAILED; } @@ -283,15 +284,15 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f GELOGE(FAILED, "[Save][ModelWeights]Failed, model %s, model index %zu", ge_model->GetName().c_str(), model_index); REPORT_CALL_ERROR("E19999","ModelHelper save mode weights failed, model %s, model index %zu", - ge_model->GetName().c_str(), model_index); + ge_model->GetName().c_str(), model_index); return FAILED; } if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model %s, model index %zu", ge_model->GetName().c_str(), model_index); - REPORT_CALL_ERROR("E19999", "ModelHelper save model tbe kernel failed, model %s, model index %zu", - ge_model->GetName().c_str(), model_index); + REPORT_CALL_ERROR("E19999", "ModelHelper save model tbe kernel failed, model %s, " + "model index %zu", ge_model->GetName().c_str(), model_index); return FAILED; } @@ -299,7 +300,7 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model %s, model index %zu", ge_model->GetName().c_str(), model_index); REPORT_CALL_ERROR("E19999", "ModelHelper save model cust aicpu failed, model %s " - "model index %zu", ge_model->GetName().c_str(), model_index); + "model index %zu", ge_model->GetName().c_str(), model_index); return FAILED; } @@ -308,7 +309,7 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr& om_f GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu", ge_model->GetName().c_str(), model_index); REPORT_CALL_ERROR("E19999", "ModelHelper save task def failed, model %s, model index %zu", - ge_model->GetName().c_str(), model_index); + ge_model->GetName().c_str(), model_index); return FAILED; } return SUCCESS; From b3c2892738614295fc6b1958f4f0442ec0e4ef62 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 15 Apr 2021 16:35:15 +0800 Subject: [PATCH 13/19] ge log optimize --- ge/client/ge_api.cc | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index 3a07fb18..a8c0b645 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -487,11 +487,11 @@ Status Session::RemoveGraph(uint32_t graph_id) { std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (!instance_ptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } @@ -569,11 +569,11 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RunGraph Failed, GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "RunGraph Failed, GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Running Graph"); @@ -620,11 +620,11 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "Build graph failed, the GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "Build graph failed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); @@ -648,11 +648,11 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, - "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", - "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, - session_id %lu, graph_id %lu", sessionId_, graph_id); + "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, " + "session_id %lu, graph_id %lu", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); From 2532a8a4a7aa42fc1421df6ce66313f92d83f242 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 15 Apr 2021 17:00:06 +0800 Subject: [PATCH 14/19] ge log optimize --- ge/client/ge_api.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ge/client/ge_api.cc b/ge/client/ge_api.cc index a8c0b645..2af82e4d 100644 --- a/ge/client/ge_api.cc +++ b/ge/client/ge_api.cc @@ -488,10 +488,10 @@ Status Session::RemoveGraph(uint32_t graph_id) { if (!instance_ptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", "RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } @@ -570,10 +570,10 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector &inputs, s if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", "RunGraph Failed, GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Running Graph"); @@ -621,10 +621,10 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", "Build graph failed, the GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Building Graph"); @@ -649,10 +649,10 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vectorInitFlag()) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); REPORT_INNER_ERROR("E19999", "RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, " - "session_id %lu, graph_id %lu", sessionId_, graph_id); + "session_id %lu, graph_id %u", sessionId_, graph_id); return FAILED; } GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); From dd1bec6717b8ef1f9effb2bde0b0ea4205a05027 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 15 Apr 2021 19:23:37 +0800 Subject: [PATCH 15/19] ge log optimize --- ge/common/dump/dump_op.cc | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index fe97ae22..b6a29c9e 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -102,8 +102,11 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { } int64_t output_size = 0; if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output_size %ld", output_size); - REPORT_CALL_ERROR("E19999", "Get output_size %ld failed", output_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, tensor name %s, " + "tensor type %s, output_size %ld", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), output_size); + REPORT_CALL_ERROR("E19999", "Get output_size %ld failed, tensor name %s, tensor type %s", + output_size, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get output size in lanch dump op is %ld", output_size); @@ -130,8 +133,10 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { } int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input_size %ld", input_size); - REPORT_CALL_ERROR("E19999", "Get input size %ld failed", input_size); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, tesor name %s, tensor type %s, " + "input_size %ld", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), input_size); + REPORT_CALL_ERROR("E19999", "Get input size %ld failed, tensor name %s, tensor type %s", + input_size, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get input size in lanch dump op is %ld", input_size); @@ -275,8 +280,10 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpOutput) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Output]Failed, ret 0x%X", ret); - REPORT_CALL_ERROR("E19999", "Dump Output failed, ret 0x%X", ret); + GELOGE(ret, "[Dump][Output]Failed, tensor name %s, tensor type %s, ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed, tensor name %s, tensor type %s, ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); @@ -284,8 +291,10 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpInput) { auto ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Input]Failed, ret 0x%X", ret); - REPORT_CALL_ERROR("E19999", "Dump Input failed, ret 0x%X", ret); + GELOGE(ret, "[Dump][Input]Failed, tensor name %s, tensor type %s, ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Input failed, tensor name %s, tensor type %s, ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); @@ -293,14 +302,21 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpAll || dump_properties_.IsOpDebugOpen()) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Output]Failed when in dumping all, ret 0x%X", ret); - REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, ret 0x%X", ret); + GELOGE(ret, "[Dump][Output]Failed when in dumping all, tensor name %s, tensor type %s, " + "ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, tensor name %s, " + "tensor type %s,ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Input]Failed when in dumping all, ret 0x%X", ret); - REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, ret 0x%X", ret); + GELOGE(ret, "[Dump][Input]Failed when in dumping all, tensor name %s, " + "tensor type %s, ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, tensor name %s, " + "tensor type %s, ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } op_mapping_info.mutable_task()->Add(std::move(task)); From 8b59a93089a03a00407094dcd3b0d0258b3d483e Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Thu, 15 Apr 2021 19:26:24 +0800 Subject: [PATCH 16/19] ge log optimize --- ge/common/dump/dump_op.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index b6a29c9e..e2a5d57c 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -134,7 +134,8 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, tesor name %s, tensor type %s, " - "input_size %ld", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), input_size); + "input_size %ld", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), input_size); REPORT_CALL_ERROR("E19999", "Get input size %ld failed, tensor name %s, tensor type %s", input_size, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; From 47cfda3ada8122232f6b07a85af5b2fe646d9b02 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Sat, 17 Apr 2021 11:52:55 +0800 Subject: [PATCH 17/19] ge log optimize --- ge/common/dump/dump_op.cc | 47 ++++++++++++++++++---------------------- ge/common/helper/model_helper.cc | 27 +++++++---------------- 2 files changed, 29 insertions(+), 45 deletions(-) diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index e2a5d57c..0e4ffe40 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -102,11 +102,10 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { } int64_t output_size = 0; if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, tensor name %s, " - "tensor type %s, output_size %ld", - op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), output_size); - REPORT_CALL_ERROR("E19999", "Get output_size %ld failed, tensor name %s, tensor type %s", - output_size, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output %zu, node %s(%s),", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), output_size); + REPORT_CALL_ERROR("E19999", "Get output %zu tensor size pf node %s(%s) failed", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get output size in lanch dump op is %ld", output_size); @@ -133,11 +132,10 @@ Status DumpOp::DumpInput(aicpu::dump::Task &task) { } int64_t input_size = 0; if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { - GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, tesor name %s, tensor type %s, " - "input_size %ld", - op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), input_size); - REPORT_CALL_ERROR("E19999", "Get input size %ld failed, tensor name %s, tensor type %s", - input_size, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); + GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input %zu, node %s(%s)", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); + REPORT_CALL_ERROR("E19999", "Get input %zu tensor size of node %s(%s) failed", + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } GELOGD("Get input size in lanch dump op is %ld", input_size); @@ -190,8 +188,8 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { } rt_ret = rtMemcpy(proto_size_dev_mem_, sizeof(size_t), &proto_size, sizeof(size_t), RT_MEMCPY_HOST_TO_DEVICE); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret: 0x%X", rt_ret); - REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } @@ -210,8 +208,8 @@ Status DumpOp::ExecutorDumpOp(aicpu::dump::OpMappingInfo &op_mapping_info) { nullptr, // no need smDesc stream_); if (rt_ret != RT_ERROR_NONE) { - GELOGE(rt_ret, "Call rtCpuKernelLaunch failed, ret:0x%X", rt_ret); - REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret: 0x%X", rt_ret); + GELOGE(rt_ret, "[Call][rtCpuKernelLaunch]Failed, ret 0x%X", rt_ret); + REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret 0x%X", rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret); } GELOGI("Kernel launch dump op success"); @@ -281,9 +279,9 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpOutput) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Output]Failed, tensor name %s, tensor type %s, ret 0x%X", + GELOGE(ret, "[Dump][Output]Failed, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); - REPORT_CALL_ERROR("E19999", "Dump Output failed, tensor name %s, tensor type %s, ret 0x%X", + REPORT_CALL_ERROR("E19999", "Dump Output failed, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } @@ -292,9 +290,9 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpInput) { auto ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Input]Failed, tensor name %s, tensor type %s, ret 0x%X", + GELOGE(ret, "[Dump][Input]Failed, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); - REPORT_CALL_ERROR("E19999", "Dump Input failed, tensor name %s, tensor type %s, ret 0x%X", + REPORT_CALL_ERROR("E19999", "Dump Input failed, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } @@ -303,20 +301,17 @@ Status DumpOp::LaunchDumpOp() { if (dump_properties_.GetDumpMode() == kDumpAll || dump_properties_.IsOpDebugOpen()) { auto ret = DumpOutput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Output]Failed when in dumping all, tensor name %s, tensor type %s, " - "ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); - REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, tensor name %s, " - "tensor type %s,ret 0x%X", + GELOGE(ret, "[Dump][Output]Failed when in dumping all, node %s(%s), ret 0x%X", + op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); + REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } ret = DumpInput(task); if (ret != SUCCESS) { - GELOGE(ret, "[Dump][Input]Failed when in dumping all, tensor name %s, " - "tensor type %s, ret 0x%X", + GELOGE(ret, "[Dump][Input]Failed when in dumping all, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); - REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, tensor name %s, " - "tensor type %s, ret 0x%X", + REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, node %s(%s), ret 0x%X", op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); return ret; } diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 1bcecd20..bcc83893 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -355,7 +355,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod if (ret != SUCCESS) { GELOGE(FAILED, "[Save][Model]Failed, model %s, output file %s", ge_model->GetName().c_str(), output_file.c_str()); - REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model failed, model %s, " + REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model failed, model %s, " "output file %s", ge_model->GetName().c_str(), output_file.c_str()); return ret; } @@ -546,20 +546,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c if (is_assign_model_) { GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "[Load][Model]Model helper has already loaded!"); - REPORT_INNER_ERROR("E19999", "Model helper has already loaded"); return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; } if (ReleaseLocalModelData() != SUCCESS) { GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "[Release][ModelData]Failed."); - REPORT_CALL_ERROR("E19999", "Release local model data failed"); return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][ModelContent]Failed!"); - REPORT_CALL_ERROR("E19999", "Parse model content failed"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -568,7 +565,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { GELOGE(status, "[Init][OmLoadHelper]Failed"); - REPORT_CALL_ERROR("E19999", "Om_load_helper init failed"); model_addr_tmp_ = nullptr; return status; } @@ -576,7 +572,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c if (partition_table->num == kOriginalOmPartitionNum) { model_addr_tmp_ = nullptr; GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][OmModel]Error, please use executable om model"); - REPORT_CALL_ERROR("E19999", "Om model is error, please use executable om model"); return ACL_ERROR_GE_PARAM_INVALID; } // Encrypt model need to del temp model/no encrypt model don't need to del model @@ -585,7 +580,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c status = GenerateGeModel(om_load_helper); if (status != SUCCESS) { GELOGE(status, "[Generate][GEModel]Failed"); - REPORT_CALL_ERROR("E19999", "Generate GE model failed"); return status; } GELOGD("in ModelHelper::LoadModel, is_assign_model_ is setted to true!"); @@ -604,20 +598,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod if (is_assign_model_) { GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "[Load][RootModel]Model helper has already loaded!"); - REPORT_INNER_ERROR("E19999", "Load root model failed, model helper has already loaded"); return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; } if (ReleaseLocalModelData() != SUCCESS) { GELOGE(INTERNAL_ERROR, "[Release][ModelData]Failed."); - REPORT_CALL_ERROR("E19999", "Release local root model data failed"); return INTERNAL_ERROR; } Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); if (status != SUCCESS) { GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!"); - REPORT_CALL_ERROR("E19999", "Parse model content failed"); return ACL_ERROR_GE_PARAM_INVALID; } @@ -637,7 +628,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod } if (status != SUCCESS) { GELOGE(status, "[Init][OmLoadHelper]Failed"); - REPORT_CALL_ERROR("E19999", "Om_load_helper init failed"); model_addr_tmp_ = nullptr; return status; } @@ -647,7 +637,6 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod status = GenerateGeRootModel(om_load_helper); if (status != SUCCESS) { GELOGE(status, "[Generate][GERootModel]Failed"); - REPORT_CALL_ERROR("E19999", "Generate GE root model failed"); return status; } GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); @@ -846,7 +835,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om GELOGE(FAILED, "Get task model partition failed."); GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size %u, mode_index %zu", task_partition.size, mode_index); - REPORT_INNER_ERROR("E19999", "Get model task partition failed, " + REPORT_CALL_ERROR("E19999", "Get model task partition failed, " "task_partition size %u, mode_index %zu", task_partition.size, mode_index); return FAILED; } @@ -1043,7 +1032,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef OmFileLoadHelper om_load_helper; ret = om_load_helper.Init(model_data, model_len); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"}); + REPORT_INNER_ERROR("E19999", "Init om file %s failed", model_file); GELOGE(ge::FAILED, "[Init][OmFile]Failed, model_file %s", model_file); return ret; } @@ -1051,7 +1040,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ModelPartition ir_part; ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); if (ret != SUCCESS) { - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); + REPORT_INNER_ERROR("E19999", "Get model partition failed ,model_file %s", model_file); GELOGE(ge::FAILED, "[Get][ModelPart]Failed, model_file %s", model_file); return ret; } @@ -1059,7 +1048,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef bool flag = ReadProtoFromArray(ir_part.data, ir_part.size, &model_def); if (!flag) { ret = INTERNAL_ERROR; - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); + REPORT_INNER_ERROR("E19999", "Read proto from array failed, model_file %s", model_file); GELOGE(ret, "[Read][ProtoFromArray]Failed, model_file %s", model_file); return ret; } @@ -1091,7 +1080,7 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model bool flag = google::protobuf::TextFormat::ParseFromString(reinterpret_cast(model.model_data), &model_def); if (!flag) { free_model_data(&model.model_data); - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); + REPORT_INNER_ERROR("E19999", "Parse model info failed from string, model_file %s", model_file); GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, model_file %s", model_file); return FAILED; } @@ -1099,8 +1088,8 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model return SUCCESS; } catch (google::protobuf::FatalException &e) { free_model_data(&model.model_data); - ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" - + std::string(e.what()) + "]"}); + REPORT_INNER_ERROR("E19999", "Parse model info failed from string, exception message %s, model_file %s", + e.what(), model_file); GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message %s, model_file %s", e.what(), model_file); return FAILED; From bb6ea9f31b0e130025146d1a75e5de8d7d53a440 Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Sat, 17 Apr 2021 14:42:50 +0800 Subject: [PATCH 18/19] ge log optimize --- ge/common/dump/dump_op.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 0e4ffe40..6996df5c 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -103,7 +103,7 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { int64_t output_size = 0; if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output %zu, node %s(%s),", - i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), output_size); + i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); REPORT_CALL_ERROR("E19999", "Get output %zu tensor size pf node %s(%s) failed", i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; From a27b23778a93913c690b04780a7761ff74d7451f Mon Sep 17 00:00:00 2001 From: "liyihan2@huawei.com" Date: Sat, 17 Apr 2021 15:57:01 +0800 Subject: [PATCH 19/19] ge log optimize --- ge/common/dump/dump_op.cc | 2 +- ge/common/helper/model_helper.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/common/dump/dump_op.cc b/ge/common/dump/dump_op.cc index 6996df5c..ae29b2a8 100755 --- a/ge/common/dump/dump_op.cc +++ b/ge/common/dump/dump_op.cc @@ -104,7 +104,7 @@ Status DumpOp::DumpOutput(aicpu::dump::Task &task) { if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output %zu, node %s(%s),", i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); - REPORT_CALL_ERROR("E19999", "Get output %zu tensor size pf node %s(%s) failed", + REPORT_CALL_ERROR("E19999", "Get output %zu tensor size of node %s(%s) failed", i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); return ACL_ERROR_GE_INTERNAL_ERROR; } diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index bcc83893..b62462b2 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -1040,7 +1040,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef ModelPartition ir_part; ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); if (ret != SUCCESS) { - REPORT_INNER_ERROR("E19999", "Get model partition failed ,model_file %s", model_file); + REPORT_INNER_ERROR("E19999", "Get model partition failed, model_file %s", model_file); GELOGE(ge::FAILED, "[Get][ModelPart]Failed, model_file %s", model_file); return ret; }