Merge pull request !1580 from 王笑天/mastertags/v1.3.0
| @@ -100,7 +100,7 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||
| GELOGW("GEInitialize is called more than once"); | |||
| return SUCCESS; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsProtoInit); | |||
| // Load OpsProto lib plugin | |||
| std::string opsproto_path; | |||
| GetOpsProtoPath(opsproto_path); | |||
| @@ -119,7 +119,7 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||
| return FAILED; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| // check options is valid | |||
| GE_TIMESTAMP_START(CheckOptionsValid); | |||
| if (CheckOptionsValid(options) != SUCCESS) { | |||
| @@ -127,13 +127,13 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||
| } | |||
| GE_TIMESTAMP_END(CheckOptionsValid, "GEInitialize::CheckOptionsValid"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsProtoInit); | |||
| GE_TIMESTAMP_START(InitPreparation); | |||
| TBEPluginManager::Instance().InitPreparation(options); | |||
| GE_TIMESTAMP_END(InitPreparation, "GEInitialize::InitPreparation"); | |||
| // call Initialize | |||
| GELOGT(TRACE_RUNNING, "Initializing environment"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| GE_TIMESTAMP_START(GELibInitialize); | |||
| ret = ge::GELib::Initialize(options); | |||
| GE_TIMESTAMP_END(GELibInitialize, "GEInitialize::GELibInitialize"); | |||
| @@ -154,7 +154,7 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||
| // Initialize GE, prepare for execution, call GELib::Initialize | |||
| Status GEInitialize(const std::map<string, string> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| if (DlogReportInitialize() != SUCCESS) { | |||
| GELOGW("Dlog report device log initialize failed."); | |||
| } | |||
| @@ -162,7 +162,7 @@ Status GEInitialize(const std::map<string, string> &options) { | |||
| } | |||
| Status GEInitialize(const std::map<AscendString, AscendString> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| std::map<std::string, std::string> str_options; | |||
| for (auto &option : options) { | |||
| if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { | |||
| @@ -191,7 +191,7 @@ Status GEFinalize() { | |||
| return SUCCESS; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| GELOGT(TRACE_INIT, "GEFinalize start"); | |||
| @@ -243,7 +243,7 @@ std::string GEGetWarningMsg() { | |||
| // Initialize session,which calls innerSession | |||
| Session::Session(const std::map<string, string> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Session Constructor start"); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| @@ -259,7 +259,7 @@ Session::Session(const std::map<string, string> &options) { | |||
| // call Initialize | |||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||
| if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | |||
| GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||
| GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||
| "[Construct][Session]Failed, GELib instance is nullptr or it is not InitFlag"); | |||
| return; | |||
| } | |||
| @@ -280,7 +280,7 @@ Session::Session(const std::map<string, string> &options) { | |||
| } | |||
| Session::Session(const std::map<AscendString, AscendString> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Session Constructor start"); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| @@ -331,7 +331,7 @@ Session::Session(const std::map<AscendString, AscendString> &options) { | |||
| // session destructor | |||
| Session::~Session() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); | |||
| GELOGT(TRACE_INIT, "Session Destructor start"); | |||
| // 0.check init status | |||
| if (!g_ge_initialized) { | |||
| @@ -371,7 +371,7 @@ Session::~Session() { | |||
| // Add Graph | |||
| Status Session::AddGraph(uint32_t graph_id, const Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| std::map<std::string, std::string> options; | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| return AddGraph(graph_id, graph, options); | |||
| @@ -379,7 +379,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph) { | |||
| // Add Graph | |||
| Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map<std::string, std::string> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Start to add graph in Session. graph_id: %u, session_id: %lu.", graph_id, sessionId_); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||
| @@ -393,7 +393,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map<s | |||
| GELOGD("Adding graph to session"); | |||
| Status ret = instance_ptr->SessionManagerObj().AddGraph(sessionId_, graph_id, graph, options); | |||
| if (ret != SUCCESS) { | |||
| GELOGE(ret, | |||
| GELOGE(ret, | |||
| "[Add][Graph]Failed, error code:%u, session_id:%lu, graph_id:%u.", | |||
| ret, sessionId_, graph_id); | |||
| return FAILED; | |||
| @@ -405,7 +405,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, const std::map<s | |||
| //Add Graph | |||
| Status Session::AddGraph(uint32_t graph_id, const Graph &graph, | |||
| const std::map<AscendString, AscendString> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Start to add graph in Session. graph_id: %u, session_id: %lu.", graph_id, sessionId_); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||
| @@ -441,7 +441,7 @@ Status Session::AddGraph(uint32_t graph_id, const Graph &graph, | |||
| } | |||
| Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| std::map<AscendString, AscendString> options; | |||
| return AddGraphWithCopy(graph_id, graph, options); | |||
| @@ -450,7 +450,7 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph) { | |||
| // Add Graph With Copy | |||
| Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, | |||
| const std::map<AscendString, AscendString> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Start to add graph in Session. graph_id: %u, session_id: %lu.", graph_id, sessionId_); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||
| @@ -479,7 +479,7 @@ Status Session::AddGraphWithCopy(uint32_t graph_id, const Graph &graph, | |||
| // Remove Graph | |||
| Status Session::RemoveGraph(uint32_t graph_id) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Session RemoveGraph start"); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| @@ -560,7 +560,7 @@ void PrintOutputResult(std::vector<Tensor> &outputs) { | |||
| // Run Graph | |||
| Status Session::RunGraph(uint32_t graph_id, const std::vector<Tensor> &inputs, std::vector<Tensor> &outputs) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGT(TRACE_INIT, "Session RunGraph start"); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| @@ -615,7 +615,7 @@ Status Session::RegisterCallBackFunc(const char *key, const session::pCallBackFu | |||
| // Build Graph | |||
| Status Session::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> &inputs) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||
| if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | |||
| @@ -643,7 +643,7 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo> | |||
| // Run Graph Asynchronously | |||
| Status Session::RunGraphAsync(uint32_t graph_id, const std::vector<InputTensorInfo> &inputs, | |||
| RunAsyncCallback callback) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| ErrorManager::GetInstance().GenWorkStreamIdBySessionGraph(sessionId_, graph_id); | |||
| std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); | |||
| if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | |||
| @@ -672,11 +672,11 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector<InputTensorIn | |||
| // Get Variables | |||
| Status Session::GetVariables(const std::vector<std::string> &var_names, std::vector<Tensor> &var_values) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| auto instance_ptr = ge::GELib::GetInstance(); | |||
| if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | |||
| GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||
| GELOGE(GE_CLI_GE_NOT_INITIALIZED, | |||
| "[Get][Variables]Failed, the GELib instance is nullptr or is not InitFlag."); | |||
| REPORT_INNER_ERROR("E19999", | |||
| "GetVariables failed, the GELib instance is nullptr or is not InitFlag."); | |||
| @@ -693,7 +693,7 @@ Status Session::GetVariables(const std::vector<std::string> &var_names, std::vec | |||
| // Get Variables | |||
| Status Session::GetVariables(const std::vector<AscendString> &var_names, std::vector<Tensor> &var_values) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
| auto instance_ptr = ge::GELib::GetInstance(); | |||
| if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { | |||
| @@ -48,8 +48,8 @@ Status FileSaver::OpenFile(int32_t &fd, const std::string &file_path) { | |||
| fd = mmOpen2(real_path, M_RDWR | M_CREAT | O_TRUNC, mode); | |||
| if (fd == EN_INVALID_PARAM || fd == EN_ERROR) { | |||
| // -1: Failed to open file; - 2: Illegal parameter | |||
| GELOGE(FAILED, "[Open][File]Failed. mmpa_errno = %d, %s", fd, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Open file failed, mmpa_errno = %d, error:%s.", | |||
| GELOGE(FAILED, "[Open][File]Failed. errno:%d, errmsg:%s", fd, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Open file failed, errno:%d, errmsg:%s.", | |||
| fd, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| @@ -67,9 +67,9 @@ Status FileSaver::WriteData(const void *data, uint32_t size, int32_t fd) { | |||
| while (size > size_1g) { | |||
| write_count = mmWrite(fd, reinterpret_cast<void *>(seek), size_1g); | |||
| if (write_count == EN_INVALID_PARAM || write_count == EN_ERROR) { | |||
| GELOGE(FAILED, "[Write][Data]Failed, mmpa_errorno = %ld, error:%s", | |||
| GELOGE(FAILED, "[Write][Data]Failed, errno:%ld, errmsg:%s", | |||
| write_count, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Write data failed, mmpa_errorno = %ld, error:%s.", | |||
| REPORT_INNER_ERROR("E19999", "Write data failed, errno:%ld, errmsg:%s.", | |||
| write_count, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| @@ -59,17 +59,17 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::DumpToFile | |||
| int32_t mmpa_ret = mmWrite(fd, data, len); | |||
| // mmWrite return -1:Failed to write data to file;return -2:Invalid parameter | |||
| if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | |||
| GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Write data failed, errno = %d, error:%s.", | |||
| GELOGE(FAILED, "[Write][Data]Failed, errno:%d, errmsg:%s", mmpa_ret, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Write data failed, errno:%d, errmsg:%s.", | |||
| mmpa_ret, strerror(errno)); | |||
| ret = FAILED; | |||
| } | |||
| // Close the file | |||
| if (mmClose(fd) != EN_OK) { // mmClose return 0: success | |||
| GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s.", ret, filename); | |||
| REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s.", | |||
| ret, filename); | |||
| GELOGE(FAILED, "[Close][File]Failed, error_code:%u, filename:%s errmsg:%s.", ret, filename, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Close file failed, error_code:%u, filename:%s errmsg:%s.", | |||
| ret, filename, strerror(errno)); | |||
| ret = FAILED; | |||
| } | |||
| @@ -111,8 +111,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void | |||
| int32_t mmpa_ret = mmWrite(fd_, data, len); | |||
| // mmWrite return -1:failed to write data to file;return -2:invalid parameter | |||
| if (mmpa_ret == EN_ERROR || mmpa_ret == EN_INVALID_PARAM) { | |||
| GELOGE(FAILED, "[Write][Data]Failed, errno = %d, error:%s", mmpa_ret, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Write data to file failed, errno = %d, error:%s.", | |||
| GELOGE(FAILED, "[Write][Data]Failed, errno:%d, errmsg:%s", mmpa_ret, strerror(errno)); | |||
| REPORT_INNER_ERROR("E19999", "Write data to file failed, errno:%d, errmsg:%s.", | |||
| mmpa_ret, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| @@ -128,7 +128,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status MemoryDumper::Dump(void | |||
| void MemoryDumper::Close() noexcept { | |||
| // Close file | |||
| if (fd_ != kInvalidFd && mmClose(fd_) != EN_OK) { | |||
| GELOGW("Close file failed."); | |||
| GELOGW("Close file failed, errmsg:%s.", strerror(errno)); | |||
| } | |||
| fd_ = kInvalidFd; | |||
| } | |||
| @@ -151,7 +151,7 @@ int MemoryDumper::OpenFile(const char *filename) { | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(prefix_path.length() >= MMPA_MAX_PATH, | |||
| return kInvalidFd, "Prefix path is too long!"); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(mmRealPath(prefix_path.c_str(), tmp_path, MMPA_MAX_PATH) != EN_OK, return kInvalidFd, | |||
| "Dir %s does not exit.", prefix_path.c_str()); | |||
| "Dir %s does not exit, errmsg:%s.", prefix_path.c_str(), strerror(errno)); | |||
| real_path = std::string(tmp_path) + last_path;) | |||
| GE_IF_BOOL_EXEC( | |||
| path_split_pos == -1 || path_split_pos == 0, | |||
| @@ -166,7 +166,7 @@ int MemoryDumper::OpenFile(const char *filename) { | |||
| int32_t fd = mmOpen2(real_path.c_str(), M_RDWR | M_CREAT | M_APPEND, mode); | |||
| if (fd == EN_ERROR || fd == EN_INVALID_PARAM) { | |||
| GELOGE(kInvalidFd, "[Open][File]Failed. errno = %d, error:%s, filename:%s.", | |||
| GELOGE(kInvalidFd, "[Open][File]Failed. errno:%d, errmsg:%s, filename:%s.", | |||
| fd, strerror(errno), filename); | |||
| return kInvalidFd; | |||
| } | |||
| @@ -53,7 +53,7 @@ std::string OpTilingManager::GetPath() { | |||
| ErrorManager::GetInstance().ATCReportErrMessage( | |||
| "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); | |||
| "is invalid path. errmsg:%s", opp_path_env, strerror(errno)); | |||
| return std::string(); | |||
| } | |||
| opp_path = resolved_path; | |||
| @@ -76,7 +76,7 @@ void OpTilingManager::LoadSo() { | |||
| if (handle_bi == nullptr) { | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGW("Failed to dlopen %s!", error); | |||
| GELOGW("Failed to dlopen %s! errmsg:%s", built_in_tiling_lib.c_str(), error); | |||
| } else { | |||
| handles_[built_in_name] = handle_bi; | |||
| } | |||
| @@ -85,7 +85,7 @@ void OpTilingManager::LoadSo() { | |||
| if (handle_ct == nullptr) { | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGW("Failed to dlopen %s!", error); | |||
| GELOGW("Failed to dlopen %s! errmsg:%s", custom_tiling_lib.c_str(), error); | |||
| } else { | |||
| handles_[custom_name] = handle_ct; | |||
| } | |||
| @@ -39,7 +39,7 @@ void PluginManager::ClearHandles_() noexcept { | |||
| if (mmDlclose(handle.second) != 0) { | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGW("Failed to close handle of %s: %s", handle.first.c_str(), error); | |||
| GELOGW("Failed to close handle of %s, errmsg:%s", handle.first.c_str(), error); | |||
| } | |||
| } | |||
| handles_.clear(); | |||
| @@ -50,7 +50,9 @@ PluginManager::~PluginManager() { ClearHandles_(); } | |||
| string PluginManager::GetPath() { | |||
| mmDlInfo dl_info; | |||
| if (mmDladdr(reinterpret_cast<void *>(&PluginManager::GetPath), &dl_info) != EN_OK) { | |||
| GELOGW("Failed to read the shared library file path!"); | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGW("Failed to read the shared library file path! errmsg:%s", error); | |||
| return string(); | |||
| } else { | |||
| GE_IF_BOOL_EXEC(dl_info.dli_fname == nullptr, return string()); | |||
| @@ -61,7 +63,7 @@ string PluginManager::GetPath() { | |||
| return string(); | |||
| } | |||
| if (mmRealPath(so_path.c_str(), path, MMPA_MAX_PATH) != EN_OK) { | |||
| GELOGW("Failed to get realpath of %s", so_path.c_str()); | |||
| GELOGW("Failed to get realpath of %s, errmsg:%s", so_path.c_str(), strerror(errno)); | |||
| return string(); | |||
| } | |||
| @@ -137,18 +139,24 @@ Status PluginManager::LoadSo(const string &path, const vector<string> &func_chec | |||
| for (const auto &func_name : func_check_list) { | |||
| auto real_fn = (void (*)())mmDlsym(handle, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19012", {"function", "reason"}, | |||
| {"mmDlsym", FmtToStr(func_name) + " is skipped since function" + | |||
| FmtToStr(func_name) + " is not existed!"}); | |||
| GELOGE(ACL_ERROR_GE_PLGMGR_PATH_INVALID, | |||
| "[Check][So]%s is skipped since function %s is not existed!", | |||
| func_name.c_str(), func_name.c_str()); | |||
| "[Check][So]%s is skipped since function %s is not existed! errmsg:%s", | |||
| func_name.c_str(), func_name.c_str(), error); | |||
| is_valid = false; | |||
| break; | |||
| } | |||
| } | |||
| if (!is_valid) { | |||
| GE_LOGE_IF(mmDlclose(handle), "[DLClose][Handle]Failed."); | |||
| if (mmDlclose(handle) != 0) { | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGE(FAILED, "[DLClose][Handle]Failed. errmsg:%s", error); | |||
| } | |||
| continue; | |||
| } | |||
| @@ -212,21 +220,21 @@ Status PluginManager::Load(const string &path, const vector<string> &func_check_ | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(path.length() >= MMPA_MAX_PATH, GELOGW("File path is too long!"); | |||
| return FAILED, "File path is too long!"); | |||
| if (mmRealPath(path.c_str(), canonical_path, MMPA_MAX_PATH) != EN_OK) { | |||
| GELOGW("Failed to get realpath of %s", path.c_str()); | |||
| GELOGW("Failed to get realpath of %s, errmsg:%s", path.c_str(), strerror(errno)); | |||
| return SUCCESS; | |||
| } | |||
| INT32 is_dir = mmIsDir(canonical_path); | |||
| // Lib plugin path not exist | |||
| if (is_dir != EN_OK) { | |||
| GELOGW("Invalid path for load: %s", path.c_str()); | |||
| GELOGW("Invalid path for load: %s, errmsg:%s", path.c_str(), strerror(errno)); | |||
| return SUCCESS; | |||
| } | |||
| mmDirent **entries = nullptr; | |||
| auto ret = mmScandir(canonical_path, &entries, nullptr, nullptr); | |||
| if (ret < EN_OK) { | |||
| GELOGW("scan dir failed. path = %s, ret = %d", canonical_path, ret); | |||
| GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", canonical_path, ret, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| for (int i = 0; i < ret; ++i) { | |||
| @@ -283,13 +291,20 @@ Status PluginManager::Load(const string &path, const vector<string> &func_check_ | |||
| for (const auto &func_name : func_check_list) { | |||
| auto real_fn = (void (*)())mmDlsym(handle, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| GELOGW("The %s is skipped since function %s is not existed!", file_name.c_str(), func_name.c_str()); | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGW("The %s is skipped since function %s is not existed! errmsg:%s", | |||
| file_name.c_str(), func_name.c_str(), error); | |||
| is_valid = false; | |||
| break; | |||
| } | |||
| } | |||
| if (!is_valid) { | |||
| GE_LOGE_IF(mmDlclose(handle), "Failed to dlclose."); | |||
| if (mmDlclose(handle) != 0) { | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGE(FAILED, "[DLClose][Handle]Failed. errmsg:%s", error); | |||
| } | |||
| continue; | |||
| } | |||
| @@ -59,7 +59,11 @@ class PluginManager { | |||
| for (const auto &handle : handles_) { | |||
| auto real_fn = (R(*)(Types...))mmDlsym(handle.second, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| GELOGW("Failed to get function %s in %s!", func_name.c_str(), handle.first.c_str()); | |||
| const char *error = mmDlerror(); | |||
| if (error == nullptr) { | |||
| error = ""; | |||
| } | |||
| GELOGW("Failed to get function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); | |||
| return GE_PLGMGR_FUNC_NOT_EXIST; | |||
| } else { | |||
| funcs[handle.first] = real_fn; | |||
| @@ -74,7 +78,11 @@ class PluginManager { | |||
| // If the funcName is existed, signature of realFn can be casted to any type | |||
| auto real_fn = (void (*)(Types...))mmDlsym(handle.second, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); | |||
| const char *error = mmDlerror(); | |||
| if (error == nullptr) { | |||
| error = ""; | |||
| } | |||
| GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); | |||
| return GE_PLGMGR_INVOKE_FAILED; | |||
| } else { | |||
| real_fn(args...); | |||
| @@ -89,7 +97,11 @@ class PluginManager { | |||
| // If the funcName is existed, signature of realFn can be casted to any type | |||
| auto real_fn = (void (*)(T))mmDlsym(handle.second, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); | |||
| const char *error = mmDlerror(); | |||
| if (error == nullptr) { | |||
| error = ""; | |||
| } | |||
| GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); | |||
| return GE_PLGMGR_INVOKE_FAILED; | |||
| } | |||
| typename std::remove_reference<T>::type arg_temp; | |||
| @@ -114,7 +126,11 @@ class PluginManager { | |||
| // If the funcName is existed, signature of realFn can be casted to any type | |||
| auto real_fn = (T2(*)(T1))mmDlsym(handle.second, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); | |||
| const char *error = mmDlerror(); | |||
| if (error == nullptr) { | |||
| error = ""; | |||
| } | |||
| GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); | |||
| return GE_PLGMGR_INVOKE_FAILED; | |||
| } else { | |||
| T2 res = real_fn(arg); | |||
| @@ -132,7 +148,11 @@ class PluginManager { | |||
| // If the funcName is existed, signature of realFn can be casted to any type | |||
| auto real_fn = (T(*)())mmDlsym(handle.second, const_cast<char *>(func_name.c_str())); | |||
| if (real_fn == nullptr) { | |||
| GELOGW("Failed to invoke function %s in %s!", func_name.c_str(), handle.first.c_str()); | |||
| const char *error = mmDlerror(); | |||
| if (error == nullptr) { | |||
| error = ""; | |||
| } | |||
| GELOGW("Failed to invoke function %s in %s! errmsg:%s", func_name.c_str(), handle.first.c_str(), error); | |||
| return GE_PLGMGR_INVOKE_FAILED; | |||
| } else { | |||
| T res = real_fn(); | |||
| @@ -69,7 +69,9 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status TBEPluginManager::Finali | |||
| string TBEPluginManager::GetPath() { | |||
| mmDlInfo dl_info; | |||
| if (mmDladdr(reinterpret_cast<void *>(&TBEPluginManager::GetPath), &dl_info) != EN_OK) { | |||
| GELOGW("Failed to read so path!"); | |||
| const char *error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGW("Failed to read so path! errmsg:%s", error); | |||
| return string(); | |||
| } else { | |||
| string so_path = dl_info.dli_fname; | |||
| @@ -79,7 +81,7 @@ string TBEPluginManager::GetPath() { | |||
| return string(); | |||
| } | |||
| if (mmRealPath(so_path.c_str(), path, MMPA_MAX_PATH) != EN_OK) { | |||
| GELOGW("Failed to get realpath of %s", so_path.c_str()); | |||
| GELOGW("Failed to get realpath of %s, errmsg:%s", so_path.c_str(), strerror(errno)); | |||
| return string(); | |||
| } | |||
| @@ -113,14 +115,14 @@ void TBEPluginManager::FindParserSo(const string &path, vector<string> &file_lis | |||
| INT32 is_dir = mmIsDir(real_path.c_str()); | |||
| // Lib plugin path not exist | |||
| if (is_dir != EN_OK) { | |||
| GELOGW("%s is not a dir.", real_path.c_str()); | |||
| GELOGW("%s is not a dir. errmsg:%s", real_path.c_str(), strerror(errno)); | |||
| return; | |||
| } | |||
| mmDirent **entries = nullptr; | |||
| auto ret = mmScandir(real_path.c_str(), &entries, nullptr, nullptr); | |||
| if (ret < EN_OK) { | |||
| GELOGW("scan dir failed. path = %s, ret = %d", real_path.c_str(), ret); | |||
| GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", real_path.c_str(), ret, strerror(errno)); | |||
| return; | |||
| } | |||
| for (int i = 0; i < ret; ++i) { | |||
| @@ -441,11 +441,11 @@ Status ModelCacheHelper::SaveJsonToFile(const string &file_name, const Json &jso | |||
| const int FILE_AUTHORITY = 0600; | |||
| int fd = mmOpen2(path.c_str(), M_WRONLY | M_CREAT | O_TRUNC, FILE_AUTHORITY); | |||
| if (fd < 0) { | |||
| GELOGW("Fail to open the file: %s.", path.c_str()); | |||
| GELOGW("Fail to open the file:%s. errmsg:%s", path.c_str(), strerror(errno)); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| if (mmClose(fd) != 0) { | |||
| GELOGW("Fail to close the file: %s.", path.c_str()); | |||
| GELOGW("Fail to close the file:%s. errmsg:%s", path.c_str(), strerror(errno)); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -59,7 +59,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi | |||
| int32_t fd = mmOpen2(real_path, M_RDWR | M_CREAT | O_TRUNC, mode); | |||
| if (fd == EN_ERROR || fd == EN_INVALID_PARAM) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {file_path, strerror(errno)}); | |||
| GELOGE(FAILED, "Open file[%s] failed. %s", file_path, strerror(errno)); | |||
| GELOGE(FAILED, "Open file[%s] failed. errmsg:%s", file_path, strerror(errno)); | |||
| return FAILED; | |||
| } | |||
| const char *model_char = model_str.c_str(); | |||
| @@ -70,12 +70,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelSaver::SaveJsonToFi | |||
| ErrorManager::GetInstance().ATCReportErrMessage( | |||
| "E19004", {"file", "errmsg"}, {file_path, strerror(errno)}); | |||
| // Need to both print the error info of mmWrite and mmClose, so return ret after mmClose | |||
| GELOGE(FAILED, "Write to file failed. errno = %ld, %s", mmpa_ret, strerror(errno)); | |||
| GELOGE(FAILED, "Write to file failed. errno:%ld, errmsg:%s", mmpa_ret, strerror(errno)); | |||
| ret = FAILED; | |||
| } | |||
| // Close file | |||
| if (mmClose(fd) != EN_OK) { | |||
| GELOGE(FAILED, "Close file failed."); | |||
| GELOGE(FAILED, "Close file failed. errmsg:%s", strerror(errno)); | |||
| ret = FAILED; | |||
| } | |||
| return ret; | |||
| @@ -122,7 +122,7 @@ long GetFileLength(const std::string &input_file) { | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG( | |||
| mmGetFileSize(input_file.c_str(), &file_length) != EN_OK, | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19001", {"file", "errmsg"}, {input_file, strerror(errno)}); | |||
| return kFileSizeOutLimitedOrOpenFailed, "Open file[%s] failed. %s", input_file.c_str(), strerror(errno)); | |||
| return kFileSizeOutLimitedOrOpenFailed, "Open file[%s] failed. errmsg:%s", input_file.c_str(), strerror(errno)); | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG((file_length == 0), | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19015", {"filepath"}, {input_file}); | |||
| @@ -226,7 +226,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int CreateDirectory(const std:: | |||
| if (ret != 0) { | |||
| if (errno != EEXIST) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable.", directory_path.c_str()); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | |||
| directory_path.c_str(), strerror(errno)); | |||
| return ret; | |||
| } | |||
| } | |||
| @@ -237,7 +238,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY int CreateDirectory(const std:: | |||
| if (ret != 0) { | |||
| if (errno != EEXIST) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E19006", {"path"}, {directory_path}); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable.", directory_path.c_str()); | |||
| GELOGW("Can not create directory %s. Make sure the directory exists and writable. errmsg:%s", | |||
| directory_path.c_str(), strerror(errno)); | |||
| return ret; | |||
| } | |||
| } | |||
| @@ -310,7 +312,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY bool ReadProtoFromMem(const cha | |||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() { | |||
| mmTimeval tv{}; | |||
| int ret = mmGetTimeOfDay(&tv, nullptr); | |||
| GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d", ret); | |||
| GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed, ret:%d, errmsg:%s", ret, strerror(errno)); | |||
| auto total_use_time = tv.tv_usec + tv.tv_sec * 1000000; // 1000000: seconds to microseconds | |||
| return static_cast<uint64_t>(total_use_time); | |||
| } | |||
| @@ -318,7 +320,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint64_t GetCurrentTimestamp() | |||
| FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY uint32_t GetCurrentSecondTimestap() { | |||
| mmTimeval tv{}; | |||
| int ret = mmGetTimeOfDay(&tv, nullptr); | |||
| GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed: ret=%d", ret); | |||
| GE_LOGE_IF(ret != EN_OK, "Func gettimeofday may failed, ret:%d, errmsg:%s", ret, strerror(errno)); | |||
| auto total_use_time = tv.tv_sec; // seconds | |||
| return static_cast<uint32_t>(total_use_time); | |||
| } | |||
| @@ -568,7 +570,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status CheckPath(const char *pa | |||
| INT32 is_dir = mmIsDir(path); | |||
| if (is_dir != EN_OK) { | |||
| GELOGE(PATH_INVALID, "Open directory %s failed, maybe it is not exit or not a dir", path); | |||
| GELOGE(PATH_INVALID, "Open directory %s failed, maybe it is not exit or not a dir. errmsg:%s", | |||
| path, strerror(errno)); | |||
| return PATH_INVALID; | |||
| } | |||
| @@ -435,7 +435,7 @@ Status DNNEngineManager::ReadJsonFile(const std::string &file_path, JsonHandle h | |||
| const char *file = file_path.data(); | |||
| if ((mmAccess2(file, M_F_OK)) != EN_OK) { | |||
| if (engines_map_.size() != 0) { | |||
| GELOGE(FAILED, "The json file %s is not exist, %s", file_path.c_str(), strerror(errno)); | |||
| GELOGE(FAILED, "The json file %s is not exist, errmsg:%s", file_path.c_str(), strerror(errno)); | |||
| return FAILED; | |||
| } else { | |||
| GELOGW("The json file %s is not needed.", file_path.c_str()); | |||
| @@ -82,7 +82,9 @@ Status GetDataNumber(const GeTensorDesc &out_desc, uint64_t &data_num) { | |||
| void HostCpuEngine::CloseSo() { | |||
| for (auto handle : lib_handles_) { | |||
| if (mmDlclose(handle) != 0) { | |||
| GELOGW("failed to close handle, message: %s", mmDlerror()); | |||
| const char *error = mmDlerror(); | |||
| error = (error == nullptr) ? "" : error; | |||
| GELOGW("failed to close handle, message: %s", error); | |||
| } | |||
| } | |||
| lib_handles_.clear(); | |||
| @@ -284,7 +286,7 @@ Status HostCpuEngine::ListSoFiles(const std::string &base_dir, std::vector<std:: | |||
| mmDirent **entries = nullptr; | |||
| auto ret = mmScandir(real_path.c_str(), &entries, RegularFileFilterFn, nullptr); | |||
| if (ret < 0) { | |||
| GELOGW("scan dir failed. path = %s, ret = %d", real_path.c_str(), ret); | |||
| GELOGW("scan dir failed. path = %s, ret = %d, errmsg = %s", real_path.c_str(), ret, strerror(errno)); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -324,7 +326,9 @@ Status HostCpuEngine::LoadLib(const std::string &lib_path) { | |||
| GELOGI("To invoke dlopen on lib: %s", lib_path.c_str()); | |||
| auto handle = mmDlopen(lib_path.c_str(), MMPA_RTLD_NOW | MMPA_RTLD_GLOBAL); | |||
| if (handle == nullptr) { | |||
| GELOGE(INTERNAL_ERROR, "Failed to invoke dlopen. path = %s, error = %s", lib_path.c_str(), mmDlerror()); | |||
| const char *error = mmDlerror(); | |||
| error = (error == nullptr) ? "" : error; | |||
| GELOGE(INTERNAL_ERROR, "Failed to invoke dlopen. path = %s, error = %s", lib_path.c_str(), error); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -377,7 +377,7 @@ Status GeGenerator::Initialize(const map<string, string> &options, OmgContext &o | |||
| return MEMALLOC_FAILED; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsProtoInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsProtoInit); | |||
| string opsproto_path; | |||
| GetOpsProtoPath(opsproto_path); | |||
| GELOGI("Get opsproto path is %s", opsproto_path.c_str()); | |||
| @@ -426,7 +426,7 @@ Status GeGenerator::Initialize(const map<string, string> &options, OmgContext &o | |||
| } | |||
| Status GeGenerator::Finalize() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); | |||
| GE_CHECK_NOTNULL_EXEC(impl_, return PARAM_INVALID); | |||
| Status ret = impl_->graph_manager_.Finalize(); | |||
| if (ret != SUCCESS) { | |||
| @@ -438,14 +438,14 @@ Status GeGenerator::Finalize() { | |||
| Status GeGenerator::GenerateOfflineModel(const Graph &graph, const string &file_name_prefix, | |||
| const vector<GeTensor> &inputs) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGI("Start to generate offline model."); | |||
| ModelBufferData model; | |||
| return GenerateModel(graph, file_name_prefix, inputs, model, true); | |||
| } | |||
| Status GeGenerator::GenerateOnlineModel(const Graph &graph, const vector<GeTensor> &inputs, ModelBufferData &model) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| return GenerateModel(graph, "online", inputs, model, false); | |||
| } | |||
| @@ -893,7 +893,7 @@ Status GeGenerator::BuildSingleOp(OpDescPtr &op_desc, const vector<GeTensor> &in | |||
| Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | |||
| const vector<GeTensor> &outputs, const string &model_file_name, | |||
| int32_t compile_flag) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGI("Start to build single op offline model, input size: %zu, output size: %zu", inputs.size(), outputs.size()); | |||
| ModelBufferData model_buff; | |||
| OpEngineType engine_type = ENGINE_SYS; | |||
| @@ -917,7 +917,7 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor | |||
| Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | |||
| const vector<GeTensor> &outputs, OpEngineType engine_type, | |||
| ModelBufferData &model_buff) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGI("Start to build single op online, input size: %zu, output size: %zu", inputs.size(), outputs.size()); | |||
| Status status = BuildSingleOp(op_desc, inputs, outputs, kFileNameSuffix, engine_type, model_buff, false); | |||
| GELOGI("Finish build single online model, status: %u", status); | |||
| @@ -927,7 +927,7 @@ Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor | |||
| Status GeGenerator::BuildSingleOpModel(OpDescPtr &op_desc, const vector<GeTensor> &inputs, | |||
| const vector<GeTensor> &outputs, OpEngineType engine_type, int32_t compile_flag, | |||
| ModelBufferData &model_buff) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGI("Start to build single op online, input size: %zu, output size: %zu", inputs.size(), outputs.size()); | |||
| Status status = BuildSingleOp(op_desc, inputs, outputs, kFileNameSuffix, engine_type, model_buff, false, | |||
| compile_flag); | |||
| @@ -1073,7 +1073,7 @@ Status GeGenerator::Impl::BuildModel(const Graph &graph, const vector<GeTensor> | |||
| ret = graph_manager_.BuildGraph(graph_id, inputs, ge_root_model, session_id); | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| if (ret != SUCCESS) { | |||
| GELOGE(GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED, "GraphManager build graph fail, graph id: %u", graph_id); | |||
| ret = GE_GENERATOR_GRAPH_MANAGER_BUILD_GRAPH_FAILED; | |||
| @@ -233,7 +233,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, | |||
| return SUCCESS; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPreBuild); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPreBuild); | |||
| GELOGI("Begin to build known shape graph[%s].", comp_graph->GetName().c_str()); | |||
| Status ret = SecondPartition(comp_graph); | |||
| GE_CHK_STATUS_RET(ret, "Graph[%s] second partition Failed.", comp_graph->GetName().c_str()); | |||
| @@ -264,7 +264,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, | |||
| GE_TIMESTAMP_END(BuildModelForGetTask, "GraphBuilder::BuildModelForGetTask"); | |||
| GE_DUMP(comp_graph, "AfterBuildModel"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kTaskGenerate); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kTaskGenerate); | |||
| GE_TIMESTAMP_START(GetTaskInfo); | |||
| ret = GetTaskInfo(builder, model_ptr, comp_graph, subgraph_map, session_id); | |||
| GE_TIMESTAMP_END(GetTaskInfo, "GraphBuilder::GetTaskInfo"); | |||
| @@ -274,7 +274,7 @@ Status GraphBuilder::BuildForKnownShapeGraph(ComputeGraphPtr &comp_graph, | |||
| return ret; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| ge_model_ptr = MakeShared<ge::GeModel>(); | |||
| if (ge_model_ptr == nullptr) { | |||
| return MEMALLOC_FAILED; | |||
| @@ -336,7 +336,7 @@ Status GraphBuilder::SetConstantInputOffset(ComputeGraphPtr &comp_graph) { | |||
| Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeModelPtr &ge_model_ptr, | |||
| uint64_t session_id) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPreBuild); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPreBuild); | |||
| GELOGI("Begin to build unknown shape graph[%s].", comp_graph->GetName().c_str()); | |||
| Graph2SubGraphInfoList subgraph_map; | |||
| ge::ModelBuilder builder(session_id, comp_graph, subgraph_map, stream_max_parallel_num_, hcom_parallel_, build_mode_); | |||
| @@ -369,11 +369,11 @@ Status GraphBuilder::BuildForUnknownShapeGraph(ComputeGraphPtr &comp_graph, GeMo | |||
| GE_CHK_STATUS_RET(builder.BuildModelForGetDynShapeTask(*model_ptr), | |||
| "Graph[%s] builder BuildModelForGetDynShapeTask() return fail.", comp_graph->GetName().c_str()); | |||
| GE_TIMESTAMP_END(BuildModelForGetDynShapeTask, "GraphBuilder::BuildModelForGetDynShapeTask"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kTaskGenerate); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kTaskGenerate); | |||
| GE_TIMESTAMP_START(GetTaskInfo); | |||
| Status ret = GetTaskInfo(builder, model_ptr, comp_graph, subgraph_map, session_id); | |||
| GE_TIMESTAMP_END(GetTaskInfo, "GraphBuilder::GetTaskInfo"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GraphUtils::DumpGEGraph(comp_graph, "AfterGetTask"); | |||
| GraphUtils::DumpGEGraphToOnnx(*comp_graph, "AfterGetTask"); | |||
| @@ -794,7 +794,7 @@ Status ModelBuilder::PreBuildModel() { | |||
| Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { | |||
| GE_CHK_STATUS_RET(AdjustInputTensorFlag(), "AdjustInputTensorFlag failed!"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kStreamAlloc); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kStreamAlloc); | |||
| // Assign logical streams. | |||
| StreamAllocator stream_allocator(compute_graph_, subgraphs_); | |||
| GE_TIMESTAMP_START(AssignLogicalStreams); | |||
| @@ -802,7 +802,7 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { | |||
| "Assign logical streams failed."); | |||
| GE_TIMESTAMP_END(AssignLogicalStreams, "GraphBuilder::AssignLogicalStreams"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kMemoryAlloc); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kMemoryAlloc); | |||
| // Assign functional op labels. | |||
| auto root_graph = GraphUtils::FindRootGraph(compute_graph_); | |||
| (void)AttrUtils::GetInt(*root_graph, ATTR_MODEL_LABEL_NUM, label_num_); | |||
| @@ -813,7 +813,7 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { | |||
| "Assign Memory Failed!"); | |||
| GE_TIMESTAMP_END(AssignMemory, "GraphBuilder::AssignMemory"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GE_TIMESTAMP_START(SetInputOutputOffset); | |||
| SetInputOutputOffsetPass input_output_offset; | |||
| GE_CHK_STATUS_RET(input_output_offset.Run(compute_graph_), "Set input output offset failed."); | |||
| @@ -824,14 +824,14 @@ Status ModelBuilder::BuildModelForGetTask(ge::Model &model) { | |||
| GE_CHK_STATUS_RET(CompileSingleOp(), "ATC builder CompileSingleOp() return fail."); | |||
| GE_TIMESTAMP_EVENT_END(CompileSingleOp, "GraphBuilder::CompileSingleOp"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kStreamAlloc); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kStreamAlloc); | |||
| // Refresh real streams and insert event nodes. | |||
| GE_TIMESTAMP_START(RefreshRealStream); | |||
| GE_CHK_STATUS_RET(stream_allocator.RefreshRealStream(stream_num_, event_num_), "RefreshRealStream failed."); | |||
| huge_streams_ = stream_allocator.GetHugeStreams(); | |||
| GE_TIMESTAMP_END(RefreshRealStream, "GraphBuilder::RefreshRealStream"); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GE_TIMESTAMP_START(MergeWeights); | |||
| GE_CHK_STATUS_RET(MergeWeights(), "MergeWeights Failed!"); | |||
| GE_TIMESTAMP_END(MergeWeights, "GraphBuilder::MergeWeights"); | |||
| @@ -2733,7 +2733,7 @@ void *DavinciModel::Run(DavinciModel *model) { | |||
| // DeviceReset before thread run finished! | |||
| GE_MAKE_GUARD(not_used_var, [&] { GE_CHK_RT(rtDeviceReset(device_id)); }); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| while (model->RunFlag()) { | |||
| // Model hasn't truly started runing before received data | |||
| model->SetRunningFlag(false); | |||
| @@ -2886,7 +2886,7 @@ Status DavinciModel::ModelRunStart() { | |||
| int64_t maxDumpOpNum = std::strtol(opt.c_str(), nullptr, kDecimal); | |||
| maxDumpOpNum_ = maxDumpOpNum; | |||
| error_context_ = ErrorManager::GetInstance().GetErrorContext(); | |||
| error_context_ = ErrorManager::GetInstance().GetErrorManagerContext(); | |||
| CREATE_STD_THREAD(thread_id_, DavinciModel::Run, this); | |||
| GELOGI("model thread create success, model id:%u.", model_id_); | |||
| return SUCCESS; | |||
| @@ -424,7 +424,7 @@ class DavinciModel { | |||
| /// | |||
| uint64_t GetSessionId() const { return session_id_; } | |||
| const struct ErrorMessage::Context &GetErrorContext() const { return error_context_; } | |||
| const struct error_message::Context &GetErrorContext() const { return error_context_; } | |||
| /// | |||
| /// @ingroup ge | |||
| @@ -992,7 +992,7 @@ class DavinciModel { | |||
| vector<uintptr_t> output_mbuf_list_; // output mbuf created by dequeue task. | |||
| uint64_t session_id_; | |||
| struct ErrorMessage::Context error_context_; | |||
| struct error_message::Context error_context_; | |||
| uint32_t device_id_; | |||
| @@ -1092,7 +1092,7 @@ Status ModelManager::GenSessionId(uint64_t &session_id) { | |||
| mmTimeval tv; | |||
| if (mmGetTimeOfDay(&tv, nullptr) != 0) { | |||
| REPORT_CALL_ERROR("E19999", "Call mmGetTimeOfDay fail"); | |||
| REPORT_CALL_ERROR("E19999", "Call mmGetTimeOfDay fail. errmsg:%s", strerror(errno)); | |||
| GELOGE(INTERNAL_ERROR, "Failed to get current time."); | |||
| return INTERNAL_ERROR; | |||
| } | |||
| @@ -31,7 +31,9 @@ Status SuperKernelFactory::Init() { | |||
| std::string skt_bin = "libcce_aicore.so"; | |||
| handle_ = mmDlopen(skt_bin.c_str(), MMPA_RTLD_NOW | MMPA_RTLD_GLOBAL); | |||
| if (handle_ == nullptr) { | |||
| GELOGE(FAILED, "SKT: open skt lib failed, please check LD_LIBRARY_PATH."); | |||
| const char* error = mmDlerror(); | |||
| GE_IF_BOOL_EXEC(error == nullptr, error = ""); | |||
| GELOGE(FAILED, "SKT: open skt lib failed, please check LD_LIBRARY_PATH. errmsg:%s", error); | |||
| } | |||
| rtError_t rt_ret; | |||
| rt_ret = rtGetFunctionByName(this->sk_stub_name_.c_str(), &this->func_stub_); | |||
| @@ -165,7 +165,7 @@ GraphManager::GraphManager() | |||
| } | |||
| Status GraphManager::Initialize(const std::map<string, string> &options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| if (init_flag_) { | |||
| GELOGW("[Initialize] GraphManager already initialized."); | |||
| return SUCCESS; | |||
| @@ -683,7 +683,7 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr | |||
| std::future<Status> f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this, | |||
| compute_graph->GetGraphID(), subgraph, | |||
| compute_graph->GetName(), session_id, | |||
| ErrorManager::GetInstance().GetErrorContext(), | |||
| ErrorManager::GetInstance().GetErrorManagerContext(), | |||
| GetThreadLocalContext()); | |||
| if (!f.valid()) { | |||
| GELOGE(FAILED, "Future is invalid"); | |||
| @@ -700,7 +700,7 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr | |||
| std::future<Status> f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this, | |||
| compute_graph->GetGraphID(), subgraph, | |||
| compute_graph->GetName(), session_id, | |||
| ErrorManager::GetInstance().GetErrorContext(), | |||
| ErrorManager::GetInstance().GetErrorManagerContext(), | |||
| GetThreadLocalContext()); | |||
| if (!f.valid()) { | |||
| GELOGE(FAILED, "Future is invalid"); | |||
| @@ -812,7 +812,7 @@ Status GraphManager::SetSubgraph(uint64_t session_id, ComputeGraphPtr compute_gr | |||
| Status GraphManager::PreRunOptimizeOriginalGraph(const GraphNodePtr &graph_node, const std::vector<GeTensor> &inputs, | |||
| ge::ComputeGraphPtr &compute_graph, uint64_t session_id) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPrepareOptimize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPrepareOptimize); | |||
| GE_CHECK_NOTNULL(graph_node); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| @@ -821,10 +821,10 @@ Status GraphManager::PreRunOptimizeOriginalGraph(const GraphNodePtr &graph_node, | |||
| GM_RUN_AND_DUMP_PERF("HandleSummaryOp", stages.optimizer.HandleSummaryOp, compute_graph); | |||
| GM_RUN_AND_DUMP_PERF("Prepare", stages.preparer.PrepareDynShape, graph_node, inputs, compute_graph, | |||
| session_id); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOriginOptimize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOriginOptimize); | |||
| GM_RUN_AND_DUMP_PERF("OptimizeOriginalGraph", stages.optimizer.OptimizeOriginalGraph, compute_graph); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kPrepareOptimize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kPrepareOptimize); | |||
| GM_RUN_AND_DUMP_PERF("PrepareRunningFormatRefiner", stages.preparer.PrepareRunningFormatRefiner); | |||
| GM_RUN_AND_DUMP_PERF("RefineRunningFormat", stages.optimizer.OptimizeOriginalGraphJudgeInsert, compute_graph); | |||
| GM_RUN_AND_DUMP_PERF("SubexpressionMigration", SubexpressionMigration, compute_graph); | |||
| @@ -867,7 +867,7 @@ Status GraphManager::PreRunAfterOptimizeSubGraph(const GraphNodePtr &graph_node, | |||
| GE_CHECK_NOTNULL(graph_node); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kMergeGraphOptimize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kMergeGraphOptimize); | |||
| CompilerStages &stages = GetCompilerStages(graph_node->GetGraphId()); | |||
| GM_RUN_AND_DUMP_PERF("OptimizeWholeGraph", stages.optimizer.OptimizeWholeGraph, compute_graph); | |||
| GM_RUN_AND_DUMP_PERF("Optimize2", OptimizeStage2, compute_graph); | |||
| @@ -961,7 +961,7 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector<Ge | |||
| } | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kSubGraphOptimize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kSubGraphOptimize); | |||
| // set fuzz compile flag after origin graph optimize | |||
| GE_CHK_STATUS_RET(SetFuzzCompileFlag(compute_graph), "Set fuzz compile flag failed."); | |||
| ret = PreRunOptimizeSubGraph(graph_node, compute_graph, session_id); | |||
| @@ -985,7 +985,7 @@ Status GraphManager::PreRun(const GraphNodePtr &graph_node, const std::vector<Ge | |||
| } | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| // when set incre build, save om model and var manager | |||
| GeModelPtr ge_model = nullptr; | |||
| auto save_ret = SaveCacheAfterBuild(graph_node->GetGraphId(), compute_graph, ge_model); | |||
| @@ -1033,7 +1033,7 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: | |||
| // it will not execute graph prreprocess, optimize, parition, build if the graph has built successful. | |||
| Status ret = SUCCESS; | |||
| if (IsGraphNeedBuild(graph_node)) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| if (graph_node->GetBuildFlag()) { | |||
| REPORT_INNER_ERROR("E19999", "Graph:%u has not build before, can't run directly, " | |||
| "check invalid", graph_node->GetGraphId()); | |||
| @@ -1055,7 +1055,7 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: | |||
| return ret; | |||
| } | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelLoad, ErrorMessage::kModelLoad); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); | |||
| if (!graph_node->IsAsync()) { | |||
| ret = LoadGraph(ge_root_model, graph_node); | |||
| } else { | |||
| @@ -1068,7 +1068,7 @@ Status GraphManager::StartForRunGraph(const GraphNodePtr &graph_node, const std: | |||
| graph_node->SetBuildFlag(true); | |||
| var_acc_ctrl_.SetGraphBuildEnd(graph_node->GetGraphId()); | |||
| } else if (!graph_node->GetLoadFlag()) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelLoad, ErrorMessage::kModelLoad); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); | |||
| GeRootModelPtr ge_root_model_ptr = graph_node->GetGeRootModel(); | |||
| if (!graph_node->IsAsync()) { | |||
| ret = LoadGraph(ge_root_model_ptr, graph_node); | |||
| @@ -1227,7 +1227,7 @@ Status GraphManager::InnerRunGraph(GraphNodePtr &graph_node, const GraphId &grap | |||
| Status GraphManager::RunGraph(const GraphId &graph_id, const std::vector<GeTensor> &inputs, | |||
| std::vector<GeTensor> &outputs, uint64_t session_id) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| std::lock_guard<std::mutex> lock(run_mutex_); | |||
| GELOGI("[RunGraph] start to run graph, graph_id = %u, is_train_graph: %d", graph_id, GetTrainFlag()); | |||
| @@ -1288,7 +1288,7 @@ Status GraphManager::RunGraph(const GraphId &graph_id, const std::vector<GeTenso | |||
| return ret; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| // excute graph | |||
| ret = InnerRunGraph(graph_node, graph_id, inputs, outputs); | |||
| if (ret != SUCCESS) { | |||
| @@ -1421,7 +1421,7 @@ Status GraphManager::BuildGraphForUnregisteredOp(const GraphId &graph_id, const | |||
| Status GraphManager::BuildGraph(const GraphId &graph_id, const std::vector<GeTensor> &inputs, | |||
| GeRootModelPtr &ge_root_model, uint64_t session_id, bool async) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGD("[BuildGraph] start to build graph, graph_id:%u", graph_id); | |||
| if (inputs.empty()) { | |||
| GELOGW("[BuildGraph] BuildGraph warning: empty GeTensor inputs"); | |||
| @@ -2812,10 +2812,10 @@ Status GraphManager::ProcessSubGraphWithMultiThreads(GraphManager *graph_manager | |||
| const SubGraphInfoPtr &sub_graph_info_ptr, | |||
| const std::string &root_graph_name, | |||
| uint64_t session_id, | |||
| const struct ErrorMessage::Context &error_context, | |||
| const struct error_message::Context &error_context, | |||
| const GEThreadLocalContext &ge_context) { | |||
| ErrorManager::GetInstance().SetErrorContext(error_context); | |||
| if (sub_graph_info_ptr != nullptr && graph_manager != nullptr) { | |||
| ErrorManager::GetInstance().SetErrorContext(error_context); | |||
| GetContext().SetSessionId(session_id); | |||
| GetThreadLocalContext() = ge_context; | |||
| graph_manager->UpdateLocalOmgContext(root_graph_id); | |||
| @@ -2865,11 +2865,11 @@ Status GraphManager::ProcessSubGraphWithMultiThreads(GraphManager *graph_manager | |||
| // run graph async on session | |||
| Status GraphManager::RunGraphAsync(const GraphId &graph_id, const std::vector<ge::InputTensorInfo> &inputs, | |||
| uint64_t session_id, RunAsyncCallback callback) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| GELOGI("[GraphManager] Start to run graph async, graph_id=%u, inputsSize=%zu.", graph_id, inputs.size()); | |||
| bool ret = prerun_args_q_.Push(PreRunArgs({graph_id, inputs, session_id, | |||
| ErrorManager::GetInstance().GetErrorContext(), | |||
| ErrorManager::GetInstance().GetErrorManagerContext(), | |||
| GetThreadLocalContext(), callback})); | |||
| if (!ret) { | |||
| GELOGE(FAILED, "[GraphManager] Run graph async failed, graph_id=%u.", graph_id); | |||
| @@ -2990,7 +2990,7 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { | |||
| GELOGI("[PreRunThread] A new loop start, graph_id:%u.", args.graph_id); | |||
| ErrorManager::GetInstance().SetErrorContext(args.error_context); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GetContext().SetSessionId(args.session_id); | |||
| GetThreadLocalContext() = args.context; | |||
| graph_manager->UpdateLocalOmgContext(args.graph_id); | |||
| @@ -3160,7 +3160,7 @@ Status GraphManager::ParseInputsDims(const std::vector<InputTensorInfo> &input_t | |||
| } | |||
| void GraphManager::RunThread(GraphManager *graph_manager) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| if (prctl(PR_SET_NAME, ("GE_Run")) != 0) { | |||
| GELOGW("Set thread name failed."); | |||
| } | |||
| @@ -3190,7 +3190,7 @@ void GraphManager::RunThread(GraphManager *graph_manager) { | |||
| args.graph_node->UpdateLoadFlag(); | |||
| if (!args.graph_node->GetLoadFlag()) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelLoad, ErrorMessage::kModelLoad); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelLoad, error_message::kModelLoad); | |||
| args.ge_root_model->SetTrainFlag(graph_manager->GetTrainFlag()); | |||
| ret = graph_manager->LoadGraphAsync(args.ge_root_model, args.graph_node); | |||
| if (ret != SUCCESS || args.ge_root_model == nullptr) { | |||
| @@ -3208,7 +3208,7 @@ void GraphManager::RunThread(GraphManager *graph_manager) { | |||
| args.ge_root_model->GetModelId()); | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelExecute, ErrorMessage::kModelExecute); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelExecute, error_message::kModelExecute); | |||
| if (graph_manager->GetTrainFlag()) { | |||
| ret = graph_manager->graph_executor_.SetGraphContext(graph_manager->GetGraphContext()); | |||
| if (ret != SUCCESS) { | |||
| @@ -3506,7 +3506,7 @@ Status GraphManager::ConvertGraphToFile(ComputeGraphPtr &compute_graph, GraphPar | |||
| Status GraphManager::Build(const GraphNodePtr &graph_node, ComputeGraphPtr &compute_graph, | |||
| GeRootModelPtr &ge_root_model, uint64_t session_id) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| // build | |||
| if (compute_graph != nullptr) { | |||
| std::string graph_name = compute_graph->GetName(); | |||
| @@ -210,7 +210,7 @@ class GraphManager { | |||
| GraphId graph_id; | |||
| std::vector<ge::InputTensorInfo> input_tensor; | |||
| uint64_t session_id; | |||
| struct ErrorMessage::Context error_context; | |||
| struct error_message::Context error_context; | |||
| GEThreadLocalContext context; | |||
| RunAsyncCallback callback; | |||
| }; | |||
| @@ -219,7 +219,7 @@ class GraphManager { | |||
| GraphNodePtr graph_node; | |||
| GraphId graph_id; | |||
| uint64_t session_id; | |||
| struct ErrorMessage::Context error_context; | |||
| struct error_message::Context error_context; | |||
| std::vector<ge::InputTensorInfo> input_tensor; | |||
| GeRootModelPtr ge_root_model; | |||
| GEThreadLocalContext context; | |||
| @@ -237,7 +237,7 @@ class GraphManager { | |||
| const SubGraphInfoPtr &sub_graph_info_ptr, | |||
| const std::string &root_graph_name, | |||
| uint64_t session_id, | |||
| const struct ErrorMessage::Context &error_context, | |||
| const struct error_message::Context &error_context, | |||
| const GEThreadLocalContext &ge_context); | |||
| Status ParseInputsDims(const std::vector<InputTensorInfo> &input_tensor); | |||
| void ParseInputsDimsForData(const std::vector<InputTensorInfo> &input_tensor); | |||
| @@ -487,7 +487,7 @@ Status TransVarDataUtils::TransAllVarData(const vector<NodePtr> &variable_nodes, | |||
| std::future<Status> f = executor.commit( | |||
| [](const ge::NodePtr &node, uint64_t session_id, rtContext_t ctx, uint32_t graph_id, | |||
| const struct ErrorMessage::Context &error_context) -> Status { | |||
| const struct error_message::Context &error_context) -> Status { | |||
| ErrorManager::GetInstance().SetErrorContext(error_context); | |||
| rtError_t rt_ret = rtCtxSetCurrent(ctx); | |||
| if (rt_ret != RT_ERROR_NONE) { | |||
| @@ -525,7 +525,7 @@ Status TransVarDataUtils::TransAllVarData(const vector<NodePtr> &variable_nodes, | |||
| } | |||
| return SUCCESS; | |||
| }, | |||
| node, session_id, context, graph_id, ErrorManager::GetInstance().GetErrorContext()); | |||
| node, session_id, context, graph_id, ErrorManager::GetInstance().GetErrorManagerContext()); | |||
| if (!f.valid()) { | |||
| GELOGE(FAILED, "Future is invalid"); | |||
| return FAILED; | |||
| @@ -35,14 +35,14 @@ void Debug::DumpProto(const Message &proto, const char *file) { | |||
| int fd = mmOpen2(file_path.c_str(), M_WRONLY | M_CREAT | O_TRUNC, M_IRUSR | M_IWUSR | M_UMASK_GRPREAD | | |||
| M_UMASK_OTHREAD); | |||
| if (fd == -1) { | |||
| GELOGW("Write %s failed", file_path.c_str()); | |||
| GELOGW("Write %s failed. errmsg:%s", file_path.c_str(), strerror(errno)); | |||
| return; | |||
| } | |||
| auto output = ge::MakeShared<FileOutputStream>(fd); | |||
| if (output == nullptr) { | |||
| GELOGW("create output failed."); | |||
| if (mmClose(fd) != 0) { | |||
| GELOGW("close fd failed."); | |||
| GELOGW("close fd failed. errmsg:%s", strerror(errno)); | |||
| } | |||
| return; | |||
| } | |||
| @@ -51,7 +51,7 @@ void Debug::DumpProto(const Message &proto, const char *file) { | |||
| GELOGW("dump proto failed."); | |||
| } | |||
| if (mmClose(fd) != 0) { | |||
| GELOGW("close fd failed."); | |||
| GELOGW("close fd failed. errmsg:%s", strerror(errno)); | |||
| } | |||
| } | |||
| @@ -72,7 +72,7 @@ Status GELib::Initialize(const map<string, string> &options) { | |||
| return GE_CLI_INIT_FAILED; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kSystemInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kSystemInit); | |||
| map<string, string> new_options; | |||
| Status ret = instancePtr_->SetRTSocVersion(options, new_options); | |||
| if (ret != SUCCESS) { | |||
| @@ -115,7 +115,7 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||
| return SUCCESS; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kSystemInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kSystemInit); | |||
| GELOGI("GE System initial."); | |||
| GE_TIMESTAMP_START(SystemInitialize); | |||
| Status initSystemStatus = SystemInitialize(options); | |||
| @@ -126,7 +126,7 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||
| return initSystemStatus; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kEngineInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kEngineInit); | |||
| GELOGI("engineManager initial."); | |||
| GE_TIMESTAMP_START(EngineInitialize); | |||
| Status initEmStatus = engineManager_.Initialize(options); | |||
| @@ -138,7 +138,7 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||
| return initEmStatus; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsKernelInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsKernelInit); | |||
| GELOGI("opsManager initial."); | |||
| GE_TIMESTAMP_START(OpsManagerInitialize); | |||
| Status initOpsStatus = opsManager_.Initialize(options); | |||
| @@ -150,7 +150,7 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||
| return initOpsStatus; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOpsKernelBuilderInit); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOpsKernelBuilderInit); | |||
| GELOGI("opsBuilderManager initial."); | |||
| GE_TIMESTAMP_START(OpsKernelBuilderManagerInitialize); | |||
| Status initOpsBuilderStatus = OpsKernelBuilderManager::Instance().Initialize(options); | |||
| @@ -162,7 +162,7 @@ Status GELib::InnerInitialize(const map<string, string> &options) { | |||
| return initOpsBuilderStatus; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| GELOGI("sessionManager initial."); | |||
| GE_TIMESTAMP_START(SessionManagerInitialize); | |||
| Status initSmStatus = sessionManager_.Initialize(options); | |||
| @@ -438,7 +438,7 @@ string GELib::GetPath() { return PluginManager::GetPath(); } | |||
| // Finalize all modules | |||
| Status GELib::Finalize() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); | |||
| GELOGI("finalization start"); | |||
| // Finalization is not allowed before initialization | |||
| if (!init_flag_) { | |||
| @@ -202,12 +202,12 @@ graphStatus aclgrphBuildInitializeImpl(std::map<std::string, std::string> &globa | |||
| } | |||
| graphStatus aclgrphBuildInitialize(std::map<std::string, std::string> global_options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| return aclgrphBuildInitializeImpl(global_options); | |||
| } | |||
| graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &global_options) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| std::map<std::string, std::string> tmp_global_options; | |||
| for (auto &option : global_options) { | |||
| if (option.first.GetString() == nullptr || option.second.GetString() == nullptr) { | |||
| @@ -222,7 +222,7 @@ graphStatus aclgrphBuildInitialize(std::map<AscendString, AscendString> &global_ | |||
| } | |||
| void aclgrphBuildFinalize() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); | |||
| if (ge::GELib::GetInstance() != nullptr && ge::GELib::GetInstance()->InitFlag()) { | |||
| (void)ge::GELib::GetInstance()->Finalize(); | |||
| return; | |||
| @@ -595,7 +595,7 @@ graphStatus Impl::InitDomiOmgContext(const string &input_shape, const string &in | |||
| graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string, std::string> &build_options, | |||
| ModelBufferData &model) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGD("Enter aclmdlBuildModel process!"); | |||
| Impl builder; | |||
| return builder.BuildModel(graph, build_options, model); | |||
| @@ -603,7 +603,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<std::string | |||
| graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendString, AscendString> &build_options, | |||
| ModelBufferData &model) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGD("Enter aclmdlBuildModel process!"); | |||
| std::map<std::string, std::string> tmp_build_options; | |||
| for (auto &option : build_options) { | |||
| @@ -621,7 +621,7 @@ graphStatus aclgrphBuildModel(const ge::Graph &graph, const std::map<AscendStrin | |||
| } | |||
| graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &model) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGD("Enter aclmdlSaveModel process!"); | |||
| if (model.data.get() == nullptr || model.length == 0) { | |||
| GELOGE(GRAPH_PARAM_INVALID, "[Check][ModelBufferData] model is illegal"); | |||
| @@ -632,7 +632,7 @@ graphStatus aclgrphSaveModel(const string &output_file, const ModelBufferData &m | |||
| } | |||
| graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &model) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGD("Enter aclmdlSaveModel process!"); | |||
| if (model.data.get() == nullptr || model.length == 0) { | |||
| GELOGE(GRAPH_PARAM_INVALID, "[Check][ModelBufferData]model is illegal"); | |||
| @@ -648,7 +648,7 @@ graphStatus aclgrphSaveModel(const char *output_file, const ModelBufferData &mod | |||
| } | |||
| graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *patch_version) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GELOGD("Enter aclgrphGetIRVersion process!"); | |||
| GE_CHECK_NOTNULL(major_version); | |||
| GE_CHECK_NOTNULL(minor_version); | |||
| @@ -660,7 +660,7 @@ graphStatus aclgrphGetIRVersion(int *major_version, int *minor_version, int *pat | |||
| } | |||
| graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const size_t len) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| GE_CHECK_NOTNULL(file); | |||
| if (len > PATH_MAX || len != strlen(file) || strlen(file) == 0) { | |||
| @@ -716,7 +716,7 @@ graphStatus aclgrphDumpGraph(const ge::Graph &graph, const char *file, const siz | |||
| graphStatus aclgrphGenerateForOp(const AscendString &op_type, const vector<TensorDesc> &inputs, | |||
| const vector<TensorDesc> &outputs, Graph &graph) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| auto op_type_str = std::string(op_type.GetString()); | |||
| auto op_name = op_type_str + "_" + std::to_string(ge::GetCurrentTimestamp()); | |||
| auto op_desc = ge::MakeShared<ge::OpDesc>(op_name, op_type_str); | |||
| @@ -776,7 +776,7 @@ static std::string AttrTypeToSerialString(aclgrphAttrType attr_type) { | |||
| } | |||
| graphStatus aclgrphSetOpAttr(Graph &graph, aclgrphAttrType attr_type, const char *cfg_path) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| auto compute_graph = GraphUtils::GetComputeGraph(graph); | |||
| GE_CHECK_NOTNULL(compute_graph); | |||
| if (cfg_path == nullptr) { | |||
| @@ -158,7 +158,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||
| vector<int64_t> shape = iter->second; | |||
| if (shape.empty()) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10012"); | |||
| GELOGE(ge::PARAM_INVALID, | |||
| GELOGE(ge::PARAM_INVALID, | |||
| "[Check][DynamicBatchSizeInputShape] shape size can not be less than 1 when set --dynamic_batch_size."); | |||
| return false; | |||
| } | |||
| @@ -175,7 +175,7 @@ bool CheckDynamicBatchSizeInputShapeValid(map<string, vector<int64_t>> shape_map | |||
| if (size == 0) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10031"); | |||
| GELOGE(ge::PARAM_INVALID, | |||
| GELOGE(ge::PARAM_INVALID, | |||
| "[Check][DynamicBatchSizeInputShape]At least one batch n must be equal to -1 when set dynamic_batch_size."); | |||
| return false; | |||
| } | |||
| @@ -319,7 +319,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims | |||
| if (split_set.size() > kMaxDynamicDimNum) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage( | |||
| "E10042", {"parameter", "reason"}, {"dynamic_dims", "dynamic_dims's num of parameter set can not exceed 100"}); | |||
| GELOGE(ge::PARAM_INVALID, | |||
| GELOGE(ge::PARAM_INVALID, | |||
| "[CheckAndParse][DynamicDims]dynamic_dims's num of parameter set can not exceed %zu.", kMaxDynamicDimNum); | |||
| return false; | |||
| } | |||
| @@ -340,7 +340,7 @@ bool CheckAndParseDynamicDims(int32_t dynamic_dim_num, std::string &dynamic_dims | |||
| ErrorManager::GetInstance().ATCReportErrMessage( | |||
| "E10001", {"parameter", "value", "reason"}, | |||
| {"--dynamic_dims's parameter", dim.c_str(), "must be positive integer"}); | |||
| GELOGE(ge::PARAM_INVALID, | |||
| GELOGE(ge::PARAM_INVALID, | |||
| "[CheckAndParse][DynamicDims]--dynamic_dims:%s parameter must be positive integer.", | |||
| dynamic_dims.c_str()); | |||
| return false; | |||
| @@ -402,7 +402,7 @@ Status ParseInputShapeRange(const std::string &shape_range, | |||
| if (shape_range_pair_vec.size() != DEFAULT_SHAPE_RANGE_PAIR_SIZE) { | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10048", {"shape_range", "reason", "sample"}, | |||
| {shape_range, kSplitError1, kInputShapeRangeSample1}); | |||
| GELOGE(PARAM_INVALID, "[Parse][Parameter]--input shape_range:%s invalid, reason: %s, correct sample is %s.", | |||
| GELOGE(PARAM_INVALID, "[Parse][Parameter]--input shape_range:%s invalid, reason: %s, correct sample is %s.", | |||
| shape_range.c_str(), kSplitError1, kInputShapeRangeSample1); | |||
| return PARAM_INVALID; | |||
| } | |||
| @@ -698,6 +698,11 @@ Status CheckKeepTypeParamValid(const std::string &keep_dtype) { | |||
| int CheckLogParamValidAndSetLogLevel(const std::string log) { | |||
| int ret = -1; | |||
| char *npu_collect_path = std::getenv("NPU_COLLECT_PATH"); | |||
| if (npu_collect_path != nullptr && log == "null") { | |||
| return 0; | |||
| } | |||
| if (log == "default") { | |||
| ret = 0; | |||
| } else if (log == "null") { | |||
| @@ -971,7 +971,7 @@ domi::Status GenerateModel(std::map<string, string> &options, std::string output | |||
| ge::Graph graph; | |||
| std::vector<ge::GeTensor> inputs; | |||
| if (FLAGS_framework == domi::MINDSPORE) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| // load model from file | |||
| ge::Model load_model = ge::Model("loadmodel", "version2"); | |||
| auto ret1 = load_model.LoadFromFile(FLAGS_model); | |||
| @@ -1012,12 +1012,12 @@ domi::Status GenerateModel(std::map<string, string> &options, std::string output | |||
| atc_params.insert(std::pair<string, string>(string(ge::OUTPUT_DATATYPE), FLAGS_output_type)); | |||
| atc_params.insert(std::pair<string, string>("output", output)); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| Status ret = | |||
| ParseGraph(graph, atc_params, FLAGS_model.c_str(), FLAGS_weight.c_str(), (domi::FrameworkType)FLAGS_framework, | |||
| FLAGS_op_name_map.c_str(), FLAGS_target.c_str(), (ge::RunMode)FLAGS_mode, is_dynamic_input); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| // in ONLY_PRE_CHECK mode, pre-checking report has already saved in ParseGraph | |||
| if (FLAGS_mode == ge::ONLY_PRE_CHECK) { | |||
| (void)ge_generator.Finalize(); | |||
| @@ -1117,7 +1117,7 @@ domi::Status GenerateSingleOp(const std::string& json_file_path) { | |||
| return domi::FAILED; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kParser); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kParser); | |||
| vector<ge::SingleOpBuildParam> build_params; | |||
| if (ge::SingleOpParser::ParseSingleOpList(json_file_path, build_params) != ge::SUCCESS) { | |||
| DOMI_LOGE("parse single op json file failed"); | |||
| @@ -1253,7 +1253,7 @@ domi::Status GenerateOmModel() { | |||
| return domi::FAILED; | |||
| } | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| if (FLAGS_display_model_info == "1") { | |||
| GELOGI("need to display model info."); | |||
| return ge::ConvertOm(FLAGS_output.c_str(), "", false); | |||
| @@ -1263,7 +1263,7 @@ domi::Status GenerateOmModel() { | |||
| } | |||
| domi::Status ConvertModelToJson() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| Status ret = GFlagUtils::CheckConverJsonParamFlags(); | |||
| GE_CHK_BOOL_EXEC(ret == domi::SUCCESS, return domi::FAILED, "[CheckConver][JsonParamFlags] failed!"); | |||
| @@ -1274,7 +1274,7 @@ domi::Status ConvertModelToJson() { | |||
| } | |||
| domi::Status DisplayModelInfo() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| // No model path passed in | |||
| GE_CHK_BOOL_TRUE_EXEC_WITH_LOG(FLAGS_om == "", | |||
| ErrorManager::GetInstance().ATCReportErrMessage("E10004", {"parameter"}, {"om"}); | |||
| @@ -1323,7 +1323,7 @@ bool CheckRet(domi::Status ret) { | |||
| } | |||
| domi::Status ConvertPbtxtToJson() { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kModelCompile, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kModelCompile, error_message::kOther); | |||
| Status ret = GFlagUtils::CheckConverJsonParamFlags(); | |||
| if (ret != domi::SUCCESS) { | |||
| GELOGE(ge::FAILED, "[CheckConver][JsonParamFlags] failed!"); | |||
| @@ -1413,7 +1413,7 @@ bool CheckMemInfo() { | |||
| } | |||
| int main(int argc, char* argv[]) { | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kInitialize, ErrorMessage::kOther); | |||
| ErrorManager::GetInstance().SetStage(error_message::kInitialize, error_message::kOther); | |||
| Status ret = domi::SUCCESS; | |||
| std::cout << "ATC start working now, please wait for a moment." << std::endl; | |||
| @@ -1454,7 +1454,7 @@ int main(int argc, char* argv[]) { | |||
| } | |||
| } while (0); | |||
| ErrorManager::GetInstance().SetStage(ErrorMessage::kFinalize, ErrorMessage::kFinalize); | |||
| ErrorManager::GetInstance().SetStage(error_message::kFinalize, error_message::kFinalize); | |||
| if (!CheckRet(ret)) { | |||
| std::cout << "ATC run failed, Please check the detail log, Try \'atc --help\' for more information" << std::endl; | |||
| int result = ErrorManager::GetInstance().OutputErrMessage(STDOUT_FILENO); | |||
| @@ -113,14 +113,13 @@ | |||
| } while (0) | |||
| // Check if the parameter is null. If yes, return PARAM_INVALID and record the error | |||
| #define GE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| REPORT_INNER_ERROR("E19999", "Param:%s is nullptr, check invalid when %s", \ | |||
| #val, __FUNCTION__); \ | |||
| DOMI_LOGE("[Check][Param:%s]null is invalid when %s.", #val, __FUNCTION__); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| #define GE_CHECK_NOTNULL(val) \ | |||
| do { \ | |||
| if (val == nullptr) { \ | |||
| REPORT_INNER_ERROR("E19999", "Param:%s is nullptr, check invalid", #val); \ | |||
| DOMI_LOGE("[Check][Param:%s]null is invalid.", #val); \ | |||
| return ge::PARAM_INVALID; \ | |||
| } \ | |||
| } while (0) | |||
| // Check if the parameter is null. If yes, just return and record the error | |||
| @@ -1 +1 @@ | |||
| Subproject commit 7ad77efb16b4a8a8d08345d600b345b7814f8ab6 | |||
| Subproject commit 22ab76ecd8461f679606374be4b3b6b6f7cad321 | |||
| @@ -16,7 +16,9 @@ | |||
| #include "common/util/error_manager/error_manager.h" | |||
| using namespace ErrorMessage; | |||
| using namespace error_message; | |||
| thread_local Context ErrorManager::error_context_ = {0, "", "", ""}; | |||
| namespace error_message { | |||
| int FormatErrorMessage(char *str_dst, size_t dst_max, const char *format, ...) { | |||
| @@ -24,8 +26,6 @@ int FormatErrorMessage(char *str_dst, size_t dst_max, const char *format, ...) { | |||
| } | |||
| } | |||
| thread_local Context ErrorManager::error_context_ = {0, "", "", ""}; | |||
| ErrorManager &ErrorManager::GetInstance() { | |||
| static ErrorManager instance; | |||
| return instance; | |||
| @@ -98,11 +98,11 @@ thread_local Context ErrorManager::error_context_ = {0, "", "", ""}; | |||
| const std::string &ErrorManager::GetLogHeader() { return error_context_.log_header; } | |||
| struct Context &ErrorManager::GetErrorContext() { | |||
| struct Context error_context; | |||
| struct error_message::Context &ErrorManager::GetErrorManagerContext() { | |||
| struct error_message::Context error_context; | |||
| return error_context; | |||
| } | |||
| void ErrorManager::SetErrorContext(struct Context error_context) {} | |||
| void ErrorManager::SetErrorContext(struct error_message::Context error_context) {} | |||
| void ErrorManager::SetStage(const std::string &first_stage, const std::string &second_stage) {} | |||
| @@ -251,7 +251,7 @@ TEST_F(UtestGraphManagerTest, test_pre_run_thread) { | |||
| GraphId graph_id = 1; | |||
| std::vector<ge::InputTensorInfo> input_tensor; | |||
| uint64_t session_id = 0; | |||
| ErrorMessage::Context error_context; | |||
| error_message::Context error_context; | |||
| GEThreadLocalContext context; | |||
| RunAsyncCallback callback; | |||
| // PreRunArgs args{graph_id, input_tensor, session_id, error_context, context, callback}; | |||
| @@ -277,7 +277,7 @@ TEST_F(UtestGraphManagerTest, test_pre_run_thread_2) { | |||
| graph_node_1->SetBuildFlag(true); | |||
| std::vector<ge::InputTensorInfo> input_tensor; | |||
| uint64_t session_id = 0; | |||
| ErrorMessage::Context error_context; | |||
| error_message::Context error_context; | |||
| GEThreadLocalContext context; | |||
| RunAsyncCallback callback; | |||
| // PreRunArgs args{graph_id, input_tensor, session_id, error_context, context, callback}; | |||
| @@ -402,4 +402,4 @@ TEST_F(UtestGraphManagerTest, test_add_graph_with_copy_fail) { | |||
| EXPECT_EQ(status, ge::SUCCESS); | |||
| status = graph_manager.AddGraphWithCopy(graph_id, graph, options, context); | |||
| EXPECT_NE(status, ge::SUCCESS); | |||
| } | |||
| } | |||