@@ -18,6 +18,7 @@ | |||||
#include <map> | #include <map> | ||||
#include <memory> | #include <memory> | ||||
#include <string> | #include <string> | ||||
#include <securec.h> | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "common/ge/ge_util.h" | #include "common/ge/ge_util.h" | ||||
#include "host_cpu_engine/common/constant/constant.h" | #include "host_cpu_engine/common/constant/constant.h" | ||||
@@ -34,7 +35,8 @@ Status HostCpuEngine::Initialize(const std::map<string, string> &options) { | |||||
if (ops_kernel_store_ == nullptr) { | if (ops_kernel_store_ == nullptr) { | ||||
ops_kernel_store_ = MakeShared<HostCpuOpsKernelInfoStore>(); | ops_kernel_store_ = MakeShared<HostCpuOpsKernelInfoStore>(); | ||||
if (ops_kernel_store_ == nullptr) { | if (ops_kernel_store_ == nullptr) { | ||||
GELOGE(FAILED, "Make HostCpuOpsKernelInfoStore failed."); | |||||
GELOGE(FAILED, "[Create][HostCpuEngine]Make HostCpuOpsKernelInfoStore failed."); | |||||
REPORT_INNER_ERROR("E19999", "HostCpuEngine::Initialize failed for new HostCpuEngine."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -21,6 +21,7 @@ | |||||
#include "graph/utils/node_utils.h" | #include "graph/utils/node_utils.h" | ||||
#include "graph/utils/tensor_utils.h" | #include "graph/utils/tensor_utils.h" | ||||
#include "graph/utils/type_utils.h" | #include "graph/utils/type_utils.h" | ||||
#include <securec.h> | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "host_cpu_engine/common/constant/constant.h" | #include "host_cpu_engine/common/constant/constant.h" | ||||
#include "register/ops_kernel_builder_registry.h" | #include "register/ops_kernel_builder_registry.h" | ||||
@@ -39,7 +40,8 @@ Status HostCpuOpsKernelBuilder::Initialize(const map<std::string, std::string> & | |||||
Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { | Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { | ||||
OpDescPtr op_desc = ge_node.GetOpDesc(); | OpDescPtr op_desc = ge_node.GetOpDesc(); | ||||
if (op_desc == nullptr) { | if (op_desc == nullptr) { | ||||
GELOGE(FAILED, "CalcOpRunningParam failed, as op desc is null"); | |||||
GELOGE(FAILED, "[Get][OpDesc]CalcOpRunningParam failed, as op desc is null"); | |||||
REPORT_INNER_ERROR("E19999", "GetOpDesc failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -73,9 +75,14 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { | |||||
GeShape output_shape = output_tensor.GetShape(); | GeShape output_shape = output_tensor.GetShape(); | ||||
if ((TensorUtils::CalcTensorMemSize(output_shape, format, data_type, output_mem_size) != GRAPH_SUCCESS) || | if ((TensorUtils::CalcTensorMemSize(output_shape, format, data_type, output_mem_size) != GRAPH_SUCCESS) || | ||||
(output_mem_size < 0)) { | (output_mem_size < 0)) { | ||||
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()); | |||||
GELOGE(FAILED, | |||||
"[Calc][TensorMemSize] fail for op[%s:%s] out[%zu] mem size, 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 for op[%s:%s] out[%zu] mem size, 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; | return FAILED; | ||||
} | } | ||||
GELOGI("Calc op[%s:%s] out[%zu] mem size is %ld, format=%s, data_type=%s.", | GELOGI("Calc op[%s:%s] out[%zu] mem size is %ld, format=%s, data_type=%s.", | ||||
@@ -84,8 +91,13 @@ Status HostCpuOpsKernelBuilder::CalcOpRunningParam(Node &ge_node) { | |||||
TensorUtils::SetSize(output_tensor, output_mem_size); | TensorUtils::SetSize(output_tensor, output_mem_size); | ||||
if (op_desc->UpdateOutputDesc(static_cast<uint32_t>(i), output_tensor) != GRAPH_SUCCESS) { | if (op_desc->UpdateOutputDesc(static_cast<uint32_t>(i), output_tensor) != GRAPH_SUCCESS) { | ||||
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()); | |||||
GELOGE(FAILED, | |||||
"[Update][OutputDesc] fail for op[%s:%s] out[%zu] desc , 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 for op[%s:%s] out[%zu] desc , 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; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -68,7 +68,8 @@ Status GELib::Initialize(const map<string, string> &options) { | |||||
// Multiple initializations are not allowed | // Multiple initializations are not allowed | ||||
instancePtr_ = MakeShared<GELib>(); | instancePtr_ = MakeShared<GELib>(); | ||||
if (instancePtr_ == nullptr) { | if (instancePtr_ == nullptr) { | ||||
GELOGE(GE_CLI_INIT_FAILED, "GeLib initialize failed, malloc shared_ptr failed."); | |||||
GELOGE(GE_CLI_INIT_FAILED, "[Create][GELib]GeLib initialize failed, malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "GELib Init failed for new GeLib failed."); | |||||
return GE_CLI_INIT_FAILED; | return GE_CLI_INIT_FAILED; | ||||
} | } | ||||
@@ -76,13 +77,15 @@ Status GELib::Initialize(const map<string, string> &options) { | |||||
map<string, string> new_options; | map<string, string> new_options; | ||||
Status ret = instancePtr_->SetRTSocVersion(options, new_options); | Status ret = instancePtr_->SetRTSocVersion(options, new_options); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "GeLib initial failed."); | |||||
GELOGE(ret, "[Set][RTSocVersion]GeLib initial: SetRTSocVersion failed."); | |||||
REPORT_CALL_ERROR("E19999", "SetRTSocVersion failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = instancePtr_->SetAiCoreNum(new_options); | ret = instancePtr_->SetAiCoreNum(new_options); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "GeLib initial: SetAiCoreNum failed."); | |||||
GELOGE(ret, "[Set][AiCoreNum]GeLib initial: SetAiCoreNum failed."); | |||||
REPORT_CALL_ERROR("E19999", "SetAiCoreNum failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -97,7 +100,8 @@ Status GELib::Initialize(const map<string, string> &options) { | |||||
GE_TIMESTAMP_START(Init); | GE_TIMESTAMP_START(Init); | ||||
ret = instancePtr_->InnerInitialize(new_options); | ret = instancePtr_->InnerInitialize(new_options); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "GeLib initial failed."); | |||||
GELOGE(ret, "[Init][GeLib]GeLib initial failed."); | |||||
REPORT_CALL_ERROR("E19999", "GELib::InnerInitialize failed."); | |||||
instancePtr_ = nullptr; | instancePtr_ = nullptr; | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -118,7 +122,7 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
Status initSystemStatus = SystemInitialize(options); | Status initSystemStatus = SystemInitialize(options); | ||||
GE_TIMESTAMP_END(SystemInitialize, "InnerInitialize::SystemInitialize"); | GE_TIMESTAMP_END(SystemInitialize, "InnerInitialize::SystemInitialize"); | ||||
if (initSystemStatus != SUCCESS) { | if (initSystemStatus != SUCCESS) { | ||||
GELOGE(initSystemStatus, "GE system initial failed."); | |||||
GELOGE(initSystemStatus, "[Init][GESystem]GE system initial failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return initSystemStatus; | return initSystemStatus; | ||||
} | } | ||||
@@ -129,7 +133,8 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
Status initEmStatus = engineManager_.Initialize(options); | Status initEmStatus = engineManager_.Initialize(options); | ||||
GE_TIMESTAMP_END(EngineInitialize, "InnerInitialize::EngineInitialize"); | GE_TIMESTAMP_END(EngineInitialize, "InnerInitialize::EngineInitialize"); | ||||
if (initEmStatus != SUCCESS) { | if (initEmStatus != SUCCESS) { | ||||
GELOGE(initEmStatus, "GE engine manager initial failed."); | |||||
GELOGE(initEmStatus, "[Init][EngineManager]GE engine manager initial failed."); | |||||
REPORT_CALL_ERROR("E19999", "EngineManager initialize failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return initEmStatus; | return initEmStatus; | ||||
} | } | ||||
@@ -140,7 +145,8 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
Status initOpsStatus = opsManager_.Initialize(options); | Status initOpsStatus = opsManager_.Initialize(options); | ||||
GE_TIMESTAMP_END(OpsManagerInitialize, "InnerInitialize::OpsManagerInitialize"); | GE_TIMESTAMP_END(OpsManagerInitialize, "InnerInitialize::OpsManagerInitialize"); | ||||
if (initOpsStatus != SUCCESS) { | if (initOpsStatus != SUCCESS) { | ||||
GELOGE(initOpsStatus, "GE ops manager initial failed."); | |||||
GELOGE(initOpsStatus, "[Init][OpsManager]GE ops manager initial failed."); | |||||
REPORT_CALL_ERROR("E19999", "OpsManager initialize failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return initOpsStatus; | return initOpsStatus; | ||||
} | } | ||||
@@ -151,7 +157,8 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); | Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); | ||||
GE_TIMESTAMP_END(OpsKernelBuilderManagerInitialize, "InnerInitialize::OpsKernelBuilderManager"); | GE_TIMESTAMP_END(OpsKernelBuilderManagerInitialize, "InnerInitialize::OpsKernelBuilderManager"); | ||||
if (initOpsBuilderStatus != SUCCESS) { | if (initOpsBuilderStatus != SUCCESS) { | ||||
GELOGE(initOpsBuilderStatus, "GE ops builder manager initial failed."); | |||||
GELOGE(initOpsBuilderStatus, "[Init][OpsKernelBuilderManager]GE ops builder manager initial failed."); | |||||
REPORT_CALL_ERROR("E19999", "OpsBuilderManager initialize failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return initOpsBuilderStatus; | return initOpsBuilderStatus; | ||||
} | } | ||||
@@ -162,7 +169,8 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
Status initSmStatus = sessionManager_.Initialize(options); | Status initSmStatus = sessionManager_.Initialize(options); | ||||
GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); | GE_TIMESTAMP_END(SessionManagerInitialize, "InnerInitialize::SessionManagerInitialize"); | ||||
if (initSmStatus != SUCCESS) { | if (initSmStatus != SUCCESS) { | ||||
GELOGE(initSmStatus, "GE session manager initial failed."); | |||||
GELOGE(initSmStatus, "[Init][SessionManager] GE session manager initial failed."); | |||||
REPORT_CALL_ERROR("E19999", "SessionManager initialize failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return initSmStatus; | return initSmStatus; | ||||
} | } | ||||
@@ -172,7 +180,8 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
Status initHostCpuEngineStatus = HostCpuEngine::GetInstance().Initialize(); | Status initHostCpuEngineStatus = HostCpuEngine::GetInstance().Initialize(); | ||||
GE_TIMESTAMP_END(HostCpuEngineInitialize, "InnerInitialize::HostCpuEngineInitialize"); | GE_TIMESTAMP_END(HostCpuEngineInitialize, "InnerInitialize::HostCpuEngineInitialize"); | ||||
if (initHostCpuEngineStatus != SUCCESS) { | if (initHostCpuEngineStatus != SUCCESS) { | ||||
GELOGE(initHostCpuEngineStatus, "Failed to initialize HostCpuEngine"); | |||||
GELOGE(initHostCpuEngineStatus, "[Init][HostCpuEngine]Failed to initialize HostCpuEngine."); | |||||
REPORT_CALL_ERROR("E19999", "HostCpuEngine initialize failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return initHostCpuEngineStatus; | return initHostCpuEngineStatus; | ||||
} | } | ||||
@@ -180,7 +189,8 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||||
GELOGI("Start to init Analyzer!"); | GELOGI("Start to init Analyzer!"); | ||||
Status init_analyzer_status = ge::Analyzer::GetInstance()->Initialize(); | Status init_analyzer_status = ge::Analyzer::GetInstance()->Initialize(); | ||||
if (init_analyzer_status != SUCCESS) { | if (init_analyzer_status != SUCCESS) { | ||||
GELOGE(init_analyzer_status, "Failed to initialize HostCpuEngine"); | |||||
GELOGE(init_analyzer_status, "[Init][Analyzer]Failed to initialize Analyzer."); | |||||
REPORT_CALL_ERROR("E19999", "ge::Analyzer initialize failed."); | |||||
RollbackInit(); | RollbackInit(); | ||||
return init_analyzer_status; | return init_analyzer_status; | ||||
} | } | ||||
@@ -205,7 +215,8 @@ Status GELib::SystemInitialize(const map<string, string> &options) { | |||||
auto model_manager = ModelManager::GetInstance(); | auto model_manager = ModelManager::GetInstance(); | ||||
GE_CHECK_NOTNULL(model_manager); | GE_CHECK_NOTNULL(model_manager); | ||||
GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, | GE_IF_BOOL_EXEC(model_manager->EnableExceptionDump(options) != SUCCESS, | ||||
GELOGE(FAILED, "Enable exception dump failed"); | |||||
REPORT_CALL_ERROR("E19999", "ModelManager EnableExceptionDump failed."); | |||||
GELOGE(FAILED, "[Enable][ExceptionDump] failed."); | |||||
return FAILED); | return FAILED); | ||||
// 1.`is_train_mode_` means case: train | // 1.`is_train_mode_` means case: train | ||||
// 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer | // 2.`(!is_train_mode_) && (options_.device_id != kDefaultDeviceIdForInfer)` means case: online infer | ||||
@@ -259,7 +270,10 @@ Status GELib::SetRTSocVersion(const map<string, string> &options, map<string, st | |||||
GELOGI("SOC_VERSION is not exist in options"); | GELOGI("SOC_VERSION is not exist in options"); | ||||
char version[kSocVersionLen] = {0}; | char version[kSocVersionLen] = {0}; | ||||
rtError_t rt_ret = rtGetSocVersion(version, kSocVersionLen); | rtError_t rt_ret = rtGetSocVersion(version, kSocVersionLen); | ||||
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, GELOGE(rt_ret, "rtGetSocVersion failed"); return FAILED;) | |||||
GE_IF_BOOL_EXEC(rt_ret != RT_ERROR_NONE, | |||||
REPORT_CALL_ERROR("E19999", "rtGetSocVersion failed."); | |||||
GELOGE(rt_ret, "[Get][SocVersion]rtGetSocVersion failed"); | |||||
return FAILED;) | |||||
GELOGI("Succeeded in getting SOC_VERSION[%s] from runtime.", version); | GELOGI("Succeeded in getting SOC_VERSION[%s] from runtime.", version); | ||||
new_options.insert(std::make_pair(ge::SOC_VERSION, version)); | new_options.insert(std::make_pair(ge::SOC_VERSION, version)); | ||||
} | } | ||||
@@ -280,7 +294,8 @@ Status GELib::SetAiCoreNum(map<string, string> &options) { | |||||
options.emplace(std::make_pair(AICORE_NUM, std::to_string(aicore_num))); | options.emplace(std::make_pair(AICORE_NUM, std::to_string(aicore_num))); | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
GELOGE(FAILED, "rtGetAiCoreCount failed."); | |||||
GELOGE(FAILED, "[Get][AiCoreCount]rtGetAiCoreCount failed."); | |||||
REPORT_CALL_ERROR("E19999", "rtGetAiCoreCount failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -355,7 +370,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt | |||||
mem_type.push_back(RT_MEMORY_P2P_DDR); | mem_type.push_back(RT_MEMORY_P2P_DDR); | ||||
Status initMmStatus = MemManager::Instance().Initialize(mem_type); | Status initMmStatus = MemManager::Instance().Initialize(mem_type); | ||||
if (initMmStatus != SUCCESS) { | if (initMmStatus != SUCCESS) { | ||||
GELOGE(initMmStatus, "[Initialize] MemoryAllocatorManager initialize failed."); | |||||
GELOGE(initMmStatus, "[Init][MemManager] MemoryAllocatorManager initialize failed."); | |||||
REPORT_CALL_ERROR("E19999", "MemManager initialize failed."); | |||||
return initMmStatus; | return initMmStatus; | ||||
} | } | ||||
@@ -363,7 +379,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithOpt | |||||
// Update CSA file | // Update CSA file | ||||
CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); | CsaInteract::GetInstance().Init(options.device_id, GetContext().TraceId()); | ||||
Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_RUNNING, JOBSUBSTATE_ENV_INIT); | 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 ", ret); | |||||
// set device id | // set device id | ||||
GELOGI("set logical device id:%u", options.device_id); | GELOGI("set logical device id:%u", options.device_id); | ||||
@@ -394,7 +410,7 @@ Status GELib::SystemShutdownWithOptions(const Options &options) { | |||||
// Update CSA file | // Update CSA file | ||||
Status ret = CsaInteract::GetInstance().WriteJobState(JOBSTATE_SUCCEED); | 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 ", ret); | |||||
is_system_inited = false; | is_system_inited = false; | ||||
is_shutdown = true; | is_shutdown = true; | ||||
@@ -410,7 +426,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status GELib::InitSystemWithout | |||||
mem_type.push_back(RT_MEMORY_P2P_DDR); | mem_type.push_back(RT_MEMORY_P2P_DDR); | ||||
Status initMmStatus = MemManager::Instance().Initialize(mem_type); | Status initMmStatus = MemManager::Instance().Initialize(mem_type); | ||||
if (initMmStatus != SUCCESS) { | if (initMmStatus != SUCCESS) { | ||||
GELOGE(initMmStatus, "[Initialize] MemoryAllocatorManager initialize failed."); | |||||
GELOGE(initMmStatus, "[Init][MemoryManager] initialize failed."); | |||||
REPORT_CALL_ERROR("E19999", "MemManager initialize failed."); | |||||
return initMmStatus; | return initMmStatus; | ||||
} | } | ||||
GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); | GE_CHK_STATUS_RET(HostMemManager::Instance().Initialize()); | ||||
@@ -506,7 +523,8 @@ Status GELib::Finalize() { | |||||
instancePtr_ = nullptr; | instancePtr_ = nullptr; | ||||
init_flag_ = false; | init_flag_ = false; | ||||
if (final_state != SUCCESS) { | if (final_state != SUCCESS) { | ||||
GELOGE(FAILED, "finalization failed."); | |||||
GELOGE(FAILED, "[Check][State]finalization failed."); | |||||
REPORT_INNER_ERROR("E19999", "GELib::Finalize failed."); | |||||
return final_state; | return final_state; | ||||
} | } | ||||
GELOGI("finalization success."); | GELOGI("finalization success."); | ||||
@@ -80,7 +80,7 @@ Status CheckInputFormat(const string &input_format) { | |||||
if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { | if (!ge::TypeUtils::IsFormatValid(input_format.c_str())) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, {"--input_format", input_format, "input format is invalid!"}); | "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][InputFormat] --input_format[%s] is invalid!", input_format.c_str()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | return ge::SUCCESS; | ||||
@@ -93,7 +93,8 @@ bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
vector<int64_t> shape = iter->second; | vector<int64_t> shape = iter->second; | ||||
if (shape.empty()) { | if (shape.empty()) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10012"); | 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][DynamicBatchSizeInputShape] shape size can not be less than 1 when set --dynamic_batch_size."); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -109,7 +110,8 @@ bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
if (size == 0) { | if (size == 0) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10031"); | 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][DynamicBatchSizeInputShape]At least one batch n must be equal to -1 when set dynamic_batch_size."); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -117,8 +119,8 @@ bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
if (!isdigit(c) && (c != ',') && (c != ' ')) { | if (!isdigit(c) && (c != ',') && (c != ' ')) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10033", {"value", "reason"}, {dynamic_batch_size, kDynamicBatchSizeError}); | "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][DynamicBatchSizeInputShape] --dynamic_batch_size:%s is invalid. reason: %s", | |||||
dynamic_batch_size.c_str(), kDynamicBatchSizeError); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -131,7 +133,8 @@ bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> shape_map, | bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> shape_map, | ||||
const std::string input_format, std::string &dynamic_image_size) { | const std::string input_format, std::string &dynamic_image_size) { | ||||
if (!input_format.empty() && !ge::TypeUtils::IsFormatValid(input_format.c_str())) { | 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][DynamicImagesizeInputShape] input_format [%s] invalid, can not support now.", input_format.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
int32_t size = 0; | int32_t size = 0; | ||||
@@ -141,8 +144,9 @@ bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
if (shape.size() != DIM_DEFAULT_SIZE) { | if (shape.size() != DIM_DEFAULT_SIZE) { | ||||
if (std::count(shape.begin(), shape.end(), kDynamicInputDim) > 0) { | if (std::count(shape.begin(), shape.end(), kDynamicInputDim) > 0) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10019"); | 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][DynamicImagesizeInputShape] --input_shape invalid," | |||||
" only height and width can be -1 when set --dynamic_image_size."); | |||||
return false; | return false; | ||||
} | } | ||||
continue; | continue; | ||||
@@ -161,7 +165,8 @@ bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
if (size == 0) { | if (size == 0) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10019"); | ErrorManager::GetInstance().ATCReportErrMessage("E10019"); | ||||
GELOGE(ge::PARAM_INVALID, | GELOGE(ge::PARAM_INVALID, | ||||
"--input_shape's shape is invalid, only height and width can be -1 when set --dynamic_image_size."); | |||||
"[Check][DynamicImagesizeInputShape]--input shape invalid, " | |||||
"only height and width can be -1 when set --dynamic_image_size."); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -176,9 +181,8 @@ bool CheckDynamicImagesizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E10020", {"DynamicImageSizeNum"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10020", {"DynamicImageSizeNum"}, | ||||
{std::to_string(kDynamicImageSizeNum)}); | {std::to_string(kDynamicImageSizeNum)}); | ||||
GELOGE(ge::PARAM_INVALID, | GELOGE(ge::PARAM_INVALID, | ||||
"--dynamic_image_size's number of dimensions of each " | |||||
"group must be %ld.", | |||||
kDynamicImageSizeNum); | |||||
"[Check][DynamicImagesizeInputShape] invalid value:%s number of dimensions of each group must be %ld.", | |||||
dynamic_image_size.c_str(), kDynamicImageSizeNum); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -192,7 +196,7 @@ bool CheckDynamicDimsInputShapeValid(const map<string, vector<int64_t>> &shape_m | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, | "E10001", {"parameter", "value", "reason"}, | ||||
{"--input_format", input_format.c_str(), "input_format must be ND when set dynamic_dims"}); | {"--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][DynamicDimsInputShape]--input_format must be ND when set dynamic_dims."); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -203,7 +207,8 @@ bool CheckDynamicDimsInputShapeValid(const map<string, vector<int64_t>> &shape_m | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, | "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, "Dim num must within [%zu, %zu] when set dynamic_dims.", kMinNDDimNum, kMaxNDDimNum); | |||||
GELOGE(ge::PARAM_INVALID, "[Check][DynamicDimsInputShape]Dim num must within [%zu, %zu] when set dynamic_dims.", | |||||
kMinNDDimNum, kMaxNDDimNum); | |||||
return false; | return false; | ||||
} | } | ||||
dynamic_dim += std::count(shapes.begin(), shapes.end(), kDynamicInputDim); | dynamic_dim += std::count(shapes.begin(), shapes.end(), kDynamicInputDim); | ||||
@@ -212,12 +217,13 @@ bool CheckDynamicDimsInputShapeValid(const map<string, vector<int64_t>> &shape_m | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, | "E10001", {"parameter", "value", "reason"}, | ||||
{"--input_shape's dynamic dim num", "0", "at least one dim should be -1 when set dynamic_dims"}); | {"--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][DynamicDimsInputShape]--input_shape invalid, at least one dim should be -1 when set dynamic_dims."); | |||||
return false; | return false; | ||||
} | } | ||||
if (!CheckAndParseDynamicDims(dynamic_dim, dynamic_dims)) { | 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()); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -230,7 +236,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, | "E10001", {"parameter", "value", "reason"}, | ||||
{"--dynamic_dims", dynamic_dims.c_str(), "dynamic_dims can not be empty"}); | {"--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, "[CheckAndParse][DynamicDims]--dynamic_dims can not be empty."); | |||||
return false; | return false; | ||||
} | } | ||||
// Different parameter sets are split by ';' | // Different parameter sets are split by ';' | ||||
@@ -238,7 +244,8 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims | |||||
if (split_set.size() > kMaxDynamicDimNum) { | if (split_set.size() > kMaxDynamicDimNum) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10042", {"parameter", "reason"}, {"dynamic_dims", "dynamic_dims's num of parameter set can not exceed 100"}); | "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, | |||||
"[CheckAndParse][DynamicDims]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); | |||||
return false; | return false; | ||||
} | } | ||||
for (auto split_dim : split_set) { | for (auto split_dim : split_set) { | ||||
@@ -247,8 +254,9 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10042", {"parameter", "reason"}, | "E10042", {"parameter", "reason"}, | ||||
{"dynamic_dims", "Each gear setting needs to be consistent with the number of -1 in the inputshape"}); | {"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, "[CheckAndParse][DynamicDims] --dynamic_dims:%s invalid. " | |||||
"reason: Each gear setting needs to be consistent with the number of -1 in the inputshape.", | |||||
dynamic_dims.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
for (auto dim : one_set) { | for (auto dim : one_set) { | ||||
@@ -257,7 +265,9 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, | "E10001", {"parameter", "value", "reason"}, | ||||
{"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); | {"--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, | |||||
"[CheckAndParse][DynamicDims]--dynamic_dims:%s parameter must be positive integer.", | |||||
dynamic_dims.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -273,15 +283,13 @@ bool StringToLongNoThrow(const string &str, long &val) { | |||||
} catch (const std::invalid_argument) { | } catch (const std::invalid_argument) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ||||
{str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); | {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); | |||||
} catch (const std::out_of_range) { | } catch (const std::out_of_range) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ||||
{str, kShapeRangeValueConvertError, kInputShapeRangeSample3}); | {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); | |||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
@@ -299,9 +307,8 @@ bool ParseSingleShapeRange(std::string &shape_range, vector<pair<int64_t, int64_ | |||||
if (!is_square_brackets) { | if (!is_square_brackets) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ||||
{shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample2}); | {shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample2}); | ||||
GELOGE(PARAM_INVALID, | |||||
"Parse input parameter [--input_shape_range]'s shape range[%s] failed, reason: %s, correct sample is %s.", | |||||
shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample2); | |||||
GELOGE(PARAM_INVALID, "[Parse][Parameter] shape_range:%s invalid, reason: %s, correct sample is %s.", | |||||
shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample2); | |||||
return false; | return false; | ||||
} | } | ||||
// trim start bytes, after that, single input should be "1~20,3,3~6,-1" | // trim start bytes, after that, single input should be "1~20,3,3~6,-1" | ||||
@@ -345,10 +352,9 @@ bool ParseSingleShapeRange(std::string &shape_range, vector<pair<int64_t, int64_ | |||||
range_pair = std::make_pair(range_left, range_right); | range_pair = std::make_pair(range_left, range_right); | ||||
} else { | } else { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ||||
{shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample3}); | |||||
GELOGE(PARAM_INVALID, | |||||
"Parse input parameter [--input_shape_range]'s shape range[%s] failed, reason: %s, correct sample is %s.", | |||||
shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample3); | |||||
{shape_range, kInputShapeRangeInvalid, kInputShapeRangeSample3}); | |||||
GELOGE(PARAM_INVALID,"[Parse][Parameter]shape_range:%s invalid, reason: %s, correct sample is %s.", | |||||
shape_range.c_str(), kInputShapeRangeInvalid, kInputShapeRangeSample3); | |||||
return false; | return false; | ||||
} | } | ||||
shape_range_vec.emplace_back(range_pair); | shape_range_vec.emplace_back(range_pair); | ||||
@@ -367,22 +373,22 @@ bool ParseInputShapeRange(const std::string &shape_range, | |||||
if (shape_range_pair_vec.size() != DEFAULT_SHAPE_RANGE_PAIR_SIZE) { | if (shape_range_pair_vec.size() != DEFAULT_SHAPE_RANGE_PAIR_SIZE) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | ||||
{shape_range, kSplitError1, kInputShapeRangeSample1}); | {shape_range, kSplitError1, kInputShapeRangeSample1}); | ||||
GELOGE(PARAM_INVALID, "Parse input parameter [--input_shape_range]'s shape range[%s] failed, " | |||||
"reason: %s, correct sample is %s.", shape_range.c_str(), kSplitError1, kInputShapeRangeSample1); | |||||
GELOGE(PARAM_INVALID, "[Parse][Parameter]--input shape_range:%s invalid, reason: %s, correct sample is %s.", | |||||
shape_range.c_str(), kSplitError1, kInputShapeRangeSample1); | |||||
return false; | return false; | ||||
} | } | ||||
if (shape_range_pair_vec[1].empty()) { | if (shape_range_pair_vec[1].empty()) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape", "reason", "sample"}, | ||||
{shape_range, kEmptyError, kInputShapeRangeSample1}); | {shape_range, kEmptyError, kInputShapeRangeSample1}); | ||||
GELOGE(PARAM_INVALID, "Parse input parameter [--input_shape_range]'s shape range[%s] failed," | |||||
"reason: %s, correct sample is %s.", shape_range.c_str(), kEmptyError, kInputShapeRangeSample1); | |||||
GELOGE(PARAM_INVALID, "[Parse][Parameter]shape_range:%s invalid,reason: %s, correct sample is %s.", | |||||
shape_range.c_str(), kEmptyError, kInputShapeRangeSample1); | |||||
return false; | return false; | ||||
} | } | ||||
string shape_range_str = shape_range_pair_vec[1]; | string shape_range_str = shape_range_pair_vec[1]; | ||||
vector<pair<int64_t, int64_t>> shape_range_val; | vector<pair<int64_t, int64_t>> shape_range_val; | ||||
if (!ParseSingleShapeRange(shape_range_str, 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()); | |||||
return false; | return false; | ||||
} | } | ||||
shape_range_map.emplace(make_pair(StringUtils::Trim(shape_range_pair_vec[0]), shape_range_val)); | shape_range_map.emplace(make_pair(StringUtils::Trim(shape_range_pair_vec[0]), shape_range_val)); | ||||
@@ -392,14 +398,14 @@ bool ParseInputShapeRange(const std::string &shape_range, | |||||
} | } | ||||
Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_image_size, string &dynamic_dims, | 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) { | |||||
const string input_shape, const string input_shape_range, const string input_format,bool &is_dynamic_input){ | |||||
int32_t param_size = static_cast<int32_t>(!dynamic_batch_size.empty()) + | int32_t param_size = static_cast<int32_t>(!dynamic_batch_size.empty()) + | ||||
static_cast<int32_t>(!dynamic_image_size.empty()) + static_cast<int32_t>(!dynamic_dims.empty()); | |||||
static_cast<int32_t>(!dynamic_image_size.empty()) + static_cast<int32_t>(!dynamic_dims.empty()); | |||||
if (param_size > 1) { | 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"}); | {"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; | return ge::PARAM_INVALID; | ||||
} | } | ||||
@@ -419,33 +425,34 @@ Status CheckDynamicInputParamValid(string &dynamic_batch_size, string &dynamic_i | |||||
is_dynamic_input = true; | is_dynamic_input = true; | ||||
if (input_shape.empty()) { | if (input_shape.empty()) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {"input_shape"}); | 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; | return ge::PARAM_INVALID; | ||||
} | } | ||||
if (!ParseInputShape(input_shape, shape_map, user_shape_map, is_dynamic_input)) { | 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()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
if (!dynamic_batch_size.empty()) { | if (!dynamic_batch_size.empty()) { | ||||
if (!CheckDynamicBatchSizeInputShapeValid(shape_map, dynamic_batch_size)) { | 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()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
if (!dynamic_image_size.empty()) { | if (!dynamic_image_size.empty()) { | ||||
if (!CheckDynamicImagesizeInputShapeValid(shape_map, input_format, dynamic_image_size)) { | 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] %s invalid. dynamic_image_size:%s ", | |||||
input_shape.c_str(), dynamic_image_size.c_str()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
if (!dynamic_dims.empty()) { | if (!dynamic_dims.empty()) { | ||||
if (!CheckDynamicDimsInputShapeValid(shape_map, input_format, dynamic_dims)) { | 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()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -496,7 +503,8 @@ bool ParseInputShape(const string &input_shape, map<string, vector<int64_t>> &sh | |||||
if (!isdigit(c)) { | if (!isdigit(c)) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10002", {"shape", "reason", "sample"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10002", {"shape", "reason", "sample"}, | ||||
{shape, kDigitError, kInputShapeSample2}); | {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 shape value[%s] is not digit", | |||||
shape_value_str.c_str()); | |||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
@@ -519,7 +527,8 @@ bool ParseInputShape(const string &input_shape, map<string, vector<int64_t>> &sh | |||||
int64_t result = left_result; | int64_t result = left_result; | ||||
// - 1 is not currently supported | // - 1 is not currently supported | ||||
if (!is_dynamic_input && result <= 0) { | 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( | GELOGW( | ||||
"Input parameter[--input_shape]’s shape value[%s] is invalid, " | "Input parameter[--input_shape]’s shape value[%s] is invalid, " | ||||
"expect positive integer, but value is %ld.", | "expect positive integer, but value is %ld.", | ||||
@@ -541,7 +550,7 @@ Status CheckOutputTypeParamValid(const std::string output_type) { | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); | "E10001", {"parameter", "value", "reason"}, {"--output_type", output_type, kOutputTypeSupport}); | ||||
GELOGE(ge::PARAM_INVALID, | 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); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | return ge::SUCCESS; | ||||
@@ -553,30 +562,34 @@ Status CheckBufferOptimizeParamValid(const std::string buffer_optimize) { | |||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, {"--buffer_optimize", buffer_optimize, kBufferOptimizeSupport}); | "E10001", {"parameter", "value", "reason"}, {"--buffer_optimize", buffer_optimize, kBufferOptimizeSupport}); | ||||
GELOGE(ge::PARAM_INVALID, | GELOGE(ge::PARAM_INVALID, | ||||
"Invalid value for --buffer_optimize[%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); | |||||
"[Check][BufferOptimize]Invalid value for [%s], %s.", buffer_optimize.c_str(), kBufferOptimizeSupport); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | 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()) && | if ((!compress_weight_conf.empty()) && | ||||
(!CheckInputPathValid(compress_weight_conf, "--compress_weight_conf"))) { | (!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][CompressWeight]compress weight config file not found, file_name:%s", | |||||
compress_weight_conf.c_str()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
if ((enable_compress_weight != "") && (enable_compress_weight != "true") && (enable_compress_weight != "false")) { | if ((enable_compress_weight != "") && (enable_compress_weight != "true") && (enable_compress_weight != "false")) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10005", {"parameter", "value"}, {"enable_compress_weight", enable_compress_weight}); | "E10005", {"parameter", "value"}, {"enable_compress_weight", enable_compress_weight}); | ||||
GELOGE(ge::PARAM_INVALID, | GELOGE(ge::PARAM_INVALID, | ||||
"Input parameter[--enable_compress_weight]'s value[%s] must be true or false.", enable_compress_weight.c_str()); | |||||
"[Check][CompressWeight]Input parameter[--enable_compress_weight]'s value[%s] must be true or false.", | |||||
enable_compress_weight.c_str()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
if ((enable_compress_weight == "true") && (!compress_weight_conf.empty())) { | if ((enable_compress_weight == "true") && (!compress_weight_conf.empty())) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10047", {"parameter0", "parameter1"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10047", {"parameter0", "parameter1"}, | ||||
{"enable_compress_weight", "compress_weight_conf"}); | {"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][CompressWeight]enable_compress_weight and compress_weight_conf can not both exist!!"); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | return ge::SUCCESS; | ||||
@@ -586,7 +599,7 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype) { | |||||
if ((!keep_dtype.empty()) && (!CheckInputPathValid(keep_dtype, "--keep_dtype"))) { | if ((!keep_dtype.empty()) && (!CheckInputPathValid(keep_dtype, "--keep_dtype"))) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10001", {"parameter", "value", "reason"}, {"--keep_dtype", keep_dtype, kKeepDtypeError}); | "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::--keep_dtype] file not found, file_name:%s", keep_dtype.c_str()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
@@ -608,11 +621,12 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { | |||||
} else if (log == "error") { | } else if (log == "error") { | ||||
ret = dlog_setlevel(-1, DLOG_ERROR, 1); | ret = dlog_setlevel(-1, DLOG_ERROR, 1); | ||||
} else { | } 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()); | |||||
return ret; | return ret; | ||||
} | } | ||||
if (ret != 0) { | if (ret != 0) { | ||||
GELOGE(ge::PARAM_INVALID, "Log setlevel fail !"); | |||||
GELOGE(ge::PARAM_INVALID, "[Set][LogLevel] fail, level:%s.",log.c_str()); | |||||
} | } | ||||
return ret; | return ret; | ||||
} | } | ||||
@@ -620,7 +634,7 @@ int CheckLogParamValidAndSetLogLevel(const std::string log) { | |||||
Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { | Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { | ||||
if ((!insert_op_conf.empty()) && | if ((!insert_op_conf.empty()) && | ||||
(!CheckInputPathValid(insert_op_conf, "--insert_op_conf"))) { | (!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()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | return ge::SUCCESS; | ||||
@@ -629,7 +643,7 @@ Status CheckInsertOpConfParamValid(const std::string insert_op_conf) { | |||||
Status CheckDisableReuseMemoryParamValid(const std::string disable_reuse_memory) { | Status CheckDisableReuseMemoryParamValid(const std::string disable_reuse_memory) { | ||||
if ((disable_reuse_memory != "") && (disable_reuse_memory != "0") && (disable_reuse_memory != "1")) { | if ((disable_reuse_memory != "") && (disable_reuse_memory != "0") && (disable_reuse_memory != "1")) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10006", {"parameter"}, {"disable_reuse_memory"}); | 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][DisableReuseMemory]disable_reuse_memory must be 1 or 0."); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | return ge::SUCCESS; | ||||
@@ -639,8 +653,8 @@ Status CheckEnableSingleStreamParamValid(const std::string enable_single_stream) | |||||
if ((enable_single_stream != "") && (enable_single_stream != "true") && (enable_single_stream != "false")) { | if ((enable_single_stream != "") && (enable_single_stream != "true") && (enable_single_stream != "false")) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E10005", {"parameter", "value"}, {"enable_single_stream", enable_single_stream}); | "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][Param:--enable_single_stream] value:%s must be true or false.", | |||||
enable_single_stream.c_str()); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
return ge::SUCCESS; | return ge::SUCCESS; | ||||
@@ -651,8 +665,8 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: | |||||
if (optypelist_for_implmode != "" && op_select_implmode == "") { | if (optypelist_for_implmode != "" && op_select_implmode == "") { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, | ||||
{"--op_select_implmode", op_select_implmode.c_str(), kCompressWeightError}); | {"--op_select_implmode", op_select_implmode.c_str(), kCompressWeightError}); | ||||
GELOGE(ge::PARAM_INVALID, "Invalid value for --op_select_implmode[%s], %s.", | |||||
op_select_implmode.c_str(), kCompressWeightError); | |||||
GELOGE(ge::PARAM_INVALID, "[Check][Param:--op_select_implmode]value:%s invalid, %s.", | |||||
op_select_implmode.c_str(),kCompressWeightError); | |||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
// op_select_implmode default value is high_performance | // op_select_implmode default value is high_performance | ||||
@@ -663,7 +677,7 @@ Status CheckImplmodeParamValid(const std::string &optypelist_for_implmode, std:: | |||||
op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON) { | op_select_implmode != IR_OPTION_OP_SELECT_IMPLMODE_PRECISON) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E10001", {"parameter", "value", "reason"}, | ||||
{"--op_select_implmode", op_select_implmode.c_str(), kSelectImplmodeError}); | {"--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][Implmode]Invalid value for --op_select_implmode[%s], %s.", | |||||
op_select_implmode.c_str(), kSelectImplmodeError); | op_select_implmode.c_str(), kSelectImplmodeError); | ||||
return ge::PARAM_INVALID; | return ge::PARAM_INVALID; | ||||
} | } | ||||
@@ -729,7 +743,7 @@ Status UpdateDataOpShapeRange(const OpDescPtr &op, | |||||
if (iter != shape_range_map.end()) { | if (iter != shape_range_map.end()) { | ||||
auto cur_shape_range = iter->second; | auto cur_shape_range = iter->second; | ||||
if (TensorUtils::CheckShapeByShapeRange(origin_shape, cur_shape_range) != SUCCESS) { | 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] Check shape by shape range failed for op:%s.", data_op_name.c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
for (size_t idx = 0; idx < cur_shape_range.size(); idx++) { | for (size_t idx = 0; idx < cur_shape_range.size(); idx++) { | ||||
@@ -757,7 +771,7 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co | |||||
map<string, vector<pair<int64_t, int64_t>>> shape_range_map; | map<string, vector<pair<int64_t, int64_t>>> shape_range_map; | ||||
if (!ParseInputShapeRange(input_shape_range, 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()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -767,7 +781,7 @@ Status UpdateDynamicInputShapeRange(const ge::ComputeGraphPtr &compute_graph, co | |||||
GE_CHECK_NOTNULL(op); | GE_CHECK_NOTNULL(op); | ||||
if (op->GetType() == DATA) { | if (op->GetType() == DATA) { | ||||
if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { | if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { | ||||
GELOGE(FAILED, "Update data op [%s] input shape range failed.", op->GetName().c_str()); | |||||
GELOGE(FAILED, "[Update][InputShapeRange] fail for op:%s.", op->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -85,21 +85,21 @@ static graphStatus CheckGlobalOptions(std::map<std::string, std::string> &global | |||||
? IR_OPTION_DISABLE_REUSE_MEMORY_DEFAULT | ? IR_OPTION_DISABLE_REUSE_MEMORY_DEFAULT | ||||
: global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY]; | : global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY]; | ||||
GE_CHK_BOOL_EXEC(ge::CheckDisableReuseMemoryParamValid(disable_reuse_memory) == ge::SUCCESS, | 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; | global_options[ge::ir_option::EXEC_DISABLE_REUSED_MEMORY] = disable_reuse_memory; | ||||
// check buffer_optimize | // check buffer_optimize | ||||
std::string buffer_optimize = global_options.find(ge::ir_option::BUFFER_OPTIMIZE) == global_options.end() | std::string buffer_optimize = global_options.find(ge::ir_option::BUFFER_OPTIMIZE) == global_options.end() | ||||
? IR_OPTION_BUFFER_OPTIMIZE_DEFAULT | ? IR_OPTION_BUFFER_OPTIMIZE_DEFAULT | ||||
: global_options[ge::ir_option::BUFFER_OPTIMIZE]; | : global_options[ge::ir_option::BUFFER_OPTIMIZE]; | ||||
GE_CHK_BOOL_EXEC(ge::CheckBufferOptimizeParamValid(buffer_optimize) == ge::SUCCESS, | 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; | global_options[ge::ir_option::BUFFER_OPTIMIZE] = buffer_optimize; | ||||
// check enable_single_stream | // check enable_single_stream | ||||
std::string enable_single_stream = global_options.find(ge::ir_option::ENABLE_SINGLE_STREAM) == global_options.end() | 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]; | : global_options[ge::ir_option::ENABLE_SINGLE_STREAM]; | ||||
GE_CHK_BOOL_EXEC(ge::CheckEnableSingleStreamParamValid(enable_single_stream) == ge::SUCCESS, | 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 | // check compress_weight | ||||
std::string enable_compress_weight = global_options.find(ge::ir_option::ENABLE_COMPRESS_WEIGHT) == | std::string enable_compress_weight = global_options.find(ge::ir_option::ENABLE_COMPRESS_WEIGHT) == | ||||
global_options.end() | global_options.end() | ||||
@@ -109,7 +109,7 @@ static graphStatus CheckGlobalOptions(std::map<std::string, std::string> &global | |||||
? "" | ? "" | ||||
: global_options[ge::ir_option::COMPRESS_WEIGHT_CONF]; | : global_options[ge::ir_option::COMPRESS_WEIGHT_CONF]; | ||||
GE_CHK_BOOL_EXEC(ge::CheckCompressWeightParamValid(enable_compress_weight, compress_weight_conf) == ge::SUCCESS, | 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") ? | global_options[ge::ir_option::ENABLE_COMPRESS_WEIGHT] = (enable_compress_weight == "true") ? | ||||
ge::kEnableCompressWeightTrue : | ge::kEnableCompressWeightTrue : | ||||
ge::kEnableCompressWeightFalse; | ge::kEnableCompressWeightFalse; | ||||
@@ -124,7 +124,7 @@ static graphStatus CheckGlobalOptions(std::map<std::string, std::string> &global | |||||
: global_options[ge::ir_option::OP_SELECT_IMPL_MODE]; | : global_options[ge::ir_option::OP_SELECT_IMPL_MODE]; | ||||
GE_CHK_BOOL_EXEC( | GE_CHK_BOOL_EXEC( | ||||
ge::CheckImplmodeParamValid(optypelist_for_implmode, op_select_implmode) == ge::SUCCESS, | 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; | global_options[ge::ir_option::OP_SELECT_IMPL_MODE] = op_select_implmode; | ||||
// set precision mode default value | // set precision mode default value | ||||
@@ -144,7 +144,7 @@ static void GetOpsProtoPath(string &opsproto_path) { | |||||
string path = path_env; | string path = path_env; | ||||
string file_path = RealPath(path.c_str()); | string file_path = RealPath(path.c_str()); | ||||
if (file_path.empty()) { | if (file_path.empty()) { | ||||
GELOGE(FAILED, "File path %s is invalid.", path.c_str()); | |||||
GELOGE(FAILED, "[Check][Path] %s is invalid.", path.c_str()); | |||||
return; | return; | ||||
} | } | ||||
opsproto_path = (path + "/op_proto/custom/" + ":") + (path + "/op_proto/built-in/"); | opsproto_path = (path + "/op_proto/custom/" + ":") + (path + "/op_proto/built-in/"); | ||||
@@ -172,7 +172,7 @@ graphStatus aclgrphBuildInitializeImpl(std::map<std::string, std::string> &globa | |||||
GELOGD("Enter aclgrphInitialize start!"); | GELOGD("Enter aclgrphInitialize start!"); | ||||
// check global options | // check global options | ||||
if (CheckGlobalOptions(global_options) != GRAPH_SUCCESS) { | 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; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
@@ -186,7 +186,7 @@ graphStatus aclgrphBuildInitializeImpl(std::map<std::string, std::string> &globa | |||||
GELOGI("aclgrphInitialize start!"); | GELOGI("aclgrphInitialize start!"); | ||||
auto ret = ge::GELib::Initialize(global_options); | auto ret = ge::GELib::Initialize(global_options); | ||||
if (ret != ge::SUCCESS) { | if (ret != ge::SUCCESS) { | ||||
GELOGE(ret, "GE initialize failed!"); | |||||
GELOGE(ret, "[Init][GELib] failed!"); | |||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -211,7 +211,7 @@ graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &global_ | |||||
std::map<std::string, std::string> tmp_global_options; | std::map<std::string, std::string> tmp_global_options; | ||||
for (auto &option : global_options) { | for (auto &option : global_options) { | ||||
if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { | 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; | return GRAPH_FAILED; | ||||
} | } | ||||
std::string key = option.first.GetString(); | std::string key = option.first.GetString(); | ||||
@@ -281,7 +281,7 @@ graphStatus Impl::InferShapePrepare(const ComputeGraphPtr &compute_graph) { | |||||
auto ret = prepare_infershape.Run(compute_graph); | auto ret = prepare_infershape.Run(compute_graph); | ||||
if ((ret != SUCCESS) && (ret != NOT_CHANGED)) { | if ((ret != SUCCESS) && (ret != NOT_CHANGED)) { | ||||
GELOGE(ret, "Prepair for infershape failed, ret:%d", ret); | |||||
GELOGE(ret, "[Prepair][InferShape] failed, ret:%d", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
GELOGD("Prepair for infershape success!"); | GELOGD("Prepair for infershape success!"); | ||||
@@ -297,12 +297,12 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { | |||||
vector<pair<string, vector<int64_t>>> user_shape_map; | vector<pair<string, vector<int64_t>>> user_shape_map; | ||||
if (!input_shape.empty()) { | if (!input_shape.empty()) { | ||||
GE_CHK_BOOL_EXEC(ParseInputShape(input_shape, shape_map, user_shape_map, true), | 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<string, std::vector<std::pair<int64_t, int64_t>>> shape_range_map; | std::map<string, std::vector<std::pair<int64_t, int64_t>>> shape_range_map; | ||||
if (!input_shape_range.empty()) { | if (!input_shape_range.empty()) { | ||||
GE_CHK_BOOL_EXEC(ParseInputShapeRange(input_shape_range, shape_range_map), | 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); | auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); | ||||
GE_CHECK_NOTNULL(compute_graph); | GE_CHECK_NOTNULL(compute_graph); | ||||
@@ -312,13 +312,13 @@ graphStatus Impl::UpdateDataOpAttr(const Graph &graph) { | |||||
GE_CHECK_NOTNULL(op); | GE_CHECK_NOTNULL(op); | ||||
if (op->GetType() == DATA) { | if (op->GetType() == DATA) { | ||||
if (UpdateDataOpShape(op, shape_map) != SUCCESS) { | if (UpdateDataOpShape(op, shape_map) != SUCCESS) { | ||||
GELOGE(GRAPH_FAILED, "Update data op [%s] shape failed.", op->GetName().c_str()); | |||||
GELOGE(GRAPH_FAILED, "[Update][DataOpShape] fail for op:%s.", op->GetName().c_str()); | |||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
if (UpdateDataOpShapeRange(op, shape_range_map) != SUCCESS) { | 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] fail for op:%s.", op->GetName().c_str()); | |||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -331,8 +331,8 @@ graphStatus Impl::CheckOptions(const std::map<std::string, std::string> &options | |||||
if (it == ge::ir_option::ir_builder_suppported_options.end()) { | if (it == ge::ir_option::ir_builder_suppported_options.end()) { | ||||
auto it_lx_fusion = ir_builder_supported_options_for_lx_fusion.find(ele.first); | 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()) { | 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()); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -343,7 +343,7 @@ graphStatus Impl::CheckOptions(const std::map<std::string, std::string> &options | |||||
auto it = options_.find(BUILD_MODE); | auto it = options_.find(BUILD_MODE); | ||||
if (it != options_.end() && !(it->second.empty())) { | if (it != options_.end() && !(it->second.empty())) { | ||||
if (build_mode_options.find(it->second) == build_mode_options.end()) { | 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][BuildMode]:%s is unsupported. Please check!", it->second.c_str()); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
build_mode = it->second; | build_mode = it->second; | ||||
@@ -351,12 +351,12 @@ graphStatus Impl::CheckOptions(const std::map<std::string, std::string> &options | |||||
it = options_.find(BUILD_STEP); | it = options_.find(BUILD_STEP); | ||||
if (it != options_.end() && !(it->second.empty())) { | if (it != options_.end() && !(it->second.empty())) { | ||||
if (build_step_options.find(it->second) == build_step_options.end()) { | 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][BuildStep]:%s is unsupported. Please check!", it->second.c_str()); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
} else { | } else { | ||||
if (build_mode == BUILD_MODE_TUNING) { | if (build_mode == BUILD_MODE_TUNING) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "Build mode tuning must specify build step. Please check!"); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Check][BuildMode] tuning must specify build step. Please check!"); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -376,7 +376,7 @@ graphStatus Impl::Init(const Graph &graph, const std::map<std::string, std::stri | |||||
// 1. check options | // 1. check options | ||||
graphStatus ret = CheckOptions(options); | graphStatus ret = CheckOptions(options); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
GELOGE(ret, "User input options are illegal! Please check!"); | |||||
GELOGE(ret, "[Check][Options] options are illegal! Please check!"); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = UpdateDataOpAttr(graph); | ret = UpdateDataOpAttr(graph); | ||||
@@ -410,7 +410,7 @@ graphStatus Impl::Init(const Graph &graph, const std::map<std::string, std::stri | |||||
auto status = CheckDynamicInputParamValid(dynamic_batch_size, dynamic_image_size, dynamic_dims, input_shape, | auto status = CheckDynamicInputParamValid(dynamic_batch_size, dynamic_image_size, dynamic_dims, input_shape, | ||||
input_shape_range, input_format, is_dynamic_input_); | input_shape_range, input_format, is_dynamic_input_); | ||||
if (status != ge::SUCCESS) { | if (status != ge::SUCCESS) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "Check dynamic input size failed!"); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Check][DynamicInput] failed!"); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
GELOGD("User input dynamic_batch_size:%s, dynamic_image_size:%s, dynamic_dims:%s.", dynamic_batch_size.c_str(), | GELOGD("User input dynamic_batch_size:%s, dynamic_image_size:%s, dynamic_dims:%s.", dynamic_batch_size.c_str(), | ||||
@@ -423,16 +423,16 @@ graphStatus Impl::Init(const Graph &graph, const std::map<std::string, std::stri | |||||
? "" | ? "" | ||||
: options_[ge::ir_option::OUTPUT_TYPE]; | : options_[ge::ir_option::OUTPUT_TYPE]; | ||||
GE_CHK_BOOL_EXEC(ge::CheckOutputTypeParamValid(output_type) == ge::SUCCESS, | GE_CHK_BOOL_EXEC(ge::CheckOutputTypeParamValid(output_type) == ge::SUCCESS, | ||||
return ge::GRAPH_PARAM_INVALID, "check output type failed!"); | |||||
return ge::GRAPH_PARAM_INVALID, "[Check][OutputType] failed!"); | |||||
// check insert_op_conf | // check insert_op_conf | ||||
std::string insert_op_conf = options_.find(ge::ir_option::INSERT_OP_FILE) == options_.end() | std::string insert_op_conf = options_.find(ge::ir_option::INSERT_OP_FILE) == options_.end() | ||||
? "" | ? "" | ||||
: options_[ge::ir_option::INSERT_OP_FILE]; | : options_[ge::ir_option::INSERT_OP_FILE]; | ||||
GE_CHK_BOOL_EXEC(ge::CheckInsertOpConfParamValid(std::string(insert_op_conf)) == ge::SUCCESS, | GE_CHK_BOOL_EXEC(ge::CheckInsertOpConfParamValid(std::string(insert_op_conf)) == ge::SUCCESS, | ||||
return ge::GRAPH_PARAM_INVALID, "check insert op conf failed!"); | |||||
return ge::GRAPH_PARAM_INVALID, "[Check][InsertOpConf] failed!"); | |||||
GE_CHK_BOOL_EXEC(insert_op_conf.empty() || dynamic_dims.empty(), | GE_CHK_BOOL_EXEC(insert_op_conf.empty() || dynamic_dims.empty(), | ||||
return ge::GRAPH_PARAM_INVALID, "dynamic dims function does not support aipp"); | |||||
return ge::GRAPH_PARAM_INVALID, "[Check][Data]dynamic dims function does not support aipp"); | |||||
// for IR builder.Only support om mode, so here fixed; | // for IR builder.Only support om mode, so here fixed; | ||||
options_.insert(std::pair<string, string>(string(IR_OPTION_MODE), to_string(0))); | options_.insert(std::pair<string, string>(string(IR_OPTION_MODE), to_string(0))); | ||||
@@ -448,7 +448,7 @@ graphStatus Impl::Init(const Graph &graph, const std::map<std::string, std::stri | |||||
// 3. init generator with options_ | // 3. init generator with options_ | ||||
ret = generator_.Initialize(options_, omg_context_); | ret = generator_.Initialize(options_, omg_context_); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
GELOGE(ret, "generator Initialize failed!"); | |||||
GELOGE(ret, "[Init][Generator]failed!"); | |||||
return ret; | return ret; | ||||
} | } | ||||
// 4.parse and init Context with input shape format and net format info | // 4.parse and init Context with input shape format and net format info | ||||
@@ -517,7 +517,7 @@ graphStatus Impl::BuildModel(const Graph &graph, const std::map<std::string, std | |||||
// 1. init GeGenerator with user optios | // 1. init GeGenerator with user optios | ||||
graphStatus ret = Init(graph, options); | graphStatus ret = Init(graph, options); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
GELOGE(ret, "Build ir model Init failed!"); | |||||
GELOGE(ret, "[Init][GeGenerator]Build ir model Init failed!"); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -526,7 +526,7 @@ graphStatus Impl::BuildModel(const Graph &graph, const std::map<std::string, std | |||||
if (!omg_context_.is_dynamic_input) { // if dynamic input , no need to creat inputs | if (!omg_context_.is_dynamic_input) { // if dynamic input , no need to creat inputs | ||||
ret = CreateInputsForIRBuild(graph, inputs); | ret = CreateInputsForIRBuild(graph, inputs); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
GELOGE(ret, "CreateInputsForIRBuild failed!"); | |||||
GELOGE(ret, "[Create][InputsForIRBuild] failed!"); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
@@ -534,7 +534,7 @@ graphStatus Impl::BuildModel(const Graph &graph, const std::map<std::string, std | |||||
// 3. build IR model | // 3. build IR model | ||||
ret = generator_.GenerateOnlineModel(graph, inputs, model); | ret = generator_.GenerateOnlineModel(graph, inputs, model); | ||||
if (ret != GRAPH_SUCCESS) { | if (ret != GRAPH_SUCCESS) { | ||||
GELOGE(ret, "GenerateOnlineModel failed!"); | |||||
GELOGE(ret, "[Generate][OnlineModel] failed!"); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -553,7 +553,7 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in | |||||
if (iter != ge::input_format_str_to_geformat.end()) { | if (iter != ge::input_format_str_to_geformat.end()) { | ||||
omg_context_.format = iter->second; | omg_context_.format = iter->second; | ||||
} else { | } else { | ||||
GELOGE(GRAPH_PARAM_INVALID, "Input format %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Check][Param:InputForamt] %s not support , expect ND/NCHW/NHWC/CHWN/NC1HWC0/NHWC1C0.", | |||||
input_format.c_str()); | input_format.c_str()); | ||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
@@ -564,7 +564,7 @@ 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)) { | 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:ImputShape] Failed, shape: %s", input_shape.c_str()); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
return GRAPH_SUCCESS; | return GRAPH_SUCCESS; | ||||
@@ -585,7 +585,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendStrin | |||||
std::map<std::string, std::string> tmp_build_options; | std::map<std::string, std::string> tmp_build_options; | ||||
for (auto &option : build_options) { | for (auto &option : build_options) { | ||||
if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { | 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; | return GRAPH_FAILED; | ||||
} | } | ||||
std::string key = option.first.GetString(); | std::string key = option.first.GetString(); | ||||
@@ -601,7 +601,7 @@ graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &m | |||||
ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | ||||
GELOGD("Enter aclmdlSaveModel process!"); | GELOGD("Enter aclmdlSaveModel process!"); | ||||
if (model.data.get() == nullptr || model.length == 0) { | 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 GRAPH_PARAM_INVALID; | ||||
} | } | ||||
return FileSaver::SaveToFile((output_file + ".om"), reinterpret_cast<void *>(model.data.get()), | return FileSaver::SaveToFile((output_file + ".om"), reinterpret_cast<void *>(model.data.get()), | ||||
@@ -612,11 +612,11 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod | |||||
ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | ||||
GELOGD("Enter aclmdlSaveModel process!"); | GELOGD("Enter aclmdlSaveModel process!"); | ||||
if (model.data.get() == nullptr || model.length == 0) { | 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 GRAPH_PARAM_INVALID; | ||||
} | } | ||||
if (output_file == nullptr) { | if (output_file == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "Output file is nullptr."); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Check][OutputFile]file is nullptr."); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
std::string str_output_file = output_file; | std::string str_output_file = output_file; | ||||
@@ -641,7 +641,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz | |||||
GE_CHECK_NOTNULL(file); | GE_CHECK_NOTNULL(file); | ||||
if (len > PATH_MAX || len != strlen(file) || strlen(file) == 0) { | if (len > PATH_MAX || len != strlen(file) || strlen(file) == 0) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "File path invalid."); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Check][FilePath]file invalid."); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
@@ -675,7 +675,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz | |||||
char path[PATH_MAX] = {0}; | char path[PATH_MAX] = {0}; | ||||
if (realpath(file_path.c_str(), path) == nullptr) { | if (realpath(file_path.c_str(), path) == nullptr) { | ||||
GELOGE(GRAPH_PARAM_INVALID, "Dump file path:%s is invalid.", file); | |||||
GELOGE(GRAPH_PARAM_INVALID, "[Check][DumpFile] path:%s is invalid.", file); | |||||
return GRAPH_PARAM_INVALID; | return GRAPH_PARAM_INVALID; | ||||
} | } | ||||
@@ -710,7 +710,7 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector<Tenso | |||||
ge::TensorUtils::SetOutputTensor(tensor_desc, false); | ge::TensorUtils::SetOutputTensor(tensor_desc, false); | ||||
if (op_desc->AddInputDesc(tensor_desc) != ge::GRAPH_SUCCESS) { | if (op_desc->AddInputDesc(tensor_desc) != ge::GRAPH_SUCCESS) { | ||||
GELOGE(ge::FAILED, "AddInputDesc fail."); | |||||
GELOGE(ge::FAILED, "[Add][InputDesc] fail."); | |||||
return ge::FAILED; | return ge::FAILED; | ||||
} | } | ||||
input_tensors.emplace_back(tensor_desc); | input_tensors.emplace_back(tensor_desc); | ||||
@@ -734,7 +734,7 @@ graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector<Tenso | |||||
ge::GeGenerator generator; | ge::GeGenerator generator; | ||||
std::string graph_name = ge::CurrentTimeInStr() + "_graph"; | std::string graph_name = ge::CurrentTimeInStr() + "_graph"; | ||||
if (generator.BuildSingleOpGraph(op_desc, input_tensors, output_tensors, graph_name, graph) != ge::SUCCESS) { | if (generator.BuildSingleOpGraph(op_desc, input_tensors, output_tensors, graph_name, graph) != ge::SUCCESS) { | ||||
GELOGE(GRAPH_FAILED, "make graph fail."); | |||||
GELOGE(GRAPH_FAILED, "[Make][Graph] fail."); | |||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
return GRAPH_SUCCESS; | return GRAPH_SUCCESS; | ||||
@@ -747,7 +747,7 @@ static std::string AttrTypeToSerialString(aclgrphAttrType attr_type) { | |||||
} else { | } else { | ||||
ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | ||||
{"AttrTypeToSerialString", "attr_type[" + std::to_string(attr_type) + "] is not support"}); | {"AttrTypeToSerialString", "attr_type[" + std::to_string(attr_type) + "] is not support"}); | ||||
GELOGE(GRAPH_FAILED, "AttrTypeToSerialString: attr_type not support %u", attr_type); | |||||
GELOGE(GRAPH_FAILED, "[Check][AclgrphAttrType] attr_type not support %u", attr_type); | |||||
return "UNDEFINED"; | return "UNDEFINED"; | ||||
} | } | ||||
} | } | ||||
@@ -762,7 +762,7 @@ graphStatus aclgrphSetOpAttr(Graph &graph, aclgrphAttrType attr_type, const char | |||||
auto iter = kAttrTypeFuncMap.find(attr_type); | auto iter = kAttrTypeFuncMap.find(attr_type); | ||||
if (iter == kAttrTypeFuncMap.end()) { | if (iter == kAttrTypeFuncMap.end()) { | ||||
GELOGE(GRAPH_FAILED, "attr type: %s is not support", AttrTypeToSerialString(attr_type).c_str()); | |||||
GELOGE(GRAPH_FAILED, "[Check][AclgrphAttrType]%s is not support", AttrTypeToSerialString(attr_type).c_str()); | |||||
return GRAPH_FAILED; | return GRAPH_FAILED; | ||||
} | } | ||||
@@ -78,7 +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, | Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, uint32_t module_ret_errcode, | ||||
ErrorModule error_module) { | ErrorModule error_module) { | ||||
if (!is_init_) { | if (!is_init_) { | ||||
GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); | |||||
GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); | |||||
REPORT_INNER_ERROR("E19999", "WriteJobState failed before init. "); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { | if ((curr_state_ == JOBSTATE_FAILED) || (curr_state_ == JOBSTATE_KILLED)) { | ||||
@@ -107,7 +108,10 @@ Status CsaInteract::WriteJobState(JobState job_state, JobSubState job_sub_state, | |||||
content = content_json.dump(); | content = content_json.dump(); | ||||
} catch (const nlohmann::json::exception &e) { | } catch (const nlohmann::json::exception &e) { | ||||
GELOGE(INTERNAL_ERROR, "build jobstate content json string 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; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -168,7 +172,8 @@ void CsaInteract::WriteInternalErrorCode() { | |||||
/// | /// | ||||
Status CsaInteract::WriteHcomDetection(const std::string &content) { | Status CsaInteract::WriteHcomDetection(const std::string &content) { | ||||
if (!is_init_) { | if (!is_init_) { | ||||
GELOGE(INTERNAL_ERROR, "CsaInteract has not init, can't WriteJobState"); | |||||
GELOGE(INTERNAL_ERROR, "[Init][CsaInteract] obj has not init, can't WriteJobState"); | |||||
REPORT_INNER_ERROR("E19999", "WriteHcomDetection failed before init."); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -192,28 +197,33 @@ 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); | int32_t fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); | ||||
if (fd == EN_ERROR) { | if (fd == EN_ERROR) { | ||||
if (MakePath(file_name) != SUCCESS) { | if (MakePath(file_name) != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "csainteract 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; | return INTERNAL_ERROR; | ||||
} | } | ||||
fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); | fd = mmOpen2(file_name.c_str(), flags, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD); | ||||
if (fd == EN_ERROR) { | if (fd == EN_ERROR) { | ||||
GELOGE(INTERNAL_ERROR, "open file fail, 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; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
mmSsize_t ret = mmWrite(fd, reinterpret_cast<void *>(const_cast<char *>(content.c_str())), content.length()); | mmSsize_t ret = mmWrite(fd, reinterpret_cast<void *>(const_cast<char *>(content.c_str())), content.length()); | ||||
if (ret == EN_ERROR) { | if (ret == EN_ERROR) { | ||||
GELOGE(INTERNAL_ERROR, "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); | ret = mmClose(fd); | ||||
if (ret == EN_ERROR) { | if (ret == EN_ERROR) { | ||||
GELOGE(INTERNAL_ERROR, "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; | return INTERNAL_ERROR; | ||||
} | } | ||||
ret = mmClose(fd); | ret = mmClose(fd); | ||||
if (ret == EN_ERROR) { | if (ret == EN_ERROR) { | ||||
GELOGE(INTERNAL_ERROR, "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; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -242,7 +252,8 @@ Status CsaInteract::MakePath(const std::string &file_name) { | |||||
std::string pre_path = file_path.substr(0, found + 1); | std::string pre_path = file_path.substr(0, found + 1); | ||||
if (mmAccess(pre_path.c_str()) != EN_OK) { | if (mmAccess(pre_path.c_str()) != EN_OK) { | ||||
if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { | if (mmMkdir(pre_path.c_str(), M_IRWXU) != EN_OK) { | ||||
GELOGE(INTERNAL_ERROR, "csainteract mkdir fail, errno is %d", errno); | |||||
GELOGE(INTERNAL_ERROR, "[Create][FileDir] 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; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
@@ -50,7 +50,8 @@ Status OpsKernelBuilderManager::Initialize(const map<std::string, std::string> & | |||||
GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths)); | GE_CHK_STATUS_RET_NOLOG(GetLibPaths(options, lib_paths)); | ||||
plugin_manager_.reset(new (std::nothrow)PluginManager()); | plugin_manager_.reset(new (std::nothrow)PluginManager()); | ||||
GE_CHECK_NOTNULL(plugin_manager_); | 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(); | auto &kernel_builders = OpsKernelBuilderRegistry::GetInstance().GetAll(); | ||||
@@ -61,8 +62,7 @@ Status OpsKernelBuilderManager::Initialize(const map<std::string, std::string> & | |||||
GELOGI("Initialize ops kernel util for %s", kernel_lib_name.c_str()); | GELOGI("Initialize ops kernel util for %s", kernel_lib_name.c_str()); | ||||
GE_CHECK_NOTNULL(it.second); | GE_CHECK_NOTNULL(it.second); | ||||
GE_CHK_STATUS_RET(it.second->Initialize(options), | GE_CHK_STATUS_RET(it.second->Initialize(options), | ||||
"Failed to invoke Initialize, 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); | ops_kernel_builders_.emplace(kernel_lib_name, it.second); | ||||
} | } | ||||
@@ -100,7 +100,8 @@ OpsKernelBuilderPtr OpsKernelBuilderManager::GetOpsKernelBuilder(const string &n | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
Status OpsKernelBuilderManager::GetLibPaths(const std::map<std::string, std::string> &options, std::string &lib_paths) { | |||||
Status OpsKernelBuilderManager::GetLibPaths(const std::map<std::string, | |||||
std::string> &options, std::string &lib_paths) { | |||||
GELOGD("Start to execute GetLibPaths"); | GELOGD("Start to execute GetLibPaths"); | ||||
std::string path_base = PluginManager::GetPath(); | std::string path_base = PluginManager::GetPath(); | ||||
std::string so_path = "plugin/opskernel/"; | std::string so_path = "plugin/opskernel/"; | ||||
@@ -128,18 +129,17 @@ Status OpsKernelBuilderManager::CalcOpRunningParam(Node &node) const { | |||||
const std::string &lib_name = op_desc->GetOpKernelLibName(); | const std::string &lib_name = op_desc->GetOpKernelLibName(); | ||||
auto it = ops_kernel_builders_.find(lib_name); | auto it = ops_kernel_builders_.find(lib_name); | ||||
if (it == ops_kernel_builders_.end()) { | if (it == ops_kernel_builders_.end()) { | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to get OpKernelStore. libName = %s, node = %s", | |||||
lib_name.c_str(), | |||||
op_desc->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR,"[Find][LibName] fail for libName = %s, node = %s.", | |||||
lib_name.c_str(), op_desc->GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", | |||||
"find LibName for CalcOpRunningParam failed, libName = %s, node = %s not exist.", | |||||
lib_name.c_str(), op_desc->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("To invoke CalcOpRunningParam, node = %s, lib name = %s", op_desc->GetName().c_str(), lib_name.c_str()); | 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), | GE_CHK_STATUS_RET(it->second->CalcOpRunningParam(node), | ||||
"Failed to invoke CalcOpRunningParam, 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"); | GELOGD("Done invoking CalcOpRunningParam successfully"); | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
@@ -152,20 +152,16 @@ Status OpsKernelBuilderManager::GenerateTask(const Node &node, | |||||
const std::string &lib_name = op_desc->GetOpKernelLibName(); | const std::string &lib_name = op_desc->GetOpKernelLibName(); | ||||
auto it = ops_kernel_builders_.find(lib_name); | auto it = ops_kernel_builders_.find(lib_name); | ||||
if (it == ops_kernel_builders_.end()) { | if (it == ops_kernel_builders_.end()) { | ||||
GELOGE(INTERNAL_ERROR, | |||||
"Failed to get OpKernelStore. libName = %s, node = %s", | |||||
lib_name.c_str(), | |||||
op_desc->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[Find][LibName]fail for libName = %s, node:%s", lib_name.c_str(), op_desc->GetName().c_str()); | |||||
REPORT_INNER_ERROR("E19999", "find LibName for GenerateTask failed, libName = %s, node = %s not exist", | |||||
lib_name.c_str(), op_desc->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("To invoke GenerateTask, node = %s, lib name = %s", op_desc->GetName().c_str(), lib_name.c_str()); | 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), | GE_CHK_STATUS_RET(it->second->GenerateTask(node, context, tasks), | ||||
"Failed to invoke GenerateTask, 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"); | GELOGD("Done invoking GenerateTask successfully"); | ||||
return SUCCESS; | return SUCCESS; | ||||
} | } | ||||
} // namespace ge | |||||
} // namespace ge |
@@ -56,7 +56,8 @@ Status OpsKernelManager::Initialize(const map<string, string> &options_const) { | |||||
std::map<string, string> options(options_const); | std::map<string, string> options(options_const); | ||||
Status ret = InitPluginOptions(options); | Status ret = InitPluginOptions(options); | ||||
if (ret != SUCCESS) { | 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."); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -85,7 +86,8 @@ Status OpsKernelManager::Initialize(const map<string, string> &options_const) { | |||||
initialize_ = options; | initialize_ = options; | ||||
Status rst0 = plugin_manager_.InvokeAll<map<string, string> &, Status>(kInitialize, initialize_); | Status rst0 = plugin_manager_.InvokeAll<map<string, string> &, Status>(kInitialize, initialize_); | ||||
if (rst0 == FAILED) { | 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; | return GE_OPS_GET_NO_VALID_SO; | ||||
} | } | ||||
Status rst1 = | Status rst1 = | ||||
@@ -114,18 +116,21 @@ Status OpsKernelManager::Initialize(const map<string, string> &options_const) { | |||||
} | } | ||||
ret = InitGraphOptimizerPriority(); | ret = InitGraphOptimizerPriority(); | ||||
if ((ret != SUCCESS)) { | if ((ret != SUCCESS)) { | ||||
GELOGE(ret, "Init graph optimizer priority failed."); | |||||
GELOGE(ret, "[Init][GraphOptimizerPriority] failed."); | |||||
REPORT_CALL_ERROR("E19999", "InitGraphOptimizerPriority failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
init_flag_ = true; | init_flag_ = true; | ||||
return SUCCESS; | return SUCCESS; | ||||
} else { | } else { | ||||
GELOGE(ret, "Failed to find any valid so file."); | |||||
GELOGE(ret, "[Check][SoFile] not find any valid so file."); | |||||
REPORT_INNER_ERROR("E19999", "OpsKernelManager::Initialize failed for not find any valid so file."); | |||||
return ret; | return ret; | ||||
} | } | ||||
} | } | ||||
void OpsKernelManager::GetExternalEnginePath(std::string &extern_engine_path, const std::map<string, string>& options) { | |||||
void OpsKernelManager::GetExternalEnginePath(std::string &extern_engine_path, | |||||
const std::map<string, string>& options) { | |||||
GELOGI("Enter get external engine so path schedule"); | GELOGI("Enter get external engine so path schedule"); | ||||
const char *path_env = std::getenv("ASCEND_ENGINE_PATH"); | const char *path_env = std::getenv("ASCEND_ENGINE_PATH"); | ||||
if (path_env != nullptr) { | if (path_env != nullptr) { | ||||
@@ -175,21 +180,35 @@ Status OpsKernelManager::ParsePluginOptions(const map<string, string> &options, | |||||
} else if (flag == 1) { | } else if (flag == 1) { | ||||
enable_flag = true; | enable_flag = true; | ||||
} else { | } else { | ||||
GELOGE(GE_GRAPH_OPTIONS_INVALID, "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, | |||||
"[Parse][PluginOptions]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; | return GE_GRAPH_OPTIONS_INVALID; | ||||
} | } | ||||
} catch (std::invalid_argument &) { | } 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.", | |||||
iter->second.c_str()); | |||||
GELOGE(GE_GRAPH_OPTIONS_INVALID, | |||||
"[Parse][PluginOptions] 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, 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; | return GE_GRAPH_OPTIONS_INVALID; | ||||
} catch (std::out_of_range &) { | } 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.", | |||||
iter->second.c_str()); | |||||
GELOGE(GE_GRAPH_OPTIONS_INVALID, | |||||
"[Parse][PluginOptions]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()); | |||||
return GE_GRAPH_OPTIONS_INVALID; | return GE_GRAPH_OPTIONS_INVALID; | ||||
} catch (...) { | } catch (...) { | ||||
GELOGE(GE_GRAPH_OPTIONS_INVALID, "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, | |||||
"[Parse][PluginOptions]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; | return GE_GRAPH_OPTIONS_INVALID; | ||||
} | } | ||||
} else { | } else { | ||||
@@ -203,13 +222,15 @@ Status OpsKernelManager::ParsePluginOptions(const map<string, string> &options, | |||||
Status OpsKernelManager::CheckPluginPtr() const { | Status OpsKernelManager::CheckPluginPtr() const { | ||||
for (auto iter = ops_kernel_store_.begin(); iter != ops_kernel_store_.end(); ++iter) { | for (auto iter = ops_kernel_store_.begin(); iter != ops_kernel_store_.end(); ++iter) { | ||||
if (iter->second == nullptr) { | 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()); | |||||
REPORT_INNER_ERROR("E19999", "CheckPluginPtr OpsKernelInfoStorePtr key=%s is null", iter->first.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
for (auto iter1 = graph_optimizers_.begin(); iter1 != graph_optimizers_.end(); ++iter1) { | for (auto iter1 = graph_optimizers_.begin(); iter1 != graph_optimizers_.end(); ++iter1) { | ||||
if (iter1->second == nullptr) { | 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()); | |||||
REPORT_INNER_ERROR("E19999", "GraphOptimizerPtr key=%s is null", iter1->first.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -222,7 +243,9 @@ Status OpsKernelManager::InitOpKernelInfoStores(const map<string, string> &optio | |||||
GELOGI("OpKernelInfoStore name: %s.", (it.first).c_str()); | GELOGI("OpKernelInfoStore name: %s.", (it.first).c_str()); | ||||
Status ret = it.second->Initialize(options); | Status ret = it.second->Initialize(options); | ||||
if (ret != SUCCESS) { | 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()); | |||||
REPORT_CALL_ERROR("E19999", "OpKernelInfoStore: %s initialize failed.", (it.first).c_str()); | |||||
return GE_OPS_KERNEL_STORE_INIT_FAILED; | return GE_OPS_KERNEL_STORE_INIT_FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -247,7 +270,8 @@ void OpsKernelManager::InitOpsKernelInfo() { | |||||
} | } | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr) { | 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", "InitOpsKernelInfo failed for new GELib."); | |||||
return; | return; | ||||
} | } | ||||
// sort opinfo of ops_kernel_info_ | // sort opinfo of ops_kernel_info_ | ||||
@@ -291,7 +315,8 @@ Status OpsKernelManager::InitGraphOptimzers(const map<string, string> &options) | |||||
GE_CHK_STATUS_RET(it.second->GetAttributes(attrs)) | GE_CHK_STATUS_RET(it.second->GetAttributes(attrs)) | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr) { | 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", "InitGraphOptimzers failed for new GELib."); | |||||
return GE_CLI_GE_NOT_INITIALIZED; | return GE_CLI_GE_NOT_INITIALIZED; | ||||
} | } | ||||
if (!instance_ptr->DNNEngineManagerObj().IsEngineRegistered(attrs.engineName)) { | if (!instance_ptr->DNNEngineManagerObj().IsEngineRegistered(attrs.engineName)) { | ||||
@@ -300,7 +325,9 @@ Status OpsKernelManager::InitGraphOptimzers(const map<string, string> &options) | |||||
} | } | ||||
Status ret = it.second->Initialize(options); | Status ret = it.second->Initialize(options); | ||||
if (ret != SUCCESS) { | 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_CALL_ERROR("E19999", "InitGraphOptimzers failed. %s initialize failed.", (it.first).c_str()); | |||||
return GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED; | return GE_OPS_GRAPH_OPTIMIZER_INIT_FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -317,7 +344,8 @@ Status OpsKernelManager::Finalize() { | |||||
GELOGI("OpsKernelStore finalize, name: %s.", (iter->first).c_str()); | GELOGI("OpsKernelStore finalize, name: %s.", (iter->first).c_str()); | ||||
Status status = iter->second->Finalize(); | Status status = iter->second->Finalize(); | ||||
if (SUCCESS != status) { | 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_CALL_ERROR("E19999", "OpsKernelStore finalize failed, name: %s.", (iter->first).c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
} | } | ||||
@@ -325,14 +353,16 @@ Status OpsKernelManager::Finalize() { | |||||
GELOGI("GraphOptimzers finalize, name: %s.", (iter->first).c_str()); | GELOGI("GraphOptimzers finalize, name: %s.", (iter->first).c_str()); | ||||
Status status = iter->second->Finalize(); | Status status = iter->second->Finalize(); | ||||
if (status != SUCCESS) { | 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_CALL_ERROR("E19999", "GraphOptimzers finalize failed, name: %s.", (iter->first).c_str()); | |||||
return status; | return status; | ||||
} | } | ||||
} | } | ||||
Status ret = FinalizeOpsKernel(); | Status ret = FinalizeOpsKernel(); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "free ops kernel resource failed."); | |||||
GELOGE(ret, "[Free][Ops Kernel Resource] failed."); | |||||
REPORT_CALL_ERROR("E19999", "FinalizeOpsKernel failed, Free Ops kernel resource failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -443,7 +473,8 @@ Status OpsKernelManager::FinalizeOpsKernel() { | |||||
GELOGI("ge invoke ops kernal finalize."); | GELOGI("ge invoke ops kernal finalize."); | ||||
Status ret = plugin_manager_.InvokeAll<Status>(kFinalize); | Status ret = plugin_manager_.InvokeAll<Status>(kFinalize); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Finalize] invoke Fe finalize failed."); | |||||
GELOGE(ret, "[Finalize][Check][Status] invoke Fe finalize failed."); | |||||
REPORT_INNER_ERROR("E19999", "PluginManager InvokeAll failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -21,6 +21,7 @@ | |||||
#include <utility> | #include <utility> | ||||
#include "common/ge/ge_util.h" | #include "common/ge/ge_util.h" | ||||
#include "securec.h" | |||||
#include "framework/common/debug/ge_log.h" | #include "framework/common/debug/ge_log.h" | ||||
#include "plugin/engine/dnnengines.h" | #include "plugin/engine/dnnengines.h" | ||||
@@ -29,7 +30,8 @@ std::unique_ptr<std::map<std::string, DNNEnginePtr>> EngineManager::engine_map_; | |||||
Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr) { | Status EngineManager::RegisterEngine(const std::string &engine_name, DNNEnginePtr engine_ptr) { | ||||
if (engine_ptr == nullptr) { | if (engine_ptr == nullptr) { | ||||
GELOGE(FAILED, "enginePtr is nullptr"); | |||||
GELOGE(FAILED, "[Register][Engine] failed, as input engine_ptr is nullptr"); | |||||
REPORT_INNER_ERROR("E19999", "RegisterEngine failed for input engine_ptr is nullptr."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -64,7 +66,8 @@ void RegisterAiCoreEngine() { | |||||
DNNEngineAttribute attr_aicore = {ai_core, mem_type_aicore, COST_0, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | DNNEngineAttribute attr_aicore = {ai_core, mem_type_aicore, COST_0, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | ||||
DNNEnginePtr aicore_engine_ptr = MakeShared<AICoreDNNEngine>(attr_aicore); | DNNEnginePtr aicore_engine_ptr = MakeShared<AICoreDNNEngine>(attr_aicore); | ||||
if (aicore_engine_ptr == nullptr) { | if (aicore_engine_ptr == nullptr) { | ||||
GELOGE(ge::FAILED, "make aiCoreEnginePtr failed"); | |||||
GELOGE(ge::FAILED, "[Register][AiCoreEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterAiCoreEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { | if (EngineManager::RegisterEngine(ai_core, aicore_engine_ptr) != SUCCESS) { | ||||
@@ -80,7 +83,8 @@ void RegisterVectorEngine() { | |||||
DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | ||||
DNNEnginePtr vectorcore_engine_ptr = MakeShared<VectorCoreDNNEngine>(attr_vector_core); | DNNEnginePtr vectorcore_engine_ptr = MakeShared<VectorCoreDNNEngine>(attr_vector_core); | ||||
if (vectorcore_engine_ptr == nullptr) { | if (vectorcore_engine_ptr == nullptr) { | ||||
GELOGE(ge::FAILED, "make vectorCoreEnginePtr failed"); | |||||
GELOGE(ge::FAILED, "[Register][VectorEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterVectorEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { | if (EngineManager::RegisterEngine(vector_core, vectorcore_engine_ptr) != SUCCESS) { | ||||
@@ -95,7 +99,8 @@ void RegisterAiCpuEngine() { | |||||
DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | DNNEngineAttribute attr_aicpu = {vm_aicpu, mem_type_aicpu, COST_3, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | ||||
DNNEnginePtr vm_engine_ptr = MakeShared<AICpuDNNEngine>(attr_aicpu); | DNNEnginePtr vm_engine_ptr = MakeShared<AICpuDNNEngine>(attr_aicpu); | ||||
if (vm_engine_ptr == nullptr) { | if (vm_engine_ptr == nullptr) { | ||||
GELOGE(ge::FAILED, "make vm_engine_ptr failed"); | |||||
GELOGE(ge::FAILED, "[Register][AiCpuEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterAiCpuEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { | if (EngineManager::RegisterEngine(vm_aicpu, vm_engine_ptr) != SUCCESS) { | ||||
@@ -110,7 +115,8 @@ void RegisterAiCpuTFEngine() { | |||||
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<AICpuTFDNNEngine>(attr_aicpu_tf); | DNNEnginePtr vm_engine_ptr = MakeShared<AICpuTFDNNEngine>(attr_aicpu_tf); | ||||
if (vm_engine_ptr == nullptr) { | if (vm_engine_ptr == nullptr) { | ||||
GELOGE(ge::FAILED, "make vm_engine_ptr failed"); | |||||
GELOGE(ge::FAILED, "[Register][AiCpuTFEngine]make vm_engine_ptr failed"); | |||||
REPORT_INNER_ERROR("E19999", "RegisterAiCpuTFEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { | if (EngineManager::RegisterEngine(vm_aicpu_tf, vm_engine_ptr) != SUCCESS) { | ||||
@@ -126,7 +132,8 @@ void RegisterGeLocalEngine() { | |||||
DNNEngineAttribute attr_ge_local = {vm_ge_local, mem_type_ge_local, COST_9, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | DNNEngineAttribute attr_ge_local = {vm_ge_local, mem_type_ge_local, COST_9, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | ||||
DNNEnginePtr ge_local_engine = MakeShared<GeLocalDNNEngine>(attr_ge_local); | DNNEnginePtr ge_local_engine = MakeShared<GeLocalDNNEngine>(attr_ge_local); | ||||
if (ge_local_engine == nullptr) { | if (ge_local_engine == nullptr) { | ||||
GELOGE(ge::FAILED, "make ge_local_engine failed"); | |||||
GELOGE(ge::FAILED, "[Register][GeLocalEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterGeLocalEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { | if (EngineManager::RegisterEngine(vm_ge_local, ge_local_engine) != SUCCESS) { | ||||
@@ -139,10 +146,12 @@ void RegisterHostCpuEngine() { | |||||
std::vector<std::string> mem_type_host_cpu; | std::vector<std::string> mem_type_host_cpu; | ||||
mem_type_host_cpu.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); | mem_type_host_cpu.emplace_back(GE_ENGINE_ATTR_MEM_TYPE_HBM); | ||||
// HostCpu use minimum priority, set it as 10 | // 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<HostCpuDNNEngine>(attr_host_cpu); | DNNEnginePtr host_cpu_engine = MakeShared<HostCpuDNNEngine>(attr_host_cpu); | ||||
if (host_cpu_engine == nullptr) { | if (host_cpu_engine == nullptr) { | ||||
GELOGE(ge::FAILED, "make host_cpu_engine failed"); | |||||
GELOGE(ge::FAILED, "[Register][HostCpuEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterHostCpuEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { | if (EngineManager::RegisterEngine(vm_host_cpu, host_cpu_engine) != SUCCESS) { | ||||
@@ -157,7 +166,8 @@ void RegisterRtsEngine() { | |||||
DNNEngineAttribute attr_rts = {vm_rts, mem_type_rts, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | DNNEngineAttribute attr_rts = {vm_rts, mem_type_rts, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | ||||
DNNEnginePtr rts_engine = MakeShared<RtsDNNEngine>(attr_rts); | DNNEnginePtr rts_engine = MakeShared<RtsDNNEngine>(attr_rts); | ||||
if (rts_engine == nullptr) { | if (rts_engine == nullptr) { | ||||
GELOGE(ge::FAILED, "make rts_engine failed"); | |||||
GELOGE(ge::FAILED, "[Register][RtsEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterRtsEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { | if (EngineManager::RegisterEngine(vm_rts, rts_engine) != SUCCESS) { | ||||
@@ -172,7 +182,8 @@ void RegisterHcclEngine() { | |||||
DNNEngineAttribute attr_hccl = {dnn_hccl, mem_type_hccl, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | DNNEngineAttribute attr_hccl = {dnn_hccl, mem_type_hccl, COST_1, DEVICE, FORMAT_RESERVED, FORMAT_RESERVED}; | ||||
DNNEnginePtr hccl_engine = MakeShared<HcclDNNEngine>(attr_hccl); | DNNEnginePtr hccl_engine = MakeShared<HcclDNNEngine>(attr_hccl); | ||||
if (hccl_engine == nullptr) { | if (hccl_engine == nullptr) { | ||||
GELOGE(ge::FAILED, "make hccl_engine failed"); | |||||
GELOGE(ge::FAILED, "[Register][HcclEngine] failed, as malloc shared_ptr failed."); | |||||
REPORT_INNER_ERROR("E19999", "RegisterHcclEngine failed for new DNNEnginePtr failed."); | |||||
return; | return; | ||||
} | } | ||||
if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) { | if (EngineManager::RegisterEngine(dnn_hccl, hccl_engine) != SUCCESS) { | ||||