From 00f8b7d37ba441a87257b846fffc0db3cf0aa665 Mon Sep 17 00:00:00 2001 From: lichun Date: Thu, 29 Apr 2021 19:34:52 +0800 Subject: [PATCH] mark distance attr --- ge/graph/build/memory/graph_mem_assigner.cc | 20 ++++++++++---------- ge/graph/build/memory/graph_mem_assigner.h | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ge/graph/build/memory/graph_mem_assigner.cc b/ge/graph/build/memory/graph_mem_assigner.cc index 3ea85ce0..834d4f4f 100755 --- a/ge/graph/build/memory/graph_mem_assigner.cc +++ b/ge/graph/build/memory/graph_mem_assigner.cc @@ -2035,9 +2035,9 @@ void GraphMemoryAssigner::UpdateCurNodeInputDesc(const NodePtr &cur_node, } void GraphMemoryAssigner::CheckNeedCalcDistAndUpdateVisitInfo( - const size_t matched_mem_offset, const NodePtr &peer_out_node, const OutDataAnchorPtr &peer_out_anchor, + size_t matched_mem_offset, map>> &mem_block_visit_info, bool &is_need_calc_distance) { auto iter = mem_block_visit_info.find(matched_mem_offset); @@ -2073,10 +2073,10 @@ void GraphMemoryAssigner::CheckNeedCalcDistAndUpdateVisitInfo( } // calculate distance, update visit info, update prev_node input desc, update cur node input desc -void GraphMemoryAssigner::CalcDistanceAndUpdateDesc(const size_t matched_mem_offset, - const map &node_index_in_stream, - NodePtr &node, +void GraphMemoryAssigner::CalcDistanceAndUpdateDesc(const map &node_index_in_stream, const InDataAnchorPtr &in_data_anchor, + size_t matched_mem_offset, + NodePtr &node, map>> &mem_block_visit_info, bool &is_need_skip) { int64_t distance = -1; @@ -2134,9 +2134,9 @@ void GraphMemoryAssigner::CalcDistanceAndUpdateDesc(const size_t matched_mem_off } void GraphMemoryAssigner::DeleteVisitInfoWhenLifecycleEnded( - const size_t matched_mem_offset, const NodePtr &node, const InDataAnchorPtr &in_data_anchor, + size_t matched_mem_offset, map>> &mem_block_visit_info) { GE_IF_BOOL_EXEC(node->GetOpDesc() == nullptr, return); auto input_desc = node->GetOpDesc()->GetInputDesc(in_data_anchor->GetIdx()); @@ -2172,20 +2172,20 @@ void GraphMemoryAssigner::MarkNodeDistanceAttr(const ComputeGraphPtr &compute_gr auto matched_mem_offset = peer_out_node->GetOpDesc()->GetOutputOffset().at(peer_out_anchor->GetIdx()); bool is_need_calc_distance = false; - CheckNeedCalcDistAndUpdateVisitInfo(mem_block_visit_info, matched_mem_offset, peer_out_node, - peer_out_anchor, is_need_calc_distance); + CheckNeedCalcDistAndUpdateVisitInfo(peer_out_node, peer_out_anchor, matched_mem_offset, + mem_block_visit_info, is_need_calc_distance); if (!is_need_calc_distance) { continue; } bool is_need_skip = false; - CalcDistanceAndUpdateDesc(mem_block_visit_info, matched_mem_offset, node_index_in_stream, node, - in_data_anchor, is_need_skip); + CalcDistanceAndUpdateDesc(node_index_in_stream, in_data_anchor, matched_mem_offset, node, + mem_block_visit_info, is_need_skip); if (is_need_skip) { continue; } - DeleteVisitInfoWhenLifecycleEnded(mem_block_visit_info, matched_mem_offset, node, in_data_anchor); + DeleteVisitInfoWhenLifecycleEnded(node, in_data_anchor, matched_mem_offset, mem_block_visit_info); } } diff --git a/ge/graph/build/memory/graph_mem_assigner.h b/ge/graph/build/memory/graph_mem_assigner.h index 10e435b5..0d9b03e5 100755 --- a/ge/graph/build/memory/graph_mem_assigner.h +++ b/ge/graph/build/memory/graph_mem_assigner.h @@ -212,22 +212,22 @@ class GraphMemoryAssigner { void UpdateCurNodeInputDesc(const NodePtr &cur_node, int64_t cur_node_input_index, int64_t distance); - void CheckNeedCalcDistAndUpdateVisitInfo(const size_t matched_mem_offset, - const NodePtr &peer_out_node, + void CheckNeedCalcDistAndUpdateVisitInfo(const NodePtr &peer_out_node, const OutDataAnchorPtr &peer_out_anchor, + size_t matched_mem_offset, map>> &mem_block_visit_info, bool &is_need_calc_distance); - void CalcDistanceAndUpdateDesc(const size_t matched_mem_offset, - const map &node_index_in_stream, - NodePtr &node, + void CalcDistanceAndUpdateDesc(const map &node_index_in_stream, const InDataAnchorPtr &in_data_anchor, + size_t matched_mem_offset, + NodePtr &node, map>> &mem_block_visit_info, bool &is_need_skip); - void DeleteVisitInfoWhenLifecycleEnded(const size_t matched_mem_offset, - const NodePtr &node, + void DeleteVisitInfoWhenLifecycleEnded(const NodePtr &node, const InDataAnchorPtr &in_data_anchor, + size_t matched_mem_offset, map>> &mem_block_visit_info); MemoryOffsetMap memory_offset_;