| @@ -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) { | 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) { | 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_) { | if (is_assign_model_) { | ||||
| @@ -207,9 +207,9 @@ Status OmFileLoadHelper::LoadModelPartitionTable(uint8_t *model_data, uint32_t m | |||||
| "ModelFileHeader length :%zu, ModelPartitionTable length :%zu", | "ModelFileHeader length :%zu, ModelPartitionTable length :%zu", | ||||
| index, partition_table->num, sizeof(ModelFileHeader), partition_table_size); | index, partition_table->num, sizeof(ModelFileHeader), partition_table_size); | ||||
| if (model_data_size <= cur_offset) { | 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); | 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++) { | 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) { | 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); | 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; | cur_offset += partition.size; | ||||
| GELOGD("Partition, type:%d, size:%u, model_index:%u", static_cast<int>(partition.type), partition.size, index); | GELOGD("Partition, type:%d, size:%u, model_index:%u", static_cast<int>(partition.type), partition.size, index); | ||||
| @@ -175,14 +175,14 @@ bool IsDynamicImageSizeMatchModel(uint64_t image_height, uint64_t image_width, | |||||
| bool IsDynmaicDimsSizeMatchModel(const vector<uint64_t> cur_dynamic_dims, | bool IsDynmaicDimsSizeMatchModel(const vector<uint64_t> cur_dynamic_dims, | ||||
| const vector<vector<int64_t>> &batch_info) { | const vector<vector<int64_t>> &batch_info) { | ||||
| if (batch_info.empty()) { | 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; | return false; | ||||
| } | } | ||||
| bool find_match = false; | bool find_match = false; | ||||
| for (auto resolution : batch_info) { | for (auto resolution : batch_info) { | ||||
| if (cur_dynamic_dims.size() != resolution.size()) { | 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()); | cur_dynamic_dims.size(), resolution.size()); | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -199,7 +199,7 @@ bool IsDynmaicDimsSizeMatchModel(const vector<uint64_t> cur_dynamic_dims, | |||||
| } | } | ||||
| } | } | ||||
| if (!find_match) { | 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; | return find_match; | ||||
| } | } | ||||
| @@ -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. | // The input and model input size can not be exactly equal because user input is not definite. | ||||
| if ((input_size + kDataMemAlignSizeCompare) < op_size) { | 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 false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| @@ -3334,27 +3334,28 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map<uint32_t, ZeroCopyOffset> & | |||||
| string input_or_output = "input"; | string input_or_output = "input"; | ||||
| is_input ? input_or_output = "input" : input_or_output = "output"; | is_input ? input_or_output = "input" : input_or_output = "output"; | ||||
| if (blobs.size() != data_info.size()) { | 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()); | input_or_output.c_str(), data_info.size(), blobs.size()); | ||||
| return FAILED; | |||||
| return ACL_ERROR_GE_PARAM_INVALID; | |||||
| } | } | ||||
| for (const auto &data : data_info) { | for (const auto &data : data_info) { | ||||
| if (data.first >= blobs.size()) { // check data index. | 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()); | 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. | const DataBuffer &buffer = blobs[data.first]; // index of data. | ||||
| if (buffer.data == nullptr) { | 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)) { | 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(); | void *basic_addr = data.second.GetBasicAddr(); | ||||
| @@ -3362,9 +3363,10 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map<uint32_t, ZeroCopyOffset> & | |||||
| if (copy_only_addrs_.count(basic_addr) > 0) { | if (copy_only_addrs_.count(basic_addr) > 0) { | ||||
| if (is_input) { | if (is_input) { | ||||
| GELOGI("[IMAS] Find addr %p need direct copy from user malloc input %p", basic_addr, buffer.data); | 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); | 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<uint32_t, ZeroCopyOffset> & | |||||
| } | } | ||||
| uintptr_t addr_val = reinterpret_cast<uintptr_t>(addr); | uintptr_t addr_val = reinterpret_cast<uintptr_t>(addr); | ||||
| if (task.UpdateTaskParam(addr_val, buffer_addr) != SUCCESS) { | if (task.UpdateTaskParam(addr_val, buffer_addr) != SUCCESS) { | ||||
| return FAILED; | |||||
| return ACL_ERROR_GE_PARAM_INVALID; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -55,16 +55,18 @@ const char *const kDeleteCustOp = "deleteCustOp"; | |||||
| const int kTimeSpecNano = 1000000000; | const int kTimeSpecNano = 1000000000; | ||||
| const int kTimeSpecMiro = 1000000; | const int kTimeSpecMiro = 1000000; | ||||
| const int kOpNameMaxSize = 100; | const int kOpNameMaxSize = 100; | ||||
| #pragma pack(push, 1) | |||||
| struct CustAicpuSoBuf { | struct CustAicpuSoBuf { | ||||
| uint64_t kernelSoBuf; | uint64_t kernelSoBuf; | ||||
| uint32_t kernelSoBufLen; | uint32_t kernelSoBufLen; | ||||
| uint64_t kernelSoName; | uint64_t kernelSoName; | ||||
| uint32_t kernelSoNameLen; | uint32_t kernelSoNameLen; | ||||
| } __attribute__((packed)); | |||||
| }; | |||||
| struct BatchLoadOpFromBufArgs { | struct BatchLoadOpFromBufArgs { | ||||
| uint32_t soNum; | uint32_t soNum; | ||||
| uint64_t args; | uint64_t args; | ||||
| } __attribute__((packed)); | |||||
| }; | |||||
| #pragma pack(pop) | |||||
| } // namespace | } // namespace | ||||
| DumpProperties ModelManager::dump_properties_; | DumpProperties ModelManager::dump_properties_; | ||||