| @@ -2185,8 +2185,9 @@ Status DavinciModel::CopyInputData(const InputData &input_data, bool device_data | |||||
| const std::vector<DataBuffer> &blobs = input_data.blobs; | const std::vector<DataBuffer> &blobs = input_data.blobs; | ||||
| for (const auto &data : new_input_data_info_) { | for (const auto &data : new_input_data_info_) { | ||||
| if (data.first >= blobs.size()) { | if (data.first >= blobs.size()) { | ||||
| GELOGE(FAILED, "Blobs not match: blobs=%zu, tensor=%zu, index=%u, size=%ld", blobs.size(), | |||||
| new_input_data_info_.size(), data.first, data.second.GetDataInfo().at(0).first); | |||||
| GELOGE(FAILED, "Blobs not match: blobs=%zu, tensor=%zu, index=%u, size=%ld, op_name(%s)", blobs.size(), | |||||
| new_input_data_info_.size(), data.first, data.second.GetDataInfo().at(0).first, | |||||
| data.second.GetOpName().c_str()); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| @@ -2197,13 +2198,14 @@ Status DavinciModel::CopyInputData(const InputData &input_data, bool device_data | |||||
| } | } | ||||
| uint64_t data_size = data.second.GetDataSize(); | uint64_t data_size = data.second.GetDataSize(); | ||||
| GE_CHK_BOOL_RET_STATUS(data_size >= data_buf.length, PARAM_INVALID, | GE_CHK_BOOL_RET_STATUS(data_size >= data_buf.length, PARAM_INVALID, | ||||
| "input data size(%lu) does not match model required size(%lu), ret failed.", data_buf.length, | |||||
| data_size); | |||||
| "input data size(%lu) does not match model required size(%lu), op_name(%s) ret failed.", | |||||
| data_buf.length, data_size, data.second.GetOpName().c_str()); | |||||
| void *mem_addr = data.second.GetBasicAddr(); | void *mem_addr = data.second.GetBasicAddr(); | ||||
| void *data_buf_addr = reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(data_buf.data)); | void *data_buf_addr = reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(data_buf.data)); | ||||
| uint64_t data_buf_length = data_buf.length; | uint64_t data_buf_length = data_buf.length; | ||||
| GELOGI("CopyPlainData memcpy graph_%u type[F] input[%u] dst[%p] src[%p] mem_size[%lu] datasize[%lu]", | |||||
| runtime_param_.graph_id, data.first, mem_addr, data_buf_addr, data_size, data_buf_length); | |||||
| GELOGI("CopyPlainData memcpy graph_%u type[F] input[%s] rank[%u] dst[%p] src[%p] mem_size[%lu] datasize[%lu]", | |||||
| runtime_param_.graph_id, data.second.GetOpName().c_str(), data.first, mem_addr, data_buf_addr, data_size, | |||||
| data_buf_length); | |||||
| GE_CHK_RT_RET(rtMemcpy(mem_addr, data_size, data_buf_addr, data_buf_length, kind)); | GE_CHK_RT_RET(rtMemcpy(mem_addr, data_size, data_buf_addr, data_buf_length, kind)); | ||||
| } | } | ||||
| @@ -3444,7 +3446,7 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map<uint32_t, ZeroCopyOffset> & | |||||
| } | } | ||||
| 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"); | |||||
| GELOGE(FAILED, "Check input size and model size failed, op[%s]", data.second.GetOpName().c_str()); | |||||
| return FAILED; | return FAILED; | ||||
| } | } | ||||
| @@ -35,6 +35,7 @@ Status ZeroCopyOffset::InitInputDataInfo(int64_t output_size, void *virtual_addr | |||||
| GELOGI("[ZCPY] Start to InitInputDataInfo of %s, total_data_size is %ld, virtual_addr is %p", | GELOGI("[ZCPY] Start to InitInputDataInfo of %s, total_data_size is %ld, virtual_addr is %p", | ||||
| op_desc->GetName().c_str(), output_size, virtual_addr); | op_desc->GetName().c_str(), output_size, virtual_addr); | ||||
| basic_addr_ = virtual_addr; | basic_addr_ = virtual_addr; | ||||
| op_name_ = op_desc->GetName(); | |||||
| (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset_); | (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset_); | ||||
| (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset_); | (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset_); | ||||
| GE_CHK_BOOL_EXEC(zero_copy_basic_offset_.size() == zero_copy_relative_offset_.size(), return PARAM_INVALID, | GE_CHK_BOOL_EXEC(zero_copy_basic_offset_.size() == zero_copy_relative_offset_.size(), return PARAM_INVALID, | ||||
| @@ -82,6 +83,7 @@ Status ZeroCopyOffset::InitOutputDataInfo(const vector<int64_t> &input_size_list | |||||
| GELOGD("Tensor data size: GetSize=%ld, GetTensorSizeInBytes=%ld", input_size_list[idx], size); | GELOGD("Tensor data size: GetSize=%ld, GetTensorSizeInBytes=%ld", input_size_list[idx], size); | ||||
| basic_addr_ = virtual_addr_list[idx]; | basic_addr_ = virtual_addr_list[idx]; | ||||
| op_name_ = op_desc->GetName(); | |||||
| (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset_); | (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_BASIC_OFFSET, zero_copy_basic_offset_); | ||||
| (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset_); | (void)ge::AttrUtils::GetListInt(op_desc, ATTR_ZERO_COPY_RELATIVE_OFFSET, zero_copy_relative_offset_); | ||||
| GE_CHK_BOOL_EXEC(zero_copy_basic_offset_.size() == zero_copy_relative_offset_.size(), return PARAM_INVALID, | GE_CHK_BOOL_EXEC(zero_copy_basic_offset_.size() == zero_copy_relative_offset_.size(), return PARAM_INVALID, | ||||
| @@ -66,9 +66,12 @@ class ZeroCopyOffset { | |||||
| int64_t GetDataSize() const { return data_size_; } | int64_t GetDataSize() const { return data_size_; } | ||||
| // value of *outside_addrs_ from davinci_model | // value of *outside_addrs_ from davinci_model | ||||
| std::vector<std::map<const void *, std::vector<void *>>> &GetOutsideAddrs() { return outside_addrs_; } | std::vector<std::map<const void *, std::vector<void *>>> &GetOutsideAddrs() { return outside_addrs_; } | ||||
| // name of op | |||||
| std::string GetOpName() const { return op_name_; } | |||||
| private: | private: | ||||
| void *basic_addr_ = nullptr; | void *basic_addr_ = nullptr; | ||||
| std::string op_name_; | |||||
| uint32_t data_count_ = 0; | uint32_t data_count_ = 0; | ||||
| std::vector<std::pair<int64_t, void *>> data_info_; | std::vector<std::pair<int64_t, void *>> data_info_; | ||||
| vector<int64_t> relative_offset_; | vector<int64_t> relative_offset_; | ||||
| @@ -80,4 +83,4 @@ class ZeroCopyOffset { | |||||
| std::vector<int64_t> zero_copy_relative_offset_; | std::vector<int64_t> zero_copy_relative_offset_; | ||||
| }; | }; | ||||
| } // namespace ge | } // namespace ge | ||||
| #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_ZERO_COPY_OFFSET_H_ | |||||
| #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_ZERO_COPY_OFFSET_H_ | |||||
| @@ -614,32 +614,32 @@ Status ge::GraphPartitioner::AddPartitionsToGraphNode(vector<ge::SubGraphInfoPtr | |||||
| } | } | ||||
| // flush parent node of subgraph | // flush parent node of subgraph | ||||
| sub_graph->SetParentNode(compute_graph->GetParentNode()); | sub_graph->SetParentNode(compute_graph->GetParentNode()); | ||||
| (void) AttrUtils::SetStr(*sub_graph, ATTR_NAME_PARENT_GRAPH_NAME, compute_graph->GetName()); | |||||
| auto sgi = MakeShared<SubGraphInfo>(); | |||||
| if (sgi == nullptr) { | |||||
| GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: MakeShared sub graph info failed."); | |||||
| return FAILED; | |||||
| } | |||||
| // set engine name | |||||
| sgi->SetEngineName(engine_name); | |||||
| // set stream label | |||||
| string sub_graph_stream; | |||||
| if (AttrUtils::GetStr(sub_graph->GetDirectNode().at(0)->GetOpDesc(), ATTR_NAME_STREAM_LABEL, sub_graph_stream)) { | |||||
| sgi->SetStreamLabel(sub_graph_stream); | |||||
| } | |||||
| /// for now inputFlag is the same before and after partition. It should | |||||
| /// be changed according to the real partition | |||||
| std::vector<bool> sub_graph_input(graph_info_.input_size_, true); | |||||
| std::vector<bool> sub_graph_output(graph_info_.output_size_, true); | |||||
| sgi->SetSubGraph(sub_graph); | |||||
| sgi->SetOutputFlag(sub_graph_output); | |||||
| sgi->SetInputFlag(sub_graph_input); | |||||
| sgi->SetOutputContext(graph_info_.output_name_); | |||||
| AddEndPldInformationToSubGraphInfo(sgi); | |||||
| GELOGI("[GraphPartitioner]: subGraph engine name is %s, graph name is %s, stream label is %s", | |||||
| engine_name.c_str(), | |||||
| sub_graph->GetName().c_str(), | |||||
| sgi->GetStreamLabel().empty() ? "null" : sgi->GetStreamLabel().c_str()); | |||||
| (void)AttrUtils::SetStr(*sub_graph, ATTR_NAME_PARENT_GRAPH_NAME, compute_graph->GetName()); | |||||
| GELOGD("set attr success. subgraph(%s) with parent graph(%s)", sub_graph->GetName().c_str(), | |||||
| compute_graph->GetName().c_str()); | |||||
| auto sgi = MakeShared<SubGraphInfo>(); | |||||
| if (sgi == nullptr) { | |||||
| GELOGE(GE_GRAPH_PARAM_NULLPTR, "[GraphPartitioner]: MakeShared sub graph info failed."); | |||||
| return FAILED; | |||||
| } | |||||
| // set engine name | |||||
| sgi->SetEngineName(engine_name); | |||||
| // set stream label | |||||
| string sub_graph_stream; | |||||
| if (AttrUtils::GetStr(sub_graph->GetDirectNode().at(0)->GetOpDesc(), ATTR_NAME_STREAM_LABEL, sub_graph_stream)) { | |||||
| sgi->SetStreamLabel(sub_graph_stream); | |||||
| } | |||||
| /// for now inputFlag is the same before and after partition. It should | |||||
| /// be changed according to the real partition | |||||
| std::vector<bool> sub_graph_input(graph_info_.input_size_, true); | |||||
| std::vector<bool> sub_graph_output(graph_info_.output_size_, true); | |||||
| sgi->SetSubGraph(sub_graph); | |||||
| sgi->SetOutputFlag(sub_graph_output); | |||||
| sgi->SetInputFlag(sub_graph_input); | |||||
| sgi->SetOutputContext(graph_info_.output_name_); | |||||
| AddEndPldInformationToSubGraphInfo(sgi); | |||||
| GELOGI("[GraphPartitioner]: subGraph engine name is %s, graph name is %s, stream label is %s", engine_name.c_str(), | |||||
| sub_graph->GetName().c_str(), sgi->GetStreamLabel().empty() ? "null" : sgi->GetStreamLabel().c_str()); | |||||
| if (engine_name != input_subgraph_name) { // do not add Data subGraph into SubGraphInfo | if (engine_name != input_subgraph_name) { // do not add Data subGraph into SubGraphInfo | ||||
| output_subgraphs.push_back(sgi); | output_subgraphs.push_back(sgi); | ||||
| } else { | } else { | ||||