From 1d3385f9943d4c9b9f7e3e5d5b73a8d8e29b1c88 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Fri, 12 Mar 2021 16:42:09 +0800 Subject: [PATCH 01/14] modify geloge and report errmsg --- ge/omm/csa_interact.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index 1b33ddbd..98e23a5b 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -79,6 +79,7 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, ErrorModule error_module) { if (!is_init_) { GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "CsaInteract has not init, can't WriteJobState"); return INTERNAL_ERROR; } if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { @@ -107,7 +108,9 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, content = content_json.dump(); } catch (const nlohmann::json::exception &e) { + GELOGE(INTERNAL_ERROR, "construct json object failed."); GELOGE(INTERNAL_ERROR, "build jobstate content json string failed, exception:%s job_state:%u", e.what(), job_state); + REPORT_INNER_ERROR("E19999", "construct json object failed. exception:%s job_state:%u", e.what(), job_state); return INTERNAL_ERROR; } @@ -169,6 +172,7 @@ void CsaInteract::WriteInternalErrorCode() { Status CsaInteract::WriteHcomDetection(const std::string &content) { if (!is_init_) { GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "WriteHcomDetection failed. CsaInteract has not init, can't WriteJobState"); return INTERNAL_ERROR; } @@ -192,28 +196,38 @@ Status CsaInteract::WriteFile(const std::string &file_name, const std::string &c int32_t fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { if (MakePath(file_name) != SUCCESS) { + GELOGE(INTERNAL_ERROR, "MakePath failed."); GELOGE(INTERNAL_ERROR, "csainteract create file path fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "MakePath failed. create file path fail, errno is %d", errno); return INTERNAL_ERROR; } fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmOpen2 failed."); GELOGE(INTERNAL_ERROR, "open file fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmOpen2 failed. open file fail, errno is %d", errno); return INTERNAL_ERROR; } } mmSsize_t ret = mmWrite(fd, reinterpret_cast(const_cast(content.c_str())), content.length()); if (ret == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmWrite failed."); GELOGE(INTERNAL_ERROR, "write file fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmWrite failed. write file fail, errno is %d", errno); ret = mmClose(fd); if (ret == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmClose failed."); GELOGE(INTERNAL_ERROR, "close file fail, error is %d", errno); + REPORT_CALL_ERROR("E19999", "mmClose failed. close file fail, error is %d", errno); } return INTERNAL_ERROR; } ret = mmClose(fd); if (ret == EN_ERROR) { + GELOGE(INTERNAL_ERROR, "mmClose failed."); GELOGE(INTERNAL_ERROR, "close file fail, error is %d", errno); + REPORT_CALL_ERROR("E19999", "mmClose failed. close file fail, error is %d", errno); return INTERNAL_ERROR; } @@ -242,7 +256,9 @@ Status CsaInteract::MakePath(const std::string &file_name) { std::string pre_path = file_path.substr(0, found + 1); if (mmAccess(pre_path.c_str()) != EN_OK) { if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { + GELOGE(INTERNAL_ERROR, "mmMkdir failed."); GELOGE(INTERNAL_ERROR, "csainteract mkdir fail, errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmMkdir failed. mkdir fail, errno is %d", errno); return INTERNAL_ERROR; } } From 6ae54b2794bbbb08c8fa9d30b463841a5787d2ed Mon Sep 17 00:00:00 2001 From: liudingyan Date: Fri, 12 Mar 2021 17:42:31 +0800 Subject: [PATCH 02/14] modify geloge and report errmsg --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 1 + .../host_cpu_ops_kernel_builder.cc | 7 +++++ ge/plugin/engine/engine_manage.cc | 27 ++++++++++++------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index cdbad1ed..f5a5032a 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -35,6 +35,7 @@ Status HostCpuEngine::Initialize(const std::map &options) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "Make HostCpuOpsKernelInfoStore failed."); + RRPORT_INNER_ERROR("E19999", "Initialize FAILED. Make HostCpuOpsKernelInfoStore failed."); return FAILED; } } diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index adb252bc..70a4a802 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -73,9 +73,13 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { GeShape output_shape = output_tensor.GetShape(); if ((TensorUtils::CalcTensorMemSize(output_shape, format, data_type, output_mem_size) != GRAPH_SUCCESS) || (output_mem_size < 0)) { + GELOGE(FAILED, "CalcTensorMemSize failed."); GELOGE(FAILED, "Calc op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); + REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed. op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", + name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), + TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } GELOGI("Calc op[%s:%s] out[%zu] mem size is %ld, format=%s, data_type=%s.", @@ -84,8 +88,11 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { TensorUtils::SetSize(output_tensor, output_mem_size); if (op_desc->UpdateOutputDesc(static_cast(i), output_tensor) != GRAPH_SUCCESS) { + GELOGE(FAILED, "UpdateOutputDesc failed."); GELOGE(FAILED, "Update op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); + REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed. op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, + TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } } diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index a14c92ea..370021a5 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -29,7 +29,8 @@ std::unique_ptr> EngineManager::engine_map_; Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr) { if (engine_ptr == nullptr) { - GELOGE(FAILED, "enginePtr is nullptr"); + GELOGE(FAILED, "RegisterEngine failed. as input param engine_ptr is nullptr"); + REPORT_INNER_ERROR("E19999", "RegisterEngine failed. as input param engine_ptr is nullptr"); return FAILED; } @@ -64,7 +65,8 @@ void RegisterAiCoreEngine() { DNNEngineAttribute attr_aicore = {ai_core, mem_type_aicore, COST_0, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr aicore_engine_ptr = MakeShared(attr_aicore); if (aicore_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "make aiCoreEnginePtr failed"); + GELOGE(ge::FAILED, "RegisterAiCoreEngine failed. as make aiCoreEnginePtr failed"); + REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed. as make aiCoreEnginePtr failed"); return; } if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { @@ -80,7 +82,8 @@ void RegisterVectorEngine() { DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vectorcore_engine_ptr = MakeShared(attr_vector_core); if (vectorcore_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "make vectorCoreEnginePtr failed"); + GELOGE(ge::FAILED, "RegisterVectorEngine failed. as make vectorCoreEnginePtr failed"); + REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed. as make vectorCoreEnginePtr failed"); return; } if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { @@ -95,7 +98,8 @@ void RegisterAiCpuEngine() { DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu); if (vm_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "make vm_engine_ptr failed"); + GELOGE(ge::FAILED, "RegisterAiCpuEngine failed. as make vm_engine_ptr failed"); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed. as make vm_engine_ptr failed"); return; } if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { @@ -110,7 +114,8 @@ void RegisterAiCpuTFEngine() { DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_2, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu_tf); if (vm_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "make vm_engine_ptr failed"); + GELOGE(ge::FAILED, "RegisterAiCpuTFEngine failed. as make vm_engine_ptr failed"); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed. as make vm_engine_ptr failed"); return; } if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { @@ -126,7 +131,8 @@ void RegisterGeLocalEngine() { DNNEngineAttribute attr_ge_local = {vm_ge_local, mem_type_ge_local, COST_9, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr ge_local_engine = MakeShared(attr_ge_local); if (ge_local_engine == nullptr) { - GELOGE(ge::FAILED, "make ge_local_engine failed"); + GELOGE(ge::FAILED, "RegisterGeLocalEngine failed. as make ge_local_engine failed"); + REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed. as make ge_local_engine failed"); return; } if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { @@ -142,7 +148,8 @@ void RegisterHostCpuEngine() { DNNEngineAttribute attr_host_cpu = {vm_host_cpu, mem_type_host_cpu, COST_10, HOST, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr host_cpu_engine = MakeShared(attr_host_cpu); if (host_cpu_engine == nullptr) { - GELOGE(ge::FAILED, "make host_cpu_engine failed"); + GELOGE(ge::FAILED, "RegisterHostCpuEngine failed. as make host_cpu_engine failed"); + REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed. as make host_cpu_engine failed"); return; } if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { @@ -157,7 +164,8 @@ void RegisterRtsEngine() { DNNEngineAttribute attr_rts = {vm_rts, mem_type_rts, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr rts_engine = MakeShared(attr_rts); if (rts_engine == nullptr) { - GELOGE(ge::FAILED, "make rts_engine failed"); + GELOGE(ge::FAILED, "RegisterRtsEngine failed. as make rts_engine failed"); + REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed. as make rts_engine failed"); return; } if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { @@ -172,7 +180,8 @@ void RegisterHcclEngine() { DNNEngineAttribute attr_hccl = {dnn_hccl, mem_type_hccl, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr hccl_engine = MakeShared(attr_hccl); if (hccl_engine == nullptr) { - GELOGE(ge::FAILED, "make hccl_engine failed"); + GELOGE(ge::FAILED, "RegisterHcclEngine failed. as make hccl_engine failed"); + REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed. as make hccl_engine failed"); return; } if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) { From 1fbc4e1fe1d96c5e375f1c547f61b5446ac53eda Mon Sep 17 00:00:00 2001 From: liudingyan Date: Mon, 15 Mar 2021 15:47:32 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E6=95=B4=E6=94=B9=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=8F=8A=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 4 +- .../host_cpu_ops_kernel_builder.cc | 7 ++- ge/init/gelib.cc | 48 ++++++++++------ ge/omm/csa_interact.cc | 33 ++++++----- .../ops_kernel_builder_manager.cc | 22 +++++--- ge/opskernel_manager/ops_kernel_manager.cc | 55 +++++++++++++------ ge/plugin/engine/engine_manage.cc | 36 ++++++------ 7 files changed, 124 insertions(+), 81 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index f5a5032a..6c9173c2 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -34,8 +34,8 @@ Status HostCpuEngine::Initialize(const std::map &options) { if (ops_kernel_store_ == nullptr) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { - GELOGE(FAILED, "Make HostCpuOpsKernelInfoStore failed."); - RRPORT_INNER_ERROR("E19999", "Initialize FAILED. Make HostCpuOpsKernelInfoStore failed."); + GELOGE(FAILED, "[init][HostCpuEngine] Initialize failed. as malloc shared_ptr failed."); + RRPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. as malloc shared_ptr failed."); return FAILED; } } diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index 70a4a802..eca43a31 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -39,7 +39,8 @@ Status HostCpuOpsKernelBuilder::Initialize(const map & Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { OpDescPtr op_desc = ge_node.GetOpDesc(); if (op_desc == nullptr) { - GELOGE(FAILED, "CalcOpRunningParam failed, as op desc is null"); + GELOGE(FAILED, "[get][opdes] OpDesc is nullptr, as input node's op desc is null."); + REPORT_INNER_ERROR("E19999", "CalcOpRunningParam failed, as input param node GetOpDesc return nullptr."); return FAILED; } @@ -74,7 +75,7 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { if ((TensorUtils::CalcTensorMemSize(output_shape, format, data_type, output_mem_size) != GRAPH_SUCCESS) || (output_mem_size < 0)) { GELOGE(FAILED, "CalcTensorMemSize failed."); - GELOGE(FAILED, "Calc op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", + GELOGE(FAILED, "[Calc][TensorMemSize] op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed. op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", @@ -89,7 +90,7 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { TensorUtils::SetSize(output_tensor, output_mem_size); if (op_desc->UpdateOutputDesc(static_cast(i), output_tensor) != GRAPH_SUCCESS) { GELOGE(FAILED, "UpdateOutputDesc failed."); - GELOGE(FAILED, "Update op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, + GELOGE(FAILED, "[Update][OutputDesc] op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed. op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 17e257c0..bc4514ae 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -68,7 +68,8 @@ Status GELib::Initialize(const map &options) { // Multiple initializations are not allowed instancePtr_ = MakeShared(); if (instancePtr_ == nullptr) { - GELOGE(GE_CLI_INIT_FAILED, "GeLib initialize failed, malloc shared_ptr failed."); + GELOGE(GE_CLI_INIT_FAILED, "[init][GeLib] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "GeLib initialize failed, as malloc shared_ptr failed."); return GE_CLI_INIT_FAILED; } @@ -76,13 +77,15 @@ Status GELib::Initialize(const map &options) { map new_options; Status ret = instancePtr_->SetRTSocVersion(options, new_options); if (ret != SUCCESS) { - GELOGE(ret, "GeLib initial failed."); + GELOGE(ret, "[set][RTSocVersion] failed, input options invalid."); + REPORT_INNER_ERROR("E19999", "GeLib initial failed, as SetRTSocVersion failed."); return ret; } ret = instancePtr_->SetAiCoreNum(new_options); if (ret != SUCCESS) { - GELOGE(ret, "GeLib initial: SetAiCoreNum failed."); + GELOGE(ret, "[Set][AiCoreNum] failed, input options invalid."); + REPORT_INNER_ERROR("E19999", "GeLib initial failed, as SetAiCoreNum failed."); return ret; } @@ -97,7 +100,8 @@ Status GELib::Initialize(const map &options) { GE_TIMESTAMP_START(Init); ret = instancePtr_->InnerInitialize(new_options); if (ret != SUCCESS) { - GELOGE(ret, "GeLib initial failed."); + GELOGE(ret, "[init][GELib] failed, as options is invalid ."); + REPORT_INNER_ERROR("E19999", "GeLib initial failed, as GELib::InnerInitialize failed."); instancePtr_ = nullptr; return ret; } @@ -118,7 +122,8 @@ Status GELib::InnerInitialize(const map &options) { Status initSystemStatus = SystemInitialize(options); GE_TIMESTAMP_END(SystemInitialize, "InnerInitialize::SystemInitialize"); if (initSystemStatus != SUCCESS) { - GELOGE(initSystemStatus, "GE system initial failed."); + GELOGE(initSystemStatus, "[init][system]failed, as options invalid."); + REPORT_INNER_ERROR("E19999", "GE system initial failed, as SystemInitialize failed."); RollbackInit(); return initSystemStatus; } @@ -129,7 +134,8 @@ Status GELib::InnerInitialize(const map &options) { Status initEmStatus = engineManager_.Initialize(options); GE_TIMESTAMP_END(EngineInitialize, "InnerInitialize::EngineInitialize"); if (initEmStatus != SUCCESS) { - GELOGE(initEmStatus, "GE engine manager initial failed."); + GELOGE(initEmStatus, "[init][enginemanager] failed, options invalid. "); + REPORT_INNER_ERROR("E19999", "GE engine manager initial failed, as call DNNEngineManager::Initialize failed. "); RollbackInit(); return initEmStatus; } @@ -140,7 +146,8 @@ Status GELib::InnerInitialize(const map &options) { Status initOpsStatus = opsManager_.Initialize(options); GE_TIMESTAMP_END(OpsManagerInitialize, "InnerInitialize::OpsManagerInitialize"); if (initOpsStatus != SUCCESS) { - GELOGE(initOpsStatus, "GE ops manager initial failed."); + GELOGE(initOpsStatus, "[init][OpsKernelManager] failed, options invalid. "); + REPORT_INNER_ERROR("E19999", "GE ops manager initial failed. as call OpsKernelManager::Initialize failed. "); RollbackInit(); return initOpsStatus; } @@ -151,7 +158,8 @@ Status GELib::InnerInitialize(const map &options) { Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); GE_TIMESTAMP_END(OpsKernelBuilderManagerInitialize, "InnerInitialize::OpsKernelBuilderManager"); if (initOpsBuilderStatus != SUCCESS) { - GELOGE(initOpsBuilderStatus, "GE ops builder manager initial failed."); + GELOGE(initOpsBuilderStatus, "[init][OpsKernelBuilderManager] failed, options invalid."); + REPORT_INNER_ERROR("E19999", "GE ops buildermanager initial failed, as call OpsKernelBuilderManager::Initialize failed."); RollbackInit(); return initOpsBuilderStatus; } @@ -162,7 +170,8 @@ Status GELib::InnerInitialize(const map &options) { Status initSmStatus = sessionManager_.Initialize(options); GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); if (initSmStatus != SUCCESS) { - GELOGE(initSmStatus, "GE session manager initial failed."); + GELOGE(initSmStatus, "[init][SessionManager] failed, options invalid."); + REPORT_INNER_ERROR("E19999", "GE session manager initial failed. as SessionManager::Initialize failed."); RollbackInit(); return initSmStatus; } @@ -205,7 +214,8 @@ Status GELib::SystemInitialize(const map &options) { auto model_manager = ModelManager::GetInstance(); GE_CHECK_NOTNULL(model_manager); GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, - GELOGE(FAILED, "Enable exception dump failed"); + REPORT_INNER_ERROR("E19999", "ModelManager EnableExceptionDump failed, options invalid."); + GELOGE(FAILED, "[check][ModelManager][EnableExceptionDump] failed, options invalid."); return FAILED); // 1.`is_train_mode_` means case: train // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer @@ -259,7 +269,9 @@ Status GELib::SetRTSocVersion(const map &options, map &options) { options.emplace(std::make_pair(AICORE_NUM, std::to_string(aicore_num))); return SUCCESS; } - GELOGE(FAILED, "rtGetAiCoreCount failed."); + GELOGE(FAILED, "[get][AiCoreCount] failed."); + REPORT_CALL_ERROR("E19999", "rtGetAiCoreCount failed."); return FAILED; } @@ -355,7 +368,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt mem_type.push_back(RT_MEMORY_P2P_DDR); Status initMmStatus = MemManager::Instance().Initialize(mem_type); if (initMmStatus != SUCCESS) { - GELOGE(initMmStatus, "[Initialize] MemoryAllocatorManager initialize failed."); + GELOGE(initMmStatus, "[Init][MemManager] MemoryAllocatorManager initialize failed."); return initMmStatus; } @@ -363,7 +376,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt // Update CSA file CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); - GE_LOGE_IF(ret != SUCCESS, "write job state failed, ret:%u", ret); + GE_LOGE_IF(ret != SUCCESS, "[write] [job state] failed, ret:%u", ret); // set device id GELOGI("set logical device id:%u", options.device_id); @@ -394,7 +407,7 @@ Status GELib::SystemShutdownWithOptions(const Options &options) { // Update CSA file Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_SUCCEED); - GE_LOGE_IF(ret != SUCCESS, "write job state failed, ret:%u", ret); + GE_LOGE_IF(ret != SUCCESS, "[write] [job state] failed, ret:%u", ret); is_system_inited = false; is_shutdown = true; @@ -410,7 +423,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithout mem_type.push_back(RT_MEMORY_P2P_DDR); Status initMmStatus = MemManager::Instance().Initialize(mem_type); if (initMmStatus != SUCCESS) { - GELOGE(initMmStatus, "[Initialize] MemoryAllocatorManager initialize failed."); + GELOGE(initMmStatus, "[Initialize][MemManager] MemoryAllocatorManager initialize failed."); return initMmStatus; } GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); @@ -506,7 +519,8 @@ Status GELib::Finalize() { instancePtr_ = nullptr; init_flag_ = false; if (final_state != SUCCESS) { - GELOGE(FAILED, "finalization failed."); + GELOGE(FAILED, "[check][state]finalization failed."); + REPORT_INNER_ERROR("E19999", "GELib::Finalize finalization failed."); return final_state; } GELOGI("finalization success."); diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index 98e23a5b..e305748e 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -78,8 +78,8 @@ void CsaInteract::Init(int32_t dev_index, int64_t job_id) { Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, uint32_t module_ret_errcode, ErrorModule error_module) { if (!is_init_) { - GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); - REPORT_INNER_ERROR("E19999", "CsaInteract has not init, can't WriteJobState"); + GELOGE(INTERNAL_ERROR, "[init][CsaInteract] obj has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "CsaInteracthas not init, can't WriteJobState"); return INTERNAL_ERROR; } if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { @@ -108,9 +108,8 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, content = content_json.dump(); } catch (const nlohmann::json::exception &e) { - GELOGE(INTERNAL_ERROR, "construct json object failed."); - GELOGE(INTERNAL_ERROR, "build jobstate content json string failed, exception:%s job_state:%u", e.what(), job_state); - REPORT_INNER_ERROR("E19999", "construct json object failed. exception:%s job_state:%u", e.what(), job_state); + GELOGE(INTERNAL_ERROR, "[create] [json object] exception:%s job_state:%u", e.what(), job_state); + REPORT_INNER_ERROR("E19999", "create json object failed. exception:%s job_state:%u", e.what(), job_state); return INTERNAL_ERROR; } @@ -171,8 +170,8 @@ void CsaInteract::WriteInternalErrorCode() { /// Status CsaInteract::WriteHcomDetection(const std::string &content) { if (!is_init_) { - GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); - REPORT_INNER_ERROR("E19999", "WriteHcomDetection failed. CsaInteract has not init, can't WriteJobState"); + GELOGE(INTERNAL_ERROR, "[init][CsaInteract] obj has not init,can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "CsaInteracthas not init, can't WriteJobState"); return INTERNAL_ERROR; } @@ -197,15 +196,15 @@ Status CsaInteract::WriteFile(const std::string &file_name, const std::string &c if (fd == EN_ERROR) { if (MakePath(file_name) != SUCCESS) { GELOGE(INTERNAL_ERROR, "MakePath failed."); - GELOGE(INTERNAL_ERROR, "csainteract create file path fail, errno is %d", errno); - REPORT_CALL_ERROR("E19999", "MakePath failed. create file path fail, errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[create] [file path] errno is %d", errno); + REPORT_CALL_ERROR("E19999", "MakePath failed. errno is %d", errno); return INTERNAL_ERROR; } fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { GELOGE(INTERNAL_ERROR, "mmOpen2 failed."); - GELOGE(INTERNAL_ERROR, "open file fail, errno is %d", errno); - REPORT_CALL_ERROR("E19999", "mmOpen2 failed. open file fail, errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[open] [file] errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmOpen2 failed. errno is %d", errno); return INTERNAL_ERROR; } } @@ -213,21 +212,21 @@ Status CsaInteract::WriteFile(const std::string &file_name, const std::string &c mmSsize_t ret = mmWrite(fd, reinterpret_cast(const_cast(content.c_str())), content.length()); if (ret == EN_ERROR) { GELOGE(INTERNAL_ERROR, "mmWrite failed."); - GELOGE(INTERNAL_ERROR, "write file fail, errno is %d", errno); - REPORT_CALL_ERROR("E19999", "mmWrite failed. write file fail, errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[write] [file] errno is %d", errno); + REPORT_CALL_ERROR("E19999", "mmWrite failed. errno is %d", errno); ret = mmClose(fd); if (ret == EN_ERROR) { GELOGE(INTERNAL_ERROR, "mmClose failed."); - GELOGE(INTERNAL_ERROR, "close file fail, error is %d", errno); - REPORT_CALL_ERROR("E19999", "mmClose failed. close file fail, error is %d", errno); + GELOGE(INTERNAL_ERROR, "[close] [file] error is %d", errno); + REPORT_CALL_ERROR("E19999", "mmClose failed. error is %d", errno); } return INTERNAL_ERROR; } ret = mmClose(fd); if (ret == EN_ERROR) { GELOGE(INTERNAL_ERROR, "mmClose failed."); - GELOGE(INTERNAL_ERROR, "close file fail, error is %d", errno); - REPORT_CALL_ERROR("E19999", "mmClose failed. close file fail, error is %d", errno); + GELOGE(INTERNAL_ERROR, "[close] [file] error is %d", errno); + REPORT_CALL_ERROR("E19999", "mmClose failed. error is %d", errno); return INTERNAL_ERROR; } diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.cc b/ge/opskernel_manager/ops_kernel_builder_manager.cc index 37bdcf7a..f7500d3d 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.cc +++ b/ge/opskernel_manager/ops_kernel_builder_manager.cc @@ -50,7 +50,8 @@ Status OpsKernelBuilderManager::Initialize(const map & GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths)); plugin_manager_.reset(new (std::nothrow)PluginManager()); GE_CHECK_NOTNULL(plugin_manager_); - GE_CHK_STATUS_RET(plugin_manager_->LoadSo(lib_paths), "Failed to load libs"); + GE_CHK_STATUS_RET(plugin_manager_->LoadSo(lib_paths), + "[load][libs]Failed, lib_paths=%s.", lib_paths.c_str()); } auto &kernel_builders = OpsKernelBuilderRegistry::GetInstance().GetAll(); @@ -61,7 +62,7 @@ Status OpsKernelBuilderManager::Initialize(const map & GELOGI("Initialize ops kernel util for %s", kernel_lib_name.c_str()); GE_CHECK_NOTNULL(it.second); GE_CHK_STATUS_RET(it.second->Initialize(options), - "Failed to invoke Initialize, kernel lib name = %s", + "[invoke][Initialize]failed, kernel lib name = %s", kernel_lib_name.c_str()); ops_kernel_builders_.emplace(kernel_lib_name, it.second); @@ -128,8 +129,11 @@ Status OpsKernelBuilderManager::CalcOpRunningParam(Node &node) const { const std::string &lib_name = op_desc->GetOpKernelLibName(); auto it = ops_kernel_builders_.find(lib_name); if (it == ops_kernel_builders_.end()) { - GELOGE(INTERNAL_ERROR, - "Failed to get OpKernelStore. libName = %s, node = %s", + GELOGE(INTERNAL_ERROR, "OpKernelLibName failed."); + GELOGE(INTERNAL_ERROR,"[Check][lib_name] libName = %s, node = %s not exist.", + lib_name.c_str(), + op_desc->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "CalcOpRunningParam failed, libName = %s, node = %s not exist.", lib_name.c_str(), op_desc->GetName().c_str()); return INTERNAL_ERROR; @@ -137,7 +141,7 @@ Status OpsKernelBuilderManager::CalcOpRunningParam(Node &node) const { GELOGD("To invoke CalcOpRunningParam, node = %s, lib name = %s", op_desc->GetName().c_str(), lib_name.c_str()); GE_CHK_STATUS_RET(it->second->CalcOpRunningParam(node), - "Failed to invoke CalcOpRunningParam, libName = %s, node = %s", + "[invoke] [CalcOpRunningParam]failed, libName = %s, node = %s", lib_name.c_str(), op_desc->GetName().c_str()); GELOGD("Done invoking CalcOpRunningParam successfully"); @@ -152,8 +156,12 @@ Status OpsKernelBuilderManager::GenerateTask(const Node &node, const std::string &lib_name = op_desc->GetOpKernelLibName(); auto it = ops_kernel_builders_.find(lib_name); if (it == ops_kernel_builders_.end()) { + GELOGE(INTERNAL_ERROR, "GenerateTask failed."); GELOGE(INTERNAL_ERROR, - "Failed to get OpKernelStore. libName = %s, node = %s", + "[Check][lib_name] libName = %s, node = %s not exist.", + lib_name.c_str(), + op_desc->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "GenerateTask failed, libName = %s, node = %s not exist.", lib_name.c_str(), op_desc->GetName().c_str()); return INTERNAL_ERROR; @@ -161,7 +169,7 @@ Status OpsKernelBuilderManager::GenerateTask(const Node &node, GELOGD("To invoke GenerateTask, node = %s, lib name = %s", op_desc->GetName().c_str(), lib_name.c_str()); GE_CHK_STATUS_RET(it->second->GenerateTask(node, context, tasks), - "Failed to invoke GenerateTask, libName = %s, node = %s", + "[invoke][GenerateTask]failed, libName = %s, node = %s", lib_name.c_str(), op_desc->GetName().c_str()); GELOGD("Done invoking GenerateTask successfully"); diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index 30f39c0d..f2d4cdad 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -56,7 +56,8 @@ Status OpsKernelManager::Initialize(const map &options_const) { std::map options(options_const); Status ret = InitPluginOptions(options); if (ret != SUCCESS) { - GELOGE(ret, "[OpsKernelManager] [Initialize] parse pluginFlag from ge options failed."); + GELOGE(ret, "[Init][PluginOptions] parse pluginFlag from ge options failed."); + REPORT_CALL_ERROR("E19999", "InitPluginOptions failed, options invalid."); return ret; } @@ -85,7 +86,8 @@ Status OpsKernelManager::Initialize(const map &options_const) { initialize_ = options; Status rst0 = plugin_manager_.InvokeAll &, Status>(kInitialize, initialize_); if (rst0 == FAILED) { - GELOGE(GE_OPS_GET_NO_VALID_SO, "There is invalid so about OpsKernelInfoStore."); + GELOGE(GE_OPS_GET_NO_VALID_SO, "[invoke][opskernelinfo]PluginManager InvokeAll failed."); + REPORT_INNER_ERROR("E19999", "PluginManager InvokeAll failed."); return GE_OPS_GET_NO_VALID_SO; } Status rst1 = @@ -114,13 +116,15 @@ Status OpsKernelManager::Initialize(const map &options_const) { } ret = InitGraphOptimizerPriority(); if ((ret != SUCCESS)) { - GELOGE(ret, "Init graph optimizer priority failed."); + GELOGE(ret, "[Init][GraphOptimizerPriority] failed."); + REPORT_CALL_ERROR("E19999", "GraphOptimizerPriority failed."); return ret; } init_flag_ = true; return SUCCESS; } else { - GELOGE(ret, "Failed to find any valid so file."); + GELOGE(ret, "[check][so file] not find any valid so file."); + REPORT_INNER_ERROR("E19999", "OpsKernelManager::Initialize failed, not find any valid so file."); return ret; } } @@ -175,20 +179,32 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, } else if (flag == 1) { enable_flag = true; } else { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:%s, its value %s is invalid, it must be 0 or 1.", + GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:%s, its value %s is invalid, it must be 0 or 1.", + plugin_name.c_str(), iter->second.c_str()); + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } } catch (std::invalid_argument &) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:ge.feFlag, its value %s is invalid_argument, it must be 0 or 1.", + GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:ge.feFlag, its value %s is invalid_argument, it must be 0 or 1.", + iter->second.c_str()); + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,its value %s is invalid_argument, it must be 0 or 1.", iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (std::out_of_range &) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:ge.feFlag, its value %s is out of range, it must be 0 or 1.", + GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:ge.feFlag, its value %s is out of range, it must be 0 or 1.", + iter->second.c_str()); + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,its value %s is out of range, it must be 0 or 1.", iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (...) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "option_key:%s, its value %s is invalid, it must be 0 or 1.", + GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:%s, its value %s is invalid, it must be 0 or 1.", + plugin_name.c_str(), iter->second.c_str()); + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } @@ -203,13 +219,13 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, Status OpsKernelManager::CheckPluginPtr() const { for (auto iter = ops_kernel_store_.begin(); iter != ops_kernel_store_.end(); ++iter) { if (iter->second == nullptr) { - GELOGE(INTERNAL_ERROR, "CheckPluginPtr OpsKernelInfoStorePtr is null"); + GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); return FAILED; } } for (auto iter1 = graph_optimizers_.begin(); iter1 != graph_optimizers_.end(); ++iter1) { if (iter1->second == nullptr) { - GELOGE(INTERNAL_ERROR, "CheckPluginPtr GraphOptimizerPtr is null"); + GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] GraphOptimizerPtr key=%s is null", iter1->first.c_str()); return FAILED; } } @@ -222,7 +238,7 @@ Status OpsKernelManager::InitOpKernelInfoStores(const map &optio GELOGI("OpKernelInfoStore name: %s.", (it.first).c_str()); Status ret = it.second->Initialize(options); if (ret != SUCCESS) { - GELOGE(GE_OPS_KERNEL_STORE_INIT_FAILED, "OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); + GELOGE(GE_OPS_KERNEL_STORE_INIT_FAILED, "[init][opKernelLib]OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); return GE_OPS_KERNEL_STORE_INIT_FAILED; } } @@ -247,7 +263,8 @@ void OpsKernelManager::InitOpsKernelInfo() { } std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, "InitOpsKernelInfo failed."); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[get][GELib]malloc instance_ptr failed."); + REPORT_INNER_ERROR("E19999", "GELib::GetInstance failed."); return; } // sort opinfo of ops_kernel_info_ @@ -291,7 +308,8 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) GE_CHK_STATUS_RET(it.second->GetAttributes(attrs)) std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, "InitGraphOptimzers failed."); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[get][GELib]malloc instance_ptr failed."); + REPORT_INNER_ERROR("E19999", "GELib::GetInstance failed."); return GE_CLI_GE_NOT_INITIALIZED; } if (!instance_ptr->DNNEngineManagerObj().IsEngineRegistered(attrs.engineName)) { @@ -300,7 +318,8 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) } Status ret = it.second->Initialize(options); if (ret != SUCCESS) { - GELOGE(GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED, "GraphOptimzer: %s initialize failed.", (it.first).c_str()); + GELOGE(GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED, "[init][GraphOptimzer]GraphOptimzer: %s initialize failed.", (it.first).c_str()); + REPORT_INNER_ERROR("E19999", "InitGraphOptimzers failed. %s initialize failed.", (it.first).c_str()); return GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED; } } @@ -317,7 +336,8 @@ Status OpsKernelManager::Finalize() { GELOGI("OpsKernelStore finalize, name: %s.", (iter->first).c_str()); Status status = iter->second->Finalize(); if (SUCCESS != status) { - GELOGE(status, "OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); + GELOGE(status, "[check][status]OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); + REPORT_INNER_ERROR("E19999", "OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); return status; } } @@ -325,7 +345,8 @@ Status OpsKernelManager::Finalize() { GELOGI("GraphOptimzers finalize, name: %s.", (iter->first).c_str()); Status status = iter->second->Finalize(); if (status != SUCCESS) { - GELOGE(status, "GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); + GELOGE(status, "[check][status]GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); + REPORT_INNER_ERROR("E19999", "GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); return status; } } @@ -443,7 +464,7 @@ Status OpsKernelManager::FinalizeOpsKernel() { GELOGI("ge invoke ops kernal finalize."); Status ret = plugin_manager_.InvokeAll(kFinalize); if (ret != SUCCESS) { - GELOGE(ret, "[Finalize] invoke Fe finalize failed."); + GELOGE(ret, "[Finalize][check][status] invoke Fe finalize failed."); return ret; } diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index 370021a5..2065fb6b 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -29,8 +29,8 @@ std::unique_ptr> EngineManager::engine_map_; Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr) { if (engine_ptr == nullptr) { - GELOGE(FAILED, "RegisterEngine failed. as input param engine_ptr is nullptr"); - REPORT_INNER_ERROR("E19999", "RegisterEngine failed. as input param engine_ptr is nullptr"); + GELOGE(FAILED, "[Register][Engine] failed, as input engine_ptr is nullptr"); + REPORT_INNER_ERROR("E19999", "RegisterEngine failed, as input engine_ptr is nullptr"); return FAILED; } @@ -65,8 +65,8 @@ void RegisterAiCoreEngine() { DNNEngineAttribute attr_aicore = {ai_core, mem_type_aicore, COST_0, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr aicore_engine_ptr = MakeShared(attr_aicore); if (aicore_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "RegisterAiCoreEngine failed. as make aiCoreEnginePtr failed"); - REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed. as make aiCoreEnginePtr failed"); + GELOGE(ge::FAILED, "[Register][AiCoreEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { @@ -82,8 +82,8 @@ void RegisterVectorEngine() { DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vectorcore_engine_ptr = MakeShared(attr_vector_core); if (vectorcore_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "RegisterVectorEngine failed. as make vectorCoreEnginePtr failed"); - REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed. as make vectorCoreEnginePtr failed"); + GELOGE(ge::FAILED, "[Register][VectorEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { @@ -98,8 +98,8 @@ void RegisterAiCpuEngine() { DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu); if (vm_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "RegisterAiCpuEngine failed. as make vm_engine_ptr failed"); - REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed. as make vm_engine_ptr failed"); + GELOGE(ge::FAILED, "[Register][AiCpuEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { @@ -114,8 +114,8 @@ void RegisterAiCpuTFEngine() { DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_2, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu_tf); if (vm_engine_ptr == nullptr) { - GELOGE(ge::FAILED, "RegisterAiCpuTFEngine failed. as make vm_engine_ptr failed"); - REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed. as make vm_engine_ptr failed"); + GELOGE(ge::FAILED, "[Register][AiCpuTFEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { @@ -131,8 +131,8 @@ void RegisterGeLocalEngine() { DNNEngineAttribute attr_ge_local = {vm_ge_local, mem_type_ge_local, COST_9, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr ge_local_engine = MakeShared(attr_ge_local); if (ge_local_engine == nullptr) { - GELOGE(ge::FAILED, "RegisterGeLocalEngine failed. as make ge_local_engine failed"); - REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed. as make ge_local_engine failed"); + GELOGE(ge::FAILED, "[Register][GeLocalEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { @@ -148,8 +148,8 @@ void RegisterHostCpuEngine() { DNNEngineAttribute attr_host_cpu = {vm_host_cpu, mem_type_host_cpu, COST_10, HOST, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr host_cpu_engine = MakeShared(attr_host_cpu); if (host_cpu_engine == nullptr) { - GELOGE(ge::FAILED, "RegisterHostCpuEngine failed. as make host_cpu_engine failed"); - REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed. as make host_cpu_engine failed"); + GELOGE(ge::FAILED, "[Register][HostCpuEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { @@ -164,8 +164,8 @@ void RegisterRtsEngine() { DNNEngineAttribute attr_rts = {vm_rts, mem_type_rts, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr rts_engine = MakeShared(attr_rts); if (rts_engine == nullptr) { - GELOGE(ge::FAILED, "RegisterRtsEngine failed. as make rts_engine failed"); - REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed. as make rts_engine failed"); + GELOGE(ge::FAILED, "[Register][RtsEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { @@ -180,8 +180,8 @@ void RegisterHcclEngine() { DNNEngineAttribute attr_hccl = {dnn_hccl, mem_type_hccl, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr hccl_engine = MakeShared(attr_hccl); if (hccl_engine == nullptr) { - GELOGE(ge::FAILED, "RegisterHcclEngine failed. as make hccl_engine failed"); - REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed. as make hccl_engine failed"); + GELOGE(ge::FAILED, "[Register][HcclEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) { From 434619ef1d429ea16d2cbb0b38341ab21da90008 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Tue, 16 Mar 2021 08:57:18 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 4 +- .../host_cpu_ops_kernel_builder.cc | 15 ++-- ge/init/gelib.cc | 51 ++++++-------- ge/omm/csa_interact.cc | 28 +++----- .../ops_kernel_builder_manager.cc | 34 +++------ ge/opskernel_manager/ops_kernel_manager.cc | 70 +++++++++---------- 6 files changed, 86 insertions(+), 116 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index 6c9173c2..a2db431b 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -34,8 +34,8 @@ Status HostCpuEngine::Initialize(const std::map &options) { if (ops_kernel_store_ == nullptr) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { - GELOGE(FAILED, "[init][HostCpuEngine] Initialize failed. as malloc shared_ptr failed."); - RRPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. as malloc shared_ptr failed."); + GELOGE(FAILED, "[Init][HostCpuEngine] fail for new HostCpuOpsKernelInfoStore."); + RRPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); return FAILED; } } diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index eca43a31..28f0cdc4 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -39,8 +39,9 @@ Status HostCpuOpsKernelBuilder::Initialize(const map & Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { OpDescPtr op_desc = ge_node.GetOpDesc(); if (op_desc == nullptr) { - GELOGE(FAILED, "[get][opdes] OpDesc is nullptr, as input node's op desc is null."); - REPORT_INNER_ERROR("E19999", "CalcOpRunningParam failed, as input param node GetOpDesc return nullptr."); + GELOGE(FAILED, "[Check][Param:OpDesc]nullptr is invalid, node:%s.", ge_node->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "OpDesc is nullptr in node:%s, check invalid when CalcOpRunningParam", + ge_node->GetName().c_str()); return FAILED; } @@ -74,11 +75,10 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { GeShape output_shape = output_tensor.GetShape(); if ((TensorUtils::CalcTensorMemSize(output_shape, format, data_type, output_mem_size) != GRAPH_SUCCESS) || (output_mem_size < 0)) { - GELOGE(FAILED, "CalcTensorMemSize failed."); - GELOGE(FAILED, "[Calc][TensorMemSize] op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", + GELOGE(FAILED, "[Calc][TensorMemSize]fail for op[%s:%s] out[%zu], mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed. op[%s:%s] out[%zu] mem size failed, mem_size=%ld, format=%s, data_type=%s.", + REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed when CalcOpRunningParam. fail for op[%s:%s] out[%zu], mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; @@ -89,10 +89,9 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { TensorUtils::SetSize(output_tensor, output_mem_size); if (op_desc->UpdateOutputDesc(static_cast(i), output_tensor) != GRAPH_SUCCESS) { - GELOGE(FAILED, "UpdateOutputDesc failed."); - GELOGE(FAILED, "[Update][OutputDesc] op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, + GELOGE(FAILED, "[Update][OutputDesc] fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed. op[%s:%s] out[%zu] desc failed, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, + REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed when CalcOpRunningParam. fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index bc4514ae..45e84801 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -68,8 +68,7 @@ Status GELib::Initialize(const map &options) { // Multiple initializations are not allowed instancePtr_ = MakeShared(); if (instancePtr_ == nullptr) { - GELOGE(GE_CLI_INIT_FAILED, "[init][GeLib] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "GeLib initialize failed, as malloc shared_ptr failed."); + GELOGE(GE_CLI_INIT_FAILED, "[Init][GeLib] failed for new GELib."); return GE_CLI_INIT_FAILED; } @@ -77,15 +76,13 @@ Status GELib::Initialize(const map &options) { map new_options; Status ret = instancePtr_->SetRTSocVersion(options, new_options); if (ret != SUCCESS) { - GELOGE(ret, "[set][RTSocVersion] failed, input options invalid."); - REPORT_INNER_ERROR("E19999", "GeLib initial failed, as SetRTSocVersion failed."); + GELOGE(ret, "[Set][RTSocVersion] failed."); return ret; } ret = instancePtr_->SetAiCoreNum(new_options); if (ret != SUCCESS) { - GELOGE(ret, "[Set][AiCoreNum] failed, input options invalid."); - REPORT_INNER_ERROR("E19999", "GeLib initial failed, as SetAiCoreNum failed."); + GELOGE(ret, "[Set][AiCoreNum] failed."); return ret; } @@ -100,8 +97,7 @@ Status GELib::Initialize(const map &options) { GE_TIMESTAMP_START(Init); ret = instancePtr_->InnerInitialize(new_options); if (ret != SUCCESS) { - GELOGE(ret, "[init][GELib] failed, as options is invalid ."); - REPORT_INNER_ERROR("E19999", "GeLib initial failed, as GELib::InnerInitialize failed."); + GELOGE(ret, "[Init][GELib] failed."); instancePtr_ = nullptr; return ret; } @@ -122,8 +118,7 @@ Status GELib::InnerInitialize(const map &options) { Status initSystemStatus = SystemInitialize(options); GE_TIMESTAMP_END(SystemInitialize, "InnerInitialize::SystemInitialize"); if (initSystemStatus != SUCCESS) { - GELOGE(initSystemStatus, "[init][system]failed, as options invalid."); - REPORT_INNER_ERROR("E19999", "GE system initial failed, as SystemInitialize failed."); + GELOGE(initSystemStatus, "[Init][System]failed."); RollbackInit(); return initSystemStatus; } @@ -146,8 +141,7 @@ Status GELib::InnerInitialize(const map &options) { Status initOpsStatus = opsManager_.Initialize(options); GE_TIMESTAMP_END(OpsManagerInitialize, "InnerInitialize::OpsManagerInitialize"); if (initOpsStatus != SUCCESS) { - GELOGE(initOpsStatus, "[init][OpsKernelManager] failed, options invalid. "); - REPORT_INNER_ERROR("E19999", "GE ops manager initial failed. as call OpsKernelManager::Initialize failed. "); + GELOGE(initOpsStatus, "[Init][OpsKernelManager] failed. "); RollbackInit(); return initOpsStatus; } @@ -158,8 +152,7 @@ Status GELib::InnerInitialize(const map &options) { Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); GE_TIMESTAMP_END(OpsKernelBuilderManagerInitialize, "InnerInitialize::OpsKernelBuilderManager"); if (initOpsBuilderStatus != SUCCESS) { - GELOGE(initOpsBuilderStatus, "[init][OpsKernelBuilderManager] failed, options invalid."); - REPORT_INNER_ERROR("E19999", "GE ops buildermanager initial failed, as call OpsKernelBuilderManager::Initialize failed."); + GELOGE(initOpsBuilderStatus, "[Init][OpsKernelBuilderManager] failed."); RollbackInit(); return initOpsBuilderStatus; } @@ -170,8 +163,7 @@ Status GELib::InnerInitialize(const map &options) { Status initSmStatus = sessionManager_.Initialize(options); GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); if (initSmStatus != SUCCESS) { - GELOGE(initSmStatus, "[init][SessionManager] failed, options invalid."); - REPORT_INNER_ERROR("E19999", "GE session manager initial failed. as SessionManager::Initialize failed."); + GELOGE(initSmStatus, "[Init][SessionManager] failed."); RollbackInit(); return initSmStatus; } @@ -181,7 +173,7 @@ Status GELib::InnerInitialize(const map &options) { Status initHostCpuEngineStatus = HostCpuEngine::GetInstance().Initialize(); GE_TIMESTAMP_END(HostCpuEngineInitialize, "InnerInitialize::HostCpuEngineInitialize"); if (initHostCpuEngineStatus != SUCCESS) { - GELOGE(initHostCpuEngineStatus, "Failed to initialize HostCpuEngine"); + GELOGE(initHostCpuEngineStatus, "[Init][HostCpuEngine] failed."); RollbackInit(); return initHostCpuEngineStatus; } @@ -189,7 +181,7 @@ Status GELib::InnerInitialize(const map &options) { GELOGI("Start to init Analyzer!"); Status init_analyzer_status = ge::Analyzer::GetInstance()->Initialize(); if (init_analyzer_status != SUCCESS) { - GELOGE(init_analyzer_status, "Failed to initialize HostCpuEngine"); + GELOGE(init_analyzer_status, "[Init][HostCpuEngine] failed."); RollbackInit(); return init_analyzer_status; } @@ -214,8 +206,7 @@ Status GELib::SystemInitialize(const map &options) { auto model_manager = ModelManager::GetInstance(); GE_CHECK_NOTNULL(model_manager); GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, - REPORT_INNER_ERROR("E19999", "ModelManager EnableExceptionDump failed, options invalid."); - GELOGE(FAILED, "[check][ModelManager][EnableExceptionDump] failed, options invalid."); + GELOGE(FAILED, "[Enable][ExceptionDump] failed."); return FAILED); // 1.`is_train_mode_` means case: train // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer @@ -269,9 +260,7 @@ Status GELib::SetRTSocVersion(const map &options, map &options) { options.emplace(std::make_pair(AICORE_NUM, std::to_string(aicore_num))); return SUCCESS; } - GELOGE(FAILED, "[get][AiCoreCount] failed."); - REPORT_CALL_ERROR("E19999", "rtGetAiCoreCount failed."); + GELOGE(FAILED, "[Get][AiCoreCount] failed."); return FAILED; } @@ -368,7 +356,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt mem_type.push_back(RT_MEMORY_P2P_DDR); Status initMmStatus = MemManager::Instance().Initialize(mem_type); if (initMmStatus != SUCCESS) { - GELOGE(initMmStatus, "[Init][MemManager] MemoryAllocatorManager initialize failed."); + GELOGE(initMmStatus, "[Init][MemManager] failed."); return initMmStatus; } @@ -376,7 +364,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt // Update CSA file CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); - GE_LOGE_IF(ret != SUCCESS, "[write] [job state] failed, ret:%u", ret); + GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret:%u, jobstate_running=%d,substate_env_init=%d.", + ret, JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); // set device id GELOGI("set logical device id:%u", options.device_id); @@ -407,7 +396,7 @@ Status GELib::SystemShutdownWithOptions(const Options &options) { // Update CSA file Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_SUCCEED); - GE_LOGE_IF(ret != SUCCESS, "[write] [job state] failed, ret:%u", ret); + GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret:%u jobstate_succeed=%d.", ret, JOBSTATE_SUCCEED); is_system_inited = false; is_shutdown = true; @@ -423,7 +412,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithout mem_type.push_back(RT_MEMORY_P2P_DDR); Status initMmStatus = MemManager::Instance().Initialize(mem_type); if (initMmStatus != SUCCESS) { - GELOGE(initMmStatus, "[Initialize][MemManager] MemoryAllocatorManager initialize failed."); + GELOGE(initMmStatus, "[Init][MemManager] failed."); return initMmStatus; } GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); @@ -519,8 +508,8 @@ Status GELib::Finalize() { instancePtr_ = nullptr; init_flag_ = false; if (final_state != SUCCESS) { - GELOGE(FAILED, "[check][state]finalization failed."); - REPORT_INNER_ERROR("E19999", "GELib::Finalize finalization failed."); + GELOGE(FAILED, "[Check][State]finalization failed."); + REPORT_INNER_ERROR("E19999", "GELib::Finalize finalization failed because no init before."); return final_state; } GELOGI("finalization success."); diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index e305748e..34911d11 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -78,7 +78,7 @@ void CsaInteract::Init(int32_t dev_index, int64_t job_id) { Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, uint32_t module_ret_errcode, ErrorModule error_module) { if (!is_init_) { - GELOGE(INTERNAL_ERROR, "[init][CsaInteract] obj has not init, can't WriteJobState"); + GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); REPORT_INNER_ERROR("E19999", "CsaInteracthas not init, can't WriteJobState"); return INTERNAL_ERROR; } @@ -108,8 +108,8 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, content = content_json.dump(); } catch (const nlohmann::json::exception &e) { - GELOGE(INTERNAL_ERROR, "[create] [json object] exception:%s job_state:%u", e.what(), job_state); - REPORT_INNER_ERROR("E19999", "create json object failed. exception:%s job_state:%u", e.what(), job_state); + GELOGE(INTERNAL_ERROR, "[Create] [JsonObject] exception:%s job_state:%u job_sub_state:%u.", e.what(), job_state,job_sub_state); + REPORT_INNER_ERROR("E19999", "Create json object failed. exception:%s job_state:%u job_sub_state:%u", e.what(), job_state,job_sub_state); return INTERNAL_ERROR; } @@ -195,37 +195,32 @@ Status CsaInteract::WriteFile(const std::string &file_name, const std::string &c int32_t fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { if (MakePath(file_name) != SUCCESS) { - GELOGE(INTERNAL_ERROR, "MakePath failed."); - GELOGE(INTERNAL_ERROR, "[create] [file path] errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[Create][File Path] errno is %d", errno); REPORT_CALL_ERROR("E19999", "MakePath failed. errno is %d", errno); return INTERNAL_ERROR; } fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); if (fd == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "mmOpen2 failed."); - GELOGE(INTERNAL_ERROR, "[open] [file] errno is %d", errno); - REPORT_CALL_ERROR("E19999", "mmOpen2 failed. errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[Open][File] errno is %d file_name: %s", errno, file_name.c_str()); + REPORT_CALL_ERROR("E19999", "mmOpen2 failed. errno is %d file_name: %s", errno, file_name.c_str()); return INTERNAL_ERROR; } } mmSsize_t ret = mmWrite(fd, reinterpret_cast(const_cast(content.c_str())), content.length()); if (ret == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "mmWrite failed."); - GELOGE(INTERNAL_ERROR, "[write] [file] errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[Write][File] errno is %d", errno); REPORT_CALL_ERROR("E19999", "mmWrite failed. errno is %d", errno); ret = mmClose(fd); if (ret == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "mmClose failed."); - GELOGE(INTERNAL_ERROR, "[close] [file] error is %d", errno); + GELOGE(INTERNAL_ERROR, "[Close][File] error is %d", errno); REPORT_CALL_ERROR("E19999", "mmClose failed. error is %d", errno); } return INTERNAL_ERROR; } ret = mmClose(fd); if (ret == EN_ERROR) { - GELOGE(INTERNAL_ERROR, "mmClose failed."); - GELOGE(INTERNAL_ERROR, "[close] [file] error is %d", errno); + GELOGE(INTERNAL_ERROR, "[Close][File] error is %d", errno); REPORT_CALL_ERROR("E19999", "mmClose failed. error is %d", errno); return INTERNAL_ERROR; } @@ -255,9 +250,8 @@ Status CsaInteract::MakePath(const std::string &file_name) { std::string pre_path = file_path.substr(0, found + 1); if (mmAccess(pre_path.c_str()) != EN_OK) { if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { - GELOGE(INTERNAL_ERROR, "mmMkdir failed."); - GELOGE(INTERNAL_ERROR, "csainteract mkdir fail, errno is %d", errno); - REPORT_CALL_ERROR("E19999", "mmMkdir failed. mkdir fail, errno is %d", errno); + GELOGE(INTERNAL_ERROR, "[Create][File Dir] fail, errno is %d, pri_path:%s", errno, pri_path.c_str()); + REPORT_CALL_ERROR("E19999", "mmMkdir failed. errno is %d pri_path:%s", errno, pri_path.c_str()); return INTERNAL_ERROR; } } diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.cc b/ge/opskernel_manager/ops_kernel_builder_manager.cc index f7500d3d..0065f401 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.cc +++ b/ge/opskernel_manager/ops_kernel_builder_manager.cc @@ -51,7 +51,7 @@ Status OpsKernelBuilderManager::Initialize(const map & plugin_manager_.reset(new (std::nothrow)PluginManager()); GE_CHECK_NOTNULL(plugin_manager_); GE_CHK_STATUS_RET(plugin_manager_->LoadSo(lib_paths), - "[load][libs]Failed, lib_paths=%s.", lib_paths.c_str()); + "[Load][Libs]Failed, lib_paths=%s.", lib_paths.c_str()); } auto &kernel_builders = OpsKernelBuilderRegistry::GetInstance().GetAll(); @@ -62,8 +62,7 @@ Status OpsKernelBuilderManager::Initialize(const map & GELOGI("Initialize ops kernel util for %s", kernel_lib_name.c_str()); GE_CHECK_NOTNULL(it.second); GE_CHK_STATUS_RET(it.second->Initialize(options), - "[invoke][Initialize]failed, kernel lib name = %s", - kernel_lib_name.c_str()); + "[Invoke][Initialize]failed, kernel lib name = %s", kernel_lib_name.c_str()); ops_kernel_builders_.emplace(kernel_lib_name, it.second); } @@ -129,21 +128,16 @@ Status OpsKernelBuilderManager::CalcOpRunningParam(Node &node) const { const std::string &lib_name = op_desc->GetOpKernelLibName(); auto it = ops_kernel_builders_.find(lib_name); if (it == ops_kernel_builders_.end()) { - GELOGE(INTERNAL_ERROR, "OpKernelLibName failed."); - GELOGE(INTERNAL_ERROR,"[Check][lib_name] libName = %s, node = %s not exist.", - lib_name.c_str(), - op_desc->GetName().c_str()); + GELOGE(INTERNAL_ERROR,"[Check][Lib_name] libName = %s, node = %s not exist.", + lib_name.c_str(), op_desc->GetName().c_str()); REPORT_INNER_ERROR("E19999", "CalcOpRunningParam failed, libName = %s, node = %s not exist.", - lib_name.c_str(), - op_desc->GetName().c_str()); + lib_name.c_str(), op_desc->GetName().c_str()); return INTERNAL_ERROR; } GELOGD("To invoke CalcOpRunningParam, node = %s, lib name = %s", op_desc->GetName().c_str(), lib_name.c_str()); GE_CHK_STATUS_RET(it->second->CalcOpRunningParam(node), - "[invoke] [CalcOpRunningParam]failed, libName = %s, node = %s", - lib_name.c_str(), - op_desc->GetName().c_str()); + "[Invoke][CalcOpRunningParam]failed, libName = %s, node = %s", lib_name.c_str(), op_desc->GetName().c_str()); GELOGD("Done invoking CalcOpRunningParam successfully"); return SUCCESS; } @@ -156,22 +150,16 @@ Status OpsKernelBuilderManager::GenerateTask(const Node &node, const std::string &lib_name = op_desc->GetOpKernelLibName(); auto it = ops_kernel_builders_.find(lib_name); if (it == ops_kernel_builders_.end()) { - GELOGE(INTERNAL_ERROR, "GenerateTask failed."); - GELOGE(INTERNAL_ERROR, - "[Check][lib_name] libName = %s, node = %s not exist.", - lib_name.c_str(), - op_desc->GetName().c_str()); - REPORT_INNER_ERROR("E19999", "GenerateTask failed, libName = %s, node = %s not exist.", - lib_name.c_str(), - op_desc->GetName().c_str()); + GELOGE(INTERNAL_ERROR, "[Check][lib_name] libName = %s, node = %s not exist.", + lib_name.c_str(), op_desc->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "GenerateTask failed, libName = %s, node = %s not exist.", + lib_name.c_str(), op_desc->GetName().c_str()); return INTERNAL_ERROR; } GELOGD("To invoke GenerateTask, node = %s, lib name = %s", op_desc->GetName().c_str(), lib_name.c_str()); GE_CHK_STATUS_RET(it->second->GenerateTask(node, context, tasks), - "[invoke][GenerateTask]failed, libName = %s, node = %s", - lib_name.c_str(), - op_desc->GetName().c_str()); + "[Invoke][GenerateTask]failed, libName = %s, node = %s", lib_name.c_str(), op_desc->GetName().c_str()); GELOGD("Done invoking GenerateTask successfully"); return SUCCESS; } diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index f2d4cdad..1a986b45 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -123,7 +123,7 @@ Status OpsKernelManager::Initialize(const map &options_const) { init_flag_ = true; return SUCCESS; } else { - GELOGE(ret, "[check][so file] not find any valid so file."); + GELOGE(ret, "[Check][So file] not find any valid so file."); REPORT_INNER_ERROR("E19999", "OpsKernelManager::Initialize failed, not find any valid so file."); return ret; } @@ -179,33 +179,29 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, } else if (flag == 1) { enable_flag = true; } else { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); - GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:%s, its value %s is invalid, it must be 0 or 1.", - plugin_name.c_str(), iter->second.c_str()); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]option_key:%s, its value %s is invalid, it must be 0 or 1.", + plugin_name.c_str(), iter->second.c_str()); REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, option_key:%s, its value %s is invalid, it must be 0 or 1.", - plugin_name.c_str(), iter->second.c_str()); + plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } } catch (std::invalid_argument &) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); - GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:ge.feFlag, its value %s is invalid_argument, it must be 0 or 1.", - iter->second.c_str()); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data] failed, its value %s is invalid_argument, it must be 0 or 1.", + iter->second.c_str()); REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,its value %s is invalid_argument, it must be 0 or 1.", - iter->second.c_str()); + iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (std::out_of_range &) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); - GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:ge.feFlag, its value %s is out of range, it must be 0 or 1.", - iter->second.c_str()); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]failed, its value %s is out of range, it must be 0 or 1.", + iter->second.c_str()); REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,its value %s is out of range, it must be 0 or 1.", - iter->second.c_str()); + iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (...) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "ParsePluginOptions failed."); - GELOGE(GE_GRAPH_OPTIONS_INVALID, "[check][data]option_key:%s, its value %s is invalid, it must be 0 or 1.", - plugin_name.c_str(), iter->second.c_str()); + GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]option_key:%s, its value %s is invalid, it must be 0 or 1.", + plugin_name.c_str(), iter->second.c_str()); REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,option_key:%s, its value %s is invalid, it must be 0 or 1.", - plugin_name.c_str(), iter->second.c_str()); + plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } } else { @@ -219,14 +215,16 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, Status OpsKernelManager::CheckPluginPtr() const { for (auto iter = ops_kernel_store_.begin(); iter != ops_kernel_store_.end(); ++iter) { if (iter->second == nullptr) { - GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); - return FAILED; + GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); + REPORT_INNER_ERROR("E19999", "CheckPluginPtr OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); + return FAILED; } } for (auto iter1 = graph_optimizers_.begin(); iter1 != graph_optimizers_.end(); ++iter1) { if (iter1->second == nullptr) { - GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] GraphOptimizerPtr key=%s is null", iter1->first.c_str()); - return FAILED; + GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] GraphOptimizerPtr key=%s is null", iter1->first.c_str()); + REPORT_INNER_ERROR("E19999", "GraphOptimizerPtr key=%s is null", iter1->first.c_str()); + return FAILED; } } return SUCCESS; @@ -238,8 +236,9 @@ Status OpsKernelManager::InitOpKernelInfoStores(const map &optio GELOGI("OpKernelInfoStore name: %s.", (it.first).c_str()); Status ret = it.second->Initialize(options); if (ret != SUCCESS) { - GELOGE(GE_OPS_KERNEL_STORE_INIT_FAILED, "[init][opKernelLib]OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); - return GE_OPS_KERNEL_STORE_INIT_FAILED; + GELOGE(GE_OPS_KERNEL_STORE_INIT_FAILED, "[init][opKernelLib]OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); + REPORT_CALL_ERROR("E19999", "OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); + return GE_OPS_KERNEL_STORE_INIT_FAILED; } } @@ -264,7 +263,7 @@ void OpsKernelManager::InitOpsKernelInfo() { std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[get][GELib]malloc instance_ptr failed."); - REPORT_INNER_ERROR("E19999", "GELib::GetInstance failed."); + REPORT_CALL_ERROR("E19999", "GELib::GetInstance failed."); return; } // sort opinfo of ops_kernel_info_ @@ -308,8 +307,8 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) GE_CHK_STATUS_RET(it.second->GetAttributes(attrs)) std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[get][GELib]malloc instance_ptr failed."); - REPORT_INNER_ERROR("E19999", "GELib::GetInstance failed."); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib]malloc instance_ptr failed."); + REPORT_CALL_ERROR("E19999", "GELib::GetInstance failed."); return GE_CLI_GE_NOT_INITIALIZED; } if (!instance_ptr->DNNEngineManagerObj().IsEngineRegistered(attrs.engineName)) { @@ -318,8 +317,8 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) } Status ret = it.second->Initialize(options); if (ret != SUCCESS) { - GELOGE(GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED, "[init][GraphOptimzer]GraphOptimzer: %s initialize failed.", (it.first).c_str()); - REPORT_INNER_ERROR("E19999", "InitGraphOptimzers failed. %s initialize failed.", (it.first).c_str()); + GELOGE(GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED, "[Init][GraphOptimzer]GraphOptimzer: %s initialize failed.", (it.first).c_str()); + REPORT_CALL_ERROR("E19999", "InitGraphOptimzers failed. %s initialize failed.", (it.first).c_str()); return GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED; } } @@ -336,8 +335,8 @@ Status OpsKernelManager::Finalize() { GELOGI("OpsKernelStore finalize, name: %s.", (iter->first).c_str()); Status status = iter->second->Finalize(); if (SUCCESS != status) { - GELOGE(status, "[check][status]OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); - REPORT_INNER_ERROR("E19999", "OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); + GELOGE(status, "[Check][Status]OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); + REPORT_CALL_ERROR("E19999", "OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); return status; } } @@ -345,15 +344,15 @@ Status OpsKernelManager::Finalize() { GELOGI("GraphOptimzers finalize, name: %s.", (iter->first).c_str()); Status status = iter->second->Finalize(); if (status != SUCCESS) { - GELOGE(status, "[check][status]GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); - REPORT_INNER_ERROR("E19999", "GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); + GELOGE(status, "[Check][Status]GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); + REPORT_CALL_ERROR("E19999", "GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); return status; } } Status ret = FinalizeOpsKernel(); if (ret != SUCCESS) { - GELOGE(ret, "free ops kernel resource failed."); + GELOGE(ret, "[Free][Ops kernel resource] failed."); return ret; } @@ -464,8 +463,9 @@ Status OpsKernelManager::FinalizeOpsKernel() { GELOGI("ge invoke ops kernal finalize."); Status ret = plugin_manager_.InvokeAll(kFinalize); if (ret != SUCCESS) { - GELOGE(ret, "[Finalize][check][status] invoke Fe finalize failed."); - return ret; + GELOGE(ret, "[Finalize][Check][Status] invoke Fe finalize failed."); + REPORT_CALL_ERROR("E19999", "PluginManager InvokeAll failed."); + return ret; } return SUCCESS; From cd44f8ba0140829466afe380eb64ae54fd56e643 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Tue, 16 Mar 2021 16:13:40 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=95=B4=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 2 +- ge/ir_build/atc_ir_common.cc | 187 ++++++++++++------- ge/ir_build/ge_ir_build.cc | 91 +++++---- 3 files changed, 172 insertions(+), 108 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index a2db431b..62dd9ec2 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -35,7 +35,7 @@ Status HostCpuEngine::Initialize(const std::map &options) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "[Init][HostCpuEngine] fail for new HostCpuOpsKernelInfoStore."); - RRPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); + REPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); return FAILED; } } diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index ff156c75..28787048 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -78,7 +78,8 @@ Status CheckInputFormat(const string &input_format) { if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format, "input format is invalid!"}); - GELOGE(ge::PARAM_INVALID, "input format [%s] is invalid!", input_format.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputParam]input format [%s] is invalid!", input_format.c_str()); + REPORT_CALL_ERROR("E19999", "CheckInputFormat failed, input_format [%s] is invalid!", input_format.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -91,7 +92,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map vector shape = iter->second; if (shape.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10012"); - GELOGE(ge::PARAM_INVALID, "--input_shape's shape size can not be less than 1 when set --dynamic_batch_size."); + GELOGE(ge::PARAM_INVALID, "[Check][Param] shape size can not be less than 1 when set --dynamic_batch_size."); return false; } @@ -107,7 +108,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map if (size == 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10031"); - GELOGE(ge::PARAM_INVALID, "At least one batch n must be equal to -1 when set --dynamic_batch_size."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]At least one batch n must be equal to -1 when set --dynamic_batch_size."); return false; } @@ -115,8 +116,10 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map if (!isdigit(c) && (c != ',') && (c != ' ')) { ErrorManager::GetInstance().ATCReportErrMessage( "E10033", {"value", "reason"}, {dynamic_batch_size, kDynamicBatchSizeError}); - GELOGE(ge::PARAM_INVALID, "Input parameter[--dynamic_batch_size]'s value[%s] is invalid. reason: %s", - dynamic_batch_size.c_str(), kDynamicBatchSizeError); + GELOGE(ge::PARAM_INVALID, "[Check][Param] dynamic_batch_size:%s is invalid. reason: %s", + dynamic_batch_size.c_str(), kDynamicBatchSizeError); + REPORT_INNER_ERROR("E19999", "CheckDynamicBatchSizeInputShapeValid failed.dynamic_batch_size:%s is invalid. reason: %s", + dynamic_batch_size.c_str(), kDynamicBatchSizeError); return false; } } @@ -129,7 +132,9 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map bool CheckDynamicImagesizeInputShapeValid(map> shape_map, const std::string input_format, std::string &dynamic_image_size) { if (!input_format.empty() && !ge::TypeUtils::IsFormatValid(input_format.c_str())) { - GELOGE(ge::PARAM_INVALID, "user input format [%s] is not found!", input_format.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][Param] input_format [%s] invalid.", input_format.c_str()); + REPORT_INNER_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, input_format [%s] invalid.", + input_format.c_str()); return false; } int32_t size = 0; @@ -139,8 +144,8 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map if (shape.size() != DIM_DEFAULT_SIZE) { if (std::count(shape.begin(), shape.end(), kDynamicInputDim) > 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10019"); - GELOGE(ge::PARAM_INVALID, - "--input_shape's shape is invalid, only height and width can be -1 when set --dynamic_image_size."); + GELOGE(ge::PARAM_INVALID, + "[Check][Param] shape invalid, only height and width can be -1 when set --dynamic_image_size."); return false; } continue; @@ -159,7 +164,7 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map if (size == 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10019"); GELOGE(ge::PARAM_INVALID, - "--input_shape's shape is invalid, only height and width can be -1 when set --dynamic_image_size."); + "[Check][Param]shape invalid, only height and width can be -1 when set --dynamic_image_size."); return false; } @@ -174,9 +179,10 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map ErrorManager::GetInstance().ATCReportErrMessage("E10020", {"DynamicImageSizeNum"}, {std::to_string(kDynamicImageSizeNum)}); GELOGE(ge::PARAM_INVALID, - "--dynamic_image_size's number of dimensions of each " - "group must be %ld.", - kDynamicImageSizeNum); + "[Check][Param]dynamic_image_size invalid value:%s number of dimensions of each group must be %ld.", + dynamic_image_size.c_str(), kDynamicImageSizeNum); + REPORT_INNER_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, dynamic_image_size invalid value:%s number of dimensions of each group must be %ld.", + dynamic_image_size.c_str(), kDynamicImageSizeNum); return false; } } @@ -190,7 +196,7 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format.c_str(), "input_format must be ND when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "input_format must be ND when set dynamic_dims."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]input_format must be ND when set dynamic_dims."); return false; } @@ -201,7 +207,8 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_shape's dim", std::to_string(shapes.size()), "Dim num must within [1, 4] when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "Dim num must within [%zu, %zu] when set dynamic_dims.", kMinNDDimNum, kMaxNDDimNum); + GELOGE(ge::PARAM_INVALID, "[Check][Param]Dim num must within [%zu, %zu] when set dynamic_dims.", + kMinNDDimNum, kMaxNDDimNum); return false; } dynamic_dim += std::count(shapes.begin(), shapes.end(), kDynamicInputDim); @@ -210,12 +217,14 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_shape's dynamic dim num", "0", "at least one dim should be -1 when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "input_shape's shape is invalid, at least one dim should be -1 when set dynamic_dims."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]input_shape invalid, at least one dim should be -1 when set dynamic_dims."); return false; } if (!CheckAndParseDynamicDims(dynamic_dim, dynamic_dims)) { - GELOGE(ge::PARAM_INVALID, "Check and parse dynamic dims: %s failed.", dynamic_dims.c_str()); + GELOGE(ge::PARAM_INVALID, "[CheckAndParse][DynamicDims]: %s failed.", dynamic_dims.c_str()); + REPORT_CALL_ERROR("E19999", "CheckAndParseDynamicDims failed,dynamic_dim:%d dynamic_dims:%s", + dynamic_dim,dynamic_dims.c_str()); return false; } @@ -228,7 +237,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims", dynamic_dims.c_str(), "dynamic_dims can not be empty"}); - GELOGE(ge::PARAM_INVALID, "dynamic_dims can not be empty."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims can not be empty."); return false; } // Different parameter sets are split by ';' @@ -236,7 +245,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims if (split_set.size() > kMaxDynamicDimNum) { ErrorManager::GetInstance().ATCReportErrMessage( "E10042", {"parameter", "reason"}, {"dynamic_dims", "dynamic_dims's num of parameter set can not exceed 100"}); - GELOGE(ge::PARAM_INVALID, "dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); + REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); return false; } for (auto split_dim : split_set) { @@ -245,8 +255,10 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10042", {"parameter", "reason"}, {"dynamic_dims", "Each gear setting needs to be consistent with the number of -1 in the inputshape"}); - GELOGE(ge::PARAM_INVALID, "Input parameter --dynamic_dims parse failed, " - "reason: Each gear setting needs to be consistent with the number of -1 in the inputshape."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims:%s invalid. " + "reason: Each gear setting needs to be consistent with the number of -1 in the inputshape.", dynamic_dims.c_str()); + + REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); return false; } for (auto dim : one_set) { @@ -255,7 +267,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); - GELOGE(ge::PARAM_INVALID, "dynamic_dims's parameter must be positive integer."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); + REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); return false; } } @@ -271,15 +284,17 @@ bool StringToLongNoThrow(const string &str, long &val) { } catch (const std::invalid_argument) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, - "Parse input parameter [--input_shape_range]'s shape range[%s] failed, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + REPORT_INNER_ERROR("E19999", "StringToLongNoThrow failed, str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); } catch (const std::out_of_range) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); - GELOGE(PARAM_INVALID, - "Parse input parameter [--input_shape_range]'s shape range[%s] failed, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); + REPORT_INNER_ERROR("E19999", "StringToLongNoThrow failed str:%s invalid, reason: %s, correct sample is %s.", + str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); } return false; } @@ -296,9 +311,10 @@ bool ParseSingleShapeRange(std::string &shape_range, vector> shape_range_val; if (!ParseSingleShapeRange(shape_range_str, shape_range_val)) { - GELOGE(PARAM_INVALID, "Parse single shape range %s error.", shape_range_str.c_str()); + GELOGE(PARAM_INVALID, "[Parse][Param] shape_range_str: %s invalid.", shape_range_str.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, shape_range_str: %s invalid.", shape_range_str.c_str()); return false; } shape_range_map.emplace(make_pair(StringUtils::Trim(shape_range_pair_vec[0]), shape_range_val)); @@ -395,7 +418,7 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (param_size > 1) { ErrorManager::GetInstance().ATCReportErrMessage("E10009", {"parameter0", "parameter1", "parameter2"}, {"dynamic_batch_size", "dynamic_image_size", "dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); + GELOGE(ge::PARAM_INVALID, "[Parse][Param]dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); return ge::PARAM_INVALID; } @@ -403,7 +426,8 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (!input_shape_range.empty()) { std::map>> shape_range_map; if(!ParseInputShapeRange(input_shape_range, shape_range_map)) { - GELOGE(ge::PARAM_INVALID, "Failed to parse input shape range: %s", input_shape_range.c_str()); + GELOGE(ge::PARAM_INVALID, "[Parse][Param]input_shape_range: %s invalid.", input_shape_range.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, input_shape_range: %s invalid.", input_shape_range.c_str()); return ge::PARAM_INVALID; } } @@ -415,33 +439,40 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i is_dynamic_input = true; if (input_shape.empty()) { ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {"input_shape"}); - GELOGE(ge::PARAM_INVALID, "The input_shape can not be empty in dynamic input size scenario."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]The input_shape can not be empty in dynamic input size scenario."); return ge::PARAM_INVALID; } if (!ParseInputShape(input_shape, shape_map, user_shape_map, is_dynamic_input)) { - GELOGE(ge::PARAM_INVALID, "Failed to parse input shape: %s", input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Parse][InputShape]input_shape: %s invalid.", input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShape failed, input_shape: %s invalid.", input_shape.c_str()); return ge::PARAM_INVALID; } if (!dynamic_batch_size.empty()) { if (!CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size)) { - GELOGE(ge::PARAM_INVALID, "Check dynamic batch size input shape failed: %s", input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape] input_shape: %s invalid.", input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "CheckDynamicBatchSizeInputShapeValid failed, input_shape: %s invalid.", input_shape.c_str()); return ge::PARAM_INVALID; } } if (!dynamic_image_size.empty()) { if (!CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size)) { - GELOGE(ge::PARAM_INVALID, "Check dynamic image size input shape failed: %s", input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] input_shape: %s invalid. dynamic_image_size:%d ", + input_shape.c_str(), dynamic_image_size); + REPORT_CALL_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, input_shape: %s invalid. dynamic_image_size:%d ", + input_shape.c_str(), dynamic_image_size); return ge::PARAM_INVALID; } } if (!dynamic_dims.empty()) { if (!CheckDynamicDimsInputShapeValid(shape_map, input_format, dynamic_dims)) { - GELOGE(ge::PARAM_INVALID, "Check dynamic dims: %s of input shape: %s failed.", dynamic_dims.c_str(), - input_shape.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicDimsInputShape]: %s of input shape: %s failed.", dynamic_dims.c_str(), + input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "CheckDynamicDimsInputShapeValid failed, input_shape: %s invalid. dynamic_dims:%s ", + input_shape.c_str(), dynamic_dims.c_str()); return ge::PARAM_INVALID; } } @@ -492,7 +523,8 @@ bool ParseInputShape(const string &input_shape, map> &sh if (!isdigit(c)) { ErrorManager::GetInstance().ATCReportErrMessage("E10002", {"shape", "reason", "sample"}, {shape, kDigitError, kInputShapeSample2}); - GELOGE(PARAM_INVALID, "--input_shape's shape value[%s] is not digit", shape_value_str.c_str()); + GELOGE(PARAM_INVALID, "[Check][Param]input_shape:%s invalid", shape_value_str.c_str()); + REPORT_CALL_ERROR("E19999", "isdigit return false, input_shape:%s invalid", shape_value_str.c_str()); return false; } } @@ -537,7 +569,8 @@ Status CheckOutputTypeParamValid(const std::string output_type) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); GELOGE(ge::PARAM_INVALID, - "Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); + "[Check][Param]Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); + REPORT_INNER_ERROR("E19999", "CheckOutputTypeParamValid failed, output_type: %s invalid.", output_type.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -549,7 +582,8 @@ Status CheckBufferOptimizeParamValid(const std::string buffer_optimize) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--buffer_optimize", buffer_optimize, kBufferOptimizeSupport}); GELOGE(ge::PARAM_INVALID, - "Invalid value for --buffer_optimize[%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); + "[Check][Param]Invalid value for --buffer_optimize[%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); + REPORT_INNER_ERROR("E19999", "CheckBufferOptimizeParamValid failed, buffer_optimize: %s invalid.", buffer_optimize.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -558,21 +592,23 @@ Status CheckBufferOptimizeParamValid(const std::string buffer_optimize) { Status CheckCompressWeightParamValid(const std::string enable_compress_weight, const std::string compress_weight_conf) { if ((!compress_weight_conf.empty()) && (!CheckInputPathValid(compress_weight_conf, "--compress_weight_conf"))) { - GELOGE(ge::PARAM_INVALID, "compress weight config file not found, file_name:%s", compress_weight_conf.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][Param]compress weight config file not found, file_name:%s", compress_weight_conf.c_str()); + REPORT_INNER_ERROR("E19999", "CheckCompressWeightParamValid failed, compress_weight_conf: %s invalid.", compress_weight_conf.c_str()); return ge::PARAM_INVALID; } if ((enable_compress_weight != "") && (enable_compress_weight != "true") && (enable_compress_weight != "false")) { ErrorManager::GetInstance().ATCReportErrMessage( "E10005", {"parameter", "value"}, {"enable_compress_weight", enable_compress_weight}); GELOGE(ge::PARAM_INVALID, - "Input parameter[--enable_compress_weight]'s value[%s] must be true or false.", enable_compress_weight.c_str()); + "[Check][Param]enable_compress_weight:%s must be true or false.", enable_compress_weight.c_str()); + REPORT_INNER_ERROR("E19999", "CheckCompressWeightParamValid failed, enable_compress_weight: %s invalid.", enable_compress_weight.c_str()); return ge::PARAM_INVALID; } if ((enable_compress_weight == "true") && (!compress_weight_conf.empty())) { ErrorManager::GetInstance().ATCReportErrMessage("E10047", {"parameter0", "parameter1"}, {"enable_compress_weight", "compress_weight_conf"}); - GELOGE(ge::PARAM_INVALID, "enable_compress_weight and compress_weight_conf can not both exist!!"); + GELOGE(ge::PARAM_INVALID, "[Check][Param]enable_compress_weight and compress_weight_conf can not both exist!!"); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -582,7 +618,8 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype) { if ((!keep_dtype.empty()) && (!CheckInputPathValid(keep_dtype, "--keep_dtype"))) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--keep_dtype", keep_dtype, kKeepDtypeError}); - GELOGE(ge::PARAM_INVALID, "keep dtype config file not found, file_name:%s", keep_dtype.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputPath] file not found, file_name:%s", keep_dtype.c_str()); + REPORT_CALL_ERROR("E19999", "CheckInputPathValid failed, file not found, file_name:%s", keep_dtype.c_str()); return ge::PARAM_INVALID; } @@ -604,11 +641,13 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { } else if (log == "error") { ret = dlog_setlevel(-1, DLOG_ERROR, 1); } else { - GELOGE(ge::PARAM_INVALID, "invalid value for log:%s, only support debug, info, warning, error, null", log.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][LogParam]log:%s invalid, only support debug, info, warning, error, null", log.c_str()); + REPORT_INNER_ERROR("E19999", "CheckLogParamValidAndSetLogLevel failed, log:%s invalid", log.c_str()); return ret; } if (ret != 0) { - GELOGE(ge::PARAM_INVALID, "Log setlevel fail !"); + GELOGE(ge::PARAM_INVALID, "[Check][LogParam]Log setlevel fail !"); + REPORT_INNER_ERROR("E19999", "CheckLogParamValidAndSetLogLevel failed, log:%s invalid", log.c_str()); } return ret; } @@ -616,7 +655,8 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { if ((!insert_op_conf.empty()) && (!CheckInputPathValid(insert_op_conf, "--insert_op_conf"))) { - GELOGE(ge::PARAM_INVALID, "insert op config file not found: %s", insert_op_conf.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputPath]file not found: %s", insert_op_conf.c_str()); + REPORT_CALL_ERROR("E19999", "CheckInputPathValid failed, file not found: %s", insert_op_conf.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -625,7 +665,9 @@ Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { Status CheckDisableReuseMemoryParamValid(const std::string disable_reuse_memory) { if ((disable_reuse_memory != "") && (disable_reuse_memory != "0") && (disable_reuse_memory != "1")) { ErrorManager::GetInstance().ATCReportErrMessage("E10006", {"parameter"}, {"disable_reuse_memory"}); - GELOGE(ge::PARAM_INVALID, "Input parameter[--disable_reuse_memory]'s value must be 1 or 0."); + GELOGE(ge::PARAM_INVALID, "[Check][DisableReuseMemoryParam]disable_reuse_memory must be 1 or 0."); + REPORT_INNER_ERROR("E19999", "CheckDisableReuseMemoryParamValid failed, disable_reuse_memory:%s invalid.", + disable_reuse_memory.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -635,8 +677,10 @@ Status CheckEnableSingleStreamParamValid(const std::string enable_single_stream) if ((enable_single_stream != "") && (enable_single_stream != "true") && (enable_single_stream != "false")) { ErrorManager::GetInstance().ATCReportErrMessage( "E10005", {"parameter", "value"}, {"enable_single_stream", enable_single_stream}); - GELOGE(ge::PARAM_INVALID, "Input parameter[--enable_single_stream]'s value[%s] must be true or false.", - enable_single_stream.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][EnableSingleStreamParam]enable_single_stream:%s must be true or false.", + enable_single_stream.c_str()); + REPORT_INNER_ERROR("E19999", "CheckEnableSingleStreamParamValid failed, enable_single_stream:%s invalid.", + enable_single_stream.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -647,7 +691,9 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: if (optypelist_for_implmode != "" && op_select_implmode == "") { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kCompressWeightError}); - GELOGE(ge::PARAM_INVALID, "Invalid value for --op_select_implmode[%s], %s.", + GELOGE(ge::PARAM_INVALID, "[Check][ImplmodeParam]op_select_implmode:%s invalid, %s.", + op_select_implmode.c_str(),kCompressWeightError); + REPORT_INNER_ERROR("E19999", "CheckImplmodeParamValid failed, op_select_implmode:%s invalid, %s.", op_select_implmode.c_str(), kCompressWeightError); return ge::PARAM_INVALID; } @@ -659,10 +705,12 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kSelectImplmodeError}); - GELOGE(ge::PARAM_INVALID, "Invalid value for --op_select_implmode[%s], %s.", + GELOGE(ge::PARAM_INVALID, "[Check][ImplmodeParam]Invalid value for --op_select_implmode[%s], %s.", + op_select_implmode.c_str(), kSelectImplmodeError); + REPORT_INNER_ERROR("E19999", "CheckImplmodeParamValid failed, op_select_implmode:%s invalid, %s.", op_select_implmode.c_str(), kSelectImplmodeError); return ge::PARAM_INVALID; - } + }op_select_implmode[%s] } return ge::SUCCESS; @@ -725,7 +773,8 @@ Status UpdateDataOpShapeRange(const OpDescPtr &op, if (iter != shape_range_map.end()) { auto cur_shape_range = iter->second; if (TensorUtils::CheckShapeByShapeRange(origin_shape, cur_shape_range) != SUCCESS) { - GELOGE(PARAM_INVALID, "[%s] Check shape by shape range failed.", op->GetName().c_str()); + GELOGE(PARAM_INVALID, "[Check][OpDescPtr][%s] Check shape by shape range failed.", data_op_name.c_str()); + REPORT_CALL_ERROR("E19999", "CheckShapeByShapeRange failed, op invalid, op_name=%s.", data_op_name.c_str()); return PARAM_INVALID; } for (size_t idx = 0; idx < cur_shape_range.size(); idx++) { @@ -753,7 +802,8 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co map>> shape_range_map; if (!ParseInputShapeRange(input_shape_range, shape_range_map)) { - GELOGE(PARAM_INVALID, "Parse input shape range failed."); + GELOGE(PARAM_INVALID, "[Parse][InputShapeRange] input_shape_range:%s invalid.", input_shape_range.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, input_shape_range:%s invalid.", input_shape_range.c_str()); return PARAM_INVALID; } @@ -763,7 +813,8 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co GE_CHECK_NOTNULL(op); if (op->GetType() == DATA) { if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { - GELOGE(FAILED, "Update data op [%s] input shape range failed.", op->GetName().c_str()); + GELOGE(FAILED, "[Update][Data] op[%s] invalid.", op->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "UpdateDataOpShapeRange failed, op[%s] invalid.", op->GetName().c_str()); return FAILED; } } diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index bd1be318..67a2664b 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -85,21 +85,21 @@ static graphStatus CheckGlobalOptions(std::map &global ? IR_OPTION_DISABLE_REUSE_MEMORY_DEFAULT : global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY]; GE_CHK_BOOL_EXEC(ge::CheckDisableReuseMemoryParamValid(disable_reuse_memory) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check disable_reuse_memory failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][DisableReuseMemory] failed!"); global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY] = disable_reuse_memory; // check buffer_optimize std::string buffer_optimize = global_options.find(ge::ir_option::BUFFER_OPTIMIZE) == global_options.end() ? IR_OPTION_BUFFER_OPTIMIZE_DEFAULT : global_options[ge::ir_option::BUFFER_OPTIMIZE]; GE_CHK_BOOL_EXEC(ge::CheckBufferOptimizeParamValid(buffer_optimize) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check buffer optimize failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][BufferOptimize] failed!"); global_options[ge::ir_option::BUFFER_OPTIMIZE] = buffer_optimize; // check enable_single_stream std::string enable_single_stream = global_options.find(ge::ir_option::ENABLE_SINGLE_STREAM) == global_options.end() ? "" : global_options[ge::ir_option::ENABLE_SINGLE_STREAM]; GE_CHK_BOOL_EXEC(ge::CheckEnableSingleStreamParamValid(enable_single_stream) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check enable single stream failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][EnableSingleStream] failed!"); // check compress_weight std::string enable_compress_weight = global_options.find(ge::ir_option::ENABLE_COMPRESS_WEIGHT) == global_options.end() @@ -109,7 +109,7 @@ static graphStatus CheckGlobalOptions(std::map &global ? "" : global_options[ge::ir_option::COMPRESS_WEIGHT_CONF]; GE_CHK_BOOL_EXEC(ge::CheckCompressWeightParamValid(enable_compress_weight, compress_weight_conf) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check compress weight failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][CompressWeight] failed!"); global_options[ge::ir_option::ENABLE_COMPRESS_WEIGHT] = (enable_compress_weight == "true") ? ge::kEnableCompressWeightTrue : ge::kEnableCompressWeightFalse; @@ -124,7 +124,7 @@ static graphStatus CheckGlobalOptions(std::map &global : global_options[ge::ir_option::OP_SELECT_IMPL_MODE]; GE_CHK_BOOL_EXEC( ge::CheckImplmodeParamValid(optypelist_for_implmode, op_select_implmode) == ge::SUCCESS, - return ge::GRAPH_PARAM_INVALID, "check optypelist_for_implmode and op_select_implmode failed!"); + return ge::GRAPH_PARAM_INVALID, "[Check][Implmode] failed!"); global_options[ge::ir_option::OP_SELECT_IMPL_MODE] = op_select_implmode; // set precision mode default value @@ -144,7 +144,8 @@ static void GetOpsProtoPath(string &opsproto_path) { string path = path_env; string file_path = RealPath(path.c_str()); if (file_path.empty()) { - GELOGE(FAILED, "File path %s is invalid.", path.c_str()); + GELOGE(FAILED, "[Check][Path] %s is invalid.", path.c_str()); + REPORT_INNER_ERROR("E19999", "GetOpsProtoPath failed, %s is invalid.", path.c_str()); return; } opsproto_path = (path + "/op_proto/custom/" + ":") + (path + "/op_proto/built-in/"); @@ -172,7 +173,7 @@ graphStatus aclgrphBuildInitializeImpl(std::map &globa GELOGD("Enter aclgrphInitialize start!"); // check global options if (CheckGlobalOptions(global_options) != GRAPH_SUCCESS) { - GELOGE(GRAPH_PARAM_INVALID, "Check global options falied!"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Global Options] falied!"); return GRAPH_PARAM_INVALID; } @@ -186,7 +187,7 @@ graphStatus aclgrphBuildInitializeImpl(std::map &globa GELOGI("aclgrphInitialize start!"); auto ret = ge::GELib::Initialize(global_options); if (ret != ge::SUCCESS) { - GELOGE(ret, "GE initialize failed!"); + GELOGE(ret, "[Init][GELib] failed!"); return GRAPH_FAILED; } } @@ -211,7 +212,7 @@ graphStatus aclgrphBuildInitialize(std::map &global_ std::map tmp_global_options; for (auto &option : global_options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { - GELOGE(GRAPH_FAILED, "AclgrphBuildInitialize option is nullptr."); + GELOGE(GRAPH_FAILED, "[Check][Options]AclgrphBuildInitialize option is nullptr."); return GRAPH_FAILED; } std::string key = option.first.GetString(); @@ -281,7 +282,8 @@ graphStatus Impl::InferShapePrepare(const ComputeGraphPtr &compute_graph) { auto ret = prepare_infershape.Run(compute_graph); if ((ret != SUCCESS) && (ret != NOT_CHANGED)) { - GELOGE(ret, "Prepair for infershape failed, ret:%d", ret); + GELOGE(ret, "[Prepair][InferShape] failed, ret:%d", ret); + REPORT_CALL_ERROR("E19999", "PassManager::Run falied,ret:%d", ret); return ret; } GELOGD("Prepair for infershape success!"); @@ -297,12 +299,12 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { vector>> user_shape_map; if (!input_shape.empty()) { GE_CHK_BOOL_EXEC(ParseInputShape(input_shape, shape_map, user_shape_map, true), - return GRAPH_PARAM_INVALID, "Parse input shape failed!"); + return GRAPH_PARAM_INVALID, "[Parse][InputShape] failed!"); } std::map>> shape_range_map; if (!input_shape_range.empty()) { GE_CHK_BOOL_EXEC(ParseInputShapeRange(input_shape_range, shape_range_map), - return GRAPH_PARAM_INVALID, "Parse input shape range failed."); + return GRAPH_PARAM_INVALID, "[Parse][InputShapeRange] failed."); } auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); @@ -312,11 +314,12 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { GE_CHECK_NOTNULL(op); if (op->GetType() == DATA) { if (UpdateDataOpShape(op, shape_map) != SUCCESS) { - GELOGE(GRAPH_FAILED, "Update data op [%s] shape failed.", op->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Update][DataOpShape] op[%s] failed.", op->GetName().c_str()); + REPORT_CALL_ERROR("E19999", "UpdateDataOpShape failed, op[%s].", op->GetName().c_str()); return GRAPH_FAILED; } if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { - GELOGE(GRAPH_FAILED, "Update data op [%s] shape range failed.", op->GetName().c_str()); + GELOGE(GRAPH_FAILED, "[Update][DataOpShapeRange] op[%s] failed.", op->GetName().c_str()); return GRAPH_FAILED; } } @@ -331,8 +334,10 @@ graphStatus Impl::CheckOptions(const std::map &options if (it == ge::ir_option::ir_builder_suppported_options.end()) { auto it_lx_fusion = ir_builder_supported_options_for_lx_fusion.find(ele.first); if (it_lx_fusion == ir_builder_supported_options_for_lx_fusion.end()) { - GELOGE(GRAPH_PARAM_INVALID, "input options include unsupported option(%s).Please check!", - ele.first.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Options] unsupported option(%s).Please check!", + ele.first.c_str()); + REPORT_INNER_ERROR("E19999", "CheckOptions failed, unsupported option(%s).Please check!", + ele.first.c_str()); return GRAPH_PARAM_INVALID; } } @@ -343,7 +348,8 @@ graphStatus Impl::CheckOptions(const std::map &options auto it = options_.find(BUILD_MODE); if (it != options_.end() && !(it->second.empty())) { if (build_mode_options.find(it->second) == build_mode_options.end()) { - GELOGE(GRAPH_PARAM_INVALID, "Build mode:%s is unsupported. Please check!", it->second.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Mode]:%s is unsupported. Please check!", it->second.c_str()); + REPORT_INNER_ERROR("E19999", "CheckOptions failed, %s is unsupported. Please check!", it->second.c_str()); return GRAPH_PARAM_INVALID; } build_mode = it->second; @@ -351,12 +357,13 @@ graphStatus Impl::CheckOptions(const std::map &options it = options_.find(BUILD_STEP); if (it != options_.end() && !(it->second.empty())) { if (build_step_options.find(it->second) == build_step_options.end()) { - GELOGE(GRAPH_PARAM_INVALID, "Build step:%s is unsupported. Please check!", it->second.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Step]:%s is unsupported. Please check!", it->second.c_str()); + REPORT_INNER_ERROR("E19999", "CheckOptions failed, %s is unsupported. Please check!", it->second.c_str()); return GRAPH_PARAM_INVALID; } } else { if (build_mode == BUILD_MODE_TUNING) { - GELOGE(GRAPH_PARAM_INVALID, "Build mode tuning must specify build step. Please check!"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Mode] tuning must specify build step. Please check!"); return GRAPH_PARAM_INVALID; } } @@ -376,7 +383,7 @@ graphStatus Impl::Init(const Graph &graph, const std::map(string(IR_OPTION_MODE), to_string(0))); @@ -448,7 +455,7 @@ graphStatus Impl::Init(const Graph &graph, const std::mapsecond; } else { - GELOGE(GRAPH_PARAM_INVALID, "Input format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", + GELOGE(GRAPH_PARAM_INVALID, "[Check][Param]input_format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); + REPORT_INNER_ERROR("E19999", "InitDomiOmgContext failed, input_format %s not support.", input_format.c_str()); return GRAPH_PARAM_INVALID; } } @@ -564,7 +572,8 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in } if (!ParseInputShape(input_shape, omg_context_.input_dims, omg_context_.user_input_dims, is_dynamic_input)) { - GELOGE(GRAPH_PARAM_INVALID, "Failed to parse input shape: %s", input_shape.c_str()); + GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape] Failed, shape: %s", input_shape.c_str()); + REPORT_CALL_ERROR("E19999", "ParseInputShape failed, shape: %s", input_shape.c_str()) return GRAPH_PARAM_INVALID; } return GRAPH_SUCCESS; @@ -585,7 +594,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map tmp_build_options; for (auto &option : build_options) { if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { - GELOGE(GRAPH_FAILED, "AclgrphBuildInitialize option is nullptr."); + GELOGE(GRAPH_FAILED, "[Check][Options]AclgrphBuildInitialize option is nullptr."); return GRAPH_FAILED; } std::string key = option.first.GetString(); @@ -601,7 +610,7 @@ graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &m ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); GELOGD("Enter aclmdlSaveModel process!"); if (model.data.get() == nullptr || model.length == 0) { - GELOGE(GRAPH_PARAM_INVALID, "input model is illegal"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][ModelBufferData] model is illegal"); return GRAPH_PARAM_INVALID; } return FileSaver::SaveToFile((output_file + ".om"), reinterpret_cast(model.data.get()), @@ -612,11 +621,11 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); GELOGD("Enter aclmdlSaveModel process!"); if (model.data.get() == nullptr || model.length == 0) { - GELOGE(GRAPH_PARAM_INVALID, "Input model is illegal"); + GELOGE(GRAPH_PARAM_INVALID, "[Check][ModelBufferData]model is illegal"); return GRAPH_PARAM_INVALID; } if (output_file == nullptr) { - GELOGE(GRAPH_PARAM_INVALID, "Output file is nullptr."); + GELOGE(GRAPH_PARAM_INVALID, "[Check][output_file]file is nullptr."); return GRAPH_PARAM_INVALID; } std::string str_output_file = output_file; @@ -641,7 +650,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz GE_CHECK_NOTNULL(file); if (len > PATH_MAX || len != strlen(file) || strlen(file) == 0) { - GELOGE(GRAPH_PARAM_INVALID, "File path invalid."); + GELOGE(GRAPH_PARAM_INVALID, "[Check][File Path]file invalid."); return GRAPH_PARAM_INVALID; } @@ -675,7 +684,8 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz char path[PATH_MAX] = {0}; if (realpath(file_path.c_str(), path) == nullptr) { - GELOGE(GRAPH_PARAM_INVALID, "Dump file path:%s is invalid.", file); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Dump File] path:%s is invalid.", file); + REPORT_INNER_ERROR("E19999", "aclgrphDumpGraph failed, %s is invalid.", file); return GRAPH_PARAM_INVALID; } @@ -710,7 +720,7 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vectorAddInputDesc(tensor_desc) != ge::GRAPH_SUCCESS) { - GELOGE(ge::FAILED, "AddInputDesc fail."); + GELOGE(ge::FAILED, "[Add][InputDesc] fail."); return ge::FAILED; } input_tensors.emplace_back(tensor_desc); @@ -734,7 +744,8 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector Date: Tue, 16 Mar 2021 19:36:14 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=95=B4=E6=94=B93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 1 - .../host_cpu_ops_kernel_builder.cc | 20 +-- ge/init/gelib.cc | 10 +- ge/ir_build/atc_ir_common.cc | 126 ++++++------------ ge/ir_build/ge_ir_build.cc | 23 +--- ge/omm/csa_interact.cc | 10 +- .../ops_kernel_builder_manager.cc | 11 +- ge/opskernel_manager/ops_kernel_manager.cc | 46 +++---- ge/plugin/engine/engine_manage.cc | 15 +-- 9 files changed, 97 insertions(+), 165 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index 62dd9ec2..7d4b9df7 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -35,7 +35,6 @@ Status HostCpuEngine::Initialize(const std::map &options) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "[Init][HostCpuEngine] fail for new HostCpuOpsKernelInfoStore."); - REPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); return FAILED; } } diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index 28f0cdc4..844969eb 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -76,11 +76,11 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { if ((TensorUtils::CalcTensorMemSize(output_shape, format, data_type, output_mem_size) != GRAPH_SUCCESS) || (output_mem_size < 0)) { GELOGE(FAILED, "[Calc][TensorMemSize]fail for op[%s:%s] out[%zu], mem_size=%ld, format=%s, data_type=%s.", - name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), - TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed when CalcOpRunningParam. fail for op[%s:%s] out[%zu], mem_size=%ld, format=%s, data_type=%s.", - name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), - TypeUtils::DataTypeToSerialString(data_type).c_str()); + name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), + TypeUtils::DataTypeToSerialString(data_type).c_str()); + REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed when CalcOpRunningParam. fail for op[%s:%s] out[%zu], " + "mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, + TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } GELOGI("Calc op[%s:%s] out[%zu] mem size is %ld, format=%s, data_type=%s.", @@ -89,10 +89,12 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { TensorUtils::SetSize(output_tensor, output_mem_size); if (op_desc->UpdateOutputDesc(static_cast(i), output_tensor) != GRAPH_SUCCESS) { - GELOGE(FAILED, "[Update][OutputDesc] fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, - TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed when CalcOpRunningParam. fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, - TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); + GELOGE(FAILED, "[Update][OutputDesc] fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", + name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), + TypeUtils::DataTypeToSerialString(data_type).c_str()); + REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed when CalcOpRunningParam. " + "fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, + TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } } diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 45e84801..03870522 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -129,8 +129,7 @@ Status GELib::InnerInitialize(const map &options) { Status initEmStatus = engineManager_.Initialize(options); GE_TIMESTAMP_END(EngineInitialize, "InnerInitialize::EngineInitialize"); if (initEmStatus != SUCCESS) { - GELOGE(initEmStatus, "[init][enginemanager] failed, options invalid. "); - REPORT_INNER_ERROR("E19999", "GE engine manager initial failed, as call DNNEngineManager::Initialize failed. "); + GELOGE(initEmStatus, "[Init][Enginemanager] failed, options invalid. "); RollbackInit(); return initEmStatus; } @@ -364,7 +363,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt // Update CSA file CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); - GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret:%u, jobstate_running=%d,substate_env_init=%d.", + GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret=%u , jobstate_running=%d , substate_env_init=%d .", ret, JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); // set device id @@ -396,7 +395,7 @@ Status GELib::SystemShutdownWithOptions(const Options &options) { // Update CSA file Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_SUCCEED); - GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret:%u jobstate_succeed=%d.", ret, JOBSTATE_SUCCEED); + GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret=%u jobstate_succeed=%d .", ret, JOBSTATE_SUCCEED); is_system_inited = false; is_shutdown = true; @@ -508,8 +507,7 @@ Status GELib::Finalize() { instancePtr_ = nullptr; init_flag_ = false; if (final_state != SUCCESS) { - GELOGE(FAILED, "[Check][State]finalization failed."); - REPORT_INNER_ERROR("E19999", "GELib::Finalize finalization failed because no init before."); + GELOGE(FAILED, "[Check][State]finalization failed, because no init before. "); return final_state; } GELOGI("finalization success."); diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index 28787048..dc2f504e 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -78,8 +78,7 @@ Status CheckInputFormat(const string &input_format) { if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format, "input format is invalid!"}); - GELOGE(ge::PARAM_INVALID, "[Check][InputParam]input format [%s] is invalid!", input_format.c_str()); - REPORT_CALL_ERROR("E19999", "CheckInputFormat failed, input_format [%s] is invalid!", input_format.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputFormat] [%s] is invalid!", input_format.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -108,7 +107,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map if (size == 0) { ErrorManager::GetInstance().ATCReportErrMessage("E10031"); - GELOGE(ge::PARAM_INVALID, "[Check][Param]At least one batch n must be equal to -1 when set --dynamic_batch_size."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]At least one batch n must be equal to -1 when set dynamic_batch_size."); return false; } @@ -118,8 +117,6 @@ bool CheckDynamicBatchSizeInputShapeValid(map> shape_map "E10033", {"value", "reason"}, {dynamic_batch_size, kDynamicBatchSizeError}); GELOGE(ge::PARAM_INVALID, "[Check][Param] dynamic_batch_size:%s is invalid. reason: %s", dynamic_batch_size.c_str(), kDynamicBatchSizeError); - REPORT_INNER_ERROR("E19999", "CheckDynamicBatchSizeInputShapeValid failed.dynamic_batch_size:%s is invalid. reason: %s", - dynamic_batch_size.c_str(), kDynamicBatchSizeError); return false; } } @@ -133,8 +130,6 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map const std::string input_format, std::string &dynamic_image_size) { if (!input_format.empty() && !ge::TypeUtils::IsFormatValid(input_format.c_str())) { GELOGE(ge::PARAM_INVALID, "[Check][Param] input_format [%s] invalid.", input_format.c_str()); - REPORT_INNER_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, input_format [%s] invalid.", - input_format.c_str()); return false; } int32_t size = 0; @@ -179,9 +174,7 @@ bool CheckDynamicImagesizeInputShapeValid(map> shape_map ErrorManager::GetInstance().ATCReportErrMessage("E10020", {"DynamicImageSizeNum"}, {std::to_string(kDynamicImageSizeNum)}); GELOGE(ge::PARAM_INVALID, - "[Check][Param]dynamic_image_size invalid value:%s number of dimensions of each group must be %ld.", - dynamic_image_size.c_str(), kDynamicImageSizeNum); - REPORT_INNER_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, dynamic_image_size invalid value:%s number of dimensions of each group must be %ld.", + "[Check][Param] invalid value:%s number of dimensions of each group must be %ld.", dynamic_image_size.c_str(), kDynamicImageSizeNum); return false; } @@ -206,7 +199,7 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m if (shapes.size() > kMaxNDDimNum || shapes.size() < kMinNDDimNum) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, - {"--input_shape's dim", std::to_string(shapes.size()), "Dim num must within [1, 4] when set dynamic_dims"}); + {"input_shape's dim", std::to_string(shapes.size()), "Dim num must within [1, 4] when set dynamic_dims"}); GELOGE(ge::PARAM_INVALID, "[Check][Param]Dim num must within [%zu, %zu] when set dynamic_dims.", kMinNDDimNum, kMaxNDDimNum); return false; @@ -217,14 +210,13 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_shape's dynamic dim num", "0", "at least one dim should be -1 when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "[Check][Param]input_shape invalid, at least one dim should be -1 when set dynamic_dims."); + GELOGE(ge::PARAM_INVALID, + "[Check][Param]input_shape invalid, at least one dim should be -1 when set dynamic_dims."); return false; } if (!CheckAndParseDynamicDims(dynamic_dim, dynamic_dims)) { GELOGE(ge::PARAM_INVALID, "[CheckAndParse][DynamicDims]: %s failed.", dynamic_dims.c_str()); - REPORT_CALL_ERROR("E19999", "CheckAndParseDynamicDims failed,dynamic_dim:%d dynamic_dims:%s", - dynamic_dim,dynamic_dims.c_str()); return false; } @@ -245,8 +237,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims if (split_set.size() > kMaxDynamicDimNum) { ErrorManager::GetInstance().ATCReportErrMessage( "E10042", {"parameter", "reason"}, {"dynamic_dims", "dynamic_dims's num of parameter set can not exceed 100"}); - GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); - REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); + GELOGE(ge::PARAM_INVALID, + "[Check][Param]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); return false; } for (auto split_dim : split_set) { @@ -256,9 +248,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims "E10042", {"parameter", "reason"}, {"dynamic_dims", "Each gear setting needs to be consistent with the number of -1 in the inputshape"}); GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims:%s invalid. " - "reason: Each gear setting needs to be consistent with the number of -1 in the inputshape.", dynamic_dims.c_str()); - - REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); + "reason: Each gear setting needs to be consistent with the number of -1 in the inputshape.", + dynamic_dims.c_str()); return false; } for (auto dim : one_set) { @@ -267,8 +258,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); - GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); - REPORT_INNER_ERROR("E19999", "CheckAndParseDynamicDims failed, dynamic_dims:%s invalid.", dynamic_dims.c_str()); + GELOGE(ge::PARAM_INVALID, + "[Check][Param]dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); return false; } } @@ -286,15 +277,11 @@ bool StringToLongNoThrow(const string &str, long &val) { {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); - REPORT_INNER_ERROR("E19999", "StringToLongNoThrow failed, str:%s invalid, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); } catch (const std::out_of_range) { ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, {str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); GELOGE(PARAM_INVALID, "[Parse][Parameter] str:%s invalid, reason: %s, correct sample is %s.", str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); - REPORT_INNER_ERROR("E19999", "StringToLongNoThrow failed str:%s invalid, reason: %s, correct sample is %s.", - str.c_str(), kShapeRangeValueConvertError, kInputShapeRangeSample3); } return false; } @@ -307,14 +294,13 @@ bool ParseSingleShapeRange(std::string &shape_range, vector> shape_range_val; if (!ParseSingleShapeRange(shape_range_str, shape_range_val)) { GELOGE(PARAM_INVALID, "[Parse][Param] shape_range_str: %s invalid.", shape_range_str.c_str()); - REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, shape_range_str: %s invalid.", shape_range_str.c_str()); return false; } shape_range_map.emplace(make_pair(StringUtils::Trim(shape_range_pair_vec[0]), shape_range_val)); @@ -411,14 +388,15 @@ bool ParseInputShapeRange(const std::string &shape_range, } Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_image_size, string &dynamic_dims, - const string input_shape, const string input_shape_range, const string input_format, - bool &is_dynamic_input) { - int32_t param_size = static_cast(!dynamic_batch_size.empty()) + - static_cast(!dynamic_image_size.empty()) + static_cast(!dynamic_dims.empty()); - if (param_size > 1) { + const string input_shape, const string input_shape_range, const string input_format,bool &is_dynamic_input) + { + int32_t param_size = static_cast(!dynamic_batch_size.empty()) + + static_cast(!dynamic_image_size.empty()) + static_cast(!dynamic_dims.empty()); + if (param_size > 1) { ErrorManager::GetInstance().ATCReportErrMessage("E10009", {"parameter0", "parameter1", "parameter2"}, {"dynamic_batch_size", "dynamic_image_size", "dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "[Parse][Param]dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); + GELOGE(ge::PARAM_INVALID, + "[Parse][Param]dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); return ge::PARAM_INVALID; } @@ -427,7 +405,6 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i std::map>> shape_range_map; if(!ParseInputShapeRange(input_shape_range, shape_range_map)) { GELOGE(ge::PARAM_INVALID, "[Parse][Param]input_shape_range: %s invalid.", input_shape_range.c_str()); - REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, input_shape_range: %s invalid.", input_shape_range.c_str()); return ge::PARAM_INVALID; } } @@ -445,23 +422,19 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (!ParseInputShape(input_shape, shape_map, user_shape_map, is_dynamic_input)) { GELOGE(ge::PARAM_INVALID, "[Parse][InputShape]input_shape: %s invalid.", input_shape.c_str()); - REPORT_CALL_ERROR("E19999", "ParseInputShape failed, input_shape: %s invalid.", input_shape.c_str()); return ge::PARAM_INVALID; } if (!dynamic_batch_size.empty()) { if (!CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size)) { GELOGE(ge::PARAM_INVALID, "[Check][DynamicBatchSizeInputShape] input_shape: %s invalid.", input_shape.c_str()); - REPORT_CALL_ERROR("E19999", "CheckDynamicBatchSizeInputShapeValid failed, input_shape: %s invalid.", input_shape.c_str()); return ge::PARAM_INVALID; } } if (!dynamic_image_size.empty()) { if (!CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size)) { - GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] input_shape: %s invalid. dynamic_image_size:%d ", - input_shape.c_str(), dynamic_image_size); - REPORT_CALL_ERROR("E19999", "CheckDynamicImagesizeInputShapeValid failed, input_shape: %s invalid. dynamic_image_size:%d ", + GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] %s invalid. dynamic_image_size:%d ", input_shape.c_str(), dynamic_image_size); return ge::PARAM_INVALID; } @@ -471,8 +444,6 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (!CheckDynamicDimsInputShapeValid(shape_map, input_format, dynamic_dims)) { GELOGE(ge::PARAM_INVALID, "[Check][DynamicDimsInputShape]: %s of input shape: %s failed.", dynamic_dims.c_str(), input_shape.c_str()); - REPORT_CALL_ERROR("E19999", "CheckDynamicDimsInputShapeValid failed, input_shape: %s invalid. dynamic_dims:%s ", - input_shape.c_str(), dynamic_dims.c_str()); return ge::PARAM_INVALID; } } @@ -524,7 +495,6 @@ bool ParseInputShape(const string &input_shape, map> &sh ErrorManager::GetInstance().ATCReportErrMessage("E10002", {"shape", "reason", "sample"}, {shape, kDigitError, kInputShapeSample2}); GELOGE(PARAM_INVALID, "[Check][Param]input_shape:%s invalid", shape_value_str.c_str()); - REPORT_CALL_ERROR("E19999", "isdigit return false, input_shape:%s invalid", shape_value_str.c_str()); return false; } } @@ -547,7 +517,8 @@ bool ParseInputShape(const string &input_shape, map> &sh int64_t result = left_result; // - 1 is not currently supported if (!is_dynamic_input && result <= 0) { - ErrorManager::GetInstance().ATCReportErrMessage("E10011", {"shape", "result"}, {shape, std::to_string(result)}); + ErrorManager::GetInstance().ATCReportErrMessage("E10011", {"shape", "result"}, + {shape, std::to_string(result)}); GELOGW( "Input parameter[--input_shape]’s shape value[%s] is invalid, " "expect positive integer, but value is %ld.", @@ -570,7 +541,6 @@ Status CheckOutputTypeParamValid(const std::string output_type) { "E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); GELOGE(ge::PARAM_INVALID, "[Check][Param]Invalid value for --output_type[%s], %s.", output_type.c_str(), kOutputTypeSupport); - REPORT_INNER_ERROR("E19999", "CheckOutputTypeParamValid failed, output_type: %s invalid.", output_type.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -582,33 +552,33 @@ Status CheckBufferOptimizeParamValid(const std::string buffer_optimize) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--buffer_optimize", buffer_optimize, kBufferOptimizeSupport}); GELOGE(ge::PARAM_INVALID, - "[Check][Param]Invalid value for --buffer_optimize[%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); - REPORT_INNER_ERROR("E19999", "CheckBufferOptimizeParamValid failed, buffer_optimize: %s invalid.", buffer_optimize.c_str()); + "[Check][BufferOptimize]Invalid value for [%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); return ge::PARAM_INVALID; } return ge::SUCCESS; } -Status CheckCompressWeightParamValid(const std::string enable_compress_weight, const std::string compress_weight_conf) { +Status CheckCompressWeightParamValid(const std::string enable_compress_weight, + const std::string compress_weight_conf) { if ((!compress_weight_conf.empty()) && (!CheckInputPathValid(compress_weight_conf, "--compress_weight_conf"))) { - GELOGE(ge::PARAM_INVALID, "[Check][Param]compress weight config file not found, file_name:%s", compress_weight_conf.c_str()); - REPORT_INNER_ERROR("E19999", "CheckCompressWeightParamValid failed, compress_weight_conf: %s invalid.", compress_weight_conf.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][CompressWeight]compress weight config file not found, file_name:%s", + compress_weight_conf.c_str()); return ge::PARAM_INVALID; } if ((enable_compress_weight != "") && (enable_compress_weight != "true") && (enable_compress_weight != "false")) { ErrorManager::GetInstance().ATCReportErrMessage( "E10005", {"parameter", "value"}, {"enable_compress_weight", enable_compress_weight}); GELOGE(ge::PARAM_INVALID, - "[Check][Param]enable_compress_weight:%s must be true or false.", enable_compress_weight.c_str()); - REPORT_INNER_ERROR("E19999", "CheckCompressWeightParamValid failed, enable_compress_weight: %s invalid.", enable_compress_weight.c_str()); + "[Check][CompressWeight]enable_compress_weight:%s must be true or false.", enable_compress_weight.c_str()); return ge::PARAM_INVALID; } if ((enable_compress_weight == "true") && (!compress_weight_conf.empty())) { ErrorManager::GetInstance().ATCReportErrMessage("E10047", {"parameter0", "parameter1"}, {"enable_compress_weight", "compress_weight_conf"}); - GELOGE(ge::PARAM_INVALID, "[Check][Param]enable_compress_weight and compress_weight_conf can not both exist!!"); + GELOGE(ge::PARAM_INVALID, + "[Check][CompressWeight]enable_compress_weight and compress_weight_conf can not both exist!!"); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -619,7 +589,6 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--keep_dtype", keep_dtype, kKeepDtypeError}); GELOGE(ge::PARAM_INVALID, "[Check][InputPath] file not found, file_name:%s", keep_dtype.c_str()); - REPORT_CALL_ERROR("E19999", "CheckInputPathValid failed, file not found, file_name:%s", keep_dtype.c_str()); return ge::PARAM_INVALID; } @@ -641,13 +610,12 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { } else if (log == "error") { ret = dlog_setlevel(-1, DLOG_ERROR, 1); } else { - GELOGE(ge::PARAM_INVALID, "[Check][LogParam]log:%s invalid, only support debug, info, warning, error, null", log.c_str()); - REPORT_INNER_ERROR("E19999", "CheckLogParamValidAndSetLogLevel failed, log:%s invalid", log.c_str()); + GELOGE(ge::PARAM_INVALID, + "[Check][LogParam]log:%s invalid, only support debug, info, warning, error, null", log.c_str()); return ret; } if (ret != 0) { GELOGE(ge::PARAM_INVALID, "[Check][LogParam]Log setlevel fail !"); - REPORT_INNER_ERROR("E19999", "CheckLogParamValidAndSetLogLevel failed, log:%s invalid", log.c_str()); } return ret; } @@ -656,7 +624,6 @@ Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { if ((!insert_op_conf.empty()) && (!CheckInputPathValid(insert_op_conf, "--insert_op_conf"))) { GELOGE(ge::PARAM_INVALID, "[Check][InputPath]file not found: %s", insert_op_conf.c_str()); - REPORT_CALL_ERROR("E19999", "CheckInputPathValid failed, file not found: %s", insert_op_conf.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -665,9 +632,7 @@ Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { Status CheckDisableReuseMemoryParamValid(const std::string disable_reuse_memory) { if ((disable_reuse_memory != "") && (disable_reuse_memory != "0") && (disable_reuse_memory != "1")) { ErrorManager::GetInstance().ATCReportErrMessage("E10006", {"parameter"}, {"disable_reuse_memory"}); - GELOGE(ge::PARAM_INVALID, "[Check][DisableReuseMemoryParam]disable_reuse_memory must be 1 or 0."); - REPORT_INNER_ERROR("E19999", "CheckDisableReuseMemoryParamValid failed, disable_reuse_memory:%s invalid.", - disable_reuse_memory.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][DisableReuseMemory]disable_reuse_memory must be 1 or 0."); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -677,9 +642,7 @@ Status CheckEnableSingleStreamParamValid(const std::string enable_single_stream) if ((enable_single_stream != "") && (enable_single_stream != "true") && (enable_single_stream != "false")) { ErrorManager::GetInstance().ATCReportErrMessage( "E10005", {"parameter", "value"}, {"enable_single_stream", enable_single_stream}); - GELOGE(ge::PARAM_INVALID, "[Check][EnableSingleStreamParam]enable_single_stream:%s must be true or false.", - enable_single_stream.c_str()); - REPORT_INNER_ERROR("E19999", "CheckEnableSingleStreamParamValid failed, enable_single_stream:%s invalid.", + GELOGE(ge::PARAM_INVALID, "[Check][EnableSingleStream]enable_single_stream:%s must be true or false.", enable_single_stream.c_str()); return ge::PARAM_INVALID; } @@ -691,10 +654,8 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: if (optypelist_for_implmode != "" && op_select_implmode == "") { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kCompressWeightError}); - GELOGE(ge::PARAM_INVALID, "[Check][ImplmodeParam]op_select_implmode:%s invalid, %s.", + GELOGE(ge::PARAM_INVALID, "[Check][Implmode]op_select_implmode:%s invalid, %s.", op_select_implmode.c_str(),kCompressWeightError); - REPORT_INNER_ERROR("E19999", "CheckImplmodeParamValid failed, op_select_implmode:%s invalid, %s.", - op_select_implmode.c_str(), kCompressWeightError); return ge::PARAM_INVALID; } // op_select_implmode default value is high_performance @@ -705,12 +666,10 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON) { ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, {"--op_select_implmode", op_select_implmode.c_str(), kSelectImplmodeError}); - GELOGE(ge::PARAM_INVALID, "[Check][ImplmodeParam]Invalid value for --op_select_implmode[%s], %s.", - op_select_implmode.c_str(), kSelectImplmodeError); - REPORT_INNER_ERROR("E19999", "CheckImplmodeParamValid failed, op_select_implmode:%s invalid, %s.", + GELOGE(ge::PARAM_INVALID, "[Check][Implmode]Invalid value for --op_select_implmode[%s], %s.", op_select_implmode.c_str(), kSelectImplmodeError); return ge::PARAM_INVALID; - }op_select_implmode[%s] + } } return ge::SUCCESS; @@ -774,7 +733,6 @@ Status UpdateDataOpShapeRange(const OpDescPtr &op, auto cur_shape_range = iter->second; if (TensorUtils::CheckShapeByShapeRange(origin_shape, cur_shape_range) != SUCCESS) { GELOGE(PARAM_INVALID, "[Check][OpDescPtr][%s] Check shape by shape range failed.", data_op_name.c_str()); - REPORT_CALL_ERROR("E19999", "CheckShapeByShapeRange failed, op invalid, op_name=%s.", data_op_name.c_str()); return PARAM_INVALID; } for (size_t idx = 0; idx < cur_shape_range.size(); idx++) { @@ -803,7 +761,6 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co map>> shape_range_map; if (!ParseInputShapeRange(input_shape_range, shape_range_map)) { GELOGE(PARAM_INVALID, "[Parse][InputShapeRange] input_shape_range:%s invalid.", input_shape_range.c_str()); - REPORT_CALL_ERROR("E19999", "ParseInputShapeRange failed, input_shape_range:%s invalid.", input_shape_range.c_str()); return PARAM_INVALID; } @@ -814,7 +771,6 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co if (op->GetType() == DATA) { if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { GELOGE(FAILED, "[Update][Data] op[%s] invalid.", op->GetName().c_str()); - REPORT_CALL_ERROR("E19999", "UpdateDataOpShapeRange failed, op[%s] invalid.", op->GetName().c_str()); return FAILED; } } diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 67a2664b..bbae61d4 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -145,7 +145,6 @@ static void GetOpsProtoPath(string &opsproto_path) { string file_path = RealPath(path.c_str()); if (file_path.empty()) { GELOGE(FAILED, "[Check][Path] %s is invalid.", path.c_str()); - REPORT_INNER_ERROR("E19999", "GetOpsProtoPath failed, %s is invalid.", path.c_str()); return; } opsproto_path = (path + "/op_proto/custom/" + ":") + (path + "/op_proto/built-in/"); @@ -283,7 +282,6 @@ graphStatus Impl::InferShapePrepare(const ComputeGraphPtr &compute_graph) { auto ret = prepare_infershape.Run(compute_graph); if ((ret != SUCCESS) && (ret != NOT_CHANGED)) { GELOGE(ret, "[Prepair][InferShape] failed, ret:%d", ret); - REPORT_CALL_ERROR("E19999", "PassManager::Run falied,ret:%d", ret); return ret; } GELOGD("Prepair for infershape success!"); @@ -315,7 +313,6 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { if (op->GetType() == DATA) { if (UpdateDataOpShape(op, shape_map) != SUCCESS) { GELOGE(GRAPH_FAILED, "[Update][DataOpShape] op[%s] failed.", op->GetName().c_str()); - REPORT_CALL_ERROR("E19999", "UpdateDataOpShape failed, op[%s].", op->GetName().c_str()); return GRAPH_FAILED; } if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { @@ -336,8 +333,6 @@ graphStatus Impl::CheckOptions(const std::map &options if (it_lx_fusion == ir_builder_supported_options_for_lx_fusion.end()) { GELOGE(GRAPH_PARAM_INVALID, "[Check][Options] unsupported option(%s).Please check!", ele.first.c_str()); - REPORT_INNER_ERROR("E19999", "CheckOptions failed, unsupported option(%s).Please check!", - ele.first.c_str()); return GRAPH_PARAM_INVALID; } } @@ -349,7 +344,6 @@ graphStatus Impl::CheckOptions(const std::map &options if (it != options_.end() && !(it->second.empty())) { if (build_mode_options.find(it->second) == build_mode_options.end()) { GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Mode]:%s is unsupported. Please check!", it->second.c_str()); - REPORT_INNER_ERROR("E19999", "CheckOptions failed, %s is unsupported. Please check!", it->second.c_str()); return GRAPH_PARAM_INVALID; } build_mode = it->second; @@ -358,7 +352,6 @@ graphStatus Impl::CheckOptions(const std::map &options if (it != options_.end() && !(it->second.empty())) { if (build_step_options.find(it->second) == build_step_options.end()) { GELOGE(GRAPH_PARAM_INVALID, "[Check][Build Step]:%s is unsupported. Please check!", it->second.c_str()); - REPORT_INNER_ERROR("E19999", "CheckOptions failed, %s is unsupported. Please check!", it->second.c_str()); return GRAPH_PARAM_INVALID; } } else { @@ -417,7 +410,7 @@ graphStatus Impl::Init(const Graph &graph, const std::mapsecond; } else { - GELOGE(GRAPH_PARAM_INVALID, "[Check][Param]input_format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", + GELOGE(GRAPH_PARAM_INVALID, "[Check][Param] %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", input_format.c_str()); - REPORT_INNER_ERROR("E19999", "InitDomiOmgContext failed, input_format %s not support.", input_format.c_str()); return GRAPH_PARAM_INVALID; } } @@ -573,7 +565,6 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in if (!ParseInputShape(input_shape, omg_context_.input_dims, omg_context_.user_input_dims, is_dynamic_input)) { GELOGE(GRAPH_PARAM_INVALID, "[Parse][InputShape] Failed, shape: %s", input_shape.c_str()); - REPORT_CALL_ERROR("E19999", "ParseInputShape failed, shape: %s", input_shape.c_str()) return GRAPH_PARAM_INVALID; } return GRAPH_SUCCESS; @@ -625,7 +616,7 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod return GRAPH_PARAM_INVALID; } if (output_file == nullptr) { - GELOGE(GRAPH_PARAM_INVALID, "[Check][output_file]file is nullptr."); + GELOGE(GRAPH_PARAM_INVALID, "[Check][Output_File]file is nullptr."); return GRAPH_PARAM_INVALID; } std::string str_output_file = output_file; @@ -685,7 +676,6 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz char path[PATH_MAX] = {0}; if (realpath(file_path.c_str(), path) == nullptr) { GELOGE(GRAPH_PARAM_INVALID, "[Check][Dump File] path:%s is invalid.", file); - REPORT_INNER_ERROR("E19999", "aclgrphDumpGraph failed, %s is invalid.", file); return GRAPH_PARAM_INVALID; } @@ -745,7 +735,6 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector &options, std::string &lib_paths) { +Status OpsKernelBuilderManager::GetLibPaths(const std::map &options, std::string &lib_paths) { GELOGD("Start to execute GetLibPaths"); std::string path_base = PluginManager::GetPath(); std::string so_path = "plugin/opskernel/"; @@ -150,10 +151,10 @@ Status OpsKernelBuilderManager::GenerateTask(const Node &node, const std::string &lib_name = op_desc->GetOpKernelLibName(); auto it = ops_kernel_builders_.find(lib_name); if (it == ops_kernel_builders_.end()) { - GELOGE(INTERNAL_ERROR, "[Check][lib_name] libName = %s, node = %s not exist.", - lib_name.c_str(), op_desc->GetName().c_str()); - REPORT_INNER_ERROR("E19999", "GenerateTask failed, libName = %s, node = %s not exist.", - lib_name.c_str(), op_desc->GetName().c_str()); + GELOGE(INTERNAL_ERROR, "[Check][Lib_Name] libName = %s, node = %s not exist.", + lib_name.c_str(), op_desc->GetName().c_str()); + REPORT_INNER_ERROR("E19999", "GenerateTask failed, libName = %s, node = %s not exist.", + lib_name.c_str(), op_desc->GetName().c_str()); return INTERNAL_ERROR; } diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index 1a986b45..878726b4 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -57,7 +57,6 @@ Status OpsKernelManager::Initialize(const map &options_const) { Status ret = InitPluginOptions(options); if (ret != SUCCESS) { GELOGE(ret, "[Init][PluginOptions] parse pluginFlag from ge options failed."); - REPORT_CALL_ERROR("E19999", "InitPluginOptions failed, options invalid."); return ret; } @@ -87,7 +86,6 @@ Status OpsKernelManager::Initialize(const map &options_const) { Status rst0 = plugin_manager_.InvokeAll &, Status>(kInitialize, initialize_); if (rst0 == FAILED) { GELOGE(GE_OPS_GET_NO_VALID_SO, "[invoke][opskernelinfo]PluginManager InvokeAll failed."); - REPORT_INNER_ERROR("E19999", "PluginManager InvokeAll failed."); return GE_OPS_GET_NO_VALID_SO; } Status rst1 = @@ -117,19 +115,18 @@ Status OpsKernelManager::Initialize(const map &options_const) { ret = InitGraphOptimizerPriority(); if ((ret != SUCCESS)) { GELOGE(ret, "[Init][GraphOptimizerPriority] failed."); - REPORT_CALL_ERROR("E19999", "GraphOptimizerPriority failed."); return ret; } init_flag_ = true; return SUCCESS; } else { GELOGE(ret, "[Check][So file] not find any valid so file."); - REPORT_INNER_ERROR("E19999", "OpsKernelManager::Initialize failed, not find any valid so file."); return ret; } } -void OpsKernelManager::GetExternalEnginePath(std::string &extern_engine_path, const std::map& options) { +void OpsKernelManager::GetExternalEnginePath(std::string &extern_engine_path, + const std::map& options) { GELOGI("Enter get external engine so path schedule"); const char *path_env = std::getenv("ASCEND_ENGINE_PATH"); if (path_env != nullptr) { @@ -181,8 +178,8 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, } else { GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, option_key:%s, its value %s is invalid, it must be 0 or 1.", - plugin_name.c_str(), iter->second.c_str()); + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, option_key:%s, " + "its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } } catch (std::invalid_argument &) { @@ -200,8 +197,8 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, } catch (...) { GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,option_key:%s, its value %s is invalid, it must be 0 or 1.", - plugin_name.c_str(), iter->second.c_str()); + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,option_key:%s, " + "its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } } else { @@ -215,16 +212,16 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, Status OpsKernelManager::CheckPluginPtr() const { for (auto iter = ops_kernel_store_.begin(); iter != ops_kernel_store_.end(); ++iter) { if (iter->second == nullptr) { - GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); - REPORT_INNER_ERROR("E19999", "CheckPluginPtr OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); - return FAILED; + GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); + REPORT_INNER_ERROR("E19999", "CheckPluginPtr OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); + return FAILED; } } for (auto iter1 = graph_optimizers_.begin(); iter1 != graph_optimizers_.end(); ++iter1) { if (iter1->second == nullptr) { - GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] GraphOptimizerPtr key=%s is null", iter1->first.c_str()); - REPORT_INNER_ERROR("E19999", "GraphOptimizerPtr key=%s is null", iter1->first.c_str()); - return FAILED; + GELOGE(INTERNAL_ERROR, "[Check][PluginPtr] GraphOptimizerPtr key=%s is null", iter1->first.c_str()); + REPORT_INNER_ERROR("E19999", "GraphOptimizerPtr key=%s is null", iter1->first.c_str()); + return FAILED; } } return SUCCESS; @@ -236,9 +233,10 @@ Status OpsKernelManager::InitOpKernelInfoStores(const map &optio GELOGI("OpKernelInfoStore name: %s.", (it.first).c_str()); Status ret = it.second->Initialize(options); if (ret != SUCCESS) { - GELOGE(GE_OPS_KERNEL_STORE_INIT_FAILED, "[init][opKernelLib]OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); - REPORT_CALL_ERROR("E19999", "OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); - return GE_OPS_KERNEL_STORE_INIT_FAILED; + GELOGE(GE_OPS_KERNEL_STORE_INIT_FAILED, + "[Init][OpKernelLib]OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); + REPORT_CALL_ERROR("E19999", "OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); + return GE_OPS_KERNEL_STORE_INIT_FAILED; } } @@ -262,8 +260,7 @@ void OpsKernelManager::InitOpsKernelInfo() { } std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { - GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[get][GELib]malloc instance_ptr failed."); - REPORT_CALL_ERROR("E19999", "GELib::GetInstance failed."); + GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib]malloc instance_ptr failed."); return; } // sort opinfo of ops_kernel_info_ @@ -308,7 +305,6 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib]malloc instance_ptr failed."); - REPORT_CALL_ERROR("E19999", "GELib::GetInstance failed."); return GE_CLI_GE_NOT_INITIALIZED; } if (!instance_ptr->DNNEngineManagerObj().IsEngineRegistered(attrs.engineName)) { @@ -317,7 +313,8 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) } Status ret = it.second->Initialize(options); if (ret != SUCCESS) { - GELOGE(GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED, "[Init][GraphOptimzer]GraphOptimzer: %s initialize failed.", (it.first).c_str()); + GELOGE(GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED, + "[Init][GraphOptimzer]GraphOptimzer: %s initialize failed.", (it.first).c_str()); REPORT_CALL_ERROR("E19999", "InitGraphOptimzers failed. %s initialize failed.", (it.first).c_str()); return GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED; } @@ -463,9 +460,8 @@ Status OpsKernelManager::FinalizeOpsKernel() { GELOGI("ge invoke ops kernal finalize."); Status ret = plugin_manager_.InvokeAll(kFinalize); if (ret != SUCCESS) { - GELOGE(ret, "[Finalize][Check][Status] invoke Fe finalize failed."); - REPORT_CALL_ERROR("E19999", "PluginManager InvokeAll failed."); - return ret; + GELOGE(ret, "[Finalize][Check][Status] invoke Fe finalize failed."); + return ret; } return SUCCESS; diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index 2065fb6b..08b0640a 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -30,7 +30,6 @@ std::unique_ptr> EngineManager::engine_map_; Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr) { if (engine_ptr == nullptr) { GELOGE(FAILED, "[Register][Engine] failed, as input engine_ptr is nullptr"); - REPORT_INNER_ERROR("E19999", "RegisterEngine failed, as input engine_ptr is nullptr"); return FAILED; } @@ -66,7 +65,6 @@ void RegisterAiCoreEngine() { DNNEnginePtr aicore_engine_ptr = MakeShared(attr_aicore); if (aicore_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][AiCoreEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { @@ -83,7 +81,6 @@ void RegisterVectorEngine() { DNNEnginePtr vectorcore_engine_ptr = MakeShared(attr_vector_core); if (vectorcore_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][VectorEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { @@ -99,7 +96,6 @@ void RegisterAiCpuEngine() { DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu); if (vm_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][AiCpuEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { @@ -111,11 +107,11 @@ void RegisterAiCpuTFEngine() { const std::string vm_aicpu_tf = "DNN_VM_AICPU"; std::vector mem_type_aicpu_tf; mem_type_aicpu_tf.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); - DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_2, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_2, DEVICE, + FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu_tf); if (vm_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][AiCpuTFEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { @@ -132,7 +128,6 @@ void RegisterGeLocalEngine() { DNNEnginePtr ge_local_engine = MakeShared(attr_ge_local); if (ge_local_engine == nullptr) { GELOGE(ge::FAILED, "[Register][GeLocalEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { @@ -145,11 +140,11 @@ void RegisterHostCpuEngine() { std::vector mem_type_host_cpu; mem_type_host_cpu.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); // HostCpu use minimum priority, set it as 10 - DNNEngineAttribute attr_host_cpu = {vm_host_cpu, mem_type_host_cpu, COST_10, HOST, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEngineAttribute attr_host_cpu = {vm_host_cpu, mem_type_host_cpu, COST_10, + HOST, FORMAT_RESERVED, FORMAT_RESERVED}; DNNEnginePtr host_cpu_engine = MakeShared(attr_host_cpu); if (host_cpu_engine == nullptr) { GELOGE(ge::FAILED, "[Register][HostCpuEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { @@ -165,7 +160,6 @@ void RegisterRtsEngine() { DNNEnginePtr rts_engine = MakeShared(attr_rts); if (rts_engine == nullptr) { GELOGE(ge::FAILED, "[Register][RtsEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { @@ -181,7 +175,6 @@ void RegisterHcclEngine() { DNNEnginePtr hccl_engine = MakeShared(attr_hccl); if (hccl_engine == nullptr) { GELOGE(ge::FAILED, "[Register][HcclEngine] failed, as malloc shared_ptr failed."); - REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed, as malloc shared_ptr failed."); return; } if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) { From 3d269fcf7eb67284089fa0ed5c82d623e0fb4f64 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 08:53:47 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=95=B4=E6=94=B94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/omm/csa_interact.cc | 2 +- ge/opskernel_manager/ops_kernel_manager.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index 2c0c0dfb..eb8921a8 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -171,7 +171,7 @@ void CsaInteract::WriteInternalErrorCode() { /// Status CsaInteract::WriteHcomDetection(const std::string &content) { if (!is_init_) { - GELOGE(INTERNAL_ERROR, "[init][CsaInteract] obj has not init, can't WriteJobState"); + GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); return INTERNAL_ERROR; } diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index 878726b4..3de80805 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -85,7 +85,7 @@ Status OpsKernelManager::Initialize(const map &options_const) { initialize_ = options; Status rst0 = plugin_manager_.InvokeAll &, Status>(kInitialize, initialize_); if (rst0 == FAILED) { - GELOGE(GE_OPS_GET_NO_VALID_SO, "[invoke][opskernelinfo]PluginManager InvokeAll failed."); + GELOGE(GE_OPS_GET_NO_VALID_SO, "[Invoke][OpsKernelInfo]PluginManager InvokeAll failed."); return GE_OPS_GET_NO_VALID_SO; } Status rst1 = @@ -120,7 +120,7 @@ Status OpsKernelManager::Initialize(const map &options_const) { init_flag_ = true; return SUCCESS; } else { - GELOGE(ret, "[Check][So file] not find any valid so file."); + GELOGE(ret, "[Check][So File] not find any valid so file."); return ret; } } @@ -185,19 +185,19 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, } catch (std::invalid_argument &) { GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data] failed, its value %s is invalid_argument, it must be 0 or 1.", iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,its value %s is invalid_argument, it must be 0 or 1.", + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, its value %s is invalid_argument, it must be 0 or 1.", iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (std::out_of_range &) { GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]failed, its value %s is out of range, it must be 0 or 1.", iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,its value %s is out of range, it must be 0 or 1.", + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, its value %s is out of range, it must be 0 or 1.", iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (...) { GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]option_key:%s, its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed,option_key:%s, " + REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, option_key:%s, " "its value %s is invalid, it must be 0 or 1.", plugin_name.c_str(), iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } From 33a107a041dc154d7285a68aa0bb12aa3f0c8a21 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 09:19:44 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=9C=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/omm/csa_interact.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index eb8921a8..a9f64dd1 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -250,8 +250,8 @@ Status CsaInteract::MakePath(const std::string &file_name) { std::string pre_path = file_path.substr(0, found + 1); if (mmAccess(pre_path.c_str()) != EN_OK) { if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { - GELOGE(INTERNAL_ERROR, "[Create][File Dir] fail, errno is %d, pri_path:%s", errno, pri_path.c_str()); - REPORT_CALL_ERROR("E19999", "mmMkdir failed. errno is %d pri_path:%s", errno, pri_path.c_str()); + GELOGE(INTERNAL_ERROR, "[Create][File Dir] fail, errno is %d, pre_path:%s", errno, pre_path.c_str()); + REPORT_CALL_ERROR("E19999", "mmMkdir failed. errno is %d pre_path:%s", errno, pre_path.c_str()); return INTERNAL_ERROR; } } From 59dd39ff42a59f66d222cf8160f74f1536363ade Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 09:40:41 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/ir_build/atc_ir_common.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index dc2f504e..54793e6b 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -434,8 +434,8 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i if (!dynamic_image_size.empty()) { if (!CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size)) { - GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] %s invalid. dynamic_image_size:%d ", - input_shape.c_str(), dynamic_image_size); + GELOGE(ge::PARAM_INVALID, "[Check][DynamicImagesizeInputShape] %s invalid. dynamic_image_size:%s ", + input_shape.c_str(), dynamic_image_size.c_str()); return ge::PARAM_INVALID; } } From db80be9765dcd0a504a92a6636a3d84fb9a8c280 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 10:03:01 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ops_kernel_store/host_cpu_ops_kernel_builder.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index 844969eb..5ece62de 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -39,9 +39,9 @@ Status HostCpuOpsKernelBuilder::Initialize(const map & Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { OpDescPtr op_desc = ge_node.GetOpDesc(); if (op_desc == nullptr) { - GELOGE(FAILED, "[Check][Param:OpDesc]nullptr is invalid, node:%s.", ge_node->GetName().c_str()); + GELOGE(FAILED, "[Check][Param:OpDesc]nullptr is invalid, node:%s.", ge_node.GetName().c_str()); REPORT_INNER_ERROR("E19999", "OpDesc is nullptr in node:%s, check invalid when CalcOpRunningParam", - ge_node->GetName().c_str()); + ge_node.GetName().c_str()); return FAILED; } @@ -92,9 +92,9 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { GELOGE(FAILED, "[Update][OutputDesc] fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed when CalcOpRunningParam. " - "fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", name.c_str(), type.c_str(), i, - TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); + REPORT_CALL_ERROR("E19999", "UpdateOutputDesc failed, fail for op[%s:%s] out[%zu], format=%s, data_type=%s.", + name.c_str(), type.c_str(), i, TypeUtils::FormatToSerialString(format).c_str(), + TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } } From 6e3f755e37c318f14efa3f29bfe94c2cd1f8c50c Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 10:41:30 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E6=95=B4=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ops_kernel_store/host_cpu_ops_kernel_builder.cc | 6 +++--- ge/plugin/engine/CMakeLists.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index 5ece62de..44d62fb9 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -41,7 +41,7 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { if (op_desc == nullptr) { GELOGE(FAILED, "[Check][Param:OpDesc]nullptr is invalid, node:%s.", ge_node.GetName().c_str()); REPORT_INNER_ERROR("E19999", "OpDesc is nullptr in node:%s, check invalid when CalcOpRunningParam", - ge_node.GetName().c_str()); + ge_node.GetName().c_str()); return FAILED; } @@ -78,8 +78,8 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { GELOGE(FAILED, "[Calc][TensorMemSize]fail for op[%s:%s] out[%zu], mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); - REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed when CalcOpRunningParam. fail for op[%s:%s] out[%zu], " - "mem_size=%ld, format=%s, data_type=%s.", name.c_str(), type.c_str(), i, output_mem_size, + REPORT_CALL_ERROR("E19999", "CalcTensorMemSize failed, op[%s:%s] out[%zu], size=%ld, format=%s, type=%s.", + name.c_str(), type.c_str(), i, output_mem_size, TypeUtils::FormatToSerialString(format).c_str(), TypeUtils::DataTypeToSerialString(data_type).c_str()); return FAILED; } diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index e5736b51..a984384e 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -41,6 +41,7 @@ target_link_options(engine PRIVATE target_link_libraries(engine PRIVATE $ -Wl,--no-as-needed + c_sec slog -Wl,--as-needed -lrt From f0fbda249e92bda011a773b7c3a0ce5008a05444 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 11:06:57 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E6=95=B4=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ops_kernel_store/host_cpu_ops_kernel_builder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc index 44d62fb9..db08ca0e 100644 --- a/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc +++ b/ge/host_cpu_engine/ops_kernel_store/host_cpu_ops_kernel_builder.cc @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +#include #include "host_cpu_ops_kernel_builder.h" #include #include "common/ge_inner_error_codes.h" From 3585bdd3a3cf3425558199ac976cf7b630031eb0 Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 16:01:09 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E6=95=B4=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/host_cpu_engine/engine/host_cpu_engine.cc | 1 + ge/init/gelib.cc | 776 +++++------------- ge/ir_build/atc_ir_common.cc | 24 +- .../ops_kernel_builder_manager.cc | 2 +- ge/opskernel_manager/ops_kernel_manager.cc | 14 +- ge/plugin/engine/CMakeLists.txt | 2 +- 6 files changed, 236 insertions(+), 583 deletions(-) diff --git a/ge/host_cpu_engine/engine/host_cpu_engine.cc b/ge/host_cpu_engine/engine/host_cpu_engine.cc index 7d4b9df7..62dd9ec2 100644 --- a/ge/host_cpu_engine/engine/host_cpu_engine.cc +++ b/ge/host_cpu_engine/engine/host_cpu_engine.cc @@ -35,6 +35,7 @@ Status HostCpuEngine::Initialize(const std::map &options) { ops_kernel_store_ = MakeShared(); if (ops_kernel_store_ == nullptr) { GELOGE(FAILED, "[Init][HostCpuEngine] fail for new HostCpuOpsKernelInfoStore."); + REPORT_INNER_ERROR("E19999", "HostCpuEngine Initialize failed. fail for new HostCpuOpsKernelInfoStore."); return FAILED; } } diff --git a/ge/init/gelib.cc b/ge/init/gelib.cc index 03870522..add130c4 100644 --- a/ge/init/gelib.cc +++ b/ge/init/gelib.cc @@ -1,564 +1,212 @@ -/** - * Copyright 2020 Huawei Technologies Co., Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "init/gelib.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "common/ge/ge_util.h" -#include "common/ge/plugin_manager.h" -#include "common/profiling/profiling_manager.h" -#include "common/properties_manager.h" -#include "framework/common/debug/ge_log.h" -#include "framework/common/debug/log.h" -#include "framework/common/util.h" -#include "framework/omg/ge_init.h" -#include "analyzer/analyzer.h" -#include "ge/ge_api_types.h" -#include "ge_local_engine/engine/host_cpu_engine.h" -#include "graph/common/ge_call_wrapper.h" -#include "graph/ge_context.h" -#include "graph/ge_global_options.h" -#include "graph/load/model_manager/model_manager.h" -#include "graph/manager/graph_mem_allocator.h" -#include "graph/manager/host_mem_manager.h" -#include "graph/manager/graph_var_manager.h" -#include "omm/csa_interact.h" -#include "runtime/kernel.h" -#include "opskernel_manager/ops_kernel_builder_manager.h" -#include "external/runtime/rt_error_codes.h" - -using Json = nlohmann::json; - -namespace ge { -namespace { -const int kDecimal = 10; -const int kSocVersionLen = 50; -const int kDefaultDeviceIdForTrain = 0; -const int kDefaultDeviceIdForInfer = -1; -const char *const kGlobalOptionFpCeilingModeDefault = "2"; -} // namespace -static std::shared_ptr instancePtr_ = nullptr; - -// Initial each module of GE, if one failed, release all -Status GELib::Initialize(const map &options) { - - - GELOGI("initial start"); - GEEVENT("[GEPERFTRACE] GE Init Start"); - // Multiple initializations are not allowed - instancePtr_ = MakeShared(); - if (instancePtr_ == nullptr) { - GELOGE(GE_CLI_INIT_FAILED, "[Init][GeLib] failed for new GELib."); - return GE_CLI_INIT_FAILED; - } - - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kSystemInit); - map new_options; - Status ret = instancePtr_->SetRTSocVersion(options, new_options); - if (ret != SUCCESS) { - GELOGE(ret, "[Set][RTSocVersion] failed."); - return ret; - } - - ret = instancePtr_->SetAiCoreNum(new_options); - if (ret != SUCCESS) { - GELOGE(ret, "[Set][AiCoreNum] failed."); - return ret; - } - - instancePtr_->SetDefaultPrecisionMode(new_options); - - if (new_options.find("ge.fpCeilingMode") == new_options.end()) { - new_options["ge.fpCeilingMode"] = kGlobalOptionFpCeilingModeDefault; - } - - GetMutableGlobalOptions().insert(new_options.begin(), new_options.end()); - GetThreadLocalContext().SetGlobalOption(GetMutableGlobalOptions()); - GE_TIMESTAMP_START(Init); - ret = instancePtr_->InnerInitialize(new_options); - if (ret != SUCCESS) { - GELOGE(ret, "[Init][GELib] failed."); - instancePtr_ = nullptr; - return ret; - } - GE_TIMESTAMP_EVENT_END(Init, "GELib::Initialize"); - return SUCCESS; -} - -Status GELib::InnerInitialize(const map &options) { - // Multiple initializations are not allowed - if (init_flag_) { - GELOGW("multi initializations"); - return SUCCESS; - } - - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kSystemInit); - GELOGI("GE System initial."); - GE_TIMESTAMP_START(SystemInitialize); - Status initSystemStatus = SystemInitialize(options); - GE_TIMESTAMP_END(SystemInitialize, "InnerInitialize::SystemInitialize"); - if (initSystemStatus != SUCCESS) { - GELOGE(initSystemStatus, "[Init][System]failed."); - RollbackInit(); - return initSystemStatus; - } - - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kEngineInit); - GELOGI("engineManager initial."); - GE_TIMESTAMP_START(EngineInitialize); - Status initEmStatus = engineManager_.Initialize(options); - GE_TIMESTAMP_END(EngineInitialize, "InnerInitialize::EngineInitialize"); - if (initEmStatus != SUCCESS) { - GELOGE(initEmStatus, "[Init][Enginemanager] failed, options invalid. "); - RollbackInit(); - return initEmStatus; - } - - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsKernelInit); - GELOGI("opsManager initial."); - GE_TIMESTAMP_START(OpsManagerInitialize); - Status initOpsStatus = opsManager_.Initialize(options); - GE_TIMESTAMP_END(OpsManagerInitialize, "InnerInitialize::OpsManagerInitialize"); - if (initOpsStatus != SUCCESS) { - GELOGE(initOpsStatus, "[Init][OpsKernelManager] failed. "); - RollbackInit(); - return initOpsStatus; - } - - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsKernelBuilderInit); - GELOGI("opsBuilderManager initial."); - GE_TIMESTAMP_START(OpsKernelBuilderManagerInitialize); - Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); - GE_TIMESTAMP_END(OpsKernelBuilderManagerInitialize, "InnerInitialize::OpsKernelBuilderManager"); - if (initOpsBuilderStatus != SUCCESS) { - GELOGE(initOpsBuilderStatus, "[Init][OpsKernelBuilderManager] failed."); - RollbackInit(); - return initOpsBuilderStatus; - } - - ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); - GELOGI("sessionManager initial."); - GE_TIMESTAMP_START(SessionManagerInitialize); - Status initSmStatus = sessionManager_.Initialize(options); - GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); - if (initSmStatus != SUCCESS) { - GELOGE(initSmStatus, "[Init][SessionManager] failed."); - RollbackInit(); - return initSmStatus; - } - - GELOGI("Start to initialize HostCpuEngine"); - GE_TIMESTAMP_START(HostCpuEngineInitialize); - Status initHostCpuEngineStatus = HostCpuEngine::GetInstance().Initialize(); - GE_TIMESTAMP_END(HostCpuEngineInitialize, "InnerInitialize::HostCpuEngineInitialize"); - if (initHostCpuEngineStatus != SUCCESS) { - GELOGE(initHostCpuEngineStatus, "[Init][HostCpuEngine] failed."); - RollbackInit(); - return initHostCpuEngineStatus; - } - - GELOGI("Start to init Analyzer!"); - Status init_analyzer_status = ge::Analyzer::GetInstance()->Initialize(); - if (init_analyzer_status != SUCCESS) { - GELOGE(init_analyzer_status, "[Init][HostCpuEngine] failed."); - RollbackInit(); - return init_analyzer_status; - } - - init_flag_ = true; - return SUCCESS; -} - -Status GELib::SystemInitialize(const map &options) { - Status status = FAILED; - auto iter = options.find(OPTION_GRAPH_RUN_MODE); - if (iter != options.end()) { - if (GraphRunMode(std::strtol(iter->second.c_str(), nullptr, kDecimal)) >= TRAIN) { - is_train_mode_ = true; - } - } - - InitOptions(options); - - // In train and infer, profiling is always needed. - InitProfiling(this->options_); - auto model_manager = ModelManager::GetInstance(); - GE_CHECK_NOTNULL(model_manager); - GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, - GELOGE(FAILED, "[Enable][ExceptionDump] failed."); - return FAILED); - // 1.`is_train_mode_` means case: train - // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer - // these two case with logical device id - if (is_train_mode_ || (options_.device_id != kDefaultDeviceIdForInfer)) { - status = InitSystemWithOptions(this->options_); - } else { - status = InitSystemWithoutOptions(); - } - return status; -} - -void GELib::InitProfiling(Options &options) { - GELOGI("Init Profiling. session Id: %ld, device id:%d ", options.session_id, options.device_id); - std::lock_guard lock(status_mutex_); - GetContext().Init(); - // Profiling init - if (ProfilingManager::Instance().Init(options) != SUCCESS) { - GELOGW("Profiling init failed."); - } -} - -void GELib::SetDefaultPrecisionMode(map &new_options) { - auto iter = new_options.find(PRECISION_MODE); - if (iter != new_options.end()) { - GELOGI("Find precision_mode in options, value is %s", iter->second.c_str()); - return; - } - iter = new_options.find(OPTION_GRAPH_RUN_MODE); - if (iter != new_options.end()) { - if (GraphRunMode(std::strtol(iter->second.c_str(), nullptr, kDecimal)) >= TRAIN) { - // only train mode need to be set allow_fp32_to_fp16. - GELOGI("This is train mode, precision_mode need to be set allow_fp32_to_fp16"); - new_options.insert(std::make_pair(PRECISION_MODE, "allow_fp32_to_fp16")); - return; - } - } - GELOGI("This is not train mode, precision_mode need to be set force_fp16"); - new_options.insert(std::make_pair(PRECISION_MODE, "force_fp16")); - return; -} - -Status GELib::SetRTSocVersion(const map &options, map &new_options) { - GELOGI("Start to set SOC_VERSION"); - new_options.insert(options.begin(), options.end()); - auto it = new_options.find(ge::SOC_VERSION); - if (it != new_options.end()) { - GE_CHK_RT_RET(rtSetSocVersion(it->second.c_str())); - GELOGI("Succeeded in setting SOC_VERSION[%s] to runtime.", it->second.c_str()); - } else { - GELOGI("SOC_VERSION is not exist in options"); - char version[kSocVersionLen] = {0}; - rtError_t rt_ret = rtGetSocVersion(version, kSocVersionLen); - GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(rt_ret, "[Get][SocVersion] failed."); return FAILED;) - GELOGI("Succeeded in getting SOC_VERSION[%s] from runtime.", version); - new_options.insert(std::make_pair(ge::SOC_VERSION, version)); - } - return SUCCESS; -} - -Status GELib::SetAiCoreNum(map &options) { - // Already set or get AICORE_NUM from options in offline mode - if (options.find(AICORE_NUM) != options.end()) { - return SUCCESS; - } - - uint32_t aicore_num = 0; - rtError_t ret = rtGetAiCoreCount(&aicore_num); - if (ret == ACL_ERROR_RT_FEATURE_NOT_SUPPORT) { // offline without ATC Input of AiCoreNum - return SUCCESS; - } else if (ret == RT_ERROR_NONE) { // online-mode - options.emplace(std::make_pair(AICORE_NUM, std::to_string(aicore_num))); - return SUCCESS; - } - GELOGE(FAILED, "[Get][AiCoreCount] failed."); - return FAILED; -} - -void GELib::InitOptions(const map &options) { - this->options_.session_id = 0; - auto iter = options.find(OPTION_EXEC_SESSION_ID); - if (iter != options.end()) { - this->options_.session_id = std::strtoll(iter->second.c_str(), nullptr, kDecimal); - } - this->options_.device_id = is_train_mode_ ? kDefaultDeviceIdForTrain : kDefaultDeviceIdForInfer; - iter = options.find(OPTION_EXEC_DEVICE_ID); - if (iter != options.end()) { - this->options_.device_id = static_cast(std::strtol(iter->second.c_str(), nullptr, kDecimal)); - } - iter = options.find(OPTION_EXEC_JOB_ID); - if (iter != options.end()) { - this->options_.job_id = iter->second.c_str(); - } - this->options_.isUseHcom = false; - iter = options.find(OPTION_EXEC_IS_USEHCOM); - if (iter != options.end()) { - std::istringstream(iter->second) >> this->options_.isUseHcom; - } - this->options_.isUseHvd = false; - iter = options.find(OPTION_EXEC_IS_USEHVD); - if (iter != options.end()) { - std::istringstream(iter->second) >> this->options_.isUseHvd; - } - this->options_.deployMode = false; - iter = options.find(OPTION_EXEC_DEPLOY_MODE); - if (iter != options.end()) { - std::istringstream(iter->second) >> this->options_.deployMode; - } - iter = options.find(OPTION_EXEC_POD_NAME); - if (iter != options.end()) { - this->options_.podName = iter->second.c_str(); - } - iter = options.find(OPTION_EXEC_PROFILING_MODE); - if (iter != options.end()) { - this->options_.profiling_mode = iter->second.c_str(); - } - iter = options.find(OPTION_EXEC_PROFILING_OPTIONS); - if (iter != options.end()) { - this->options_.profiling_options = iter->second.c_str(); - } - iter = options.find(OPTION_EXEC_RANK_ID); - if (iter != options.end()) { - this->options_.rankId = std::strtoll(iter->second.c_str(), nullptr, kDecimal); - } - iter = options.find(OPTION_EXEC_RANK_TABLE_FILE); - if (iter != options.end()) { - this->options_.rankTableFile = iter->second.c_str(); - } - this->options_.enable_atomic = true; - iter = options.find(OPTION_EXEC_ATOMIC_FLAG); - GE_IF_BOOL_EXEC(iter != options.end(), - this->options_.enable_atomic = std::strtol(iter->second.c_str(), nullptr, kDecimal)); - GELOGI("ge InnerInitialize, the enable_atomic_flag in options_ is %d", this->options_.enable_atomic); -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOptions(Options &options) { - std::string mode = is_train_mode_ ? "Training" : "Online infer"; - GELOGI("%s init GELib. session Id:%ld, device id :%d ", mode.c_str(), options.session_id, options.device_id); - GEEVENT("System init with options begin, job id %s", options.job_id.c_str()); - std::lock_guard lock(status_mutex_); - GE_IF_BOOL_EXEC(is_system_inited && !is_shutdown, - GELOGW("System init with options is already inited and not shutdown."); - return SUCCESS); - - std::vector mem_type; - mem_type.push_back(RT_MEMORY_HBM); - mem_type.push_back(RT_MEMORY_P2P_DDR); - Status initMmStatus = MemManager::Instance().Initialize(mem_type); - if (initMmStatus != SUCCESS) { - GELOGE(initMmStatus, "[Init][MemManager] failed."); - return initMmStatus; - } - - GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); - // Update CSA file - CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); - Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); - GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret=%u , jobstate_running=%d , substate_env_init=%d .", - ret, JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); - - // set device id - GELOGI("set logical device id:%u", options.device_id); - GetContext().SetCtxDeviceId(static_cast(options.device_id)); - GE_CHK_RT_RET(rtSetDevice(options.device_id)); - - // In the scenario that the automatic add fusion is set, but there is no cleanaddr operator, - // maybe need to check it - is_system_inited = true; - is_shutdown = false; - - GELOGI("%s init GELib success.", mode.c_str()); - - return SUCCESS; -} - -Status GELib::SystemShutdownWithOptions(const Options &options) { - std::string mode = is_train_mode_ ? "Training" : "Online infer"; - GELOGI("%s finalize GELib begin.", mode.c_str()); - std::lock_guard lock(status_mutex_); - GE_IF_BOOL_EXEC(is_shutdown || !is_system_inited, - GELOGW("System Shutdown with options is already is_shutdown or system does not inited. " - "is_shutdown:%d is_omm_inited:%d", - is_shutdown, is_system_inited); - return SUCCESS); - - GE_CHK_RT(rtDeviceReset(options.device_id)); - - // Update CSA file - Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_SUCCEED); - GE_LOGE_IF(ret != SUCCESS, "[Write][JobState] failed, ret=%u jobstate_succeed=%d .", ret, JOBSTATE_SUCCEED); - - is_system_inited = false; - is_shutdown = true; - GELOGI("%s finalize GELib success.", mode.c_str()); - return SUCCESS; -} - -FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithoutOptions() { - GELOGI("Inference Init GELib begin."); - - std::vector mem_type; - mem_type.push_back(RT_MEMORY_HBM); - mem_type.push_back(RT_MEMORY_P2P_DDR); - Status initMmStatus = MemManager::Instance().Initialize(mem_type); - if (initMmStatus != SUCCESS) { - GELOGE(initMmStatus, "[Init][MemManager] failed."); - return initMmStatus; - } - GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); - - static bool is_inited = false; - if (is_inited) { - GELOGW("System init without options is already inited, don't need to init again."); - return SUCCESS; - } - is_inited = true; - GELOGI("Inference init GELib success."); - - return SUCCESS; -} - -string GELib::GetPath() { return PluginManager::GetPath(); } - -// Finalize all modules -Status GELib::Finalize() { - ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); - GELOGI("finalization start"); - // Finalization is not allowed before initialization - if (!init_flag_) { - GELOGW("not initialize"); - return SUCCESS; - } - if (is_train_mode_ || (options_.device_id != kDefaultDeviceIdForInfer)) { - GE_CHK_RT_RET(rtSetDevice(options_.device_id)); - } - Status final_state = SUCCESS; - Status mid_state; - GELOGI("engineManager finalization."); - mid_state = engineManager_.Finalize(); - if (mid_state != SUCCESS) { - GELOGW("engineManager finalize failed"); - final_state = mid_state; - } - GELOGI("sessionManager finalization."); - mid_state = sessionManager_.Finalize(); - if (mid_state != SUCCESS) { - GELOGW("sessionManager finalize failed"); - final_state = mid_state; - } - - GELOGI("opsBuilderManager finalization."); - mid_state = OpsKernelBuilderManager::Instance().Finalize(); - if (mid_state != SUCCESS) { - GELOGW("opsBuilderManager finalize failed"); - final_state = mid_state; - } - GELOGI("opsManager finalization."); - mid_state = opsManager_.Finalize(); - if (mid_state != SUCCESS) { - GELOGW("opsManager finalize failed"); - final_state = mid_state; - } - - GELOGI("VarManagerPool finalization."); - VarManagerPool::Instance().Destory(); - - GELOGI("MemManager finalization."); - MemManager::Instance().Finalize(); - - GELOGI("HostMemManager finalization."); - HostMemManager::Instance().Finalize(); - - GELOGI("HostCpuEngine finalization."); - HostCpuEngine::GetInstance().Finalize(); - - GELOGI("Analyzer finalization"); - Analyzer::GetInstance()->Finalize(); - - // Shut down profiling - ShutDownProfiling(); - - if (is_train_mode_ || (options_.device_id != kDefaultDeviceIdForInfer)) { - GELOGI("System ShutDown."); - mid_state = SystemShutdownWithOptions(this->options_); - if (mid_state != SUCCESS) { - GELOGW("System shutdown with options failed"); - final_state = mid_state; - } - } - - is_train_mode_ = false; - - GetMutableGlobalOptions().erase(ENABLE_SINGLE_STREAM); - - if (is_train_mode_ || (options_.device_id != kDefaultDeviceIdForInfer)) { - GE_CHK_RT_RET(rtDeviceReset(options_.device_id)); - } - - instancePtr_ = nullptr; - init_flag_ = false; - if (final_state != SUCCESS) { - GELOGE(FAILED, "[Check][State]finalization failed, because no init before. "); - return final_state; - } - GELOGI("finalization success."); - return SUCCESS; -} - -void GELib::ShutDownProfiling() { - std::lock_guard lock(status_mutex_); - - if (ProfilingManager::Instance().ProfilingOn()) { - ProfilingManager::Instance().StopProfiling(); - ProfilingManager::Instance().PluginUnInit(); - } -} - -// Get Singleton Instance -std::shared_ptr GELib::GetInstance() { return instancePtr_; } - -void GELib::RollbackInit() { - if (engineManager_.init_flag_) { - (void)engineManager_.Finalize(); - } - if (opsManager_.init_flag_) { - (void)opsManager_.Finalize(); - } - if (sessionManager_.init_flag_) { - (void)sessionManager_.Finalize(); - } - MemManager::Instance().Finalize(); - HostMemManager::Instance().Finalize(); - VarManagerPool::Instance().Destory(); -} - -Status GEInit::Initialize(const map &options) { - Status ret = SUCCESS; - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { - ret = GELib::Initialize(options); - } - return ret; -} - -Status GEInit::Finalize() { - std::shared_ptr instance_ptr = ge::GELib::GetInstance(); - if (instance_ptr != nullptr) { - return instance_ptr->Finalize(); - } - return SUCCESS; -} - -string GEInit::GetPath() { - return GELib::GetPath(); -} -} // namespace ge +/** + * Copyright 2019-2020 Huawei Technologies Co., Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "plugin/engine/engine_manage.h" + +#include +#include +#include + +#include "common/ge/ge_util.h" +#include "framework/common/debug/ge_log.h" +#include "plugin/engine/dnnengines.h" + +namespace ge { +std::unique_ptr> EngineManager::engine_map_; + +Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr) { + if (engine_ptr == nullptr) { + GELOGE(FAILED, "[Register][Engine] failed, as input engine_ptr is nullptr"); + REPORT_INNER_ERROR("E19999", "RegisterEngine failed, as input engine_ptr is nullptr"); + return FAILED; + } + + if (engine_map_ == nullptr) { + engine_map_.reset(new (std::nothrow) std::map()); + } + + auto it = engine_map_->find(engine_name); + if (it != engine_map_->end()) { + GELOGW("engine %s already exist.", engine_name.c_str()); + return FAILED; + } + engine_map_->emplace(engine_name, engine_ptr); + return SUCCESS; +} + +DNNEnginePtr EngineManager::GetEngine(const std::string &engine_name) { + auto it = engine_map_->find(engine_name); + if (it == engine_map_->end()) { + GELOGW("engine %s not exist.", engine_name.c_str()); + return nullptr; + } + + auto engine = it->second; + return engine; +} + +void RegisterAiCoreEngine() { + const std::string ai_core = "AIcoreEngine"; + std::vector mem_type_aicore; + mem_type_aicore.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + DNNEngineAttribute attr_aicore = {ai_core, mem_type_aicore, COST_0, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr aicore_engine_ptr = MakeShared(attr_aicore); + if (aicore_engine_ptr == nullptr) { + GELOGE(ge::FAILED, "[Register][AiCoreEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { + GELOGW("register ai_core failed"); + } +} + +void RegisterVectorEngine() { + const std::string vector_core = "VectorEngine"; + std::vector mem_type_aivcore; + mem_type_aivcore.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + DNNEngineAttribute attr_vector_core = {vector_core, mem_type_aivcore, COST_1, + DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr vectorcore_engine_ptr = MakeShared(attr_vector_core); + if (vectorcore_engine_ptr == nullptr) { + GELOGE(ge::FAILED, "[Register][VectorEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { + GELOGW("register vector_core failed"); + } +} + +void RegisterAiCpuEngine() { + const std::string vm_aicpu = "DNN_VM_AICPU_ASCEND"; + std::vector mem_type_aicpu; + mem_type_aicpu.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu); + if (vm_engine_ptr == nullptr) { + GELOGE(ge::FAILED, "[Register][AiCpuEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { + GELOGW("register vmAicpuEngine failed"); + } +} + +void RegisterAiCpuTFEngine() { + const std::string vm_aicpu_tf = "DNN_VM_AICPU"; + std::vector mem_type_aicpu_tf; + mem_type_aicpu_tf.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + DNNEngineAttribute attr_aicpu_tf = {vm_aicpu_tf, mem_type_aicpu_tf, COST_2, DEVICE, + FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu_tf); + if (vm_engine_ptr == nullptr) { + GELOGE(ge::FAILED, "[Register][AiCpuTFEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { + GELOGW("register vmAicpuTFEngine failed"); + } +} + +void RegisterGeLocalEngine() { + const std::string vm_ge_local = "DNN_VM_GE_LOCAL"; + std::vector mem_type_ge_local; + mem_type_ge_local.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + // GeLocal use minimum priority, set it as 9 + DNNEngineAttribute attr_ge_local = {vm_ge_local, mem_type_ge_local, COST_9, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr ge_local_engine = MakeShared(attr_ge_local); + if (ge_local_engine == nullptr) { + GELOGE(ge::FAILED, "[Register][GeLocalEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { + GELOGW("register ge_local_engine failed"); + } +} + +void RegisterHostCpuEngine() { + const std::string vm_host_cpu = "DNN_VM_HOST_CPU"; + std::vector mem_type_host_cpu; + mem_type_host_cpu.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + // HostCpu use minimum priority, set it as 10 + DNNEngineAttribute attr_host_cpu = {vm_host_cpu, mem_type_host_cpu, COST_10, + HOST, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr host_cpu_engine = MakeShared(attr_host_cpu); + if (host_cpu_engine == nullptr) { + GELOGE(ge::FAILED, "[Register][HostCpuEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { + GELOGW("register host_cpu_engine failed"); + } +} + +void RegisterRtsEngine() { + const std::string vm_rts = "DNN_VM_RTS"; + std::vector mem_type_rts; + mem_type_rts.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + DNNEngineAttribute attr_rts = {vm_rts, mem_type_rts, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr rts_engine = MakeShared(attr_rts); + if (rts_engine == nullptr) { + GELOGE(ge::FAILED, "[Register][RtsEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { + GELOGW("register rts_engine failed"); + } +} + +void RegisterHcclEngine() { + const std::string dnn_hccl = "DNN_HCCL"; + std::vector mem_type_hccl; + mem_type_hccl.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); + DNNEngineAttribute attr_hccl = {dnn_hccl, mem_type_hccl, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; + DNNEnginePtr hccl_engine = MakeShared(attr_hccl); + if (hccl_engine == nullptr) { + GELOGE(ge::FAILED, "[Register][HcclEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed, as malloc shared_ptr failed."); + return; + } + if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) { + GELOGW("register hccl_engine failed"); + } +} + +void GetDNNEngineObjs(std::map &engines) { + RegisterAiCoreEngine(); + RegisterVectorEngine(); + RegisterAiCpuTFEngine(); + RegisterAiCpuEngine(); + RegisterGeLocalEngine(); + RegisterHostCpuEngine(); + RegisterRtsEngine(); + RegisterHcclEngine(); + + for (auto it = EngineManager::engine_map_->begin(); it != EngineManager::engine_map_->end(); ++it) { + GELOGI("get engine %s from engine plugin.", it->first.c_str()); + engines.emplace(std::pair(it->first, it->second)); + } + + GELOGI("after get engine, engine size: %zu", engines.size()); + return; +} +} // namespace ge diff --git a/ge/ir_build/atc_ir_common.cc b/ge/ir_build/atc_ir_common.cc index 54793e6b..237839a2 100755 --- a/ge/ir_build/atc_ir_common.cc +++ b/ge/ir_build/atc_ir_common.cc @@ -78,7 +78,7 @@ Status CheckInputFormat(const string &input_format) { if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format, "input format is invalid!"}); - GELOGE(ge::PARAM_INVALID, "[Check][InputFormat] [%s] is invalid!", input_format.c_str()); + GELOGE(ge::PARAM_INVALID, "[Check][InputFormat] --input_format[%s] is invalid!", input_format.c_str()); return ge::PARAM_INVALID; } return ge::SUCCESS; @@ -189,7 +189,7 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--input_format", input_format.c_str(), "input_format must be ND when set dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, "[Check][Param]input_format must be ND when set dynamic_dims."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]--input_format must be ND when set dynamic_dims."); return false; } @@ -211,7 +211,7 @@ bool CheckDynamicDimsInputShapeValid(const map> &shape_m "E10001", {"parameter", "value", "reason"}, {"--input_shape's dynamic dim num", "0", "at least one dim should be -1 when set dynamic_dims"}); GELOGE(ge::PARAM_INVALID, - "[Check][Param]input_shape invalid, at least one dim should be -1 when set dynamic_dims."); + "[Check][Param]--input_shape invalid, at least one dim should be -1 when set dynamic_dims."); return false; } @@ -229,7 +229,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims ErrorManager::GetInstance().ATCReportErrMessage( "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims", dynamic_dims.c_str(), "dynamic_dims can not be empty"}); - GELOGE(ge::PARAM_INVALID, "[Check][Param]dynamic_dims can not be empty."); + GELOGE(ge::PARAM_INVALID, "[Check][Param]--dynamic_dims can not be empty."); return false; } // Different parameter sets are split by ';' @@ -259,7 +259,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims "E10001", {"parameter", "value", "reason"}, {"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); GELOGE(ge::PARAM_INVALID, - "[Check][Param]dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); + "[Check][Param]--dynamic_dims:%s parameter must be positive integer.", dynamic_dims.c_str()); return false; } } @@ -294,8 +294,8 @@ bool ParseSingleShapeRange(std::string &shape_range, vector(!dynamic_batch_size.empty()) + static_cast(!dynamic_image_size.empty()) + static_cast(!dynamic_dims.empty()); if (param_size > 1) { - ErrorManager::GetInstance().ATCReportErrMessage("E10009", {"parameter0", "parameter1", "parameter2"}, + ErrorManager::GetInstance().ATCReportErrMessage("E10009", {"parameter0", "parameter1", "parameter2"}, {"dynamic_batch_size", "dynamic_image_size", "dynamic_dims"}); - GELOGE(ge::PARAM_INVALID, - "[Parse][Param]dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); - return ge::PARAM_INVALID; + GELOGE(ge::PARAM_INVALID, + "[Parse][Param]dynamic_batch_size, dynamic_image_size and dynamic_dims can only be set one"); + return ge::PARAM_INVALID; } if (param_size == 0) { @@ -770,7 +770,7 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co GE_CHECK_NOTNULL(op); if (op->GetType() == DATA) { if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { - GELOGE(FAILED, "[Update][Data] op[%s] invalid.", op->GetName().c_str()); + GELOGE(FAILED, "[Update][InputShapeRange] op[%s] invalid.", op->GetName().c_str()); return FAILED; } } diff --git a/ge/opskernel_manager/ops_kernel_builder_manager.cc b/ge/opskernel_manager/ops_kernel_builder_manager.cc index 22a62cad..a556f740 100644 --- a/ge/opskernel_manager/ops_kernel_builder_manager.cc +++ b/ge/opskernel_manager/ops_kernel_builder_manager.cc @@ -129,7 +129,7 @@ Status OpsKernelBuilderManager::CalcOpRunningParam(Node &node) const { const std::string &lib_name = op_desc->GetOpKernelLibName(); auto it = ops_kernel_builders_.find(lib_name); if (it == ops_kernel_builders_.end()) { - GELOGE(INTERNAL_ERROR,"[Check][Lib_name] libName = %s, node = %s not exist.", + GELOGE(INTERNAL_ERROR,"[Check][Lib_Name] libName = %s, node = %s not exist.", lib_name.c_str(), op_desc->GetName().c_str()); REPORT_INNER_ERROR("E19999", "CalcOpRunningParam failed, libName = %s, node = %s not exist.", lib_name.c_str(), op_desc->GetName().c_str()); diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index 3de80805..57379552 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -183,16 +183,20 @@ Status OpsKernelManager::ParsePluginOptions(const map &options, return GE_GRAPH_OPTIONS_INVALID; } } catch (std::invalid_argument &) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data] failed, its value %s is invalid_argument, it must be 0 or 1.", + GELOGE(GE_GRAPH_OPTIONS_INVALID, + "[Check][Data] failed, option_key:ge.feFlag, its value %s is invalid_argument, it must be 0 or 1.", iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, its value %s is invalid_argument, it must be 0 or 1.", + REPORT_INNER_ERROR("E19999", + "ParsePluginOptions failed, option_key:ge.feFlag, its value %s is invalid_argument, it must be 0 or 1.", iter->second.c_str()); return GE_GRAPH_OPTIONS_INVALID; } catch (std::out_of_range &) { - GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]failed, its value %s is out of range, it must be 0 or 1.", - iter->second.c_str()); - REPORT_INNER_ERROR("E19999", "ParsePluginOptions failed, its value %s is out of range, it must be 0 or 1.", + GELOGE(GE_GRAPH_OPTIONS_INVALID, + "[Check][Data]failed, option_key:ge.feFlag, its value %s is out of range, it must be 0 or 1.", iter->second.c_str()); + REPORT_INNER_ERROR("E19999", + "ParsePluginOptions failed, option_key:ge.feFlag, its value %s is out of range, it must be 0 or 1.", + iter->second.c_str());option_key:ge.feFlag, return GE_GRAPH_OPTIONS_INVALID; } catch (...) { GELOGE(GE_GRAPH_OPTIONS_INVALID, "[Check][Data]option_key:%s, its value %s is invalid, it must be 0 or 1.", diff --git a/ge/plugin/engine/CMakeLists.txt b/ge/plugin/engine/CMakeLists.txt index a984384e..3aace4ac 100644 --- a/ge/plugin/engine/CMakeLists.txt +++ b/ge/plugin/engine/CMakeLists.txt @@ -41,7 +41,7 @@ target_link_options(engine PRIVATE target_link_libraries(engine PRIVATE $ -Wl,--no-as-needed - c_sec + c_sec slog -Wl,--as-needed -lrt From c7dae7ca1ba75afe6a16e9adaa4c858e530e64eb Mon Sep 17 00:00:00 2001 From: liudingyan Date: Wed, 17 Mar 2021 17:09:35 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E6=95=B4=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ge/omm/csa_interact.cc | 2 ++ ge/opskernel_manager/ops_kernel_manager.cc | 6 ++++++ ge/plugin/engine/engine_manage.cc | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/ge/omm/csa_interact.cc b/ge/omm/csa_interact.cc index a9f64dd1..8c93c396 100644 --- a/ge/omm/csa_interact.cc +++ b/ge/omm/csa_interact.cc @@ -79,6 +79,7 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, ErrorModule error_module) { if (!is_init_) { GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "WriteJobState failed before init. "); return INTERNAL_ERROR; } if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { @@ -172,6 +173,7 @@ void CsaInteract::WriteInternalErrorCode() { Status CsaInteract::WriteHcomDetection(const std::string &content) { if (!is_init_) { GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); + REPORT_INNER_ERROR("E19999", "WriteHcomDetection failed before init."); return INTERNAL_ERROR; } diff --git a/ge/opskernel_manager/ops_kernel_manager.cc b/ge/opskernel_manager/ops_kernel_manager.cc index 57379552..d8a3e3a8 100644 --- a/ge/opskernel_manager/ops_kernel_manager.cc +++ b/ge/opskernel_manager/ops_kernel_manager.cc @@ -86,6 +86,7 @@ Status OpsKernelManager::Initialize(const map &options_const) { Status rst0 = plugin_manager_.InvokeAll &, Status>(kInitialize, initialize_); if (rst0 == FAILED) { GELOGE(GE_OPS_GET_NO_VALID_SO, "[Invoke][OpsKernelInfo]PluginManager InvokeAll failed."); + REPORT_INNER_ERROR("E19999", "PluginManager InvokeAll failed.") return GE_OPS_GET_NO_VALID_SO; } Status rst1 = @@ -121,6 +122,7 @@ Status OpsKernelManager::Initialize(const map &options_const) { return SUCCESS; } else { GELOGE(ret, "[Check][So File] not find any valid so file."); + REPORT_INNER_ERROR("E19999", "OpsKernelManager::Initialize failed for not find any valid so file."); return ret; } } @@ -265,6 +267,7 @@ void OpsKernelManager::InitOpsKernelInfo() { std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib]malloc instance_ptr failed."); + REPORT_INNER_ERROR("E19999", "InitOpsKernelInfo failed for new GELib failed."); return; } // sort opinfo of ops_kernel_info_ @@ -309,6 +312,7 @@ Status OpsKernelManager::InitGraphOptimzers(const map &options) std::shared_ptr instance_ptr = ge::GELib::GetInstance(); if (instance_ptr == nullptr) { GELOGE(GE_CLI_GE_NOT_INITIALIZED, "[Get][GELib]malloc instance_ptr failed."); + REPORT_INNER_ERROR("E19999", "InitGraphOptimzers failed for new GELib failed."); return GE_CLI_GE_NOT_INITIALIZED; } if (!instance_ptr->DNNEngineManagerObj().IsEngineRegistered(attrs.engineName)) { @@ -354,6 +358,7 @@ Status OpsKernelManager::Finalize() { Status ret = FinalizeOpsKernel(); if (ret != SUCCESS) { GELOGE(ret, "[Free][Ops kernel resource] failed."); + REPORT_CALL_ERROR("E19999", "FinalizeOpsKernel failed, Free Ops kernel resource failed."); return ret; } @@ -465,6 +470,7 @@ Status OpsKernelManager::FinalizeOpsKernel() { Status ret = plugin_manager_.InvokeAll(kFinalize); if (ret != SUCCESS) { GELOGE(ret, "[Finalize][Check][Status] invoke Fe finalize failed."); + REPORT_INNER_ERROR("E19999", "PluginManager InvokeAll failed."); return ret; } diff --git a/ge/plugin/engine/engine_manage.cc b/ge/plugin/engine/engine_manage.cc index 08b0640a..46288bce 100644 --- a/ge/plugin/engine/engine_manage.cc +++ b/ge/plugin/engine/engine_manage.cc @@ -65,6 +65,7 @@ void RegisterAiCoreEngine() { DNNEnginePtr aicore_engine_ptr = MakeShared(attr_aicore); if (aicore_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][AiCoreEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { @@ -81,6 +82,7 @@ void RegisterVectorEngine() { DNNEnginePtr vectorcore_engine_ptr = MakeShared(attr_vector_core); if (vectorcore_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][VectorEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { @@ -96,6 +98,7 @@ void RegisterAiCpuEngine() { DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu); if (vm_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][AiCpuEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { @@ -112,6 +115,7 @@ void RegisterAiCpuTFEngine() { DNNEnginePtr vm_engine_ptr = MakeShared(attr_aicpu_tf); if (vm_engine_ptr == nullptr) { GELOGE(ge::FAILED, "[Register][AiCpuTFEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { @@ -128,6 +132,7 @@ void RegisterGeLocalEngine() { DNNEnginePtr ge_local_engine = MakeShared(attr_ge_local); if (ge_local_engine == nullptr) { GELOGE(ge::FAILED, "[Register][GeLocalEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { @@ -145,6 +150,7 @@ void RegisterHostCpuEngine() { DNNEnginePtr host_cpu_engine = MakeShared(attr_host_cpu); if (host_cpu_engine == nullptr) { GELOGE(ge::FAILED, "[Register][HostCpuEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { @@ -160,6 +166,7 @@ void RegisterRtsEngine() { DNNEnginePtr rts_engine = MakeShared(attr_rts); if (rts_engine == nullptr) { GELOGE(ge::FAILED, "[Register][RtsEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { @@ -175,6 +182,7 @@ void RegisterHcclEngine() { DNNEnginePtr hccl_engine = MakeShared(attr_hccl); if (hccl_engine == nullptr) { GELOGE(ge::FAILED, "[Register][HcclEngine] failed, as malloc shared_ptr failed."); + REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed for new DNNEnginePtr failed."); return; } if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) {