@@ -104,7 +104,6 @@ ge::Status Analyzer::Initialize() { | |||||
string real_path = RealPath(kFilePath.c_str()); | string real_path = RealPath(kFilePath.c_str()); | ||||
if (real_path.empty()) { | if (real_path.empty()) { | ||||
GELOGE(FAILED, "[Check][AnalyzeFilePath]File path is empty, Path invalid."); | GELOGE(FAILED, "[Check][AnalyzeFilePath]File path is empty, Path invalid."); | ||||
REPORT_CALL_ERROR("E19999", "Analyze file path check invalid, it is empty"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
json_file_name_ = real_path + "/" + kAnalyzeFile; | json_file_name_ = real_path + "/" + kAnalyzeFile; | ||||
@@ -156,18 +155,12 @@ std::shared_ptr<GraphInfo> Analyzer::GetJsonObject(uint64_t session_id, uint64_t | |||||
std::lock_guard<std::recursive_mutex> lg(mutex_); | std::lock_guard<std::recursive_mutex> lg(mutex_); | ||||
auto iter = graph_infos_.find(session_id); | auto iter = graph_infos_.find(session_id); | ||||
if (iter == graph_infos_.end()) { | if (iter == graph_infos_.end()) { | ||||
GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! " | |||||
"graph_id:%lu", session_id, graph_id); | |||||
REPORT_INNER_ERROR("E19999", "Sessin_id %lu does not exist, graph_id %lu", | |||||
session_id, graph_id); | |||||
GELOGE(PARAM_INVALID, "[Check][SessionId]session_id:%lu does not exist! graph_id:%lu", session_id, graph_id); | |||||
return nullptr; | return nullptr; | ||||
} else { | } else { | ||||
auto iter1 = (iter->second).find(graph_id); | auto iter1 = (iter->second).find(graph_id); | ||||
if (iter1 == (iter->second).end()) { | if (iter1 == (iter->second).end()) { | ||||
GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%lu does not exist! " | |||||
"session_id:%lu.", graph_id, session_id); | |||||
REPORT_INNER_ERROR("E19999", "Graph_id %lu does not exist, session_id %lu", | |||||
graph_id, session_id); | |||||
GELOGE(PARAM_INVALID, "[Check][GraphId]graph_id:%lu does not exist! session_id:%lu.", graph_id, session_id); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
GELOGI("GetJsonObject Success!session_id:%lu graph_id:%lu", session_id, graph_id); | GELOGI("GetJsonObject Success!session_id:%lu graph_id:%lu", session_id, graph_id); | ||||
@@ -193,15 +186,11 @@ ge::Status Analyzer::CreateAnalyzerFile() { | |||||
std::lock_guard<std::mutex> lg(file_mutex_); | std::lock_guard<std::mutex> lg(file_mutex_); | ||||
int fd = open(json_file_name_.c_str(), O_WRONLY | O_CREAT | O_TRUNC, kFileAuthority); | int fd = open(json_file_name_.c_str(), O_WRONLY | O_CREAT | O_TRUNC, kFileAuthority); | ||||
if (fd < 0) { | if (fd < 0) { | ||||
GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", | |||||
json_file_name_.c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Failed to open analyze file %s", json_file_name_.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[FileOpen][AnalyzeFile]Fail to open the analyze file: %s.", json_file_name_.c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
if (close(fd) != 0) { | if (close(fd) != 0) { | ||||
GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", | |||||
json_file_name_.c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Failed to clsoe analyze file %s", json_file_name_.c_str()); | |||||
GELOGE(INTERNAL_ERROR, "[FileClose][AnalyzeFile]Fail to close the analyze file: %s.", json_file_name_.c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
is_json_file_create_ = true; | is_json_file_create_ = true; | ||||
@@ -222,9 +211,7 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ | |||||
std::lock_guard<std::mutex> lg(file_mutex_); | std::lock_guard<std::mutex> lg(file_mutex_); | ||||
json_file_.open(json_file_name_, std::ios::app); | json_file_.open(json_file_name_, std::ios::app); | ||||
if (!json_file_.is_open()) { | if (!json_file_.is_open()) { | ||||
GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", | |||||
json_file_name_.c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Analyze file %s dose not exist", json_file_name_.c_str()); | |||||
GELOGE(FAILED, "[Check][AnalyzeFile]analyze file does not exist[%s]", json_file_name_.c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -234,13 +221,10 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_ | |||||
try { | try { | ||||
json_file_ << jsn.dump(kJsonDumpLevel) << std::endl; | json_file_ << jsn.dump(kJsonDumpLevel) << std::endl; | ||||
} catch (nlohmann::detail::type_error &e) { | } catch (nlohmann::detail::type_error &e) { | ||||
GELOGE(FAILED, | |||||
"[Json.dump][GraphInfo]Dump analyze file [%s] failed because [%s]," | |||||
"session_id:%lu, graph_id:%lu", | |||||
GELOGE(FAILED, | |||||
"[Json.dump][GraphInfo]json.dump to analyze file [%s] failed because [%s]," | |||||
"session_id:%lu, graph_id:%lu", | |||||
json_file_name_.c_str(), e.what(), session_id, graph_id); | json_file_name_.c_str(), e.what(), session_id, graph_id); | ||||
REPORT_INNER_ERROR("E19999", "Dump analyze file %s failed because %s, " | |||||
"session_id %lu, graph_id %lu", | |||||
json_file_name_.c_str(), e.what(), session_id, graph_id); | |||||
ret_failed = true; | ret_failed = true; | ||||
} | } | ||||
json_file_.close(); | json_file_.close(); | ||||
@@ -260,11 +244,9 @@ ge::Status Analyzer::DoAnalyze(DataInfo &data_info) { | |||||
GE_CHECK_NOTNULL(graph_info); | GE_CHECK_NOTNULL(graph_info); | ||||
auto status = SaveOpInfo(desc, data_info, graph_info); | auto status = SaveOpInfo(desc, data_info, graph_info); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, | |||||
GELOGE(status, | |||||
"[Check][SaveOpInfo]save op info: desc_name [%s] desc_type [%s] failed!", | "[Check][SaveOpInfo]save op info: desc_name [%s] desc_type [%s] failed!", | ||||
desc->GetName().c_str(), desc->GetType().c_str()); | desc->GetName().c_str(), desc->GetType().c_str()); | ||||
REPORT_CALL_ERROR("E19999", "Save op info: desc_name %s, desc_type %s failed", | |||||
desc->GetName().c_str(), desc->GetType().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// create json file | // create json file | ||||
@@ -73,8 +73,7 @@ Status CheckOptionsValid(const std::map<string, string> &options) { | |||||
"the job_id [%s] string length: %zu > max string length: %d", | "the job_id [%s] string length: %zu > max string length: %d", | ||||
job_id_iter->second.c_str(), job_id_iter->second.length(), kMaxStrLen); | job_id_iter->second.c_str(), job_id_iter->second.length(), kMaxStrLen); | ||||
REPORT_INPUT_ERROR("E10051", std::vector<std::string>({"id","length"}), | REPORT_INPUT_ERROR("E10051", std::vector<std::string>({"id","length"}), | ||||
std::vector<std::string>({job_id_iter->second, | |||||
std::to_string(kMaxStrLen)})); | |||||
std::vector<std::string>({job_id_iter->second, std::to_string(kMaxStrLen)})); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||
@@ -91,7 +90,6 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(GE_CLI_INIT_FAILED, | GELOGE(GE_CLI_INIT_FAILED, | ||||
"[Init][PathBase]Init failed when pass param path_base:%s", path_base.c_str()); | "[Init][PathBase]Init failed when pass param path_base:%s", path_base.c_str()); | ||||
REPORT_CALL_ERROR("E19999", "Init failed when pass param path_base:%s", path_base.c_str()); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -113,9 +111,7 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||||
if (!is_proto_init) { | if (!is_proto_init) { | ||||
GELOGE(GE_CLI_INIT_FAILED, | GELOGE(GE_CLI_INIT_FAILED, | ||||
"[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", | "[Init][OpsProtoPath]Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid.", | ||||
opsproto_path.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Loading OpsProto lib plugin failed, OpsProtoPath:%s invalid", | |||||
opsproto_path.c_str()); | |||||
opsproto_path.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -323,7 +319,6 @@ Session::Session(const std::map<AscendString, AscendString> &options) { | |||||
sessionId_ = session_id; | sessionId_ = session_id; | ||||
} else { | } else { | ||||
GELOGE(ret, "[Construct][Session]Failed, error code:%u.", ret); | GELOGE(ret, "[Construct][Session]Failed, error code:%u.", ret); | ||||
REPORT_CALL_ERROR("E19999", "Construct session failed, error code:%u.", ret); | |||||
return; | return; | ||||
} | } | ||||
GELOGT(TRACE_STOP, "Session Constructor finished"); | GELOGT(TRACE_STOP, "Session Constructor finished"); | ||||
@@ -355,15 +350,12 @@ Session::~Session() { | |||||
ret = instance_ptr->SessionManagerObj().DestroySession(session_id); | ret = instance_ptr->SessionManagerObj().DestroySession(session_id); | ||||
} catch (google::protobuf::FatalException &e) { | } catch (google::protobuf::FatalException &e) { | ||||
GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed " | |||||
"because get fatalException."); | |||||
REPORT_CALL_ERROR("E19999", "Destruct session failed, get fatal exception"); | |||||
GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed because get fatalException."); | |||||
} | } | ||||
// check return status, return, update session id if success | // check return status, return, update session id if success | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Destruct][Session]Failed, error code:%u.", ret); | GELOGE(ret, "[Destruct][Session]Failed, error code:%u.", ret); | ||||
REPORT_CALL_ERROR("E19999", "Destruct session failed, error code:%u.", ret); | |||||
} | } | ||||
GELOGT(TRACE_STOP, "Session Destructor finished"); | GELOGT(TRACE_STOP, "Session Destructor finished"); | ||||
@@ -487,11 +479,9 @@ Status Session::RemoveGraph(uint32_t graph_id) { | |||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (!instance_ptr || !instance_ptr->InitFlag()) { | if (!instance_ptr || !instance_ptr->InitFlag()) { | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, | GELOGE(GE_CLI_GE_NOT_INITIALIZED, | ||||
"[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag "); | |||||
REPORT_INNER_ERROR("E19999", | REPORT_INNER_ERROR("E19999", | ||||
"RemoveGraph Failed, GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"RemoveGraph Failed, GELib instance is nullptr or is not InitFlag."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -501,9 +491,7 @@ Status Session::RemoveGraph(uint32_t graph_id) { | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, | GELOGE(ret, | ||||
"[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | "[Remove][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | ||||
ret, sessionId_, graph_id); | |||||
REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " | |||||
"session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); | |||||
ret, sessionId_, graph_id); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGT(TRACE_STOP, "Session RemoveGraph finished"); | GELOGT(TRACE_STOP, "Session RemoveGraph finished"); | ||||
@@ -569,11 +557,9 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector<Tensor> &inputs, s | |||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, | GELOGE(GE_CLI_GE_NOT_INITIALIZED, | ||||
"[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag."); | |||||
REPORT_INNER_ERROR("E19999", | REPORT_INNER_ERROR("E19999", | ||||
"RunGraph Failed, GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"RunGraph Failed, GELib instance is nullptr or is not InitFlag."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGT(TRACE_RUNNING, "Running Graph"); | GELOGT(TRACE_RUNNING, "Running Graph"); | ||||
@@ -582,9 +568,7 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector<Tensor> &inputs, s | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, | GELOGE(ret, | ||||
"[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | "[Run][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | ||||
ret, sessionId_, graph_id); | |||||
REPORT_CALL_ERROR("E19999", "Remove graph failed, error code:%u, " | |||||
"session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); | |||||
ret, sessionId_, graph_id); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -619,12 +603,10 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> | |||||
ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | ||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||||
"[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||||
"[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag."); | |||||
REPORT_INNER_ERROR("E19999", | REPORT_INNER_ERROR("E19999", | ||||
"Build graph failed, the GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"Build graph failed, the GELib instance is nullptr or is not InitFlag."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGT(TRACE_RUNNING, "Building Graph"); | GELOGT(TRACE_RUNNING, "Building Graph"); | ||||
@@ -632,9 +614,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, | GELOGE(ret, | ||||
"[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | "[Build][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | ||||
ret, sessionId_, graph_id); | |||||
REPORT_CALL_ERROR("E19999", "Build graph failed , error code:%u, " | |||||
"session_id:%lu, graph_id:%u", ret, sessionId_, graph_id); | |||||
ret, sessionId_, graph_id); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -648,11 +628,9 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector<InputTensorIn | |||||
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | ||||
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | ||||
GELOGE(GE_CLI_GE_NOT_INITIALIZED, | GELOGE(GE_CLI_GE_NOT_INITIALIZED, | ||||
"[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag."); | |||||
REPORT_INNER_ERROR("E19999", | REPORT_INNER_ERROR("E19999", | ||||
"RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag, " | |||||
"session_id %lu, graph_id %u", sessionId_, graph_id); | |||||
"RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); | GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); | ||||
@@ -663,8 +641,6 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector<InputTensorIn | |||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Run][Graph]RunGraphAsync Failed, error code:%u, session_id:%lu, graph_id:%u.", | GELOGE(ret, "[Run][Graph]RunGraphAsync Failed, error code:%u, session_id:%lu, graph_id:%u.", | ||||
ret, sessionId_, graph_id); | ret, sessionId_, graph_id); | ||||
REPORT_CALL_ERROR("E19999", "RunGraphAsync Failed, error code:%u, session_id:%lu, " | |||||
"graph_id:%u", ret, sessionId_, graph_id); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -716,8 +692,6 @@ Status Session::GetVariables(const std::vector<AscendString> &var_names, std::ve | |||||
Status ret = ge::GELib::GetInstance()->SessionManagerObj().GetVariables(sessionId_, str_var_names, var_values); | Status ret = ge::GELib::GetInstance()->SessionManagerObj().GetVariables(sessionId_, str_var_names, var_values); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Get][Variables]Failed, error code:%u, session_id:%lu.", ret, sessionId_); | GELOGE(ret, "[Get][Variables]Failed, error code:%u, session_id:%lu.", ret, sessionId_); | ||||
REPORT_CALL_ERROR("E19999", "Get variables failed, error code:%u, session_id:%lu.", | |||||
ret, sessionId_); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -33,10 +33,8 @@ const int kFileOpSuccess = 0; | |||||
namespace ge { | namespace ge { | ||||
Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { | Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { | ||||
if (CheckPath(file_path) != SUCCESS) { | if (CheckPath(file_path) != SUCCESS) { | ||||
GELOGE(FAILED, "[Check][FilePath]Check output file failed, file_path:%s.", | |||||
file_path.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Check output file failed, file_path:%s.", | |||||
file_path.c_str()); | |||||
GELOGE(FAILED, "[Check][FilePath]Check output file failed, file_path:%s.", file_path.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Check output file failed, file_path:%s.", file_path.c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -49,8 +47,7 @@ Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { | |||||
if (fd == EN_INVALID_PARAM || fd == EN_ERROR) { | if (fd == EN_INVALID_PARAM || fd == EN_ERROR) { | ||||
// -1: Failed to open file; - 2: Illegal parameter | // -1: Failed to open file; - 2: Illegal parameter | ||||
GELOGE(FAILED, "[Open][File]Failed. mmpa_errno = %d, %s", fd, strerror(errno)); | GELOGE(FAILED, "[Open][File]Failed. mmpa_errno = %d, %s", fd, strerror(errno)); | ||||
REPORT_INNER_ERROR("E19999", "Open file failed, mmpa_errno = %d, error:%s.", | |||||
fd, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Open file failed, mmpa_errno = %d, error:%s.", fd, strerror(errno)); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -67,10 +64,9 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { | |||||
while (size > size_1g) { | while (size > size_1g) { | ||||
write_count = mmWrite(fd, reinterpret_cast<void *>(seek), size_1g); | write_count = mmWrite(fd, reinterpret_cast<void *>(seek), size_1g); | ||||
if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { | if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { | ||||
GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", | |||||
write_count, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", | |||||
write_count, strerror(errno)); | |||||
GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", | |||||
write_count, strerror(errno)); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
size -= size_1g; | size -= size_1g; | ||||
@@ -83,8 +79,7 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { | |||||
// -1: Failed to write to file; - 2: Illegal parameter | // -1: Failed to write to file; - 2: Illegal parameter | ||||
if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { | if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { | ||||
GELOGE(FAILED, "[Write][Data]Failed. mmpa_errorno = %ld, error:%s", | |||||
write_count, strerror(errno)); | |||||
GELOGE(FAILED, "[Write][Data]Failed. mmpa_errorno = %ld, error:%s", write_count, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", | REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", | ||||
write_count, strerror(errno)); | write_count, strerror(errno)); | ||||
return FAILED; | return FAILED; | ||||
@@ -96,10 +91,8 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { | |||||
Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFileHeader &file_header, const void *data, | Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFileHeader &file_header, const void *data, | ||||
int len) { | int len) { | ||||
if (data == nullptr || len <= 0) { | if (data == nullptr || len <= 0) { | ||||
GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the " | |||||
"length[%d] is less than 1.", len); | |||||
REPORT_INNER_ERROR("E19999", "Save file failed, model_data is null or the " | |||||
"length:%d is less than 1.", len); | |||||
GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the length[%d] is less than 1.", len); | |||||
REPORT_INNER_ERROR("E19999", "Save file failed, model_data is null or the length:%d is less than 1.", len); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -119,8 +112,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi | |||||
// Close file | // Close file | ||||
if (mmClose(fd) != 0) { // mmClose 0: success | if (mmClose(fd) != 0) { // mmClose 0: success | ||||
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | ||||
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", | |||||
ret, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); | |||||
ret = FAILED; | ret = FAILED; | ||||
} | } | ||||
return ret; | return ret; | ||||
@@ -158,8 +150,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi | |||||
// Close file | // Close file | ||||
if (mmClose(fd) != EN_OK) { | if (mmClose(fd) != EN_OK) { | ||||
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | ||||
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", | |||||
ret, strerror(errno)); | |||||
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); | |||||
ret = FAILED; | ret = FAILED; | ||||
} | } | ||||
return ret; | return ret; | ||||
@@ -244,8 +235,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con | |||||
if (file_path.size() >= MMPA_MAX_PATH) { | if (file_path.size() >= MMPA_MAX_PATH) { | ||||
GELOGE(FAILED, "[Check][FilePath]Failed, file path's length:%zu > mmpa_max_path:%d", | GELOGE(FAILED, "[Check][FilePath]Failed, file path's length:%zu > mmpa_max_path:%d", | ||||
file_path.size(), MMPA_MAX_PATH); | file_path.size(), MMPA_MAX_PATH); | ||||
REPORT_INNER_ERROR("E19999", "Check file path failed, file path's length:%zu > " | |||||
"mmpa_max_path:%d", file_path.size(), MMPA_MAX_PATH); | |||||
REPORT_INNER_ERROR("E19999", "Check file path failed, file path's length:%zu > mmpa_max_path:%d", | |||||
file_path.size(), MMPA_MAX_PATH); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -275,10 +266,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::CheckPath(con | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status | ||||
FileSaver::SaveToFile(const string &file_path, const ge::ModelData &model, const ModelFileHeader *model_file_header) { | FileSaver::SaveToFile(const string &file_path, const ge::ModelData &model, const ModelFileHeader *model_file_header) { | ||||
if (file_path.empty() || model.model_data == nullptr || model.model_len == 0) { | if (file_path.empty() || model.model_data == nullptr || model.model_len == 0) { | ||||
GELOGE(FAILED, "[Save][File]Incorrect input param, " | |||||
"file_path is empty or model_data is nullptr or model_len is 0"); | |||||
REPORT_INNER_ERROR("E19999", "Save file failed, at least one of the " | |||||
"input parameters(file_path, model_data, model_len) is incorrect"); | |||||
GELOGE(FAILED, "[Save][File]Incorrect input param, file_path is empty or model_data is nullptr or model_len is 0"); | |||||
REPORT_INNER_ERROR("E19999", "Save file failed, at least one of the input parameters(file_path, model_data, model_len) is incorrect"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -371,8 +360,7 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi | |||||
// Close file | // Close file | ||||
if (mmClose(fd) != 0) { // mmClose 0: success | if (mmClose(fd) != 0) { // mmClose 0: success | ||||
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | ||||
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", | |||||
ret, strerror(errno)); | |||||
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); | |||||
ret = FAILED; | ret = FAILED; | ||||
} | } | ||||
return ret; | return ret; | ||||
@@ -381,10 +369,8 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const void *data, | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(const string &file_path, const void *data, | ||||
int len) { | int len) { | ||||
if (data == nullptr || len <= 0) { | if (data == nullptr || len <= 0) { | ||||
GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the " | |||||
"length[%d] is less than 1.", len); | |||||
REPORT_INNER_ERROR("E19999", "Save file failed, the model_data is null or " | |||||
"its length:%d is less than 1.", len); | |||||
GELOGE(FAILED, "[Check][Param]Failed, model_data is null or the length[%d] is less than 1.", len); | |||||
REPORT_INNER_ERROR("E19999", "Save file failed, the model_data is null or its length:%d is less than 1.", len); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -400,8 +386,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status FileSaver::SaveToFile(co | |||||
// Close file | // Close file | ||||
if (mmClose(fd) != 0) { // mmClose 0: success | if (mmClose(fd) != 0) { // mmClose 0: success | ||||
GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | GELOGE(FAILED, "[Close][File]Failed, error_code:%u errmsg:%s", ret, strerror(errno)); | ||||
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", | |||||
ret, strerror(errno)); | |||||
REPORT_CALL_ERROR("E19999", "Close file failed, error_code:%u errmsg:%s", ret, strerror(errno)); | |||||
ret = FAILED; | ret = FAILED; | ||||
} | } | ||||
return ret; | return ret; | ||||
@@ -60,16 +60,14 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::DumpToFile | |||||
// mmWrite return -1:Failed to write data to file;return -2:Invalid parameter | // mmWrite return -1:Failed to write data to file;return -2:Invalid parameter | ||||
if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | ||||
GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); | GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); | ||||
REPORT_INNER_ERROR("E19999", "Write data failed, errno = %d, error:%s.", | |||||
mmpa_ret, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Write data failed, errno = %d, error:%s.", mmpa_ret, strerror(errno)); | |||||
ret = FAILED; | ret = FAILED; | ||||
} | } | ||||
// Close the file | // Close the file | ||||
if (mmClose(fd) != EN_OK) { // mmClose return 0: success | if (mmClose(fd) != EN_OK) { // mmClose return 0: success | ||||
GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s.", ret, filename); | GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s.", ret, filename); | ||||
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s.", | |||||
ret, filename); | |||||
REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s.", ret, filename); | |||||
ret = FAILED; | ret = FAILED; | ||||
} | } | ||||
@@ -112,8 +110,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void | |||||
// mmWrite return -1:failed to write data to file;return -2:invalid parameter | // mmWrite return -1:failed to write data to file;return -2:invalid parameter | ||||
if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | ||||
GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); | GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); | ||||
REPORT_INNER_ERROR("E19999", "Write data to file failed, errno = %d, error:%s.", | |||||
mmpa_ret, strerror(errno)); | |||||
REPORT_INNER_ERROR("E19999", "Write data to file failed, errno = %d, error:%s.", mmpa_ret, strerror(errno)); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -56,10 +56,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf | |||||
dump_properties.SetDumpOpSwitch(dump_op_switch); | dump_properties.SetDumpOpSwitch(dump_op_switch); | ||||
if (dump_op_switch == kDumpoff && dump_config.dump_list.empty()) { | if (dump_op_switch == kDumpoff && dump_config.dump_list.empty()) { | ||||
dump_properties_map_.emplace(kInferSessionId, dump_properties); | dump_properties_map_.emplace(kInferSessionId, dump_properties); | ||||
GELOGE(PARAM_INVALID, "[Check][DumpList]Invalid, dump_op_switch is %s", | |||||
dump_op_switch.c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Dump list check invalid, dump_op_switch is %s", | |||||
dump_op_switch.c_str()); | |||||
GELOGE(PARAM_INVALID, "Dump list is invalid,dump_op_switch is %s", dump_op_switch.c_str()); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -85,8 +82,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpManager::SetDumpConf | |||||
dump_path = dump_config.dump_path; | dump_path = dump_config.dump_path; | ||||
if (dump_path.empty()) { | if (dump_path.empty()) { | ||||
GELOGE(PARAM_INVALID, "[Check][DumpPath]It is empty"); | |||||
REPORT_INNER_ERROR("E19999", "Dump path check is empty"); | |||||
GELOGE(PARAM_INVALID, "Dump path is empty"); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
@@ -102,10 +102,7 @@ Status DumpOp::DumpOutput(toolkit::aicpu::dump::Task &task) { | |||||
} | } | ||||
int64_t output_size = 0; | int64_t output_size = 0; | ||||
if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { | if (TensorUtils::GetTensorSizeInBytes(output_descs.at(i), output_size) != SUCCESS) { | ||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, output %zu, node %s(%s),", | |||||
i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Get output %zu tensor size of node %s(%s) failed", | |||||
i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); | |||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Get output size filed"); | |||||
return ACL_ERROR_GE_INTERNAL_ERROR; | return ACL_ERROR_GE_INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("Get output size in lanch dump op is %ld", output_size); | GELOGD("Get output size in lanch dump op is %ld", output_size); | ||||
@@ -132,10 +129,7 @@ Status DumpOp::DumpInput(toolkit::aicpu::dump::Task &task) { | |||||
} | } | ||||
int64_t input_size = 0; | int64_t input_size = 0; | ||||
if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { | if (TensorUtils::GetTensorSizeInBytes(input_descs.at(i), input_size) != SUCCESS) { | ||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Get][TensorSize]Failed, input %zu, node %s(%s)", | |||||
i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Get input %zu tensor size of node %s(%s) failed", | |||||
i, op_desc_->GetName().c_str(), op_desc_->GetType().c_str()); | |||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Get output size filed"); | |||||
return ACL_ERROR_GE_INTERNAL_ERROR; | return ACL_ERROR_GE_INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("Get input size in lanch dump op is %ld", input_size); | GELOGD("Get input size in lanch dump op is %ld", input_size); | ||||
@@ -160,36 +154,30 @@ Status DumpOp::ExecutorDumpOp(toolkit::aicpu::dump::OpMappingInfo &op_mapping_in | |||||
size_t proto_size = op_mapping_info.ByteSizeLong(); | size_t proto_size = op_mapping_info.ByteSizeLong(); | ||||
bool ret = op_mapping_info.SerializeToString(&proto_msg); | bool ret = op_mapping_info.SerializeToString(&proto_msg); | ||||
if (!ret || proto_size == 0) { | if (!ret || proto_size == 0) { | ||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Serialize][Protobuf]Failed, proto_size is %zu", | |||||
proto_size); | |||||
REPORT_CALL_ERROR("E19999", "[Serialize][Protobuf]Failed, proto_size is %zu", proto_size); | |||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Protobuf serialize failed, proto_size is %zu", proto_size); | |||||
return ACL_ERROR_GE_INTERNAL_ERROR; | return ACL_ERROR_GE_INTERNAL_ERROR; | ||||
} | } | ||||
rtError_t rt_ret = rtMalloc(&proto_dev_mem_, proto_size, RT_MEMORY_HBM); | rtError_t rt_ret = rtMalloc(&proto_dev_mem_, proto_size, RT_MEMORY_HBM); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(rt_ret, "[Call][rtMalloc]Failed, ret: 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret: 0x%X", rt_ret); | |||||
GELOGE(rt_ret, "Call rtMalloc failed, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
rt_ret = rtMemcpy(proto_dev_mem_, proto_size, proto_msg.c_str(), proto_size, RT_MEMCPY_HOST_TO_DEVICE); | rt_ret = rtMemcpy(proto_dev_mem_, proto_size, proto_msg.c_str(), proto_size, RT_MEMCPY_HOST_TO_DEVICE); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret: 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret: 0x%X", rt_ret); | |||||
GELOGE(rt_ret, "Call rtMemcpy failed, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
rt_ret = rtMalloc(&proto_size_dev_mem_, sizeof(size_t), RT_MEMORY_HBM); | rt_ret = rtMalloc(&proto_size_dev_mem_, sizeof(size_t), RT_MEMORY_HBM); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(rt_ret, "[Call][rtMalloc]Failed, ret: 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret: 0x%X", rt_ret); | |||||
GELOGE(rt_ret, "Call rtMalloc failed, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
rt_ret = rtMemcpy(proto_size_dev_mem_, sizeof(size_t), &proto_size, sizeof(size_t), RT_MEMCPY_HOST_TO_DEVICE); | rt_ret = rtMemcpy(proto_size_dev_mem_, sizeof(size_t), &proto_size, sizeof(size_t), RT_MEMCPY_HOST_TO_DEVICE); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(rt_ret, "[Call][rtMemcpy]Failed, ret 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy failed, ret 0x%X", rt_ret); | |||||
GELOGE(rt_ret, "Call rtMemcpy failed, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
@@ -208,8 +196,7 @@ Status DumpOp::ExecutorDumpOp(toolkit::aicpu::dump::OpMappingInfo &op_mapping_in | |||||
nullptr, // no need smDesc | nullptr, // no need smDesc | ||||
stream_); | stream_); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(rt_ret, "[Call][rtCpuKernelLaunch]Failed, ret 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtCpuKernelLaunch failed, ret 0x%X", rt_ret); | |||||
GELOGE(rt_ret, "Call rtCpuKernelLaunch failed,rt_ret:0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
GELOGI("Kernel launch dump op success"); | GELOGI("Kernel launch dump op success"); | ||||
@@ -247,13 +234,12 @@ Status DumpOp::LaunchDumpOp() { | |||||
int32_t device_id = 0; | int32_t device_id = 0; | ||||
rtError_t rt_ret = rtGetDevice(&device_id); | rtError_t rt_ret = rtGetDevice(&device_id); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret); | |||||
GELOGE(rt_ret, "Call rtGetDevice failed, ret = 0x%X, device_id = %d.", rt_ret, device_id); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
if (device_id < 0) { | if (device_id < 0) { | ||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "[Check][DeviceId]Failed, device_id %d", device_id); | |||||
REPORT_INNER_ERROR("E19999","Check device_id %d failed", device_id); | |||||
GELOGE(ACL_ERROR_GE_INTERNAL_ERROR, "Check device_id failed, device_id = %d, which should be not less than 0.", | |||||
device_id); | |||||
return ACL_ERROR_GE_INTERNAL_ERROR; | return ACL_ERROR_GE_INTERNAL_ERROR; | ||||
} | } | ||||
toolkit::aicpu::dump::OpMappingInfo op_mapping_info; | toolkit::aicpu::dump::OpMappingInfo op_mapping_info; | ||||
@@ -283,10 +269,7 @@ Status DumpOp::LaunchDumpOp() { | |||||
if (dump_properties_.GetDumpMode() == kDumpOutput) { | if (dump_properties_.GetDumpMode() == kDumpOutput) { | ||||
auto ret = DumpOutput(task); | auto ret = DumpOutput(task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Dump][Output]Failed, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "Dump Output failed, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
GELOGE(ret, "Dump output failed"); | |||||
return ret; | return ret; | ||||
} | } | ||||
op_mapping_info.mutable_task()->Add(std::move(task)); | op_mapping_info.mutable_task()->Add(std::move(task)); | ||||
@@ -294,10 +277,7 @@ Status DumpOp::LaunchDumpOp() { | |||||
if (dump_properties_.GetDumpMode() == kDumpInput) { | if (dump_properties_.GetDumpMode() == kDumpInput) { | ||||
auto ret = DumpInput(task); | auto ret = DumpInput(task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Dump][Input]Failed, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "Dump Input failed, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
GELOGE(ret, "Dump input failed"); | |||||
return ret; | return ret; | ||||
} | } | ||||
op_mapping_info.mutable_task()->Add(std::move(task)); | op_mapping_info.mutable_task()->Add(std::move(task)); | ||||
@@ -305,26 +285,19 @@ Status DumpOp::LaunchDumpOp() { | |||||
if (dump_properties_.GetDumpMode() == kDumpAll || dump_properties_.IsOpDebugOpen()) { | if (dump_properties_.GetDumpMode() == kDumpAll || dump_properties_.IsOpDebugOpen()) { | ||||
auto ret = DumpOutput(task); | auto ret = DumpOutput(task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Dump][Output]Failed when in dumping all, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "Dump Output failed when in dumping all, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
GELOGE(ret, "Dump output failed when in dumping all"); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = DumpInput(task); | ret = DumpInput(task); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Dump][Input]Failed when in dumping all, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "Dump Input failed when in dumping all, node %s(%s), ret 0x%X", | |||||
op_desc_->GetName().c_str(), op_desc_->GetType().c_str(), ret); | |||||
GELOGE(ret, "Dump input failed when in dumping all"); | |||||
return ret; | return ret; | ||||
} | } | ||||
op_mapping_info.mutable_task()->Add(std::move(task)); | op_mapping_info.mutable_task()->Add(std::move(task)); | ||||
} | } | ||||
auto ret = ExecutorDumpOp(op_mapping_info); | auto ret = ExecutorDumpOp(op_mapping_info); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Dump][Op]Failed, ret 0x%X", ret); | |||||
REPORT_CALL_ERROR("E19999", "Executor dump op failed, ret 0x%X", ret); | |||||
GELOGE(ret, "Executor dump op failed"); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -27,9 +27,7 @@ Status OpdebugRegister::RegisterDebugForModel(rtModel_t model_handle, uint32_t o | |||||
GELOGD("Start to register debug for model in overflow"); | GELOGD("Start to register debug for model in overflow"); | ||||
auto ret = MallocMemForOpdebug(); | auto ret = MallocMemForOpdebug(); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for model overflow, ret:0x%X", ret); | |||||
REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug " | |||||
"for model in overflow, ret 0x%X", ret); | |||||
GELOGE(ret, "Malloc memory for opdebug in model overflow failed ,ret:0x%X", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
uint32_t debug_stream_id = 0; | uint32_t debug_stream_id = 0; | ||||
@@ -76,9 +74,7 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de | |||||
GELOGD("Start to register debug for stream in stream overflow"); | GELOGD("Start to register debug for stream in stream overflow"); | ||||
auto ret = MallocMemForOpdebug(); | auto ret = MallocMemForOpdebug(); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for stream in overflow, ret:0x%X", ret); | |||||
REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug " | |||||
"for stream in overflow, ret:0x%X", ret); | |||||
GELOGE(ret, "Malloc memory for opdebug in stream overflow ,ret:0x%X", ret); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -86,8 +82,7 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de | |||||
uint32_t debug_task_id = 0; | uint32_t debug_task_id = 0; | ||||
auto rt_ret = rtDebugRegisterForStream(stream, op_debug_mode, op_debug_addr_, &debug_stream_id, &debug_task_id); | auto rt_ret = rtDebugRegisterForStream(stream, op_debug_mode, op_debug_addr_, &debug_stream_id, &debug_task_id); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(RT_FAILED, "[Call][rtDebugRegisterForStream]Failed, ret 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtDebugRegisterForStream failed, ret 0x%X", rt_ret); | |||||
GELOGE(RT_FAILED, "rtDebugRegisterForStream error, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
GELOGD("debug_task_id:%u, debug_stream_id:%u in stream overflow.", debug_task_id, debug_stream_id); | GELOGD("debug_task_id:%u, debug_stream_id:%u in stream overflow.", debug_task_id, debug_stream_id); | ||||
@@ -126,8 +121,7 @@ void OpdebugRegister::UnregisterDebugForStream(rtStream_t stream) { | |||||
Status OpdebugRegister::MallocMemForOpdebug() { | Status OpdebugRegister::MallocMemForOpdebug() { | ||||
rtError_t rt_ret = rtMalloc(&op_debug_addr_, kOpDebugMemorySize, RT_MEMORY_DDR); | rtError_t rt_ret = rtMalloc(&op_debug_addr_, kOpDebugMemorySize, RT_MEMORY_DDR); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(RT_FAILED, "[Call][rtMalloc]Failed, ret 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret 0x%X", rt_ret); | |||||
GELOGE(RT_FAILED, "rtMalloc error, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
@@ -135,14 +129,12 @@ Status OpdebugRegister::MallocMemForOpdebug() { | |||||
// For data dump, aicpu needs the pointer to pointer that save the real debug address. | // For data dump, aicpu needs the pointer to pointer that save the real debug address. | ||||
rt_ret = rtMalloc(&p2p_debug_addr_, kDebugP2pSize, RT_MEMORY_HBM); | rt_ret = rtMalloc(&p2p_debug_addr_, kDebugP2pSize, RT_MEMORY_HBM); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(RT_FAILED, "[Call][rtMalloc]Failed, ret 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMalloc failed, ret 0x%X", rt_ret); | |||||
GELOGE(RT_FAILED, "rtMalloc error, ret: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
rt_ret = rtMemcpy(p2p_debug_addr_, sizeof(uint64_t), &debug_addrs_tmp, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE); | rt_ret = rtMemcpy(p2p_debug_addr_, sizeof(uint64_t), &debug_addrs_tmp, sizeof(uint64_t), RT_MEMCPY_HOST_TO_DEVICE); | ||||
if (rt_ret != RT_ERROR_NONE) { | if (rt_ret != RT_ERROR_NONE) { | ||||
GELOGE(RT_FAILED, "[Call][rtMemcpy]To p2p_addr error 0x%X", rt_ret); | |||||
REPORT_CALL_ERROR("E19999", "Call rtMemcpy to p2p_addr error 0x%X", rt_ret); | |||||
GELOGE(RT_FAILED, "rtMemcpy to p2p_addr error: 0x%X", rt_ret); | |||||
return RT_ERROR_TO_GE_STATUS(rt_ret); | return RT_ERROR_TO_GE_STATUS(rt_ret); | ||||
} | } | ||||
@@ -187,7 +187,7 @@ Status GetDstDataAfterTrans(const TransArgs &args, TransResult &result, const in | |||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -33,9 +33,7 @@ void OpTilingManager::ClearHandles() noexcept { | |||||
if (mmDlclose(handle.second) != 0) { | if (mmDlclose(handle.second) != 0) { | ||||
const char *error = mmDlerror(); | const char *error = mmDlerror(); | ||||
GE_IF_BOOL_EXEC(error == nullptr, error = ""); | GE_IF_BOOL_EXEC(error == nullptr, error = ""); | ||||
GELOGE(FAILED, "[Close][Handle]Failed, handle of %s: %s", handle.first.c_str(), error); | |||||
REPORT_CALL_ERROR("E19999", "Failed to close handle of %s: %s", | |||||
handle.first.c_str(), error); | |||||
GELOGE(FAILED, "Failed to close handle of %s: %s", handle.first.c_str(), error); | |||||
} | } | ||||
} | } | ||||
handles_.clear(); | handles_.clear(); | ||||
@@ -52,8 +50,7 @@ std::string OpTilingManager::GetPath() { | |||||
if (mmRealPath(opp_path_env, resolved_path, MMPA_MAX_PATH) != EN_OK) { | if (mmRealPath(opp_path_env, resolved_path, MMPA_MAX_PATH) != EN_OK) { | ||||
ErrorManager::GetInstance().ATCReportErrMessage( | ErrorManager::GetInstance().ATCReportErrMessage( | ||||
"E19024", {"env", "value", "situation"}, {"ASCEND_OPP_PATH", opp_path_env, "loading the tiling lib"}); | "E19024", {"env", "value", "situation"}, {"ASCEND_OPP_PATH", opp_path_env, "loading the tiling lib"}); | ||||
GELOGE(PARAM_INVALID, "[Load][TilingLib]Failed, as env 'ASCEND_OPP_PATH'[%s] " | |||||
"is invalid path.", opp_path_env); | |||||
GELOGE(PARAM_INVALID, "Failed load tiling lib as env 'ASCEND_OPP_PATH'[%s] is invalid path.", opp_path_env); | |||||
return std::string(); | return std::string(); | ||||
} | } | ||||
opp_path = resolved_path; | opp_path = resolved_path; | ||||
@@ -127,7 +127,7 @@ Status PluginManager::LoadSo(const string &path, const vector<string> &func_chec | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | ||||
{"mmDlopen", "shared library path is " + FmtToStr(file_path_dlopen) + ". Errormessage" + FmtToStr(error)}); | {"mmDlopen", "shared library path is " + FmtToStr(file_path_dlopen) + ". Errormessage" + FmtToStr(error)}); | ||||
GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, | GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, | ||||
"[DLOpen][SharedLibraryPath]Failed, path[%s]. Errormessage[%s]!", | |||||
"Failed to dlopen the shared library path[%s]. Errormessage[%s]!", | |||||
file_path_dlopen.c_str(), error); | file_path_dlopen.c_str(), error); | ||||
continue; | continue; | ||||
} | } | ||||
@@ -140,15 +140,14 @@ Status PluginManager::LoadSo(const string &path, const vector<string> &func_chec | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | ||||
{"mmDlsym", FmtToStr(func_name) + " is skipped since function" + | {"mmDlsym", FmtToStr(func_name) + " is skipped since function" + | ||||
FmtToStr(func_name) + " is not existed!"}); | FmtToStr(func_name) + " is not existed!"}); | ||||
GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, | |||||
"[Check][So]%s is skipped since function %s is not existed!", | |||||
GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, "%s is skipped since function %s is not existed!", | |||||
func_name.c_str(), func_name.c_str()); | func_name.c_str(), func_name.c_str()); | ||||
is_valid = false; | is_valid = false; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (!is_valid) { | if (!is_valid) { | ||||
GE_LOGE_IF(mmDlclose(handle), "[DLClose][Handle]Failed."); | |||||
GE_LOGE_IF(mmDlclose(handle), "Failed to dlclose."); | |||||
continue; | continue; | ||||
} | } | ||||
@@ -37,9 +37,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelHelper::~ModelHelper() { ( | |||||
Status ModelHelper::SaveModelPartition(std::shared_ptr<OmFileSaveHelper> &om_file_save_helper, ModelPartitionType type, | Status ModelHelper::SaveModelPartition(std::shared_ptr<OmFileSaveHelper> &om_file_save_helper, ModelPartitionType type, | ||||
const uint8_t *data, size_t size, size_t model_index) { | const uint8_t *data, size_t size, size_t model_index) { | ||||
if (size < 1 || size > UINT32_MAX) { | if (size < 1 || size > UINT32_MAX) { | ||||
GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu invalid", size); | |||||
REPORT_INNER_ERROR("E19999", "Add model partition failed, partition size %zu " | |||||
"invalid", size); | |||||
GELOGE(PARAM_INVALID, "Add model partition failed, partition size %zu invalid", size); | |||||
if (size > UINT32_MAX) { | if (size > UINT32_MAX) { | ||||
string item = "item"; | string item = "item"; | ||||
if (type == MODEL_DEF) { | if (type == MODEL_DEF) { | ||||
@@ -59,8 +57,7 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr<OmFileSaveHelper> &om_fil | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
if (data == nullptr) { | if (data == nullptr) { | ||||
GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, data is null"); | |||||
REPORT_INNER_ERROR("E19999", "Add model partition failed, data is null"); | |||||
GELOGE(PARAM_INVALID, "Add model partition failed, data is null"); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
ModelPartition partition_model; | ModelPartition partition_model; | ||||
@@ -68,8 +65,7 @@ Status ModelHelper::SaveModelPartition(std::shared_ptr<OmFileSaveHelper> &om_fil | |||||
partition_model.size = static_cast<uint32_t>(size); | partition_model.size = static_cast<uint32_t>(size); | ||||
partition_model.type = type; | partition_model.type = type; | ||||
if (om_file_save_helper->AddPartition(partition_model, model_index) != SUCCESS) { | if (om_file_save_helper->AddPartition(partition_model, model_index) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, partition size %zu", size); | |||||
REPORT_CALL_ERROR("E19999", "Add model partition failed, partition size %zu", size); | |||||
GELOGE(PARAM_INVALID, "Add model partition failed, partition size %zu", size); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -110,8 +106,7 @@ Status ModelHelper::SaveModelDef(std::shared_ptr<OmFileSaveHelper> &om_file_save | |||||
const GeModelPtr &ge_model, ge::Buffer &model_buffer, size_t model_index) { | const GeModelPtr &ge_model, ge::Buffer &model_buffer, size_t model_index) { | ||||
ModelPtr model_tmp = ge::MakeShared<ge::Model>(ge_model->GetName(), ge_model->GetPlatformVersion()); | ModelPtr model_tmp = ge::MakeShared<ge::Model>(ge_model->GetName(), ge_model->GetPlatformVersion()); | ||||
if (model_tmp == nullptr) { | if (model_tmp == nullptr) { | ||||
GELOGE(FAILED, "[Creat][Model]Failed, Model %s Ptr", ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Create Model %s Ptr failed", ge_model->GetName().c_str()); | |||||
GELOGE(FAILED, "Create Model %s Ptr failed", ge_model->GetName().c_str()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
model_tmp->SetGraph(ge_model->GetGraph()); | model_tmp->SetGraph(ge_model->GetGraph()); | ||||
@@ -119,10 +114,7 @@ Status ModelHelper::SaveModelDef(std::shared_ptr<OmFileSaveHelper> &om_file_save | |||||
model_tmp->SetAttr(ge_model->MutableAttrMap()); | model_tmp->SetAttr(ge_model->MutableAttrMap()); | ||||
Status ret = SaveSizeToModelDef(ge_model); | Status ret = SaveSizeToModelDef(ge_model); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Save][SizeToModelDef]Failed, model %s, error_code %u", | |||||
ge_model->GetName().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, model %s, error_code %u", | |||||
ge_model->GetName().c_str(), ret); | |||||
GELOGE(ret, "SaveSizeToModelDef failed"); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -131,10 +123,7 @@ Status ModelHelper::SaveModelDef(std::shared_ptr<OmFileSaveHelper> &om_file_save | |||||
if (model_buffer.GetSize() > 0) { | if (model_buffer.GetSize() > 0) { | ||||
if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(), | if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(), | ||||
model_buffer.GetSize(), model_index) != SUCCESS) { | model_buffer.GetSize(), model_index) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model %s, model_def size %zu, model_index %zu", | |||||
ge_model->GetName().c_str(), model_buffer.GetSize(), model_index); | |||||
REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model %s, model_def %zu, " | |||||
"model_index %zu", ge_model->GetName().c_str(), model_buffer.GetSize(), model_index); | |||||
GELOGE(PARAM_INVALID, "Add model graph partition failed"); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
} | } | ||||
@@ -189,26 +178,17 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr<OmFileSaveHelper> &om_file_ | |||||
const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { | const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { | ||||
std::shared_ptr<ModelTaskDef> model_task_def = ge_model->GetModelTaskDefPtr(); | std::shared_ptr<ModelTaskDef> model_task_def = ge_model->GetModelTaskDefPtr(); | ||||
if (model_task_def == nullptr) { | if (model_task_def == nullptr) { | ||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr, " | |||||
"model %s", ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr, model %s", | |||||
ge_model->GetName().c_str()); | |||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Create model task def ptr failed"); | |||||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | return ACL_ERROR_GE_MEMORY_ALLOCATION; | ||||
} | } | ||||
size_t partition_task_size = model_task_def->ByteSizeLong(); | size_t partition_task_size = model_task_def->ByteSizeLong(); | ||||
GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, | GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, | ||||
GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu, model %s", | |||||
partition_task_size, ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid, model %s", | |||||
partition_task_size, ge_model->GetName().c_str()); | |||||
GELOGE(FAILED, "Model_def's byte size (%zu) is invalid!", partition_task_size); | |||||
return FAILED); | return FAILED); | ||||
task_buffer = ge::Buffer(partition_task_size); | task_buffer = ge::Buffer(partition_task_size); | ||||
if (task_buffer.GetSize() == 0) { | if (task_buffer.GetSize() == 0) { | ||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][ModelTaskDefBuffer]Failed, " | |||||
"model def size %zu, model %s", partition_task_size, ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu " | |||||
"model %s", partition_task_size, ge_model->GetName().c_str()); | |||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "Alloc model task def buffer failed"); | |||||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | return ACL_ERROR_GE_MEMORY_ALLOCATION; | ||||
} | } | ||||
(void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast<int>(partition_task_size)); | (void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast<int>(partition_task_size)); | ||||
@@ -218,12 +198,7 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr<OmFileSaveHelper> &om_file_ | |||||
if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), | if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), | ||||
partition_task_size, model_index) != SUCCESS) { | partition_task_size, model_index) != SUCCESS) { | ||||
GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, " | |||||
"model_index %zu, model %s", | |||||
partition_task_size, model_index, ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu " | |||||
"model_index %zu, model %s", | |||||
partition_task_size, model_index, ge_model->GetName().c_str()); | |||||
GELOGE(PARAM_INVALID, "Add model task def partition failed"); | |||||
return PARAM_INVALID; | return PARAM_INVALID; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -243,11 +218,7 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr<OmFileSaveHelper> &om_file_s | |||||
platform_version.size() + 1); | platform_version.size() + 1); | ||||
if (err != EOK) { | if (err != EOK) { | ||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, | GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, | ||||
"[Save][Model]Failed while allocating memory for platform_version %s, model %s, " | |||||
"errno %d", platform_version.c_str(), ge_model->GetName().c_str(), err); | |||||
REPORT_CALL_ERROR("E19999", "ModelHelper save model %s failed while " | |||||
"allocating memory for platform_version %s, errno %d", | |||||
ge_model->GetName().c_str(), platform_version.c_str(), err); | |||||
"ModelHelper SaveModel failed while allocating memory for platform_version."); | |||||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | return ACL_ERROR_GE_MEMORY_ALLOCATION; | ||||
} | } | ||||
string version = reinterpret_cast<char *>(model_header.platform_version); | string version = reinterpret_cast<char *>(model_header.platform_version); | ||||
@@ -257,11 +228,7 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr<OmFileSaveHelper> &om_file_s | |||||
name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; | name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; | ||||
err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size); | err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size); | ||||
if (err != EOK) { | if (err != EOK) { | ||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, | |||||
"[Save][Model]Failed while allocating memory for model %s, errno %d", | |||||
ge_model->GetName().c_str(), err); | |||||
REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while allocating memory " | |||||
"for model %s,errno %d", ge_model->GetName().c_str(), err); | |||||
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "ModelHelper SaveModel failed while allocating memory for name"); | |||||
return ACL_ERROR_GE_MEMORY_ALLOCATION; | return ACL_ERROR_GE_MEMORY_ALLOCATION; | ||||
} | } | ||||
string model_name = reinterpret_cast<char *>(model_header.name); | string model_name = reinterpret_cast<char *>(model_header.name); | ||||
@@ -273,43 +240,28 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr<OmFileSaveHelper>& om_f | |||||
const GeModelPtr &ge_model, ge::Buffer &model_buffer, | const GeModelPtr &ge_model, ge::Buffer &model_buffer, | ||||
ge::Buffer &task_buffer, size_t model_index) { | ge::Buffer &task_buffer, size_t model_index) { | ||||
if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) { | if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][ModelDef]Failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
REPORT_CALL_ERROR("E19999", "ModelHelper save model def failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
GELOGE(FAILED, "save model def failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) { | if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][ModelWeights]Failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
REPORT_CALL_ERROR("E19999","ModelHelper save mode weights failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
GELOGE(FAILED, "save model weights failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { | if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
REPORT_CALL_ERROR("E19999", "ModelHelper save model tbe kernel failed, model %s, " | |||||
"model index %zu", ge_model->GetName().c_str(), model_index); | |||||
GELOGE(FAILED, "save model tbe kernel failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) { | if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
REPORT_CALL_ERROR("E19999", "ModelHelper save model cust aicpu failed, model %s " | |||||
"model index %zu", ge_model->GetName().c_str(), model_index); | |||||
GELOGE(FAILED, "save model cust ai cpu failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) { | if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
REPORT_CALL_ERROR("E19999", "ModelHelper save task def failed, model %s, model index %zu", | |||||
ge_model->GetName().c_str(), model_index); | |||||
GELOGE(FAILED, "save task def failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -320,10 +272,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod | |||||
const std::string &output_file, | const std::string &output_file, | ||||
ModelBufferData& model) { | ModelBufferData& model) { | ||||
if (output_file.empty()) { | if (output_file.empty()) { | ||||
GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix, " | |||||
"model %s", ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix, " | |||||
"model %s", ge_model->GetName().c_str()); | |||||
GELOGE(FAILED, "GraphBuilder SaveModel received invalid file name prefix"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
@@ -335,28 +284,19 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod | |||||
auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer); | auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Save][AllModelPartition]Failed, model %s, error_code %u", | |||||
ge_model->GetName().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save all model partition failed, model %s " | |||||
"error_code %u", ge_model->GetName().c_str(), ret); | |||||
GELOGE(ret, "save all model partition failed"); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = SaveModelHeader(om_file_save_helper, ge_model); | ret = SaveModelHeader(om_file_save_helper, ge_model); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Save][ModelHeader]Failed, model %s, error_code %u", | |||||
ge_model->GetName().c_str(), ret); | |||||
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model header failed, model %s " | |||||
"error_code %u", ge_model->GetName().c_str(), ret); | |||||
GELOGE(ret, "save model header failed"); | |||||
return ret; | return ret; | ||||
} | } | ||||
ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_); | ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][Model]Failed, model %s, output file %s", | |||||
ge_model->GetName().c_str(), output_file.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model failed, model %s, " | |||||
"output file %s", ge_model->GetName().c_str(), output_file.c_str()); | |||||
GELOGE(FAILED, "OmFileSaveHelper SaveModel return fail."); | |||||
return ret; | return ret; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -370,21 +310,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo | |||||
bool is_unknown_shape) { | bool is_unknown_shape) { | ||||
GE_CHECK_NOTNULL(ge_root_model); | GE_CHECK_NOTNULL(ge_root_model); | ||||
GE_IF_BOOL_EXEC(ge_root_model == nullptr, | |||||
GELOGE(FAILED, "[Check][GERootModel]Ge_root_model is nullptr"); | |||||
REPORT_INNER_ERROR("E19999", "Ge_root_model check failed, it is nullptr"); | |||||
return FAILED); | |||||
GE_IF_BOOL_EXEC(ge_root_model == nullptr, GELOGE(FAILED, "Ge_root_model is nullptr"); return FAILED); | |||||
auto &name_to_ge_model = ge_root_model->GetSubgraphInstanceNameToModel(); | auto &name_to_ge_model = ge_root_model->GetSubgraphInstanceNameToModel(); | ||||
GE_IF_BOOL_EXEC(name_to_ge_model.empty(), | |||||
GELOGE(FAILED, "[Get][SubModel]Ge_root_model has no sub model"); | |||||
REPORT_INNER_ERROR("E19999", "Ge_root_model has no sub model"); | |||||
return FAILED); | |||||
GE_IF_BOOL_EXEC(name_to_ge_model.empty(), GELOGE(FAILED, "Ge_root_model has no sub model"); return FAILED); | |||||
GE_IF_BOOL_EXEC(output_file.empty(), | GE_IF_BOOL_EXEC(output_file.empty(), | ||||
GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid " | |||||
"file name prefix"); | |||||
REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid " | |||||
"file name prefix"); | |||||
GELOGE(FAILED, "GraphBuilder SaveModel received invalid file name prefix"); | |||||
return FAILED); | return FAILED); | ||||
if (!is_unknown_shape) { | if (!is_unknown_shape) { | ||||
@@ -413,8 +344,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo | |||||
if (model_names.size() > 1) { | if (model_names.size() > 1) { | ||||
GELOGD("only save first model MODEL_DEF"); | GELOGD("only save first model MODEL_DEF"); | ||||
if (SaveModelDef(om_file_save_helper, first_ge_model, model_buffers[cur_index], cur_index) != SUCCESS) { | if (SaveModelDef(om_file_save_helper, first_ge_model, model_buffers[cur_index], cur_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][ModelDef]Failed, cur_index %zu", cur_index); | |||||
REPORT_INNER_ERROR("E19999", "Save model def failed, cur_index %zu", cur_index); | |||||
GELOGE(FAILED, "save model def failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
++cur_index; | ++cur_index; | ||||
@@ -427,28 +357,20 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo | |||||
auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffers[cur_index], | auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffers[cur_index], | ||||
task_buffers[cur_index], cur_index); | task_buffers[cur_index], cur_index); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "[Save][AllModelPartition]Failed, model name %s, cur_index %zu", | |||||
model_name.c_str(), cur_index); | |||||
REPORT_CALL_ERROR("E19999", "Save all model %s partition failed, cur_index %zu", | |||||
model_name.c_str(), cur_index); | |||||
GELOGE(INTERNAL_ERROR, "Save model %s failed", model_name.c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
} | } | ||||
auto ret = SaveModelHeader(om_file_save_helper, first_ge_model, model_names.size()); | auto ret = SaveModelHeader(om_file_save_helper, first_ge_model, model_names.size()); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", | |||||
first_ge_model->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str()); | |||||
GELOGE(INTERNAL_ERROR, "Save model %s header failed", first_ge_model->GetName().c_str()); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_); | ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model eturn fail, output_file %s", | |||||
output_file.c_str()); | |||||
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s", | |||||
output_file.c_str()); | |||||
GELOGE(FAILED, "OmFileSaveHelper SaveModel return fail."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
return SUCCESS; | return SUCCESS; | ||||
@@ -457,17 +379,13 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status | ||||
ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file) { | ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::string &output_file) { | ||||
if (output_file.empty()) { | if (output_file.empty()) { | ||||
GELOGE(FAILED, "[Save][Model]Received invalid file name prefix, output_file %s", | |||||
output_file.c_str()); | |||||
REPORT_INNER_ERROR("E19999", "Save model received invalid file name prefix, output_file %s", | |||||
output_file.c_str()); | |||||
GELOGE(FAILED, "SaveModel received invalid file name prefix"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
// Get computegraph from graph | // Get computegraph from graph | ||||
auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); | auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); | ||||
if (compute_graph == nullptr) { | if (compute_graph == nullptr) { | ||||
GELOGE(FAILED, "[Save][Model]Failed for compute_graph null"); | |||||
REPORT_INNER_ERROR("E19999", "Save model failed for compute_graph null"); | |||||
GELOGE(FAILED, "SaveModel fail for compute_graph null"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_DUMP(compute_graph, "OriginalGraph"); | GE_DUMP(compute_graph, "OriginalGraph"); | ||||
@@ -489,10 +407,7 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin | |||||
ge::Buffer model_buffer; | ge::Buffer model_buffer; | ||||
ge::graphStatus status = model_ptr->Save(model_buffer); | ge::graphStatus status = model_ptr->Save(model_buffer); | ||||
if (status != ge::GRAPH_SUCCESS) { | if (status != ge::GRAPH_SUCCESS) { | ||||
GELOGE(FAILED, "[Save][Model]Failed for save buffer fail, model %s", | |||||
model_ptr->GetName().c_str()); | |||||
REPORT_CALL_ERROR("E19999", "Save model %s failed for save buffer fail", | |||||
model_ptr->GetName().c_str()); | |||||
GELOGE(FAILED, "SaveModel fail for save buffer fail"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
std::shared_ptr<OmFileSaveHelper> om_file_save_helper = ge::MakeShared<OmFileSaveHelper>(); | std::shared_ptr<OmFileSaveHelper> om_file_save_helper = ge::MakeShared<OmFileSaveHelper>(); | ||||
@@ -514,20 +429,14 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin | |||||
errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(), | errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(), | ||||
platform_version.size() + 1); | platform_version.size() + 1); | ||||
if (err != EOK) { | if (err != EOK) { | ||||
GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, model %s, errno %d", | |||||
platform_version.c_str(), model_ptr->GetName().c_str(), err); | |||||
REPORT_CALL_ERROR("E19999", "Save model %s failed for platform_version %s, errno %d", | |||||
model_ptr->GetName().c_str(), platform_version.c_str(), err); | |||||
GELOGE(FAILED, "ModelHelper SaveModel failed for platform_version"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
size_t name_size = model_ptr->GetName().size(); | size_t name_size = model_ptr->GetName().size(); | ||||
name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; | name_size = name_size > (MODEL_NAME_LENGTH - 1) ? (MODEL_NAME_LENGTH - 1) : name_size; | ||||
err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, model_ptr->GetName().c_str(), name_size); | err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, model_ptr->GetName().c_str(), name_size); | ||||
if (err != EOK) { | if (err != EOK) { | ||||
GELOGE(FAILED, "[Save][Model]Failed for memory copy %s failed, errno %d", | |||||
model_ptr->GetName().c_str(), err); | |||||
REPORT_CALL_ERROR("E19999", "Save model failed for memory copy %s failed, errno %d", | |||||
model_ptr->GetName().c_str(), err); | |||||
GELOGE(FAILED, "ModelHelper SaveModel memory copy failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ModelBufferData model; | ModelBufferData model; | ||||
@@ -537,26 +446,23 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(const ge::ModelData &model_data) { | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(const ge::ModelData &model_data) { | ||||
if (model_data.model_data == nullptr || model_data.model_len == 0) { | if (model_data.model_data == nullptr || model_data.model_len == 0) { | ||||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, | |||||
"[Load][Model]Model_data is nullptr or model_data_size is 0"); | |||||
REPORT_INNER_ERROR("E19999", "Load model failed, " | |||||
"Model_data is nullptr or model_data_size is 0"); | |||||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); | |||||
return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; | return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; | ||||
} | } | ||||
if (is_assign_model_) { | if (is_assign_model_) { | ||||
GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "[Load][Model]Model helper has already loaded!"); | |||||
GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "Model helper has already loaded!"); | |||||
return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; | return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; | ||||
} | } | ||||
if (ReleaseLocalModelData() != SUCCESS) { | if (ReleaseLocalModelData() != SUCCESS) { | ||||
GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "[Release][ModelData]Failed."); | |||||
GELOGE(ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA, "ReleaseLocalModelData failed."); | |||||
return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; | return ACL_ERROR_GE_EXEC_RELEASE_MODEL_DATA; | ||||
} | } | ||||
Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][ModelContent]Failed!"); | |||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); | |||||
return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
} | } | ||||
@@ -564,14 +470,14 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c | |||||
OmFileLoadHelper om_load_helper; | OmFileLoadHelper om_load_helper; | ||||
status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); | status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, "[Init][OmLoadHelper]Failed"); | |||||
GELOGE(status, "Om_load_helper init failed"); | |||||
model_addr_tmp_ = nullptr; | model_addr_tmp_ = nullptr; | ||||
return status; | return status; | ||||
} | } | ||||
auto partition_table = reinterpret_cast<ModelPartitionTable *>(model_addr_tmp_); | auto partition_table = reinterpret_cast<ModelPartitionTable *>(model_addr_tmp_); | ||||
if (partition_table->num == kOriginalOmPartitionNum) { | if (partition_table->num == kOriginalOmPartitionNum) { | ||||
model_addr_tmp_ = nullptr; | model_addr_tmp_ = nullptr; | ||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Check][OmModel]Error, please use executable om model"); | |||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "om model is error,please use executable om model"); | |||||
return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
} | } | ||||
// Encrypt model need to del temp model/no encrypt model don't need to del model | // Encrypt model need to del temp model/no encrypt model don't need to del model | ||||
@@ -579,7 +485,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c | |||||
status = GenerateGeModel(om_load_helper); | status = GenerateGeModel(om_load_helper); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, "[Generate][GEModel]Failed"); | |||||
GELOGE(status, "GenerateGeModel failed"); | |||||
return status; | return status; | ||||
} | } | ||||
GELOGD("in ModelHelper::LoadModel, is_assign_model_ is setted to true!"); | GELOGD("in ModelHelper::LoadModel, is_assign_model_ is setted to true!"); | ||||
@@ -589,26 +495,23 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { | ||||
if (model_data.model_data == nullptr || model_data.model_len == 0) { | if (model_data.model_data == nullptr || model_data.model_len == 0) { | ||||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "[Load][RootModel] " | |||||
"Model_data is nullptr or model_data_size is 0"); | |||||
REPORT_INNER_ERROR("E19999", "Load root model failed, model_data is nullptr or its size is 0"); | |||||
GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); | |||||
return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; | return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; | ||||
} | } | ||||
if (is_assign_model_) { | if (is_assign_model_) { | ||||
GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, | |||||
"[Load][RootModel]Model helper has already loaded!"); | |||||
GELOGE(ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED, "Model helper has already loaded!"); | |||||
return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; | return ACL_ERROR_GE_EXEC_LOAD_MODEL_REPEATED; | ||||
} | } | ||||
if (ReleaseLocalModelData() != SUCCESS) { | if (ReleaseLocalModelData() != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "[Release][ModelData]Failed."); | |||||
GELOGE(INTERNAL_ERROR, "ReleaseLocalModelData failed."); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!"); | |||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Parse model content failed!"); | |||||
return ACL_ERROR_GE_PARAM_INVALID; | return ACL_ERROR_GE_PARAM_INVALID; | ||||
} | } | ||||
@@ -627,7 +530,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod | |||||
status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); | status = om_load_helper.Init(model_addr_tmp_, model_len_tmp_); | ||||
} | } | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, "[Init][OmLoadHelper]Failed"); | |||||
GELOGE(status, "Om_load_helper init failed"); | |||||
model_addr_tmp_ = nullptr; | model_addr_tmp_ = nullptr; | ||||
return status; | return status; | ||||
} | } | ||||
@@ -636,7 +539,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod | |||||
status = GenerateGeRootModel(om_load_helper); | status = GenerateGeRootModel(om_load_helper); | ||||
if (status != SUCCESS) { | if (status != SUCCESS) { | ||||
GELOGE(status, "[Generate][GERootModel]Failed"); | |||||
GELOGE(status, "GenerateGeRootModel failed"); | |||||
return status; | return status; | ||||
} | } | ||||
GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); | GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); | ||||
@@ -676,8 +579,7 @@ Status ModelHelper::GenerateGeRootModel(OmFileLoadHelper &om_load_helper) { | |||||
GE_CHECK_NOTNULL(root_model_); | GE_CHECK_NOTNULL(root_model_); | ||||
if (!is_unknown_shape_model_) { | if (!is_unknown_shape_model_) { | ||||
if (GenerateGeModel(om_load_helper) != SUCCESS) { | if (GenerateGeModel(om_load_helper) != SUCCESS) { | ||||
GELOGE(FAILED, "[Generate][GERootModel]Failed"); | |||||
REPORT_CALL_ERROR("E19999", "Generate GE root model failed"); | |||||
GELOGE(FAILED, "GenerateGeModel failed"); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
GE_CHECK_NOTNULL(model_); | GE_CHECK_NOTNULL(model_); | ||||
@@ -735,10 +637,7 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper) { | |||||
ge::Model model; | ge::Model model; | ||||
if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { | if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "[Load][Model]Failed, model_def partition addr:%p, size:%u", | |||||
partition_model_def.data, partition_model_def.size); | |||||
REPORT_CALL_ERROR("E19999", "Load model failed, model_def partition addr:%p, size:%u", | |||||
partition_model_def.data, partition_model_def.size); | |||||
GELOGE(INTERNAL_ERROR, "Load model failed."); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -762,10 +661,7 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & | |||||
ge::Model model; | ge::Model model; | ||||
if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { | if (ge::Model::Load(partition_model_def.data, partition_model_def.size, model) != SUCCESS) { | ||||
GELOGE(INTERNAL_ERROR, "[Load][Model]Failed, model_def partition addr:%p, size:%u", | |||||
partition_model_def.data, partition_model_def.size); | |||||
REPORT_CALL_ERROR("E19999", "Load model failed, model_def partition addr:%p, size:%u", | |||||
partition_model_def.data, partition_model_def.size); | |||||
GELOGE(INTERNAL_ERROR, "Load model failed."); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
@@ -777,9 +673,7 @@ Status ModelHelper::LoadModelData(OmFileLoadHelper &om_load_helper, GeModelPtr & | |||||
Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { | Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { | ||||
ModelPartition partition; | ModelPartition partition; | ||||
if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { | if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { | ||||
GELOGE(FAILED, "[Get][ModelWeightPartition]Failed, GetWeight size:%u", partition.size); | |||||
REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", | |||||
partition.size); | |||||
GELOGE(FAILED, "Get weight model partition failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); | ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); | ||||
@@ -792,9 +686,7 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) { | |||||
Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index) { | Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cur_model, size_t mode_index) { | ||||
ModelPartition partition; | ModelPartition partition; | ||||
if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) { | if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) { | ||||
GELOGE(FAILED, "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); | |||||
REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u", | |||||
partition.size); | |||||
GELOGE(FAILED, "Get weight model partition failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); | ge::Buffer weight = ge::Buffer::CopyFrom(partition.data, partition.size); | ||||
@@ -807,19 +699,14 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cu | |||||
FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper) { | FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(OmFileLoadHelper &om_load_helper) { | ||||
ModelPartition task_partition; | ModelPartition task_partition; | ||||
if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { | if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { | ||||
GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); | |||||
REPORT_CALL_ERROR("E19999", "Get model task partition failed, task_partition size %u", | |||||
task_partition.size); | |||||
GELOGE(FAILED, "Get task model partition failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
std::shared_ptr<ModelTaskDef> task = ge::MakeShared<ModelTaskDef>(); | std::shared_ptr<ModelTaskDef> task = ge::MakeShared<ModelTaskDef>(); | ||||
GE_CHECK_NOTNULL(task); | GE_CHECK_NOTNULL(task); | ||||
if (task_partition.size != 0) { | if (task_partition.size != 0) { | ||||
if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { | if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { | ||||
GELOGE(INTERNAL_ERROR, "[Read][ProtoFromArray]Failed, task_partition size %u", | |||||
task_partition.size); | |||||
REPORT_CALL_ERROR("E19999", "Read proto from array failed, task_partition size %u", | |||||
task_partition.size); | |||||
GELOGE(INTERNAL_ERROR, "ReadProtoFromArray failed."); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); | GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); | ||||
@@ -834,20 +721,13 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om | |||||
ModelPartition task_partition; | ModelPartition task_partition; | ||||
if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition, mode_index) != SUCCESS) { | if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition, mode_index) != SUCCESS) { | ||||
GELOGE(FAILED, "Get task model partition failed."); | GELOGE(FAILED, "Get task model partition failed."); | ||||
GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size %u, mode_index %zu", | |||||
task_partition.size, mode_index); | |||||
REPORT_CALL_ERROR("E19999", "Get model task partition failed, " | |||||
"task_partition size %u, mode_index %zu", task_partition.size, mode_index); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
std::shared_ptr<ModelTaskDef> task = ge::MakeShared<ModelTaskDef>(); | std::shared_ptr<ModelTaskDef> task = ge::MakeShared<ModelTaskDef>(); | ||||
GE_CHECK_NOTNULL(task); | GE_CHECK_NOTNULL(task); | ||||
if (task_partition.size != 0) { | if (task_partition.size != 0) { | ||||
if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { | if (!ReadProtoFromArray(task_partition.data, task_partition.size, task.get())) { | ||||
GELOGE(INTERNAL_ERROR, "[Read][ProtoFromArray]Failed, task_partition size %u", | |||||
task_partition.size); | |||||
REPORT_CALL_ERROR("E19999", "Read proto from array failed, task_partition size %u", | |||||
task_partition.size); | |||||
GELOGE(INTERNAL_ERROR, "ReadProtoFromArray failed."); | |||||
return INTERNAL_ERROR; | return INTERNAL_ERROR; | ||||
} | } | ||||
GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); | GELOGD("TASK_INFO op_size:%d, stream_num:%u", task->op().size(), task->stream_num()); | ||||
@@ -955,8 +835,7 @@ Status ModelHelper::ReleaseLocalModelData() noexcept { | |||||
if (model_addr_tmp_ != nullptr) { | if (model_addr_tmp_ != nullptr) { | ||||
errno_t ret = memset_s(static_cast<void *>(model_addr_tmp_), model_len_tmp_, 0, model_len_tmp_); | errno_t ret = memset_s(static_cast<void *>(model_addr_tmp_), model_len_tmp_, 0, model_len_tmp_); | ||||
if (ret != EOK) { | if (ret != EOK) { | ||||
GELOGE(FAILED, "[Memset][Memory]Failed, error-code %d", ret); | |||||
REPORT_CALL_ERROR("E19999", "Failed to memset memory, error-code %d", ret); | |||||
GELOGE(FAILED, "Failed to memset memory, error-code %d", ret); | |||||
result = FAILED; | result = FAILED; | ||||
} | } | ||||
delete[] model_addr_tmp_; | delete[] model_addr_tmp_; | ||||
@@ -1005,9 +884,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef | |||||
Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); | Status ret = ModelParserBase::LoadFromFile(model_file, "", priority, model); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file, ret); | |||||
REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", | |||||
model_file, ret); | |||||
GELOGE(ret, "LoadFromFile failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
std::function<void()> callback = [&]() { | std::function<void()> callback = [&]() { | ||||
@@ -1025,32 +902,31 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E10003", | ErrorManager::GetInstance().ATCReportErrMessage("E10003", | ||||
{"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); | {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); | ||||
GELOGE(ACL_ERROR_GE_PARAM_INVALID, | GELOGE(ACL_ERROR_GE_PARAM_INVALID, | ||||
"[Parse][ModelContent]Failed because of invalid om file %s, please check om param", | |||||
model_file); | |||||
"ParseModelContent failed because of invalid om file. Please check --om param."); | |||||
return ret; | return ret; | ||||
} | } | ||||
OmFileLoadHelper om_load_helper; | OmFileLoadHelper om_load_helper; | ||||
ret = om_load_helper.Init(model_data, model_len); | ret = om_load_helper.Init(model_data, model_len); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Init om file %s failed", model_file); | |||||
GELOGE(ge::FAILED, "[Init][OmFile]Failed, model_file %s", model_file); | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"}); | |||||
GELOGE(ge::FAILED, "Om file init failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
ModelPartition ir_part; | ModelPartition ir_part; | ||||
ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); | ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
REPORT_INNER_ERROR("E19999", "Get model partition failed, model_file %s", model_file); | |||||
GELOGE(ge::FAILED, "[Get][ModelPart]Failed, model_file %s", model_file); | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); | |||||
GELOGE(ge::FAILED, "Get model part failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
bool flag = ReadProtoFromArray(ir_part.data, ir_part.size, &model_def); | bool flag = ReadProtoFromArray(ir_part.data, ir_part.size, &model_def); | ||||
if (!flag) { | if (!flag) { | ||||
ret = INTERNAL_ERROR; | ret = INTERNAL_ERROR; | ||||
REPORT_INNER_ERROR("E19999", "Read proto from array failed, model_file %s", model_file); | |||||
GELOGE(ret, "[Read][ProtoFromArray]Failed, model_file %s", model_file); | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); | |||||
GELOGE(ret, "ReadProtoFromArray failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
modeldef_size = ir_part.size; | modeldef_size = ir_part.size; | ||||
@@ -1071,9 +947,7 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model | |||||
}; | }; | ||||
if (ret != SUCCESS) { | if (ret != SUCCESS) { | ||||
free_model_data(&model.model_data); | free_model_data(&model.model_data); | ||||
GELOGE(ret, "[Load][ModelInfo]Failed from file %s, error_code %u", model_file, ret); | |||||
REPORT_CALL_ERROR("E19999", "Load model info failed from file %s, error_code %u", | |||||
model_file, ret); | |||||
GELOGE(ret, "LoadFromFile failed."); | |||||
return ret; | return ret; | ||||
} | } | ||||
@@ -1081,18 +955,17 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model | |||||
bool flag = google::protobuf::TextFormat::ParseFromString(reinterpret_cast<char *>(model.model_data), &model_def); | bool flag = google::protobuf::TextFormat::ParseFromString(reinterpret_cast<char *>(model.model_data), &model_def); | ||||
if (!flag) { | if (!flag) { | ||||
free_model_data(&model.model_data); | free_model_data(&model.model_data); | ||||
REPORT_INNER_ERROR("E19999", "Parse model info failed from string, model_file %s", model_file); | |||||
GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, model_file %s", model_file); | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); | |||||
GELOGE(FAILED, "ParseFromString failed."); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
free_model_data(&model.model_data); | free_model_data(&model.model_data); | ||||
return SUCCESS; | return SUCCESS; | ||||
} catch (google::protobuf::FatalException &e) { | } catch (google::protobuf::FatalException &e) { | ||||
free_model_data(&model.model_data); | free_model_data(&model.model_data); | ||||
REPORT_INNER_ERROR("E19999", "Parse model info failed from string, exception message %s, model_file %s", | |||||
e.what(), model_file); | |||||
GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message %s, model_file %s", | |||||
e.what(), model_file); | |||||
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" | |||||
+ std::string(e.what()) + "]"}); | |||||
GELOGE(FAILED, "ParseFromString failed. exception message : %s", e.what()); | |||||
return FAILED; | return FAILED; | ||||
} | } | ||||
} | } | ||||