From 2261390cdfa6c3e71868e18af53e06675b94d996 Mon Sep 17 00:00:00 2001 From: Ruibiao Chen Date: Tue, 7 Feb 2023 11:35:25 +0800 Subject: [PATCH] Set waiterType of kGpuSync to kCUDA (#50241) --- .../framework/new_executor/interpreter/stream_analyzer.cc | 3 +-- paddle/fluid/framework/new_executor/interpretercore.cc | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/paddle/fluid/framework/new_executor/interpreter/stream_analyzer.cc b/paddle/fluid/framework/new_executor/interpreter/stream_analyzer.cc index dde504280d..d29c827b39 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 537170e289..2f9fadf730 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_); -- GitLab