Browse Source

ge log optimize

tags/v1.3.0
liyihan2@huawei.com 4 years ago
parent
commit
2ba7e7b50c
4 changed files with 116 additions and 89 deletions
  1. +17
    -8
      ge/client/ge_api.cc
  2. +2
    -3
      ge/common/dump/dump_op.cc
  3. +6
    -6
      ge/common/dump/opdebug_register.cc
  4. +91
    -72
      ge/common/helper/model_helper.cc

+ 17
- 8
ge/client/ge_api.cc View File

@@ -357,6 +357,7 @@ Session::~Session() {
} catch (google::protobuf::FatalException &e) { } catch (google::protobuf::FatalException &e) {
GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed " GELOGE(GE_CLI_SESS_DESTROY_FAILED, "[Destruct][Session]Failed "
"because get fatalException."); "because get fatalException.");
REPORT_CALL_ERROR("E19999", "Destruct session failed, get fatal exception");
} }


// check return status, return, update session id if success // check return status, return, update session id if success
@@ -486,9 +487,11 @@ Status Session::RemoveGraph(uint32_t graph_id) {
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (!instance_ptr || !instance_ptr->InitFlag()) { if (!instance_ptr || !instance_ptr->InitFlag()) {
GELOGE(GE_CLI_GE_NOT_INITIALIZED, GELOGE(GE_CLI_GE_NOT_INITIALIZED,
"[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag ");
"[Remove][Graph]Failed, GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
REPORT_INNER_ERROR("E19999", REPORT_INNER_ERROR("E19999",
"RemoveGraph Failed, GELib instance is nullptr or is not InitFlag.");
"RemoveGraph Failed, GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
return FAILED; return FAILED;
} }


@@ -566,9 +569,11 @@ Status Session::RunGraph(uint32_t graph_id, const std::vector<Tensor> &inputs, s
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
GELOGE(GE_CLI_GE_NOT_INITIALIZED, GELOGE(GE_CLI_GE_NOT_INITIALIZED,
"[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag.");
"[Run][Graph]Failed, GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
REPORT_INNER_ERROR("E19999", REPORT_INNER_ERROR("E19999",
"RunGraph Failed, GELib instance is nullptr or is not InitFlag.");
"RunGraph Failed, GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
return FAILED; return FAILED;
} }
GELOGT(TRACE_RUNNING, "Running Graph"); GELOGT(TRACE_RUNNING, "Running Graph");
@@ -615,9 +620,11 @@ Status Session::BuildGraph(uint32_t graph_id, const std::vector<InputTensorInfo>
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
GELOGE(GE_CLI_GE_NOT_INITIALIZED, GELOGE(GE_CLI_GE_NOT_INITIALIZED,
"[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag.");
"[Build][Graph]Failed, the GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
REPORT_INNER_ERROR("E19999", REPORT_INNER_ERROR("E19999",
"Build graph failed, the GELib instance is nullptr or is not InitFlag.");
"Build graph failed, the GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
return FAILED; return FAILED;
} }
GELOGT(TRACE_RUNNING, "Building Graph"); GELOGT(TRACE_RUNNING, "Building Graph");
@@ -641,9 +648,11 @@ Status Session::RunGraphAsync(uint32_t graph_id, const std::vector<InputTensorIn
std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance(); std::shared_ptr<GELib> instance_ptr = ge::GELib::GetInstance();
if (instance_ptr == nullptr || !instance_ptr->InitFlag()) { if (instance_ptr == nullptr || !instance_ptr->InitFlag()) {
GELOGE(GE_CLI_GE_NOT_INITIALIZED, GELOGE(GE_CLI_GE_NOT_INITIALIZED,
"[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag.");
"[Run][Graph]RunGraphAsyncFailed, the GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
REPORT_INNER_ERROR("E19999", REPORT_INNER_ERROR("E19999",
"RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag.");
"RunGraphAsync Failed, the GELib instance is nullptr or is not InitFlag,
session_id %lu, graph_id %lu", sessionId_, graph_id);
return FAILED; return FAILED;
} }
GELOGT(TRACE_RUNNING, "Run Graph Asynchronously"); GELOGT(TRACE_RUNNING, "Run Graph Asynchronously");


+ 2
- 3
ge/common/dump/dump_op.cc View File

@@ -239,9 +239,8 @@ Status DumpOp::LaunchDumpOp() {
int32_t device_id = 0; int32_t device_id = 0;
rtError_t rt_ret = rtGetDevice(&device_id); rtError_t rt_ret = rtGetDevice(&device_id);
if (rt_ret != RT_ERROR_NONE) { if (rt_ret != RT_ERROR_NONE) {
GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X, device_id %d.", rt_ret, device_id);
REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X, device_id %d.",
rt_ret, device_id);
GELOGE(rt_ret, "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret);
REPORT_CALL_ERROR("E19999", "[Call][rtGetDevice]Failed, ret 0x%X", rt_ret);
return RT_ERROR_TO_GE_STATUS(rt_ret); return RT_ERROR_TO_GE_STATUS(rt_ret);
} }
if (device_id < 0) { if (device_id < 0) {


+ 6
- 6
ge/common/dump/opdebug_register.cc View File

@@ -27,9 +27,9 @@ Status OpdebugRegister::RegisterDebugForModel(rtModel_t model_handle, uint32_t o
GELOGD("Start to register debug for model in overflow"); GELOGD("Start to register debug for model in overflow");
auto ret = MallocMemForOpdebug(); auto ret = MallocMemForOpdebug();
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Malloc][MemForOpdebug]Failed in model overflow, ret:0x%X", ret);
REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, "
"ret 0x%X", ret);
GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for model overflow, ret:0x%X", ret);
REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug "
"for model in overflow, ret 0x%X", ret);
return ret; return ret;
} }
uint32_t debug_stream_id = 0; uint32_t debug_stream_id = 0;
@@ -76,9 +76,9 @@ Status OpdebugRegister::RegisterDebugForStream(rtStream_t stream, uint32_t op_de
GELOGD("Start to register debug for stream in stream overflow"); GELOGD("Start to register debug for stream in stream overflow");
auto ret = MallocMemForOpdebug(); auto ret = MallocMemForOpdebug();
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Malloc][MemForOpdebug]Failed in stream overflow, ret:0x%X", ret);
REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed in model overflow, "
"ret:0x%X", ret);
GELOGE(ret, "[Malloc][MemForOpdebug]Failed when debug for stream in overflow, ret:0x%X", ret);
REPORT_CALL_ERROR("E19999", "Malloc memory for opdebug failed when debug "
"for stream in overflow, ret:0x%X", ret);
return ret; return ret;
} }




+ 91
- 72
ge/common/helper/model_helper.cc View File

@@ -119,8 +119,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr<OmFileSaveHelper> &om_file_save
model_tmp->SetAttr(ge_model->MutableAttrMap()); model_tmp->SetAttr(ge_model->MutableAttrMap());
Status ret = SaveSizeToModelDef(ge_model); Status ret = SaveSizeToModelDef(ge_model);
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Save][SizeToModelDef]Failed, error_code %u", ret);
REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, error_code %u", ret);
GELOGE(ret, "[Save][SizeToModelDef]Failed, model %s, error_code %u",
ge_model->GetName().c_str(), ret);
REPORT_CALL_ERROR("E19999", "Save SizeToModelDef failed, model %s, error_code %u",
ge_model->GetName().c_str(), ret);
return ret; return ret;
} }


@@ -129,10 +131,10 @@ Status ModelHelper::SaveModelDef(std::shared_ptr<OmFileSaveHelper> &om_file_save
if (model_buffer.GetSize() > 0) { if (model_buffer.GetSize() > 0) {
if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(), if (SaveModelPartition(om_file_save_helper, ModelPartitionType::MODEL_DEF, model_buffer.GetData(),
model_buffer.GetSize(), model_index) != SUCCESS) { model_buffer.GetSize(), model_index) != SUCCESS) {
GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model_def size %zu, model_index %zu",
model_buffer.GetSize(), model_index);
REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model_def %zu, "
"model_index %zu", model_buffer.GetSize(), model_index);
GELOGE(PARAM_INVALID, "[Add][ModelPartition]Failed, model %s, model_def size %zu, model_index %zu",
ge_model->GetName().c_str(), model_buffer.GetSize(), model_index);
REPORT_CALL_ERROR("E19999", "Add model graph partititon failed, model %s, model_def %zu, "
"model_index %zu", ge_model->GetName().c_str(), model_buffer.GetSize(), model_index);
return PARAM_INVALID; return PARAM_INVALID;
} }
} }
@@ -187,24 +189,26 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr<OmFileSaveHelper> &om_file_
const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) { const GeModelPtr &ge_model, ge::Buffer &task_buffer, size_t model_index) {
std::shared_ptr<ModelTaskDef> model_task_def = ge_model->GetModelTaskDefPtr(); std::shared_ptr<ModelTaskDef> model_task_def = ge_model->GetModelTaskDefPtr();
if (model_task_def == nullptr) { if (model_task_def == nullptr) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr");
REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr");
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Creat][ModelTaskDef]Failed, it is nullptr, "
"model %s", ge_model->GetName().c_str());
REPORT_CALL_ERROR("E19999", "Creat model task def failed, it is nullptr, model %s",
ge_model->GetName().c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
} }
size_t partition_task_size = model_task_def->ByteSizeLong(); size_t partition_task_size = model_task_def->ByteSizeLong();
GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX, GE_IF_BOOL_EXEC(partition_task_size == 0 || partition_task_size > INT_MAX,
GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu!",
partition_task_size);
REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid,",
partition_task_size);
GELOGE(FAILED, "[Check][ModelDefSize]Invalid, size %zu, model %s",
partition_task_size, ge_model->GetName().c_str());
REPORT_CALL_ERROR("E19999", "Model def size %zu check invalid, model %s",
partition_task_size, ge_model->GetName().c_str());
return FAILED); return FAILED);


task_buffer = ge::Buffer(partition_task_size); task_buffer = ge::Buffer(partition_task_size);
if (task_buffer.GetSize() == 0) { if (task_buffer.GetSize() == 0) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][ModelTaskDefBuffer]Failed, " GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, "[Allocate][ModelTaskDefBuffer]Failed, "
"model def size %zu", partition_task_size);
REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu",
partition_task_size);
"model def size %zu, model %s", partition_task_size, ge_model->GetName().c_str());
REPORT_CALL_ERROR("E19999", "Allocate model task def buffer failed, model def size %zu "
"model %s", partition_task_size, ge_model->GetName().c_str());
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
} }
(void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast<int>(partition_task_size)); (void)model_task_def->SerializePartialToArray(task_buffer.GetData(), static_cast<int>(partition_task_size));
@@ -215,9 +219,10 @@ Status ModelHelper::SaveModelTaskDef(std::shared_ptr<OmFileSaveHelper> &om_file_
if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(), if (SaveModelPartition(om_file_save_helper, ModelPartitionType::TASK_INFO, task_buffer.GetData(),
partition_task_size, model_index) != SUCCESS) { partition_task_size, model_index) != SUCCESS) {
GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, " GELOGE(PARAM_INVALID, "[Add][ModelTaskDefPartition]Failed, model def size %zu, "
"model_index %zu", partition_task_size, model_index);
"model_index %zu, model %s", partition_task_size, model_index, ge_model->GetName().c_str());
REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu " REPORT_CALL_ERROR("E19999", "Add model task def partition failed, model def size %zu "
"model_index %zu", partition_task_size, model_index);
"model_index %zu, model %s",
partition_task_size, model_index, ge_model->GetName().c_str());
return PARAM_INVALID; return PARAM_INVALID;
} }
return SUCCESS; return SUCCESS;
@@ -237,11 +242,11 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr<OmFileSaveHelper> &om_file_s
platform_version.size() + 1); platform_version.size() + 1);
if (err != EOK) { if (err != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Save][Model]Failed while allocating memory for platform_version %s, errno %d",
platform_version.c_str(), err);
REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while "
"[Save][Model]Failed while allocating memory for platform_version %s, model %s, errno %d",
platform_version.c_str(), ge_model->GetName().c_str(), err);
REPORT_CALL_ERROR("E19999", "ModelHelper save model %s failed while "
"allocating memory for platform_version %s, errno %d", "allocating memory for platform_version %s, errno %d",
platform_version.c_str(), err);
ge_model->GetName().c_str(), platform_version.c_str(), err);
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
} }
string version = reinterpret_cast<char *>(model_header.platform_version); string version = reinterpret_cast<char *>(model_header.platform_version);
@@ -252,10 +257,10 @@ Status ModelHelper::SaveModelHeader(std::shared_ptr<OmFileSaveHelper> &om_file_s
err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size); err = memcpy_s(model_header.name, MODEL_NAME_LENGTH, ge_model->GetName().c_str(), name_size);
if (err != EOK) { if (err != EOK) {
GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION, GELOGE(ACL_ERROR_GE_MEMORY_ALLOCATION,
"[Save][Model]Failed while allocating memory for name %s, errno %d",
"[Save][Model]Failed while allocating memory for model %s, errno %d",
ge_model->GetName().c_str(), err); ge_model->GetName().c_str(), err);
REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while allocating memory " REPORT_CALL_ERROR("E19999", "ModelHelper save model failed while allocating memory "
"for name %s,errno %d", ge_model->GetName().c_str(), err);
"for model %s,errno %d", ge_model->GetName().c_str(), err);
return ACL_ERROR_GE_MEMORY_ALLOCATION; return ACL_ERROR_GE_MEMORY_ALLOCATION;
} }
string model_name = reinterpret_cast<char *>(model_header.name); string model_name = reinterpret_cast<char *>(model_header.name);
@@ -267,38 +272,43 @@ Status ModelHelper::SaveAllModelPartiton(std::shared_ptr<OmFileSaveHelper>& om_f
const GeModelPtr &ge_model, ge::Buffer &model_buffer, const GeModelPtr &ge_model, ge::Buffer &model_buffer,
ge::Buffer &task_buffer, size_t model_index) { ge::Buffer &task_buffer, size_t model_index) {
if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) { if (SaveModelDef(om_file_save_helper, ge_model, model_buffer, model_index) != SUCCESS) {
GELOGE(FAILED, "[Save][ModelDef]Failed, model index %zu", model_index);
REPORT_INNER_ERROR("E19999", "ModelHelper save model def failed, model index %zu",
model_index);
GELOGE(FAILED, "[Save][ModelDef]Failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
REPORT_CALL_ERROR("E19999", "ModelHelper save model def failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
return FAILED; return FAILED;
} }


if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) { if (SaveModelWeights(om_file_save_helper, ge_model, model_index) != SUCCESS) {
GELOGE(FAILED, "[Save][ModelWeights]Failed, model index %zu", model_index);
REPORT_INNER_ERROR("E19999","ModelHelper save mode weights failed, mode index %zu",
model_index);
GELOGE(FAILED, "[Save][ModelWeights]Failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
REPORT_CALL_ERROR("E19999","ModelHelper save mode weights failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
return FAILED; return FAILED;
} }


if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) { if (SaveModelTbeKernel(om_file_save_helper, ge_model, model_index) != SUCCESS) {
GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model index %zu", model_index);
REPORT_INNER_ERROR("E19999", "ModelHelper save model tbe kernel failed, model index %zu",
model_index);
GELOGE(FAILED, "[Save][ModelTbeKernel]Failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
REPORT_CALL_ERROR("E19999", "ModelHelper save model tbe kernel failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
return FAILED; return FAILED;
} }


if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) { if (SaveModelCustAICPU(om_file_save_helper, ge_model, model_index) != SUCCESS) {
GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model index %zu", model_index);
REPORT_INNER_ERROR("E19999", "ModelHelper save model cust aicpu failed, "
"model index %zu", model_index);
GELOGE(FAILED, "[Save][ModelCustAICPU]Failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
REPORT_CALL_ERROR("E19999", "ModelHelper save model cust aicpu failed, model %s "
"model index %zu", ge_model->GetName().c_str(), model_index);
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 index %zu", model_index);
REPORT_INNER_ERROR("E19999", "ModelHelper save task def failed, model index %zu",
model_index);
GELOGE(FAILED, "[Save][TaskDef]Failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
REPORT_CALL_ERROR("E19999", "ModelHelper save task def failed, model %s, model index %zu",
ge_model->GetName().c_str(), model_index);
return FAILED; return FAILED;
} }
return SUCCESS; return SUCCESS;
@@ -309,8 +319,10 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod
const std::string &output_file, const std::string &output_file,
ModelBufferData& model) { ModelBufferData& model) {
if (output_file.empty()) { if (output_file.empty()) {
GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix");
REPORT_INNER_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix");
GELOGE(FAILED, "[Save][Model]GraphBuilder SaveModel received invalid file name prefix, "
"model %s", ge_model->GetName().c_str());
REPORT_CALL_ERROR("E19999", "GraphBuilder SaveModel received invalid file name prefix, "
"model %s", ge_model->GetName().c_str());
return FAILED; return FAILED;
} }


@@ -322,25 +334,28 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmMod


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, error_code %u", ret);
REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save all model partition failed, "
"error_code %u", ret);
GELOGE(ret, "[Save][AllModelPartition]Failed, model %s, error_code %u",
ge_model->GetName().c_str(), ret);
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save all model partition failed, model %s "
"error_code %u", ge_model->GetName().c_str(), ret);
return ret; return ret;
} }


ret = SaveModelHeader(om_file_save_helper, ge_model); ret = SaveModelHeader(om_file_save_helper, ge_model);
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(ret, "[Save][ModelHeader]Failed, error_code %u", ret);
REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model header failed, "
"error_code %u", ret);
GELOGE(ret, "[Save][ModelHeader]Failed, model %s, error_code %u",
ge_model->GetName().c_str(), ret);
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model header failed, model %s "
"error_code %u", ge_model->GetName().c_str(), ret);
return ret; return ret;
} }


ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_); ret = om_file_save_helper->SaveModel(save_param, output_file.c_str(), model, is_offline_);
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(FAILED, "[Save][Model]Failed, output file %s", output_file.c_str());
REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model failed, output file %s",
output_file.c_str());
GELOGE(FAILED, "[Save][Model]Failed, model %s, output file %s",
ge_model->GetName().c_str(), output_file.c_str());
REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model failed, model %s, "
"output file %s", ge_model->GetName().c_str(), output_file.c_str());
return ret; return ret;
} }
return SUCCESS; return SUCCESS;
@@ -413,7 +428,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(INTERNAL_ERROR, "[Save][AllModelPartition]Failed, model name %s, cur_index %zu", GELOGE(INTERNAL_ERROR, "[Save][AllModelPartition]Failed, model name %s, cur_index %zu",
model_name.c_str(), cur_index); model_name.c_str(), cur_index);
REPORT_INNER_ERROR("E19999", "Save all model %s partition failed, cur_index %zu",
REPORT_CALL_ERROR("E19999", "Save all model %s partition failed, cur_index %zu",
model_name.c_str(), cur_index); model_name.c_str(), cur_index);
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }
@@ -423,15 +438,15 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::SaveToOmRoo
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s", GELOGE(INTERNAL_ERROR, "[Save][ModelHeader]Failed, model name %s",
first_ge_model->GetName().c_str()); first_ge_model->GetName().c_str());
REPORT_INNER_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str());
REPORT_CALL_ERROR("E19999", "Save model %s header failed", first_ge_model->GetName().c_str());
return INTERNAL_ERROR; return INTERNAL_ERROR;
} }


ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_); ret = om_file_save_helper->SaveRootModel(save_param, output_file.c_str(), model, is_offline_);
if (ret != SUCCESS) { if (ret != SUCCESS) {
GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model return fail, output_file %s",
GELOGE(FAILED, "[Save][Model]OmFileSaveHelper save model eturn fail, output_file %s",
output_file.c_str()); output_file.c_str());
REPORT_INNER_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s",
REPORT_CALL_ERROR("E19999", "OmFileSaveHelper save model return fail, output_file %s",
output_file.c_str()); output_file.c_str());
return FAILED; return FAILED;
} }
@@ -443,7 +458,7 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin
if (output_file.empty()) { if (output_file.empty()) {
GELOGE(FAILED, "[Save][Model]Received invalid file name prefix, output_file %s", GELOGE(FAILED, "[Save][Model]Received invalid file name prefix, output_file %s",
output_file.c_str()); output_file.c_str());
REPORT_CALL_ERROR("E19999", "Save model received invalid file name prefix, output_file %s",
REPORT_INNER_ERROR("E19999", "Save model received invalid file name prefix, output_file %s",
output_file.c_str()); output_file.c_str());
return FAILED; return FAILED;
} }
@@ -451,7 +466,7 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin
auto compute_graph = ge::GraphUtils::GetComputeGraph(graph); auto compute_graph = ge::GraphUtils::GetComputeGraph(graph);
if (compute_graph == nullptr) { if (compute_graph == nullptr) {
GELOGE(FAILED, "[Save][Model]Failed for compute_graph null"); GELOGE(FAILED, "[Save][Model]Failed for compute_graph null");
REPORT_CALL_ERROR("E19999", "Save model failed for compute_graph null");
REPORT_INNER_ERROR("E19999", "Save model failed for compute_graph null");
return FAILED; return FAILED;
} }
GE_DUMP(compute_graph, "OriginalGraph"); GE_DUMP(compute_graph, "OriginalGraph");
@@ -473,8 +488,10 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin
ge::Buffer model_buffer; ge::Buffer model_buffer;
ge::graphStatus status = model_ptr->Save(model_buffer); ge::graphStatus status = model_ptr->Save(model_buffer);
if (status != ge::GRAPH_SUCCESS) { if (status != ge::GRAPH_SUCCESS) {
GELOGE(FAILED, "[Save][Model]Failed for save buffer fail");
REPORT_INNER_ERROR("E19999", "Save model failed for save buffer fail");
GELOGE(FAILED, "[Save][Model]Failed for save buffer fail, model %s",
model_ptr->GetName().c_str());
REPORT_CALL_ERROR("E19999", "Save model %s failed for save buffer fail",
model_ptr->GetName().c_str());
return FAILED; return FAILED;
} }
std::shared_ptr<OmFileSaveHelper> om_file_save_helper = ge::MakeShared<OmFileSaveHelper>(); std::shared_ptr<OmFileSaveHelper> om_file_save_helper = ge::MakeShared<OmFileSaveHelper>();
@@ -496,10 +513,10 @@ ModelHelper::SaveOriginalGraphToOmModel(const ge::Graph &graph, const std::strin
errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(), errno_t err = memcpy_s(model_header.platform_version, PLATFORM_VERSION_LEN, platform_version.c_str(),
platform_version.size() + 1); platform_version.size() + 1);
if (err != EOK) { if (err != EOK) {
GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, errno %d",
platform_version.c_str(), err);
REPORT_CALL_ERROR("E19999", "Save model failed for platform_version %s, errno %d",
platform_version.c_str(), err);
GELOGE(FAILED, "[Save][Model]Failed for platform_version %s, model %s, errno %d",
platform_version.c_str(), model_ptr->GetName().c_str(), err);
REPORT_CALL_ERROR("E19999", "Save model %s failed for platform_version %s, errno %d",
model_ptr->GetName().c_str(), platform_version.c_str(), err);
return FAILED; return FAILED;
} }
size_t name_size = model_ptr->GetName().size(); size_t name_size = model_ptr->GetName().size();
@@ -599,7 +616,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod
Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_); Status status = ModelParserBase::ParseModelContent(model_data, model_addr_tmp_, model_len_tmp_);
if (status != SUCCESS) { if (status != SUCCESS) {
GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!"); GELOGE(ACL_ERROR_GE_PARAM_INVALID, "[Parse][RootModelContent]Failed!");
REPORT_INNER_ERROR("E19999", "Parse model content failed");
REPORT_CALL_ERROR("E19999", "Parse model content failed");
return ACL_ERROR_GE_PARAM_INVALID; return ACL_ERROR_GE_PARAM_INVALID;
} }


@@ -629,7 +646,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootMod
status = GenerateGeRootModel(om_load_helper); status = GenerateGeRootModel(om_load_helper);
if (status != SUCCESS) { if (status != SUCCESS) {
GELOGE(status, "[Generate][GERootModel]Failed"); GELOGE(status, "[Generate][GERootModel]Failed");
REPORT_INNER_ERROR("E19999", "Generate GE root model failed");
REPORT_CALL_ERROR("E19999", "Generate GE root model failed");
return status; return status;
} }
GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!"); GELOGD("in ModelHelper::LoadRootModel, is_assign_model_ is setted to true!");
@@ -770,7 +787,7 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper) {
ModelPartition partition; ModelPartition partition;
if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) { if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition) != SUCCESS) {
GELOGE(FAILED, "[Get][ModelWeightPartition]Failed, GetWeight size:%u", partition.size); GELOGE(FAILED, "[Get][ModelWeightPartition]Failed, GetWeight size:%u", partition.size);
REPORT_INNER_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u",
REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u",
partition.size); partition.size);
return FAILED; return FAILED;
} }
@@ -785,7 +802,7 @@ Status ModelHelper::LoadWeights(OmFileLoadHelper &om_load_helper, GeModelPtr &cu
ModelPartition partition; ModelPartition partition;
if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) { if (om_load_helper.GetModelPartition(ModelPartitionType::WEIGHTS_DATA, partition, mode_index) != SUCCESS) {
GELOGE(FAILED, "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size); GELOGE(FAILED, "[Get][ModelPartition]Failed, GetWeight size:%u", partition.size);
REPORT_INNER_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u",
REPORT_CALL_ERROR("E19999", "[Get][ModelPartition]Failed, GetWeight size:%u",
partition.size); partition.size);
return FAILED; return FAILED;
} }
@@ -800,7 +817,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadTask(Om
ModelPartition task_partition; ModelPartition task_partition;
if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) { if (om_load_helper.GetModelPartition(ModelPartitionType::TASK_INFO, task_partition) != SUCCESS) {
GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size); GELOGE(FAILED, "[Get][ModelTaskPartition]Failed, task_partition size:%u", task_partition.size);
REPORT_INNER_ERROR("E19999", "Get model task partition failed, task_partition size %u",
REPORT_CALL_ERROR("E19999", "Get model task partition failed, task_partition size %u",
task_partition.size); task_partition.size);
return FAILED; return FAILED;
} }
@@ -1017,7 +1034,8 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef
ErrorManager::GetInstance().ATCReportErrMessage("E10003", ErrorManager::GetInstance().ATCReportErrMessage("E10003",
{"parameter", "value", "reason"}, {"om", model_file, "invalid om file"}); {"parameter", "value", "reason"}, {"om", model_file, "invalid om file"});
GELOGE(ACL_ERROR_GE_PARAM_INVALID, GELOGE(ACL_ERROR_GE_PARAM_INVALID,
"[Parse][ModelContent]Failed because of invalid om file. Please check om param.");
"[Parse][ModelContent]Failed because of invalid om file %s, please check om param",
model_file);
return ret; return ret;
} }


@@ -1025,7 +1043,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef
ret = om_load_helper.Init(model_data, model_len); ret = om_load_helper.Init(model_data, model_len);
if (ret != SUCCESS) { if (ret != SUCCESS) {
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"}); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Om file init failed"});
GELOGE(ge::FAILED, "[Init][OmFile]Failed.");
GELOGE(ge::FAILED, "[Init][OmFile]Failed, model_file %s", model_file);
return ret; return ret;
} }


@@ -1033,7 +1051,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef
ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part); ret = om_load_helper.GetModelPartition(MODEL_DEF, ir_part);
if (ret != SUCCESS) { if (ret != SUCCESS) {
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"}); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"Get model part failed"});
GELOGE(ge::FAILED, "[Get][ModelPart]Failed.");
GELOGE(ge::FAILED, "[Get][ModelPart]Failed, model_file %s", model_file);
return ret; return ret;
} }


@@ -1041,7 +1059,7 @@ Status ModelTool::GetModelInfoFromOm(const char *model_file, ge::proto::ModelDef
if (!flag) { if (!flag) {
ret = INTERNAL_ERROR; ret = INTERNAL_ERROR;
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"}); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ReadProtoFromArray failed"});
GELOGE(ret, "[Read][ProtoFromArray]Failed.");
GELOGE(ret, "[Read][ProtoFromArray]Failed, model_file %s", model_file);
return ret; return ret;
} }
modeldef_size = ir_part.size; modeldef_size = ir_part.size;
@@ -1073,7 +1091,7 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model
if (!flag) { if (!flag) {
free_model_data(&model.model_data); free_model_data(&model.model_data);
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"}); ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed"});
GELOGE(FAILED, "[Parse][ModelInfo]Failed from string.");
GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, model_file %s", model_file);
return FAILED; return FAILED;
} }
free_model_data(&model.model_data); free_model_data(&model.model_data);
@@ -1082,7 +1100,8 @@ Status ModelTool::GetModelInfoFromPbtxt(const char *model_file, ge::proto::Model
free_model_data(&model.model_data); free_model_data(&model.model_data);
ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message[" ErrorManager::GetInstance().ATCReportErrMessage("E19021", {"reason"}, {"ParseFromString failed, exception message["
+ std::string(e.what()) + "]"}); + std::string(e.what()) + "]"});
GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message : %s", e.what());
GELOGE(FAILED, "[Parse][ModelInfo]Failed from string, exception message %s, model_file %s",
e.what(), model_file);
return FAILED; return FAILED;
} }
} }


Loading…
Cancel
Save