diff --git a/paddle/fluid/framework/new_exec.h b/paddle/fluid/framework/new_exec.h index cecbdb45a9cc9a2ced0a00069dda4e0b2bab2c48..defa7a967336b56654788d6beddaab1b467de914 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]++; }