| @@ -713,43 +713,6 @@ Status GeExecutor::GetModelAttr(uint32_t model_id, std::vector<std::string> &dyn | |||
| return SUCCESS; | |||
| } | |||
| Status GeExecutor::GetModelDescInfoForZeroCopy(uint32_t model_id, std::vector<ge::TensorDesc> &input_desc, | |||
| std::vector<TensorDesc> &output_desc) { | |||
| GELOGI("get model desc info for zero copy begin."); | |||
| if (!isInit_) { | |||
| GELOGE(ACL_ERROR_GE_EXEC_NOT_INIT, "GeExecutor has not been initialized!"); | |||
| return ACL_ERROR_GE_EXEC_NOT_INIT; | |||
| } | |||
| std::vector<InputOutputDescInfo> input_desc_infos; | |||
| std::vector<InputOutputDescInfo> output_desc_infos; | |||
| std::vector<uint32_t> input_formats; | |||
| std::vector<uint32_t> output_formats; | |||
| Status ret = GraphExecutor::GetInputOutputDescInfoForZeroCopy(model_id, input_desc_infos, output_desc_infos, | |||
| input_formats, output_formats); | |||
| if (ret != domi::SUCCESS) { | |||
| GELOGE(ret, "Get DescInfo from zero copy failed. ret = %u", ret); | |||
| return ACL_ERROR_GE_GET_TENSOR_INFO; | |||
| } | |||
| if (input_formats.size() != input_desc_infos.size()) { | |||
| GELOGE(ACL_ERROR_GE_PARAM_INVALID, "input_formats.size() != input_desc_infos.size()."); | |||
| return ACL_ERROR_GE_PARAM_INVALID; | |||
| } | |||
| if (output_formats.size() != output_desc_infos.size()) { | |||
| GELOGE(ACL_ERROR_GE_PARAM_INVALID, "output_formats.size() != output_desc_infos.size()."); | |||
| return ACL_ERROR_GE_PARAM_INVALID; | |||
| } | |||
| GetGeTensorDescFromDomiInfo(input_desc, input_desc_infos, input_formats); | |||
| GetGeTensorDescFromDomiInfo(output_desc, output_desc_infos, output_formats); | |||
| GELOGI("get model desc info from zero copy end."); | |||
| return ge::SUCCESS; | |||
| } | |||
| Status GeExecutor::CommandHandle(const Command &command) { | |||
| Status ret = GraphLoader::CommandHandle(command); | |||
| if (ret != SUCCESS) { | |||
| @@ -560,30 +560,6 @@ Status GraphExecutor::GetModelAttr(uint32_t model_id, std::vector<string> &dynam | |||
| return SUCCESS; | |||
| } | |||
| Status GraphExecutor::GetInputOutputDescInfoForZeroCopy(uint32_t model_id, vector<InputOutputDescInfo> &input_desc, | |||
| vector<InputOutputDescInfo> &output_desc, | |||
| std::vector<uint32_t> &input_formats, | |||
| std::vector<uint32_t> &out_formats) { | |||
| try { | |||
| auto model_manager = ge::ModelManager::GetInstance(); | |||
| GE_CHECK_NOTNULL(model_manager); | |||
| Status ret = | |||
| model_manager->GetInputOutputDescInfoForZeroCopy(model_id, input_desc, output_desc, input_formats, out_formats); | |||
| if (ret != SUCCESS) { | |||
| GELOGE(ret, "GetInputOutputDescInfoForZeroCopy failed."); | |||
| return ret; | |||
| } | |||
| } catch (std::bad_alloc &) { | |||
| GELOGE(MEMALLOC_FAILED, "GetInputOutputDescInfoForZeroCopy failed, bad memory allocation occur !"); | |||
| return MEMALLOC_FAILED; | |||
| } catch (...) { | |||
| GELOGE(FAILED, "GetInputOutputDescInfoForZeroCopy failed, some exceptions occur !"); | |||
| return FAILED; | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| Status GraphExecutor::GetAIPPInfo(uint32_t model_id, uint32_t index, AippConfigInfo &aipp_info) { | |||
| auto model_manager = ge::ModelManager::GetInstance(); | |||
| GE_CHECK_NOTNULL(model_manager); | |||
| @@ -110,10 +110,6 @@ class GraphExecutor { | |||
| static Status GetModelAttr(uint32_t model_id, std::vector<string> &dynamic_output_shape_info); | |||
| static Status GetInputOutputDescInfoForZeroCopy(uint32_t model_id, vector<InputOutputDescInfo> &input_desc, | |||
| vector<InputOutputDescInfo> &output_desc, | |||
| std::vector<uint32_t> &input_formats, | |||
| std::vector<uint32_t> &output_formats); | |||
| static Status GetOrigInputInfo(uint32_t model_id, uint32_t index, OriginInputInfo &orig_input_info); | |||
| static Status GetAllAippInputOutputDims(uint32_t model_id, uint32_t index, std::vector<InputOutputDims> &input_dims, | |||
| std::vector<InputOutputDims> &output_dims); | |||
| @@ -1751,7 +1751,7 @@ void DavinciModel::GetUserDesignateShapeOrder(std::vector<std::string> &user_inp | |||
| /// | |||
| Status DavinciModel::InitAIPPInfo(uint32_t index, const OpDescPtr &op_desc) { | |||
| if (!op_desc->HasAttr(ATTR_NAME_AIPP)) { | |||
| GELOGW("GetAIPPInfo: there is not AIPP related with index %u.", index); | |||
| GELOGW("there is not AIPP related with index %u.", index); | |||
| return SUCCESS; | |||
| } | |||
| @@ -1760,7 +1760,7 @@ Status DavinciModel::InitAIPPInfo(uint32_t index, const OpDescPtr &op_desc) { | |||
| GE_CHK_BOOL_RET_STATUS(AttrUtils::GetNamedAttrs(op_desc, ATTR_NAME_AIPP, aipp_attr), GE_AIPP_NOT_EXIST, | |||
| "Data node do not contain param aipp!"); | |||
| GE_CHK_STATUS_RET(OpUtils::ConvertAippParams(aipp_attr, &aipp_params), "get aipp params failed"); | |||
| GELOGI("GetAIPPInfo: node data: %s, type: %s, current index: %u, current node related input rank: %u", | |||
| GELOGI("node data: %s, type: %s, current index: %u, current node related input rank: %u", | |||
| op_desc->GetName().c_str(), op_desc->GetType().c_str(), index, aipp_params.related_input_rank()); | |||
| AippConfigInfo aipp_info; | |||
| @@ -1771,10 +1771,10 @@ Status DavinciModel::InitAIPPInfo(uint32_t index, const OpDescPtr &op_desc) { | |||
| return SUCCESS; | |||
| } | |||
| Status DavinciModel::GetAIPPInfo(uint32_t index, AippConfigInfo &aipp_info) { | |||
| Status DavinciModel::GetAIPPInfo(uint32_t index, AippConfigInfo &aipp_info) const { | |||
| const auto it = aipp_info_list_.find(index); | |||
| if (it == aipp_info_list_.end()) { | |||
| GELOGW("GetAIPPInfo: there is not AIPP related with index %u.", index); | |||
| GELOGW("there is not AIPP related with index %u.", index); | |||
| return ACL_ERROR_GE_AIPP_NOT_EXIST; | |||
| } | |||
| @@ -1825,7 +1825,7 @@ Status DavinciModel::InitAippType(uint32_t index, const OpDescPtr &op_desc, cons | |||
| return SUCCESS; | |||
| } | |||
| Status DavinciModel::GetAippType(uint32_t index, InputAippType &aipp_type, size_t &aipp_index) { | |||
| Status DavinciModel::GetAippType(uint32_t index, InputAippType &aipp_type, size_t &aipp_index) const { | |||
| const auto it = aipp_type_list_.find(index); | |||
| if (it == aipp_type_list_.end()) { | |||
| GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "Can not find aipp data node from index %u", index); | |||
| @@ -1865,34 +1865,6 @@ void DavinciModel::GetModelAttr(vector<string> &out_shape_info) { | |||
| out_shape_info.insert(out_shape_info.end(), dynamic_output_shape_info_.begin(), dynamic_output_shape_info_.end()); | |||
| } | |||
| Status DavinciModel::GetInputOutputDescInfoForZeroCopy(vector<InputOutputDescInfo> &input_desc, | |||
| vector<InputOutputDescInfo> &output_desc, | |||
| std::vector<uint32_t> &input_formats, | |||
| std::vector<uint32_t> &output_formats) { | |||
| if (input_addrs_list_.empty() || input_addrs_list_[0].size() != kOutputNum) { | |||
| GELOGE(FAILED, "OP List Pointer is null or input_desc size is not 1!"); | |||
| return FAILED; | |||
| } | |||
| GE_CHK_STATUS_RET(GetInputDescInfo(input_desc, input_formats), "get input desc info failed"); | |||
| GE_CHK_STATUS_RET(GetOutputDescInfo(output_desc, output_formats), "get ouput desc info failed"); | |||
| GE_CHK_BOOL_RET_STATUS(output_desc.size() == output_memory_size_list_.size(), INTERNAL_ERROR, | |||
| "output_desc size[%zu] not equal output_size_list_[%zu] size!", output_desc.size(), | |||
| output_memory_size_list_.size()); | |||
| /// For function zero copy,the momery should be aligned by 512 bytes. | |||
| /// And, because of the cce op limit, size should be lager than the real shape size. The memory should be padded by 32 | |||
| /// bytes. | |||
| /// *size equals to ((tensorDesc->dataSize + 2 * 32 - 1) / 32) * 32; | |||
| for (size_t i = 0; i < output_memory_size_list_.size(); i++) { | |||
| output_desc[i].size = output_memory_size_list_[i]; | |||
| } | |||
| return SUCCESS; | |||
| } | |||
| void DavinciModel::SetInputDimsInfo(const vector<int64_t> &model_input_dims, Format &format, | |||
| InputOutputDescInfo &input) { | |||
| uint32_t n, c, h, w; | |||
| @@ -2056,7 +2028,8 @@ Status DavinciModel::InitOutputDescInfo(const vector<OpDescPtr> &output_op_list) | |||
| return SUCCESS; | |||
| } | |||
| Status DavinciModel::GetOutputDescInfo(vector<InputOutputDescInfo> &output_descs, vector<uint32_t> &output_formats) { | |||
| Status DavinciModel::GetOutputDescInfo(vector<InputOutputDescInfo> &output_descs, | |||
| vector<uint32_t> &output_formats) const { | |||
| output_descs.insert(output_descs.end(), output_descs_.begin(), output_descs_.end()); | |||
| output_formats.insert(output_formats.end(), output_formats_.begin(), output_formats_.end()); | |||
| return SUCCESS; | |||
| @@ -3962,7 +3935,7 @@ Status DavinciModel::InitOrigInputInfo(uint32_t index, const OpDescPtr &op_desc) | |||
| vector<string> inputs; | |||
| if (AttrUtils::GetListStr(op_desc, ATTR_NAME_AIPP_INPUTS, inputs) && !inputs.empty()) { | |||
| std::string input = inputs[kAippOriginInputIndex]; | |||
| GELOGI("GetOrigInputInfo: origin input str: %s", input.c_str()); | |||
| GELOGI("origin input str: %s", input.c_str()); | |||
| std::vector<std::string> infos = ge::StringUtils::Split(input, ':'); | |||
| if (infos.size() != kAippInfoNum) { | |||
| GELOGE(ACL_ERROR_GE_AIPP_MODE_INVALID, "origin input str is invalid[%zu, %u].", infos.size(), kAippInfoNum); | |||
| @@ -3982,10 +3955,10 @@ Status DavinciModel::InitOrigInputInfo(uint32_t index, const OpDescPtr &op_desc) | |||
| return SUCCESS; | |||
| } | |||
| Status DavinciModel::GetOrigInputInfo(uint32_t index, OriginInputInfo &orig_input_info) { | |||
| Status DavinciModel::GetOrigInputInfo(uint32_t index, OriginInputInfo &orig_input_info) const { | |||
| const auto it = orig_input_info_.find(index); | |||
| if (it == orig_input_info_.end()) { | |||
| GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "GetOrigInputInfo: there is not AIPP related with index %u.", index); | |||
| GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "there is not AIPP related with index %u.", index); | |||
| return ACL_ERROR_GE_AIPP_NOT_EXIST; | |||
| } | |||
| @@ -4031,7 +4004,7 @@ Status DavinciModel::InitAippInputOutputDims(uint32_t index, const OpDescPtr &op | |||
| InputOutputDims input_info; | |||
| ParseAIPPInfo(it, input_info); | |||
| input_dims.emplace_back(input_info); | |||
| GELOGD("GetAllAippInputOutputDims Aipp origin input dims info: %s", it.c_str()); | |||
| GELOGD("Aipp origin input dims info: %s", it.c_str()); | |||
| ConstGeTensorDescPtr data_input_desc = op_desc->GetInputDescPtr(kDataIndex); | |||
| int64_t data_input_size; | |||
| @@ -4051,7 +4024,7 @@ Status DavinciModel::InitAippInputOutputDims(uint32_t index, const OpDescPtr &op | |||
| InputOutputDims output_info; | |||
| ParseAIPPInfo(it, output_info); | |||
| output_dims.emplace_back(output_info); | |||
| GELOGD("GetAllAippInputOutputDims Aipp output dims info: %s", it.c_str()); | |||
| GELOGD("Aipp output dims info: %s", it.c_str()); | |||
| } | |||
| } | |||
| @@ -4060,10 +4033,10 @@ Status DavinciModel::InitAippInputOutputDims(uint32_t index, const OpDescPtr &op | |||
| } | |||
| Status DavinciModel::GetAllAippInputOutputDims(uint32_t index, vector<InputOutputDims> &input_dims, | |||
| vector<InputOutputDims> &output_dims) { | |||
| vector<InputOutputDims> &output_dims) const { | |||
| const auto it = aipp_dims_info_.find(index); | |||
| if (it == aipp_dims_info_.end()) { | |||
| GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "GetAllAippInputOutputDims: there is not AIPP related with index %u.", index); | |||
| GELOGE(ACL_ERROR_GE_AIPP_NOT_EXIST, "there is not AIPP related with index %u.", index); | |||
| return ACL_ERROR_GE_AIPP_NOT_EXIST; | |||
| } | |||
| @@ -351,9 +351,9 @@ class DavinciModel { | |||
| /// @param [out] aipp_info | |||
| /// @return execute result | |||
| /// | |||
| Status GetAIPPInfo(uint32_t index, AippConfigInfo &aipp_info); | |||
| Status GetAIPPInfo(uint32_t index, AippConfigInfo &aipp_info) const; | |||
| Status GetAippType(uint32_t index, InputAippType &type, size_t &aipp_index); | |||
| Status GetAippType(uint32_t index, InputAippType &type, size_t &aipp_index) const; | |||
| /// | |||
| /// @ingroup ge | |||
| @@ -371,17 +371,6 @@ class DavinciModel { | |||
| /// | |||
| void GetUniqueId(const OpDescPtr &op_desc, string &unique_identification); | |||
| /// | |||
| /// @ingroup ge | |||
| /// @brief get model input and output desc for zero copy | |||
| /// @param [out] input_shape model input size | |||
| /// @param [out] output_shape model output size | |||
| /// @return execute result | |||
| /// | |||
| Status GetInputOutputDescInfoForZeroCopy(vector<InputOutputDescInfo> &input_desc, | |||
| vector<InputOutputDescInfo> &output_desc, | |||
| vector<uint32_t> &inputFormats, vector<uint32_t> &output_formats); | |||
| Status ReturnResult(uint32_t data_id, const bool rslt_flg, const bool seq_end_flg, OutputData *output_data); | |||
| Status ReturnNoOutput(uint32_t data_id); | |||
| @@ -527,9 +516,9 @@ class DavinciModel { | |||
| Status UpdateKnownZeroCopyAddr(vector<void *> &total_io_addrs, bool update_args = true); | |||
| void SetKnownNodeAddrNotChanged(bool base_addr_not_changed) { base_addr_not_changed_ = base_addr_not_changed; } | |||
| Status GetOrigInputInfo(uint32_t index, OriginInputInfo &orig_input_info); | |||
| Status GetOrigInputInfo(uint32_t index, OriginInputInfo &orig_input_info) const; | |||
| Status GetAllAippInputOutputDims(uint32_t index, vector<InputOutputDims> &input_dims, | |||
| vector<InputOutputDims> &output_dims); | |||
| vector<InputOutputDims> &output_dims) const; | |||
| void SetModelDescVersion(bool is_new_model_desc) { is_new_model_desc_ = is_new_model_desc; } | |||
| // om file name | |||
| void SetOmName(string om_name) { om_name_ = om_name; } | |||
| @@ -615,7 +604,7 @@ class DavinciModel { | |||
| void SetInputDimsInfo(const vector<int64_t> &model_input_dims, Format &format, InputOutputDescInfo &input); | |||
| Status GetInputDescInfo(vector<InputOutputDescInfo> &input_desc, vector<uint32_t> &input_formats); | |||
| Status GetOutputDescInfo(vector<InputOutputDescInfo> &output_desc, vector<uint32_t> &output_formats); | |||
| Status GetOutputDescInfo(vector<InputOutputDescInfo> &output_desc, vector<uint32_t> &output_formats) const; | |||
| Status InitTaskInfo(domi::ModelTaskDef &modelTaskInfo); | |||
| @@ -995,16 +995,6 @@ Status ModelManager::GetModelAttr(uint32_t model_id, std::vector<string> &dynami | |||
| return SUCCESS; | |||
| } | |||
| Status ModelManager::GetInputOutputDescInfoForZeroCopy(const uint32_t model_id, vector<InputOutputDescInfo> &input_desc, | |||
| vector<InputOutputDescInfo> &output_desc, | |||
| std::vector<uint32_t> &inputFormats, | |||
| std::vector<uint32_t> &outputFormats) { | |||
| std::shared_ptr<DavinciModel> davinci_model = GetModel(model_id); | |||
| GE_CHK_BOOL_RET_STATUS(davinci_model != nullptr, ACL_ERROR_GE_EXEC_MODEL_ID_INVALID, | |||
| "GetInputOutputDescInfo Failed, Invalid model id %u!", model_id); | |||
| return davinci_model->GetInputOutputDescInfoForZeroCopy(input_desc, output_desc, inputFormats, outputFormats); | |||
| } | |||
| /// | |||
| /// @ingroup ge | |||
| /// @brief Get AIPP info | |||
| @@ -243,20 +243,6 @@ class FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY ModelManager { | |||
| ge::Status GetAippType(uint32_t model_id, uint32_t index, InputAippType &type, size_t &aipp_index); | |||
| /// | |||
| /// @ingroup domi_ome | |||
| /// @brief set model input and output size zero copy | |||
| /// @param [in] model_id model id | |||
| /// @param [out] input_shape input tensor | |||
| /// @param [out] output_shape output tensor | |||
| /// @return SUCCESS success | |||
| /// @return PARAM_INVALID parameter invalid | |||
| /// | |||
| ge::Status GetInputOutputDescInfoForZeroCopy(const uint32_t model_id, std::vector<InputOutputDescInfo> &input_desc, | |||
| std::vector<InputOutputDescInfo> &output_desc, | |||
| std::vector<uint32_t> &inputFormats, | |||
| std::vector<uint32_t> &outputFormats); | |||
| ge::Status GetCurShape(const uint32_t model_id, std::vector<int64_t> &batch_info, int32_t &dynamic_type); | |||
| ge::Status GetModelAttr(uint32_t model_id, std::vector<string> &dynamic_output_shape_info); | |||
| @@ -157,9 +157,6 @@ class GE_FUNC_DEV_VISIBILITY GE_FUNC_HOST_VISIBILITY GeExecutor { | |||
| ge::Status GetAippType(uint32_t model_id, uint32_t index, InputAippType &type, size_t &aipp_index); | |||
| ge::Status GetModelDescInfoForZeroCopy(uint32_t model_id, std::vector<ge::TensorDesc> &input_desc, | |||
| std::vector<ge::TensorDesc> &output_desc); | |||
| ge::Status CommandHandle(const ge::Command &command); | |||
| ge::Status SetDump(const DumpConfig &dump_config); | |||
| @@ -582,7 +582,7 @@ TEST_F(UtestDavinciModel, init_data_aipp_input_info_invalid) { | |||
| EXPECT_EQ(model.op_list_.size(), 1); | |||
| } | |||
| TEST_F(UtestDavinciModel, init_data_aipp_input_info_normal) { | |||
| TEST_F(UtestDavinciModel, init_data_aipp_input_dims_normal) { | |||
| DavinciModel model(0, nullptr); | |||
| model.ge_model_ = make_shared<GeModel>(); // for CustAICPUKernelStore::GetCustAICPUKernelStore() | |||
| model.runtime_param_.mem_base = (uint8_t *)0x08000000; | |||