diff --git a/paddle/fluid/framework/new_executor/interpretercore.cc b/paddle/fluid/framework/new_executor/interpretercore.cc index 25f71dee2ac82869a30ff1fca164d04ecb5e038d..04d1f94d75241c611a357a0db2aff068e459a683 100644 --- a/paddle/fluid/framework/new_executor/interpretercore.cc +++ b/paddle/fluid/framework/new_executor/interpretercore.cc @@ -18,6 +18,7 @@ #include #include "paddle/fluid/framework/details/share_tensor_buffer_functor.h" +#include "paddle/fluid/platform/profiler.h" PADDLE_DEFINE_EXPORTED_bool(new_executor_use_inplace, true, "Use inplace in new executor"); @@ -304,9 +305,12 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) { VLOG(3) << "RunInstruction: " << instr_node.kernel_func_.operator_base_->Type(); - static_cast( - instr_node.kernel_func_.operator_base_) - ->InferShape(instr_node.infershape_ctx_.get()); + { + platform::RecordEvent infershape_event("InferShape"); + static_cast( + instr_node.kernel_func_.operator_base_) + ->InferShape(instr_node.infershape_ctx_.get()); + } if (FLAGS_new_executor_use_inplace) { for (auto& pair : instr_node.vec_inplace_in_to_out_) { @@ -318,8 +322,10 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) { } } } - - instr_node.kernel_func_.compute_func_(*instr_node.execution_ctx_.get()); + { + platform::RecordEvent compute_event("Compute"); + instr_node.kernel_func_.compute_func_(*instr_node.execution_ctx_.get()); + } } void InterpreterCore::ExecuteInstructionList( @@ -350,6 +356,8 @@ void InterpreterCore::RunInstructionAsync(size_t instr_id, AtomicVectorSizeT* atomic_var_ref, std::atomic* op_run_number) { auto& instr_node = vec_instruction_[instr_id]; + platform::RecordEvent instruction_event( + instr_node.kernel_func_.operator_base_->Type()); event_manager_.WaitEvent(instr_node, place_); RunInstruction(instr_node);