From 16562a9d4446e0df92f54f399bfdd803ac9b26aa Mon Sep 17 00:00:00 2001 From: james Date: Wed, 30 Nov 2022 10:30:16 +0800 Subject: [PATCH] use correct xpu stream for synchronization (#48470) some legacy code still use xpu_wait() for stream sync -- it only syncs default stream. this PR replaces them with dev_ctx.Wait() to ensure that correct stream is always used --- paddle/fluid/operators/controlflow/logical_op_xpu.h | 2 +- paddle/fluid/platform/device/xpu/xpu_info.cc | 2 +- paddle/phi/backends/xpu/xpu_info.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/controlflow/logical_op_xpu.h b/paddle/fluid/operators/controlflow/logical_op_xpu.h index 5e1a24116b..8afefd6837 100644 --- a/paddle/fluid/operators/controlflow/logical_op_xpu.h +++ b/paddle/fluid/operators/controlflow/logical_op_xpu.h @@ -151,7 +151,7 @@ class BinaryLogicalOpXPUKernel : public framework::OpKernel { XpuLogicalType2Str(xpu_type))); if (need_broad_cast && dev_ctx.x_context()->xpu_stream != nullptr) { - xpu_wait(); + dev_ctx.Wait(); } } }; diff --git a/paddle/fluid/platform/device/xpu/xpu_info.cc b/paddle/fluid/platform/device/xpu/xpu_info.cc index 0ee8963b26..548fe89dc5 100644 --- a/paddle/fluid/platform/device/xpu/xpu_info.cc +++ b/paddle/fluid/platform/device/xpu/xpu_info.cc @@ -72,7 +72,7 @@ void MemcpySyncD2H(void* dst, } // if src.device == dst.device and you need sync , after call this function, -// need to call xpu_wait() +// need to call dev_ctx.Wait() void MemcpySyncD2D(void* dst, const platform::XPUPlace& dst_place, const void* src, diff --git a/paddle/phi/backends/xpu/xpu_info.cc b/paddle/phi/backends/xpu/xpu_info.cc index 978680e958..d084afee22 100644 --- a/paddle/phi/backends/xpu/xpu_info.cc +++ b/paddle/phi/backends/xpu/xpu_info.cc @@ -160,7 +160,7 @@ void MemcpySyncD2H(void* dst, } // if src.device == dst.device and you need sync , after call this function, -// need to call xpu_wait() +// need to call dev_ctx.Wait() void MemcpySyncD2D(void* dst, const phi::XPUPlace& dst_place, const void* src, -- GitLab