Browse Source

ir_option optimize

tags/v1.1.0
wxl 4 years ago
parent
commit
e7b9261eac
3 changed files with 13 additions and 8 deletions
  1. +11
    -6
      ge/ir_build/ge_ir_build.cc
  2. +1
    -1
      metadef
  3. +1
    -1
      parser

+ 11
- 6
ge/ir_build/ge_ir_build.cc View File

@@ -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<std::string, std::string> options_;
@@ -225,8 +225,6 @@ graphStatus Impl::Init(const std::map<std::string, std::string> &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<std::string, std::string> &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<ge::GeTensor> &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<ge::GeTe
data_shape = tensor.GetShape();
GELOGI("Data op get shape from InputDesc in ge ir graph.");
}

// If user point input format, do work for all data ops; else do according to tensor_desc
auto data_format = omg_context_.format != domi::DOMI_TENSOR_ND ?
ge::TypeUtils::DomiFormatToFormat(omg_context_.format) : tensor.GetFormat();
ge::DataType data_type = tensor.GetDataType();
string data_type_str = ge::TypeUtils::DataTypeToSerialString(data_type);
GELOGI("Data op get data type:%s from InputDesc in ge ir graph.", data_type_str.c_str());

ge::GeTensor inputTensor;
ge::GeTensorDesc desc(data_shape, ge::Format(omg_context_.format), data_type);
ge::GeTensorDesc desc(data_shape, ge::Format(data_format), data_type);
inputTensor.SetTensorDesc(desc);
inputs.push_back(inputTensor);
}


+ 1
- 1
metadef

@@ -1 +1 @@
Subproject commit 5bbaf8ae9efd145225ebf656fb7da63c2432681d
Subproject commit 302c31caf83f331e528b4a6005555af0cfbaca81

+ 1
- 1
parser

@@ -1 +1 @@
Subproject commit 0ba3cb6560bfe98a43a15cf355862ab25bb1b0b6
Subproject commit bdeeb7ff55f2408cd01ee7a33bf2692ae53c9cbb

Loading…
Cancel
Save