From 557c3ba7ad93a101f63d91f248fbf6df145effaa Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 21 Nov 2020 15:02:48 +0800 Subject: [PATCH] Modify Codeex --- ge/graph/build/memory/block_mem_assigner.cc | 12 ++++++------ .../task_info/event_record_task_info.cc | 9 ++++----- .../task_info/event_wait_task_info.cc | 10 ++++------ ge/graph/passes/data_pass.cc | 3 --- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/ge/graph/build/memory/block_mem_assigner.cc b/ge/graph/build/memory/block_mem_assigner.cc index cdca7fb7..ecf253e1 100755 --- a/ge/graph/build/memory/block_mem_assigner.cc +++ b/ge/graph/build/memory/block_mem_assigner.cc @@ -881,14 +881,14 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size, continue; } std::string batch_label; - if (reusable_block->IsSameLabel(batch_label)) { - std::string op_label; - (void)ge::AttrUtils::GetStr(node_op_desc, ATTR_NAME_BATCH_LABEL, op_label); - if (batch_label != op_label) { + if (reusable_block->IsSameLabel(batch_label)) { + std::string op_label; + (void)ge::AttrUtils::GetStr(node_op_desc, ATTR_NAME_BATCH_LABEL, op_label); + if (batch_label != op_label) { GELOGI("label diff, op name %s", node_op_desc->GetName().c_str()); continue; - } - } + } + } // A node can reuse blocks of the same stream and preorder streams if (CanReuseBySize(reusable_block_counts_, *reusable_block, block_size, real_size, continuous)) { diff --git a/ge/graph/load/new_model_manager/task_info/event_record_task_info.cc b/ge/graph/load/new_model_manager/task_info/event_record_task_info.cc index 772078c6..11589258 100755 --- a/ge/graph/load/new_model_manager/task_info/event_record_task_info.cc +++ b/ge/graph/load/new_model_manager/task_info/event_record_task_info.cc @@ -32,14 +32,13 @@ Status EventRecordTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *da return ret; } - if (task_def.event_id() >= davinci_model->EventNum()) { - GELOGE(INTERNAL_ERROR, "event_list_ size = %u cur =%u!", davinci_model->EventNum(), task_def.event_id()); + const auto &eventList = davinci_model->GetEventList(); + if (task_def.event_id() >= eventList.size()) { + GELOGE(INTERNAL_ERROR, "event list size:%zu, cur:%u!", eventList.size(), task_def.event_id()); return INTERNAL_ERROR; } - if (!davinci_model->GetEventList().empty()) { - event_ = davinci_model->GetEventList()[task_def.event_id()]; - } + event_ = eventList[task_def.event_id()]; return SUCCESS; } diff --git a/ge/graph/load/new_model_manager/task_info/event_wait_task_info.cc b/ge/graph/load/new_model_manager/task_info/event_wait_task_info.cc index b6d8f04c..5701179b 100755 --- a/ge/graph/load/new_model_manager/task_info/event_wait_task_info.cc +++ b/ge/graph/load/new_model_manager/task_info/event_wait_task_info.cc @@ -32,15 +32,13 @@ Status EventWaitTaskInfo::Init(const domi::TaskDef &task_def, DavinciModel *davi return ret; } - if (task_def.event_id() >= davinci_model->EventNum()) { - GELOGE(INTERNAL_ERROR, "event_list_ size = %u cur =%u!", davinci_model->EventNum(), task_def.event_id()); + const auto &eventList = davinci_model->GetEventList(); + if (task_def.event_id() >= eventList.size()) { + GELOGE(INTERNAL_ERROR, "event list size:%zu, cur:%u!", eventList.size(), task_def.event_id()); return INTERNAL_ERROR; } - if (!davinci_model->GetEventList().empty()) { - event_ = davinci_model->GetEventList()[task_def.event_id()]; - } - + event_ = eventList[task_def.event_id()]; event_type_ = task_def.event_ex().event_type(); return SUCCESS; diff --git a/ge/graph/passes/data_pass.cc b/ge/graph/passes/data_pass.cc index c7314efb..8f9df2f0 100644 --- a/ge/graph/passes/data_pass.cc +++ b/ge/graph/passes/data_pass.cc @@ -16,11 +16,8 @@ #include "graph/passes/data_pass.h" -#include - #include "framework/common/debug/ge_log.h" #include "graph/utils/graph_utils.h" -#include "register/op_registry.h" namespace ge { namespace {