From 5daea034392b5c0d176a95010bea2c44d8bd1ce7 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Sat, 9 Jan 2021 14:23:46 +0800 Subject: [PATCH 1/3] bugfix for l1 data dump --- .../load/new_model_manager/davinci_model.cc | 35 +++++++++++-------- .../load/new_model_manager/davinci_model.h | 2 ++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index 49abe17c..44f46785 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -520,6 +520,8 @@ Status DavinciModel::DoTaskSink() { GE_CHK_STATUS_RET(InitEntryTask(), "InitEntryTask failed."); + GE_CHK_STATUS_RET(InitL1DataDumperArgs(), "InitL1DataDumperArgs failed."); + GE_CHK_STATUS_RET(DistributeTask(), "Distribute failed."); GE_CHK_RT_RET(rtModelLoadComplete(rt_model_handle_)); @@ -716,19 +718,6 @@ Status DavinciModel::Init(void *dev_ptr, size_t mem_size, void *weight_ptr, size GE_CHK_STATUS_RET(DoTaskSink(), "Task sink failed"); GE_TIMESTAMP_END(DoTaskSink, "GraphLoader::DoTaskSink"); - auto all_dump_model = GetDumpProperties().GetAllDumpModel(); - bool findByOmName = all_dump_model.find(om_name_) != all_dump_model.end(); - bool findByModelName = all_dump_model.find(name_) != all_dump_model.end(); - bool dump_l1fusion_op = (all_dump_model.find(ge::DUMP_ALL_MODEL) != all_dump_model.end()) || - findByOmName || findByModelName; - if (dump_l1fusion_op) { - // malloc 2M for dump l1fusion op - GE_CHK_RT_RET(rtMalloc(&l1_fusion_addr_, kDumpL1FusionOpMByteSize, RT_MEMORY_DDR)); - - // send l1fusion dump addr to rts - GE_CHK_RT_RET(rtDumpAddrSet(rt_model_handle_, l1_fusion_addr_, kDumpL1FusionOpMByteSize, kDumpFlagOfL1Fusion)); - } - /// In zero copy model, if a aicpu operator is connected to the first or last layer, before model execution, /// the aicpu opertor needs to destroy history record, and update operator memory address. /// The model with specified aicpu operators is only marked here, and destruction is in ModelManager::ExecuteModel(). @@ -3951,7 +3940,6 @@ void DavinciModel::SetDataDumperArgs(const ComputeGraphPtr &graph, const map &variable_by_name); + Status InitL1DataDumperArgs(); + Status InitModelProfile(); Status SinkModelProfile(); From f51a80f3abc508df08cde3e08c60a7510a6f5282 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Sat, 9 Jan 2021 19:32:36 +0800 Subject: [PATCH 2/3] bugfix for l1 data dump --- ge/graph/load/new_model_manager/davinci_model.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index 44f46785..c531fe13 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -4160,7 +4160,12 @@ Status DavinciModel::InitL1DataDumperArgs() { GE_CHK_RT_RET(rtMalloc(&l1_fusion_addr_, kDumpL1FusionOpMByteSize, RT_MEMORY_DDR)); // send l1fusion dump addr to rts - GE_CHK_RT_RET(rtDumpAddrSet(rt_model_handle_, l1_fusion_addr_, kDumpL1FusionOpMByteSize, kDumpFlagOfL1Fusion)); + if (rtDumpAddrSet(rt_model_handle_, l1_fusion_addr_, kDumpL1FusionOpMByteSize, kDumpFlagOfL1Fusion) != + RT_ERROR_NONE) { + GELOGE(FAILED, "Call rtDumpAddrSet failed"); + GE_CHK_RT(rtFree(l1_fusion_addr_)); + return FAILED; + } // set addr for l1 data dump data_dumper_.SetL1FusionAddr(l1_fusion_addr_); From fbdc97709006296ec7ab9902b66a1e988a9a16d7 Mon Sep 17 00:00:00 2001 From: "gengchao4@huawei.com" Date: Mon, 11 Jan 2021 10:16:00 +0800 Subject: [PATCH 3/3] bugfix for l1 data dump --- ge/graph/load/new_model_manager/davinci_model.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ge/graph/load/new_model_manager/davinci_model.cc b/ge/graph/load/new_model_manager/davinci_model.cc index c531fe13..35844b2d 100755 --- a/ge/graph/load/new_model_manager/davinci_model.cc +++ b/ge/graph/load/new_model_manager/davinci_model.cc @@ -4162,8 +4162,8 @@ Status DavinciModel::InitL1DataDumperArgs() { // send l1fusion dump addr to rts if (rtDumpAddrSet(rt_model_handle_, l1_fusion_addr_, kDumpL1FusionOpMByteSize, kDumpFlagOfL1Fusion) != RT_ERROR_NONE) { + // l1_fusion_addr_ will be free when DavinciModel destruct GELOGE(FAILED, "Call rtDumpAddrSet failed"); - GE_CHK_RT(rtFree(l1_fusion_addr_)); return FAILED; }