From 436c2c8688368b14acc51ae6f5aeebd14471dd97 Mon Sep 17 00:00:00 2001 From: yangwei Date: Tue, 9 Feb 2021 10:50:08 +0800 Subject: [PATCH] fix --- ge/common/helper/model_helper.cc | 4 +-- ge/common/helper/om_file_helper.cc | 9 +++--- ge/executor/ge_executor.cc | 6 ++-- ge/graph/load/model_manager/davinci_model.cc | 30 +++++++++++--------- ge/graph/load/model_manager/model_manager.cc | 6 ++-- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/ge/common/helper/model_helper.cc b/ge/common/helper/model_helper.cc index 37cb53bc..073cad29 100644 --- a/ge/common/helper/model_helper.cc +++ b/ge/common/helper/model_helper.cc @@ -512,8 +512,8 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadModel(c FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status ModelHelper::LoadRootModel(const ge::ModelData &model_data) { if (model_data.model_data == nullptr || model_data.model_len == 0) { - GELOGE(GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); - return GE_EXEC_MODEL_DATA_SIZE_INVALID; + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "Model_data is nullptr, or model_data_size is 0"); + return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } if (is_assign_model_) { diff --git a/ge/common/helper/om_file_helper.cc b/ge/common/helper/om_file_helper.cc index b42aa759..eb3bbcc2 100644 --- a/ge/common/helper/om_file_helper.cc +++ b/ge/common/helper/om_file_helper.cc @@ -207,9 +207,9 @@ Status OmFileLoadHelper::LoadModelPartitionTable(uint8_t *model_data, uint32_t m "ModelFileHeader length :%zu, ModelPartitionTable length :%zu", index, partition_table->num, sizeof(ModelFileHeader), partition_table_size); if (model_data_size <= cur_offset) { - GELOGE(GE_EXEC_MODEL_DATA_SIZE_INVALID, "invalid model data, partition_table->num:%u, model data size %u", + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, "invalid model data, partition_table->num:%u, model data size %u", partition_table->num, model_data_size); - return GE_EXEC_MODEL_DATA_SIZE_INVALID; + return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } for (uint32_t i = 0; i < partition_table->num; i++) { @@ -231,9 +231,10 @@ Status OmFileLoadHelper::LoadModelPartitionTable(uint8_t *model_data, uint32_t m } if (partition.size > model_data_size || cur_offset > model_data_size - partition.size) { - GELOGE(GE_EXEC_MODEL_DATA_SIZE_INVALID, "The partition size %u is greater than the model data size %u.", + GELOGE(ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID, + "The partition size %u is greater than the model data size %u.", partition.size + cur_offset, model_data_size); - return GE_EXEC_MODEL_DATA_SIZE_INVALID; + return ACL_ERROR_GE_EXEC_MODEL_DATA_SIZE_INVALID; } cur_offset += partition.size; GELOGD("Partition, type:%d, size:%u, model_index:%u", static_cast(partition.type), partition.size, index); diff --git a/ge/executor/ge_executor.cc b/ge/executor/ge_executor.cc index af8237e0..96bb8527 100755 --- a/ge/executor/ge_executor.cc +++ b/ge/executor/ge_executor.cc @@ -175,14 +175,14 @@ bool IsDynamicImageSizeMatchModel(uint64_t image_height, uint64_t image_width, bool IsDynmaicDimsSizeMatchModel(const vector cur_dynamic_dims, const vector> &batch_info) { if (batch_info.empty()) { - GELOGE(ge::FAILED, "Dynamic batch info is empty."); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Dynamic batch info is empty."); return false; } bool find_match = false; for (auto resolution : batch_info) { if (cur_dynamic_dims.size() != resolution.size()) { - GELOGE(ge::FAILED, "Cur dynamic dims param num is %zu, current resolution size is %zu.", + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Cur dynamic dims param num is %zu, current resolution size is %zu.", cur_dynamic_dims.size(), resolution.size()); return false; } @@ -199,7 +199,7 @@ bool IsDynmaicDimsSizeMatchModel(const vector cur_dynamic_dims, } } if (!find_match) { - GELOGE(ge::FAILED, "choose dynamic dims can not match the gear of model."); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "choose dynamic dims can not match the gear of model."); } return find_match; } diff --git a/ge/graph/load/model_manager/davinci_model.cc b/ge/graph/load/model_manager/davinci_model.cc index 8d6dca2a..231ef755 100755 --- a/ge/graph/load/model_manager/davinci_model.cc +++ b/ge/graph/load/model_manager/davinci_model.cc @@ -3283,8 +3283,8 @@ bool DavinciModel::CheckInputAndModelSize(const int64_t &input_size, const int64 } // The input and model input size can not be exactly equal because user input is not definite. if ((input_size + kDataMemAlignSizeCompare) < op_size) { - GELOGE(FAILED, "Input size [%ld] can not be smaller than op size [%ld] after 64-byte alignment", input_size, - op_size); + GELOGE(ACL_ERROR_GE_PARAM_INVALID, + "Input size [%ld] can not be smaller than op size [%ld] after 64-byte alignment", input_size, op_size); return false; } return true; @@ -3334,27 +3334,28 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map & string input_or_output = "input"; is_input ? input_or_output = "input" : input_or_output = "output"; if (blobs.size() != data_info.size()) { - GELOGE(FAILED, "Verify %s data num failed: model requires %zu, but user actually feeds %zu", + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Verify %s data num failed: model requires %zu, but user actually feeds %zu", input_or_output.c_str(), data_info.size(), blobs.size()); - return FAILED; + return ACL_ERROR_GE_PARAM_INVALID; } for (const auto &data : data_info) { if (data.first >= blobs.size()) { // check data index. - GELOGE(FAILED, "Verify %s data num failed: can not find No.%u data, because user only feeds %zu", + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "Verify %s data num failed: can not find No.%u data, because user only feeds %zu", input_or_output.c_str(), data.first, blobs.size()); - return FAILED; + return ACL_ERROR_GE_PARAM_INVALID; } const DataBuffer &buffer = blobs[data.first]; // index of data. if (buffer.data == nullptr) { - GELOGE(FAILED, "data_buf.data is nullptr, index=%u", data.first); - return FAILED; + GELOGE(ACL_ERROR_GE_PARAM_INVALID, "data_buf.data is nullptr, index=%u", data.first); + return ACL_ERROR_GE_PARAM_INVALID; } if (!CheckInputAndModelSize(buffer.length, data.second.GetDataSize(), is_dynamic)) { - GELOGE(FAILED, "Check input size and model size failed, op[%s]", data.second.GetOpName().c_str()); - return FAILED; + GELOGE(ACL_ERROR_GE_PARAM_INVALID, + "Check input size and model size failed, op[%s]", data.second.GetOpName().c_str()); + return ACL_ERROR_GE_PARAM_INVALID; } void *basic_addr = data.second.GetBasicAddr(); @@ -3362,9 +3363,10 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map & if (copy_only_addrs_.count(basic_addr) > 0) { if (is_input) { GELOGI("[IMAS] Find addr %p need direct copy from user malloc input %p", basic_addr, buffer.data); - if (rtMemcpy(basic_addr, data_size, buffer.data, buffer.length, RT_MEMCPY_DEVICE_TO_DEVICE) != RT_ERROR_NONE) { - GELOGE(FAILED, "Non-zero copy data node copy failed"); - return FAILED; + rtError_t rt_ret = rtMemcpy(basic_addr, data_size, buffer.data, buffer.length, RT_MEMCPY_DEVICE_TO_DEVICE); + if (rt_ret != RT_ERROR_NONE) { + GELOGE(rt_ret, "Non-zero copy data node copy failed"); + return RT_ERROR_TO_GE_STATUS(rt_ret); } } GELOGI("No need to exeucte zero copy task because this addr %p need direct copy.", basic_addr); @@ -3385,7 +3387,7 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map & } uintptr_t addr_val = reinterpret_cast(addr); if (task.UpdateTaskParam(addr_val, buffer_addr) != SUCCESS) { - return FAILED; + return ACL_ERROR_GE_PARAM_INVALID; } } } diff --git a/ge/graph/load/model_manager/model_manager.cc b/ge/graph/load/model_manager/model_manager.cc index d8ac4f8a..16a6ac76 100755 --- a/ge/graph/load/model_manager/model_manager.cc +++ b/ge/graph/load/model_manager/model_manager.cc @@ -55,16 +55,18 @@ const char *const kDeleteCustOp = "deleteCustOp"; const int kTimeSpecNano = 1000000000; const int kTimeSpecMiro = 1000000; const int kOpNameMaxSize = 100; +#pragma pack(push, 1) struct CustAicpuSoBuf { uint64_t kernelSoBuf; uint32_t kernelSoBufLen; uint64_t kernelSoName; uint32_t kernelSoNameLen; -} __attribute__((packed)); +}; struct BatchLoadOpFromBufArgs { uint32_t soNum; uint64_t args; -} __attribute__((packed)); +}; +#pragma pack(pop) } // namespace DumpProperties ModelManager::dump_properties_;