Browse Source

add debug info for mstune

tags/v1.2.0
gengchao4@huawei.com 3 years ago
parent
commit
3f652155a5
4 changed files with 41 additions and 34 deletions
  1. +9
    -7
      ge/graph/load/new_model_manager/davinci_model.cc
  2. +2
    -0
      ge/graph/load/new_model_manager/zero_copy_offset.cc
  3. +4
    -1
      ge/graph/load/new_model_manager/zero_copy_offset.h
  4. +26
    -26
      ge/graph/partition/graph_partition.cc

+ 9
- 7
ge/graph/load/new_model_manager/davinci_model.cc View File

@@ -2185,8 +2185,9 @@ Status DavinciModel::CopyInputData(const InputData &input_data, bool device_data
const std::vector<DataBuffer> &blobs = input_data.blobs;
for (const auto &data : new_input_data_info_) {
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;
}

@@ -2197,13 +2198,14 @@ Status DavinciModel::CopyInputData(const InputData &input_data, bool device_data
}
uint64_t data_size = data.second.GetDataSize();
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 *data_buf_addr = reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(data_buf.data));
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));
}

@@ -3444,7 +3446,7 @@ Status DavinciModel::UpdateIoTaskArgs(const std::map<uint32_t, ZeroCopyOffset> &
}

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;
}



+ 2
- 0
ge/graph/load/new_model_manager/zero_copy_offset.cc View File

@@ -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",
op_desc->GetName().c_str(), output_size, 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_RELATIVE_OFFSET, zero_copy_relative_offset_);
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);

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_RELATIVE_OFFSET, zero_copy_relative_offset_);
GE_CHK_BOOL_EXEC(zero_copy_basic_offset_.size() == zero_copy_relative_offset_.size(), return PARAM_INVALID,


+ 4
- 1
ge/graph/load/new_model_manager/zero_copy_offset.h View File

@@ -66,9 +66,12 @@ class ZeroCopyOffset {
int64_t GetDataSize() const { return data_size_; }
// value of *outside_addrs_ from davinci_model
std::vector<std::map<const void *, std::vector<void *>>> &GetOutsideAddrs() { return outside_addrs_; }
// name of op
std::string GetOpName() const { return op_name_; }

private:
void *basic_addr_ = nullptr;
std::string op_name_;
uint32_t data_count_ = 0;
std::vector<std::pair<int64_t, void *>> data_info_;
vector<int64_t> relative_offset_;
@@ -80,4 +83,4 @@ class ZeroCopyOffset {
std::vector<int64_t> zero_copy_relative_offset_;
};
} // namespace ge
#endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_ZERO_COPY_OFFSET_H_
#endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_ZERO_COPY_OFFSET_H_

+ 26
- 26
ge/graph/partition/graph_partition.cc View File

@@ -614,32 +614,32 @@ Status ge::GraphPartitioner::AddPartitionsToGraphNode(vector<ge::SubGraphInfoPtr
}
// flush parent node of subgraph
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
output_subgraphs.push_back(sgi);
} else {


Loading…
Cancel
Save