diff --git a/paddle/fluid/framework/new_executor/interpreter/stream_analyzer.cc b/paddle/fluid/framework/new_executor/interpreter/stream_analyzer.cc index dde504280d2900bdfe91c578da861fc92ee934ef..d29c827b39c3af25a4c5d2d075d240176d62d8c3 100644 --- a/paddle/fluid/framework/new_executor/interpreter/stream_analyzer.cc +++ b/paddle/fluid/framework/new_executor/interpreter/stream_analyzer.cc @@ -431,8 +431,7 @@ void StreamAnalyzer::ShrinkEventInfo( platform::DeviceType StreamAnalyzer::GetWaiterType( const Instruction& instr) const { - if (instr.KernelType() == OpFuncType::kCpuSync || - instr.KernelType() == OpFuncType::kGpuSync) { + if (instr.KernelType() == OpFuncType::kCpuSync) { return platform::kCPU; } else { if (platform::is_xpu_place(place_)) { diff --git a/paddle/fluid/framework/new_executor/interpretercore.cc b/paddle/fluid/framework/new_executor/interpretercore.cc index 537170e28905f9d7ff377cff1a31fd1883ee0025..2f9fadf7308f7501c4de3940db797706a2ba78c5 100644 --- a/paddle/fluid/framework/new_executor/interpretercore.cc +++ b/paddle/fluid/framework/new_executor/interpretercore.cc @@ -858,8 +858,6 @@ void InterpreterCore::RunOperator(const Instruction& instr_node) { : var_scope_.GetMutableScope(); VLOG(4) << "Start run " << place << " " << op->DebugStringEx(local_scope); - SetDeviceId(place); - #ifdef PADDLE_WITH_ASCEND_CL if (platform::is_npu_place(place)) { // NOTE(wangxi): nan/inf cannot be detected on NPU by checking the @@ -989,6 +987,8 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) { platform::RecordEvent instruction_event( op->Type(), platform::TracerEventType::Operator, 1); + SetDeviceId(instr_node.DeviceContext().GetPlace()); + try { instr_node.WaitEvent(place_);