From e7b9261eac33fd9843b661c0518712e9e6f0d68e Mon Sep 17 00:00:00 2001 From: wxl Date: Fri, 23 Oct 2020 13:15:04 +0800 Subject: [PATCH] ir_option optimize --- ge/ir_build/ge_ir_build.cc | 17 +++++++++++------ metadef | 2 +- parser | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ge/ir_build/ge_ir_build.cc b/ge/ir_build/ge_ir_build.cc index 2c9989ef..0fd613ed 100644 --- a/ge/ir_build/ge_ir_build.cc +++ b/ge/ir_build/ge_ir_build.cc @@ -171,7 +171,7 @@ class Impl { graphStatus InitDomiOmgContext(const string &input_shape, const string &input_format, const string &net_format, bool is_dynamic_input); void SetRtSocVersion(); - + void UpdateThreadContext(); public: ge::GeGenerator generator_; std::map options_; @@ -225,8 +225,6 @@ graphStatus Impl::Init(const std::map &options) { return ret; } - GetThreadLocalContext().SetGlobalOption(GetMutableGlobalOptions()); - GetThreadLocalContext().SetGraphOption(options_); std::string build_mode = (options_.find(BUILD_MODE) == options_.end() || options_[BUILD_MODE] == BUILD_MODE_NORMAL) ? "" : options_[BUILD_MODE]; options_[BUILD_MODE] = build_mode; @@ -286,7 +284,7 @@ graphStatus Impl::Init(const std::map &options) { ge::PrintOptionMap(options_, "ge option"); SetRtSocVersion(); - + UpdateThreadContext(); // 3. init generator with options_ ret = generator_.Initialize(options_, omg_context_); if (ret != GRAPH_SUCCESS) { @@ -310,6 +308,11 @@ void Impl::SetRtSocVersion() { } } +void Impl::UpdateThreadContext() { + GetThreadLocalContext().SetGlobalOption(GetMutableGlobalOptions()); + GetThreadLocalContext().SetGraphOption(options_); +} + graphStatus Impl::CreateInputsForIRBuild(const ge::Graph &graph, vector &inputs) { auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); GE_CHECK_NOTNULL(compute_graph); @@ -333,13 +336,15 @@ graphStatus Impl::CreateInputsForIRBuild(const ge::Graph &graph, vector