@@ -80,6 +80,12 @@ Status CheckOptionsValid(const std::map<string, string> &options) { | |||
// Initialize GE, prepare for execution, call GELib::Initialize | |||
Status GEInitializeImpl(const std::map<string, string> &options) { | |||
GELOGT(TRACE_INIT, "GEInitialize start"); | |||
std::string path_base = ge::GELib::GetPath(); | |||
auto ret = ErrorManager::GetInstance().Init(path_base); | |||
if (ret != SUCCESS) { | |||
GELOGE(GE_CLI_INIT_FAILED, "ErrorManager init fail"); | |||
return ret; | |||
} | |||
ErrorManager::GetInstance().GenWorkStreamIdDefault(); | |||
// 0.check init status | |||
@@ -114,7 +120,7 @@ Status GEInitializeImpl(const std::map<string, string> &options) { | |||
// call Initialize | |||
GELOGT(TRACE_RUNNING, "Initializing environment"); | |||
GE_TIMESTAMP_START(GELibInitialize); | |||
Status ret = ge::GELib::Initialize(options); | |||
ret = ge::GELib::Initialize(options); | |||
GE_TIMESTAMP_END(GELibInitialize, "GEInitialize::GELibInitialize"); | |||
if (ret != SUCCESS) { | |||
GELOGE(GE_CLI_INIT_FAILED, "geInitialize failed, error code = %u", ret); | |||
@@ -2590,7 +2590,7 @@ void *DavinciModel::Run(DavinciModel *model) { | |||
bool seq_end_flag = false; | |||
uint32_t model_id = model->Id(); | |||
uint32_t device_id = model->GetDeviceId(); | |||
GetContext().SetWorkStreamId(model->GetWorkStreamId()); | |||
ErrorManager::GetInstance().SetErrorContext(model->GetErrorContext()); | |||
GELOGI("Model Run thread start, model_id:%u.", model_id); | |||
rtError_t rt_ret = rtSetDevice(static_cast<int32_t>(device_id)); | |||
@@ -2753,7 +2753,7 @@ Status DavinciModel::ModelRunStart() { | |||
int64_t maxDumpOpNum = std::strtol(opt.c_str(), nullptr, kDecimal); | |||
maxDumpOpNum_ = maxDumpOpNum; | |||
work_stream_id_ = GetContext().WorkStreamId(); | |||
error_context_ = ErrorManager::GetInstance().GetErrorContext(); | |||
CREATE_STD_THREAD(thread_id_, DavinciModel::Run, this); | |||
GELOGI("model tread create success, model id:%u.", model_id_); | |||
return SUCCESS; | |||
@@ -412,7 +412,7 @@ class DavinciModel { | |||
/// | |||
uint64_t GetSessionId() const { return session_id_; } | |||
uint64_t GetWorkStreamId() const { return work_stream_id_; } | |||
const struct ErrorMessage::Context &GetErrorContext() const { return error_context_; } | |||
/// | |||
/// @ingroup ge | |||
@@ -958,7 +958,7 @@ class DavinciModel { | |||
vector<uintptr_t> output_mbuf_list_; // output mbuf created by dequeue task. | |||
uint64_t session_id_; | |||
uint64_t work_stream_id_; | |||
struct ErrorMessage::Context error_context_; | |||
uint32_t device_id_; | |||
@@ -542,7 +542,8 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr | |||
} | |||
std::future<Status> f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this, | |||
compute_graph->GetGraphID(), subgraph, | |||
compute_graph->GetName(), session_id, GetContext().WorkStreamId(), | |||
compute_graph->GetName(), session_id, | |||
ErrorManager::GetInstance().GetErrorContext(), | |||
GetThreadLocalContext()); | |||
if (!f.valid()) { | |||
GELOGE(FAILED, "Future is invalid"); | |||
@@ -558,7 +559,8 @@ Status GraphManager::OptimizeSubGraphWithMultiThreads(ComputeGraphPtr compute_gr | |||
} | |||
std::future<Status> f = executor.commit(GraphManager::ProcessSubGraphWithMultiThreads, this, | |||
compute_graph->GetGraphID(), subgraph, | |||
compute_graph->GetName(), session_id, GetContext().WorkStreamId(), | |||
compute_graph->GetName(), session_id, | |||
ErrorManager::GetInstance().GetErrorContext(), | |||
GetThreadLocalContext()); | |||
if (!f.valid()) { | |||
GELOGE(FAILED, "Future is invalid"); | |||
@@ -2509,10 +2511,10 @@ Status GraphManager::ProcessSubGraphWithMultiThreads(GraphManager *graph_manager | |||
const SubGraphInfoPtr &sub_graph_info_ptr, | |||
const std::string &root_graph_name, | |||
uint64_t session_id, | |||
uint64_t work_stream_id, | |||
const struct ErrorMessage::Context &error_context, | |||
const GEThreadLocalContext &ge_context) { | |||
if (sub_graph_info_ptr != nullptr && graph_manager != nullptr) { | |||
GetContext().SetWorkStreamId(work_stream_id); | |||
ErrorManager::GetInstance().SetErrorContext(error_context); | |||
GetContext().SetSessionId(session_id); | |||
GetThreadLocalContext() = ge_context; | |||
graph_manager->UpdateLocalOmgContext(root_graph_id); | |||
@@ -2560,7 +2562,8 @@ Status GraphManager::RunGraphAsync(const GraphId &graph_id, const std::vector<ge | |||
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, | |||
GetContext().WorkStreamId(), GetThreadLocalContext(), callback})); | |||
ErrorManager::GetInstance().GetErrorContext(), | |||
GetThreadLocalContext(), callback})); | |||
if (!ret) { | |||
GELOGE(FAILED, "[GraphManager] Run graph async failed, graph_id=%u.", graph_id); | |||
return FAILED; | |||
@@ -2647,7 +2650,7 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { | |||
GELOGI("A new loop start."); | |||
GetContext().SetWorkStreamId(args.work_stream_id); | |||
ErrorManager::GetInstance().SetErrorContext(args.error_context); | |||
GetContext().SetSessionId(args.session_id); | |||
GetThreadLocalContext() = args.context; | |||
graph_manager->UpdateLocalOmgContext(args.graph_id); | |||
@@ -2729,7 +2732,7 @@ void GraphManager::PreRunThread(GraphManager *graph_manager) { | |||
ge_root_model = graph_node->GetGeRootModel(); | |||
} | |||
graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.work_stream_id, | |||
graph_manager->run_args_q_.Push(RunArgs( { graph_node, args.graph_id, args.session_id, args.error_context, | |||
args.input_tensor, ge_root_model, GetThreadLocalContext(), args.callback })); | |||
GELOGI("Loop end."); | |||
} | |||
@@ -2829,7 +2832,7 @@ void GraphManager::RunThread(GraphManager *graph_manager) { | |||
GELOGI("A new loop start."); | |||
GetContext().SetWorkStreamId(args.work_stream_id); | |||
ErrorManager::GetInstance().SetErrorContext(args.error_context); | |||
GetContext().SetSessionId(args.session_id); | |||
GetThreadLocalContext() = args.context; | |||
graph_manager->UpdateLocalOmgContext(args.graph_id); | |||
@@ -196,7 +196,7 @@ class GraphManager { | |||
GraphId graph_id; | |||
std::vector<ge::InputTensorInfo> input_tensor; | |||
uint64_t session_id; | |||
uint64_t work_stream_id; | |||
struct ErrorMessage::Context error_context; | |||
GEThreadLocalContext context; | |||
RunAsyncCallback callback; | |||
}; | |||
@@ -205,7 +205,7 @@ class GraphManager { | |||
GraphNodePtr graph_node; | |||
GraphId graph_id; | |||
uint64_t session_id; | |||
uint64_t work_stream_id; | |||
struct ErrorMessage::Context error_context; | |||
std::vector<ge::InputTensorInfo> input_tensor; | |||
GeRootModelPtr ge_root_model; | |||
GEThreadLocalContext context; | |||
@@ -223,7 +223,7 @@ class GraphManager { | |||
const SubGraphInfoPtr &sub_graph_info_ptr, | |||
const std::string &root_graph_name, | |||
uint64_t session_id, | |||
uint64_t work_stream_id, | |||
const struct ErrorMessage::Context &error_context, | |||
const GEThreadLocalContext &ge_context); | |||
Status ParseInputsDims(const std::vector<InputTensorInfo> &input_tensor); | |||
void ParseInputsDimsForData(const std::vector<InputTensorInfo> &input_tensor); | |||
@@ -1 +1 @@ | |||
Subproject commit 29a779d0b1e0482092e387ccce2886b36dc5e395 | |||
Subproject commit 711f8dae37dfcc2db259c94edf2803986f12e2e3 |