From 17c1dae962a008efa67b55e5147dcedfa23a68f6 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Wed, 11 Aug 2021 10:00:03 +0800 Subject: [PATCH] Add no need output to gc check list (#34754) * add not used output var to gc_check_list; test=develop * add useless output to gc check list; test=develop --- paddle/fluid/framework/new_exec.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/paddle/fluid/framework/new_exec.h b/paddle/fluid/framework/new_exec.h index cecbdb45a9c..defa7a96733 100644 --- a/paddle/fluid/framework/new_exec.h +++ b/paddle/fluid/framework/new_exec.h @@ -500,6 +500,17 @@ class InterpreterCore { } vec_instruction_[i].next_instruction_.direct_run_ = filter_next; + // checkout ouput + for (auto& item : vec_instruction_[i].output_index_) { + for (auto id : item.second) { + if (input_var2op_info_[id].size() == 0) { + // output var not be used by any kernel + vec_instruction_[i].gc_check_var_list.push_back(id); + global_scope.vec_meta_info_[id].var_ref_count_++; + } + } + } + for (auto inst_id : filter_next) { dependecy_count_[inst_id]++; } -- GitLab