Browse Source

add atc-cmdline to om

tags/v1.3.0
wuweikang 3 years ago
parent
commit
16a21b7e52
6 changed files with 24 additions and 5 deletions
  1. +0
    -1
      ge/common/auth/file_saver.cc
  2. +13
    -2
      ge/common/helper/model_helper.cc
  3. +3
    -0
      ge/offline/main.cc
  4. +6
    -1
      ge/session/omg.cc
  5. +1
    -0
      inc/framework/omg/omg_inner_types.h
  6. +1
    -1
      parser

+ 0
- 1
ge/common/auth/file_saver.cc View File

@@ -128,7 +128,6 @@ Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFi


Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFileHeader &file_header, Status FileSaver::SaveWithFileHeader(const std::string &file_path, const ModelFileHeader &file_header,
ModelPartitionTable &model_partition_table, ModelPartitionTable &model_partition_table,

const std::vector<ModelPartition> &partition_datas) { const std::vector<ModelPartition> &partition_datas) {
GE_CHK_BOOL_RET_STATUS(!partition_datas.empty() && model_partition_table.num != 0 GE_CHK_BOOL_RET_STATUS(!partition_datas.empty() && model_partition_table.num != 0
&& model_partition_table.num == partition_datas.size(), FAILED, && model_partition_table.num == partition_datas.size(), FAILED,


+ 13
- 2
ge/common/helper/model_helper.cc View File

@@ -21,6 +21,7 @@
#include "framework/omg/version.h" #include "framework/omg/version.h"
#include "graph/debug/ge_attr_define.h" #include "graph/debug/ge_attr_define.h"
#include "graph/utils/graph_utils.h" #include "graph/utils/graph_utils.h"
#include "framework/omg/omg_inner_types.h"


using std::string; using std::string;
using domi::ModelTaskDef; using domi::ModelTaskDef;
@@ -304,7 +305,6 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr<OmFileSaveHelper>& om_f
return FAILED; return FAILED;
} }



if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) { if (SaveModelTaskDef(om_file_save_helper, ge_model, task_buffer, model_index) != SUCCESS) {
GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu", GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index); ge_model->GetName().c_str(), model_index);
@@ -333,6 +333,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod
ge::Buffer model_buffer; ge::Buffer model_buffer;
ge::Buffer task_buffer; ge::Buffer task_buffer;


GE_CHK_BOOL_EXEC(ge::AttrUtils::SetStr(*(ge_model.get()), ATTR_MODEL_ATC_CMDLINE,
domi::GetContext().atc_cmdline),
GELOGE(FAILED, "SetStr for atc_cmdline failed.");
return FAILED);
auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer); auto ret = SaveAllModelPartiton(om_file_save_helper, ge_model, model_buffer, task_buffer);
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Save][AllModelPartition]Failed, model %s, error_code %u", GELOGE(ret, "[Save][AllModelPartition]Failed, model %s, error_code %u",
@@ -386,9 +390,12 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo
REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid " REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid "
"file name prefix"); "file name prefix");
return FAILED); return FAILED);

if (!is_unknown_shape) { if (!is_unknown_shape) {
auto &model_root = name_to_ge_model.begin()->second; auto &model_root = name_to_ge_model.begin()->second;
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetStr(*(model_root.get()), ATTR_MODEL_ATC_CMDLINE,
domi::GetContext().atc_cmdline),
GELOGE(FAILED, "SetStr for atc_cmdline failed.");
return FAILED);
return SaveToOmModel(model_root, save_param, output_file, model); return SaveToOmModel(model_root, save_param, output_file, model);
} }


@@ -396,6 +403,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo
GE_CHECK_NOTNULL(om_file_save_helper); GE_CHECK_NOTNULL(om_file_save_helper);


auto &first_ge_model = name_to_ge_model.at(ge_root_model->GetRootGraph()->GetName()); auto &first_ge_model = name_to_ge_model.at(ge_root_model->GetRootGraph()->GetName());
GE_CHK_BOOL_EXEC(ge::AttrUtils::SetStr(*(first_ge_model.get()), ATTR_MODEL_ATC_CMDLINE,
domi::GetContext().atc_cmdline),
GELOGE(FAILED, "SetStr for atc_cmdline failed.");
return FAILED);


// ge root model must be the first to be loaded // ge root model must be the first to be loaded
vector<string> model_names{ge_root_model->GetRootGraph()->GetName()}; vector<string> model_names{ge_root_model->GetRootGraph()->GetName()};


+ 3
- 0
ge/offline/main.cc View File

@@ -1343,6 +1343,9 @@ domi::Status ConvertPbtxtToJson() {


int init(int argc, char* argv[]) { int init(int argc, char* argv[]) {
GFlagUtils::InitGFlag(argc, argv); GFlagUtils::InitGFlag(argc, argv);
const char *gflag_argv = gflags::GetArgv();
string cmdline = gflag_argv == nullptr ? "" : gflag_argv;
domi::GetContext().atc_cmdline = cmdline;
// set log level // set log level
int ret = -1; int ret = -1;
const std::set<string> log_level = {"null", "debug", "info", "warning", "error"}; const std::set<string> log_level = {"null", "debug", "info", "warning", "error"};


+ 6
- 1
ge/session/omg.cc View File

@@ -867,7 +867,12 @@ FMK_FUNC_HOST_VISIBILITY void PrintModelInfo(ge::proto::ModelDef *model_def, uin
auto soc_version = (iter != model_attr_map->end()) ? iter->second.s() : ""; auto soc_version = (iter != model_attr_map->end()) ? iter->second.s() : "";
iter = model_attr_map->find("framework_type"); iter = model_attr_map->find("framework_type");
auto framework_type = (iter != model_attr_map->end()) ? iter->second.s() : ""; auto framework_type = (iter != model_attr_map->end()) ? iter->second.s() : "";
std::cout << "system info: "
// original atc cmdline
iter = model_attr_map->find(ATTR_MODEL_ATC_CMDLINE);
auto cmdline = (iter != model_attr_map->end()) ? iter->second.s() : "";
std::cout << "Original Atc command line: "
<< cmdline << std::endl
<< "system info: "
<< ATTR_MODEL_ATC_VERSION << ATTR_MODEL_ATC_VERSION
<< "[" << atc_version << "], " << "[" << atc_version << "], "
<< "soc_version" << "soc_version"


+ 1
- 0
inc/framework/omg/omg_inner_types.h View File

@@ -124,6 +124,7 @@ struct OmgContext {
std::vector<NodePtr> data_nodes; std::vector<NodePtr> data_nodes;
std::vector<NodePtr> getnext_nosink_nodes; std::vector<NodePtr> getnext_nosink_nodes;
bool fuzz_compile_flag = false; bool fuzz_compile_flag = false;
std::string atc_cmdline;
}; };
} // namespace ge } // namespace ge




+ 1
- 1
parser

@@ -1 +1 @@
Subproject commit f12a4159641de89e38460205be89da8ef74eba8a
Subproject commit 055cc4f21aac44b96ef2f951d9e7f89f7042d77a

Loading…
Cancel
Save