From d2b0df4253a6ada58528504238a0cd948995d915 Mon Sep 17 00:00:00 2001 From: GGBond8488 <857631483@qq.com> Date: Tue, 9 Jan 2024 07:14:48 +0000 Subject: [PATCH] fix inpalce case --- .../framework/new_executor/interpreter/interpreter_util.cc | 5 ++++- paddle/fluid/framework/new_executor/program_interpreter.cc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc b/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc index 9eb4559295649..c383c657df35e 100644 --- a/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc +++ b/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc @@ -991,7 +991,10 @@ void BuildOpFuncList(const platform::Place& place, std::rethrow_exception(std::current_exception()); } - if (FLAGS_save_static_runtime_data) { + // inplace case: If you save the input and output of share_buff, it will + // cause the saved input of the op corresponding to share_buff to be + // overwritten by the output. + if (FLAGS_save_static_runtime_data && (op->Type() != "share_buffer")) { VLOG(6) << "start to save paddle variable"; auto root_path = FLAGS_static_runtime_data_save_path; for (auto& vname : op->InputVars()) { diff --git a/paddle/fluid/framework/new_executor/program_interpreter.cc b/paddle/fluid/framework/new_executor/program_interpreter.cc index 0f50665e1621e..8c64f66adc8fc 100644 --- a/paddle/fluid/framework/new_executor/program_interpreter.cc +++ b/paddle/fluid/framework/new_executor/program_interpreter.cc @@ -1072,7 +1072,10 @@ void ProgramInterpreter::RunOperator(const Instruction& instr_node) { } // for debug - if (FLAGS_save_static_runtime_data) { + // inplace case: If you save the input and output of share_buff, it will cause + // the saved input of the op corresponding to share_buff to be overwritten by + // the output. + if (FLAGS_save_static_runtime_data && (op->Type() != "share_buffer")) { VLOG(6) << "start to save paddle variable"; auto root_path = FLAGS_static_runtime_data_save_path; for (auto& vname : op->InputVars()) {