@@ -122,14 +122,14 @@ Status GraphLoader::LoadDataFromFile(const std::string &path, const std::string | |||
ModelData &model_data) { | |||
Status ret; | |||
if (!CheckInputPathValid(path)) { | |||
GELOGE(GE_EXEC_MODEL_PATH_INVALID, "model path is invalid: %s", path.c_str()); | |||
return GE_EXEC_MODEL_PATH_INVALID; | |||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID, "model path is invalid: %s", path.c_str()); | |||
return ACL_ERROR_GE_EXEC_MODEL_PATH_INVALID; | |||
} | |||
GELOGI("Load model begin, model path is: %s", path.c_str()); | |||
if (!key_path.empty() && !CheckInputPathValid(key_path)) { | |||
GELOGE(GE_EXEC_MODEL_KEY_PATH_INVALID, "decrypt_key path is invalid: %s", key_path.c_str()); | |||
return GE_EXEC_MODEL_KEY_PATH_INVALID; | |||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "decrypt_key path is invalid: %s", key_path.c_str()); | |||
return ACL_ERROR_GE_PARAM_INVALID; | |||
} | |||
ret = DavinciModelParser::LoadFromFile(path.c_str(), key_path.c_str(), priority, model_data); | |||
@@ -186,13 +186,13 @@ Status GraphLoader::LoadModel(const ModelData &model_data, const std::shared_ptr | |||
Status ret = model_manager->LoadModelOffline(model_id, model_data, listener); | |||
if (ret != SUCCESS) { | |||
GE_CHK_RT(rtDeviceReset(0)); | |||
GELOGE(ret, "LoadModel: Load failed."); | |||
return ret; | |||
GELOGE(ACL_ERROR_GE_LOAD_MODEL, "LoadModel: Load failed."); | |||
return ACL_ERROR_GE_LOAD_MODEL; | |||
} | |||
ret = model_manager->Start(model_id); | |||
if (ret != SUCCESS) { | |||
if (model_manager->Unload(model_id) != SUCCESS) { | |||
GELOGE(FAILED, "LoadModel: Unload failed while trying to unload after a failed start."); | |||
GELOGE(ACL_ERROR_GE_UNLOAD_MODEL, "LoadModel: Unload failed while trying to unload after a failed start."); | |||
} | |||
GELOGE(ret, "LoadModel: Start failed."); | |||
return ret; | |||
@@ -233,8 +233,8 @@ Status GraphLoader::LoadModelFromData(uint32_t &model_id, const ModelData &model | |||
Status ret = model_manager->LoadModelOffline( | |||
model_id, model_data, nullptr, dev_ptr, memsize, weight_ptr, weightsize); | |||
if (ret != SUCCESS) { | |||
GELOGE(ret, "Load model failed, model_id:%u.", model_id); | |||
return ret; | |||
GELOGE(ACL_ERROR_GE_LOAD_MODEL, "Load model failed, model_id:%u.", model_id); | |||
return ACL_ERROR_GE_LOAD_MODEL; | |||
} | |||
GELOGI("Load model success, model_id:%u.", model_id); | |||
return SUCCESS; | |||
@@ -259,8 +259,8 @@ Status GraphLoader::LoadModelWithQ(uint32_t &model_id, const ModelData &model_da | |||
GE_CHECK_NOTNULL(model_manager); | |||
Status ret = model_manager->LoadModelWithQ(model_id, model_data, input_queue_ids, output_queue_ids); | |||
if (ret != SUCCESS) { | |||
GELOGE(ret, "Load model with queue failed, model_id:%u.", model_id); | |||
return ret; | |||
GELOGE(ACL_ERROR_GE_LOAD_MODEL, "Load model with queue failed, model_id:%u.", model_id); | |||
return ACL_ERROR_GE_LOAD_MODEL; | |||
} | |||
GELOGI("Load model with queue success, model_id:%u.", model_id); | |||
@@ -289,8 +289,8 @@ Status DavinciModel::InitWeightMem(void *dev_ptr, void *weight_ptr, size_t weigh | |||
if (weight_ptr == nullptr) { | |||
weights_mem_base_ = MallocWeightsMem(weights_size); | |||
if (weights_mem_base_ == nullptr) { | |||
GELOGE(GE_EXEC_ALLOC_WEIGHT_MEM_FAILED, "Alloc weight memory failed. size: %zu", weights_size); | |||
return GE_EXEC_ALLOC_WEIGHT_MEM_FAILED; | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc weight memory failed. size: %zu", weights_size); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} | |||
is_inner_weight_base_ = true; | |||
} | |||
@@ -307,8 +307,8 @@ Status DavinciModel::InitWeightMem(void *dev_ptr, void *weight_ptr, size_t weigh | |||
Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) { | |||
if (is_feature_map_mem_has_inited_) { | |||
GELOGE(FAILED, "call InitFeatureMapMem more than once ."); | |||
return FAILED; | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "call InitFeatureMapMem more than once ."); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} | |||
is_feature_map_mem_has_inited_ = true; | |||
@@ -316,8 +316,8 @@ Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) { | |||
std::size_t p2p_data_size = P2PMemInfos().at(RT_MEMORY_P2P_DDR).memory_size; | |||
if ((dev_ptr != nullptr) && (mem_size < TotalMemSize())) { | |||
GELOGE(FAILED, "Invalid mem param: mem_size=%zu totalsize=%zu.", mem_size, TotalMemSize()); | |||
return FAILED; | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Invalid mem param: mem_size=%zu totalsize=%zu.", mem_size, TotalMemSize()); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} | |||
mem_base_ = static_cast<uint8_t *>(dev_ptr); | |||
@@ -327,8 +327,8 @@ Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) { | |||
if (TotalMemSize() && mem_base_ == nullptr) { | |||
mem_base_ = MallocFeatureMapMem(data_size); | |||
if (mem_base_ == nullptr) { | |||
GELOGE(GE_EXEC_ALLOC_FEATURE_MAP_MEM_FAILED, "Alloc feature map memory failed. size: %zu", data_size); | |||
return GE_EXEC_ALLOC_FEATURE_MAP_MEM_FAILED; | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc feature map memory failed. size: %zu", data_size); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} | |||
GEEVENT("[IMAS]InitFeatureMapAndP2PMem graph_%u MallocMemory type[F] memaddr[%p] mem_size[%zu]", | |||
runtime_param_.graph_id, mem_base_, data_size); | |||
@@ -343,8 +343,8 @@ Status DavinciModel::InitFeatureMapAndP2PMem(void *dev_ptr, size_t mem_size) { | |||
if (p2p_data_size != 0) { | |||
p2p_mem_base_ = MallocP2PMem(p2p_data_size); | |||
if (p2p_mem_base_ == nullptr) { | |||
GELOGE(GE_EXEC_ALLOC_P2P_MEM_FAILED, "Alloc p2p memory failed,size: %zu", p2p_data_size); | |||
return GE_EXEC_ALLOC_P2P_MEM_FAILED; | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc p2p memory failed,size: %zu", p2p_data_size); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} | |||
GELOGI("InitFeatureMapAndP2PMem graph_%u MallocMemory type[F] memaddr[%p] mem_size[%zu]", runtime_param_.graph_id, | |||
p2p_mem_base_, p2p_data_size); | |||
@@ -215,8 +215,8 @@ ge::Status ModelManager::DestroyAicpuSessionForInfer(uint32_t model_id) { | |||
auto it = model_map_.find(model_id); | |||
if (it == model_map_.end()) { | |||
GELOGE(GE_EXEC_MODEL_ID_INVALID, "model id %u does not exists.", model_id); | |||
return GE_EXEC_MODEL_ID_INVALID; | |||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, "model id %u does not exists.", model_id); | |||
return ACL_ERROR_GE_EXEC_MODEL_ID_INVALID; | |||
} | |||
uint64_t session_id = it->second->GetSessionId(); | |||
DestroyAicpuSession(session_id); | |||
@@ -384,8 +384,8 @@ Status ModelManager::DeleteModel(uint32_t id) { | |||
} else if (hybrid_model_it != hybrid_model_map_.end()) { | |||
(void)hybrid_model_map_.erase(hybrid_model_it); | |||
} else { | |||
GELOGE(GE_EXEC_MODEL_ID_INVALID, "model id %u does not exists.", id); | |||
return GE_EXEC_MODEL_ID_INVALID; | |||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, "model id %u does not exists.", id); | |||
return ACL_ERROR_GE_EXEC_MODEL_ID_INVALID; | |||
} | |||
return SUCCESS; | |||
@@ -902,7 +902,7 @@ Status ModelManager::GetInputOutputDescInfo(const uint32_t model_id, vector<Inpu | |||
} | |||
std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, GE_EXEC_MODEL_ID_INVALID, | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
"GetInputOutputDescInfo Failed, Invalid model id %u!", model_id); | |||
davinci_model->SetModelDescVersion(new_model_desc); | |||
@@ -970,8 +970,9 @@ Status ModelManager::GetUserDesignateShapeOrder(const uint32_t model_id, | |||
} | |||
Status ModelManager::GetCurShape(const uint32_t model_id, std::vector<int64_t> &batch_info, int32_t &dynamic_type) { | |||
std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
GE_CHECK_NOTNULL(davinci_model); | |||
auto davinci_model = GetModel(model_id); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
"GetCurShape Failed, Invalid Model ID %u!", model_id); | |||
davinci_model->GetCurShape(batch_info, dynamic_type); | |||
return SUCCESS; | |||
} | |||
@@ -984,7 +985,8 @@ Status ModelManager::GetModelAttr(uint32_t model_id, std::vector<string> &dynami | |||
} | |||
std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
GE_CHECK_NOTNULL(davinci_model); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
"GetModelAttr Failed, Invalid Model ID %u!", model_id); | |||
davinci_model->GetModelAttr(dynamic_output_shape_info); | |||
return SUCCESS; | |||
} | |||
@@ -994,9 +996,8 @@ Status ModelManager::GetInputOutputDescInfoForZeroCopy(const uint32_t model_id, | |||
std::vector<uint32_t> &inputFormats, | |||
std::vector<uint32_t> &outputFormats) { | |||
std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, PARAM_INVALID, "GetInputOutputDescInfo Failed, Invalid model id %u!", | |||
model_id); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
"GetInputOutputDescInfo Failed, Invalid model id %u!", model_id); | |||
return davinci_model->GetInputOutputDescInfoForZeroCopy(input_desc, output_desc, inputFormats, outputFormats); | |||
} | |||
@@ -1011,18 +1012,14 @@ Status ModelManager::GetInputOutputDescInfoForZeroCopy(const uint32_t model_id, | |||
Status ModelManager::GetAIPPInfo(const uint32_t model_id, uint32_t index, AippConfigInfo &aipp_info) { | |||
std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
"GetAIPPInfo failed, invalid model_id is %u.", | |||
model_id); | |||
"GetAIPPInfo failed, invalid model_id is %u.", model_id); | |||
return davinci_model->GetAIPPInfo(index, aipp_info); | |||
} | |||
Status ModelManager::GetAippType(uint32_t model_id, uint32_t index, InputAippType &type, size_t &aipp_index) { | |||
std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
"GetAIPPInfo failed, invalid model_id is %u.", | |||
model_id); | |||
"GetAIPPInfo failed, invalid model_id is %u.", model_id); | |||
return davinci_model->GetAippType(index, type, aipp_index); | |||
} | |||
@@ -1059,8 +1056,7 @@ Status ModelManager::LoadModelOffline(uint32_t &model_id, const ModelData &model | |||
if (model_helper.GetModelType()) { | |||
bool is_shape_unknown = false; | |||
GE_CHK_STATUS_RET(model_helper.GetGeRootModel()->CheckIsUnknownShape(is_shape_unknown), | |||
"CheckIsUnknownShape failed, model id:%u", | |||
model_id); | |||
"CheckIsUnknownShape failed, model id:%u", model_id); | |||
if (is_shape_unknown || GetContext().GetHostExecFlag()) { | |||
return DoLoadHybridModelOnline(model_id, model_helper.GetGeRootModel(), listener); | |||
} | |||
@@ -1078,8 +1074,8 @@ Status ModelManager::LoadModelOffline(uint32_t &model_id, const ModelData &model | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Make shared failed"); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} catch (...) { | |||
GELOGE(INTERNAL_ERROR, "Make shared failed since other exception raise"); | |||
return INTERNAL_ERROR; | |||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Make shared failed since other exception raise"); | |||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | |||
} | |||
ret = davinci_model->Assign(ge_model); | |||
if (ret != SUCCESS) { | |||
@@ -1091,7 +1087,7 @@ Status ModelManager::LoadModelOffline(uint32_t &model_id, const ModelData &model | |||
int32_t device_id = 0; | |||
rtError_t rt_ret = rtGetDevice(&device_id); | |||
if (rt_ret != RT_ERROR_NONE || device_id < 0) { | |||
GELOGE(RT_FAILED, "Call rtGetDevice failed, ret = 0x%X, device_id = %d.", rt_ret, device_id); | |||
GELOGE(rt_ret, "Call rtGetDevice failed, ret = 0x%X, device_id = %d.", rt_ret, device_id); | |||
return RT_ERROR_TO_GE_STATUS(rt_ret); | |||
} | |||
davinci_model->SetDeviceId(device_id); | |||