@@ -53,8 +53,8 @@ typedef struct {
5353// used.
5454void MemoryOptimizePass::CollectLifeCycle (
5555 Graph* graph, std::unordered_map<std::string, lifecycle_t >* lifecycles,
56- int sort_kind, int max_lifecycle ) const {
57- max_lifecycle = 0 ;
56+ int sort_kind) const {
57+ int max_lifecycle = 0 ;
5858 for (auto * op_node : framework::ir::TopologyVarientSort (
5959 *graph, static_cast <framework::ir::SortKind>(sort_kind))) {
6060 if (!op_node->IsOp ()) continue ;
@@ -304,19 +304,18 @@ void MemoryOptimizePass::RunImpl(Argument* argument) {
304304 // 3. Perform reuse plan: Replace all var's name in the model according to the
305305 // mapping table.
306306 if (!argument->enable_memory_optim ()) return ;
307- // Because of pass is a singleton, graph and max_lifecycle can not be member
307+ // Because of pass is a singleton, graph can not be member
308308 // variables,otherwise,errors will be caused under multithreading
309309 // conditions.
310310 auto graph = argument->main_graph_ptr ();
311- int max_lifecycle = -1 ;
312311
313312 int sort_kind = 0 ;
314313 std::unordered_map<std::string, lifecycle_t > lifecycles;
315314 space_table_t space_table;
316315 std::unordered_map<std::string, std::string> node2cluster;
317316 std::unordered_map<std::string, int > cluster_size;
318317
319- CollectLifeCycle (graph, &lifecycles, sort_kind, max_lifecycle );
318+ CollectLifeCycle (graph, &lifecycles, sort_kind);
320319 CollectVarMemorySize (graph, &space_table);
321320 MakeSimpleReusePlan (lifecycles, space_table, &node2cluster, &cluster_size);
322321 UpdateOpDescsByReuse (graph, node2cluster, sort_kind);
0 commit comments