From 54f3b83b4e7604e6586a223fb1a6eab5b18e85a1 Mon Sep 17 00:00:00 2001 From: zhou_chao1993 Date: Tue, 26 Jan 2021 15:24:18 +0800 Subject: [PATCH] dump known shape node in c76 --- ge/graph/load/new_model_manager/data_dumper.cc | 1 + ge/graph/load/new_model_manager/davinci_model.cc | 4 ++++ ge/graph/load/new_model_manager/davinci_model.h | 7 +++++++ .../new_model_manager/task_info/kernel_ex_task_info.cc | 2 +- .../node_executor/compiledsubgraph/known_node_executor.cc | 6 ++++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ge/graph/load/new_model_manager/data_dumper.cc b/ge/graph/load/new_model_manager/data_dumper.cc index 9d88171f..d31548db 100644 --- a/ge/graph/load/new_model_manager/data_dumper.cc +++ b/ge/graph/load/new_model_manager/data_dumper.cc @@ -813,6 +813,7 @@ Status DataDumper::UnloadDumpInfo() { for (const auto &op_iter : op_list_) { aicpu::dump::Task task; task.set_task_id(op_iter.task_id); + task.set_stream_id(op_iter.stream_id); op_mapping_info.mutable_task()->Add(std::move(task)); } auto ret = ExecuteUnLoadDumpInfo(op_mapping_info); diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index 34da46e7..4c412d5a 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -3851,6 +3851,9 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &compute_graph) { } data_dumper_.SetDeviceId(device_id); + if (known_node_) { + data_dumper_.SetLoopAddr(known_shape_global_step_, nullptr, nullptr); + } else { // set loop count addr auto get_var_addr = [](const OpDescPtr &op, const RuntimeParam &runtime_param) -> void *{ if (op != nullptr) { @@ -3868,6 +3871,7 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &compute_graph) { data_dumper_.SetLoopAddr(get_var_addr(GetVariableOp(NODE_NAME_GLOBAL_STEP), runtime_param_), get_var_addr(GetVariableOp(NODE_NAME_FLOWCTRL_LOOP_PER_ITER), runtime_param_), get_var_addr(GetVariableOp(NODE_NAME_FLOWCTRL_LOOP_COND), runtime_param_)); + } } uint32_t DavinciModel::GetFlowctrlIndex(uint32_t op_index) { diff --git a/ge/graph/load/new_model_manager/davinci_model.h b/ge/graph/load/new_model_manager/davinci_model.h index 998c2112..c41dd239 100755 --- a/ge/graph/load/new_model_manager/davinci_model.h +++ b/ge/graph/load/new_model_manager/davinci_model.h @@ -464,6 +464,10 @@ class DavinciModel { data_dumper_.SaveDumpTask(task_id, stream_id, op_desc, args); } + void SetKnownShapeGlobalStep(void *global_step) { + known_shape_global_step_ = global_step; + } + void SetEndGraphId(uint32_t task_id, uint32_t stream_id); DavinciModel &operator=(const DavinciModel &model) = delete; @@ -985,6 +989,9 @@ class DavinciModel { // key: input_index: input is merge node; value: each gear info and each output shape std::map, vector>> merge_nodes_gear_and_real_out_shape_info_; std::vector> all_gears_info_; + + // known shape node for dump + void *known_shape_global_step_; }; } // namespace ge #endif // GE_GRAPH_LOAD_NEW_MODEL_MANAGER_DAVINCI_MODEL_H_ diff --git a/ge/graph/load/new_model_manager/task_info/kernel_ex_task_info.cc b/ge/graph/load/new_model_manager/task_info/kernel_ex_task_info.cc index 5dba0e5d..0246fc38 100644 --- a/ge/graph/load/new_model_manager/task_info/kernel_ex_task_info.cc +++ b/ge/graph/load/new_model_manager/task_info/kernel_ex_task_info.cc @@ -203,7 +203,7 @@ void KernelExTaskInfo::InitDumpTask(void *addr, const OpDescPtr &op_desc) { if (davinci_model_->GetDumpProperties().IsLayerNeedDump(davinci_model_->Name(), davinci_model_->OmName(), op_desc->GetName())) { dump_flag_ = RT_KERNEL_DUMPFLAG; - dump_args_ = input_output_addr_; + dump_args_ = addr; } } diff --git a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc index 7f2c6288..831b9677 100755 --- a/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc +++ b/ge/hybrid/node_executor/compiledsubgraph/known_node_executor.cc @@ -126,6 +126,12 @@ Status KnownNodeTask::Init(TaskContext &context) { auto dump_properties = context.GetDumpProperties(); if (dump_properties.IsDumpOpen()) { davinci_model_->SetDumpProperties(dump_properties); + void *global_step = nullptr; + TensorValue *varible_global_step = context.GetVariable(NODE_NAME_GLOBAL_STEP); + if (varible_global_step != nullptr) { + global_step = varible_global_step->MutableData(); + } + davinci_model_->SetKnownShapeGlobalStep(global_step); } int32_t device_id = 0; rtError_t rt_ret = rtGetDevice(&device_id);