From 7b6d5ac0b79dc4ad4ee58d73c26ea6aa26fadbe1 Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Tue, 28 Feb 2023 20:02:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90Hackathon=20=20No.69=E3=80=91[PHI=20de?= =?UTF-8?q?coupling]=20move=20device=5Fwrapper=20from=20fluid=20to=20phi?= =?UTF-8?q?=20(#50749)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [phi] move device_wrapper from fluid to phi * [phi] fix ‘PADDLE_ENFORCE_XDNN_SUCCESS’ was not declared in this scope --- paddle/phi/backends/callback_manager.cc | 1 - paddle/phi/backends/event.cc | 1 - paddle/phi/backends/stream.cc | 1 - paddle/phi/kernels/funcs/selected_rows_functor.cc | 15 +++++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/paddle/phi/backends/callback_manager.cc b/paddle/phi/backends/callback_manager.cc index c996b8d9bef..0d658258fa4 100644 --- a/paddle/phi/backends/callback_manager.cc +++ b/paddle/phi/backends/callback_manager.cc @@ -16,7 +16,6 @@ #include -#include "paddle/fluid/platform/device/device_wrapper.h" #include "paddle/phi/backends/device_guard.h" #include "paddle/phi/core/enforce.h" diff --git a/paddle/phi/backends/event.cc b/paddle/phi/backends/event.cc index 7d87318cfec..7e64bc58fdb 100644 --- a/paddle/phi/backends/event.cc +++ b/paddle/phi/backends/event.cc @@ -14,7 +14,6 @@ #include "paddle/phi/backends/event.h" -#include "paddle/fluid/platform/device/device_wrapper.h" #include "paddle/phi/backends/device_guard.h" #include "paddle/phi/backends/stream.h" diff --git a/paddle/phi/backends/stream.cc b/paddle/phi/backends/stream.cc index 729f5717a5f..097f4426458 100644 --- a/paddle/phi/backends/stream.cc +++ b/paddle/phi/backends/stream.cc @@ -14,7 +14,6 @@ #include "paddle/phi/backends/stream.h" -#include "paddle/fluid/platform/device/device_wrapper.h" #include "paddle/phi/backends/device_guard.h" #include "paddle/phi/backends/event.h" diff --git a/paddle/phi/kernels/funcs/selected_rows_functor.cc b/paddle/phi/kernels/funcs/selected_rows_functor.cc index e2a3513a428..1557c3dee3d 100644 --- a/paddle/phi/kernels/funcs/selected_rows_functor.cc +++ b/paddle/phi/kernels/funcs/selected_rows_functor.cc @@ -14,9 +14,12 @@ limitations under the License. */ #include "paddle/phi/kernels/funcs/selected_rows_functor.h" -#include "paddle/fluid/platform/device/device_wrapper.h" #include "paddle/phi/core/mixed_vector.h" +#ifdef PADDLE_WITH_XPU +#include "paddle/phi/backends/xpu/enforce_xpu.h" +#endif + #ifdef PADDLE_WITH_MKLDNN #include "paddle/phi/backends/onednn/axpy_handler.h" #endif @@ -73,17 +76,17 @@ struct SelectedRowsAdd { out_value->numel() / out_rows.size())); auto in1_place = input1.place(); - PADDLE_ENFORCE_EQ(paddle::platform::is_cpu_place(in1_place), + PADDLE_ENFORCE_EQ(in1_place.GetType() == phi::AllocationType::CPU, true, phi::errors::InvalidArgument( "The running environment is not on the CPU place.")); auto in2_place = input2.place(); - PADDLE_ENFORCE_EQ(paddle::platform::is_cpu_place(in2_place), + PADDLE_ENFORCE_EQ(in2_place.GetType() == phi::AllocationType::CPU, true, phi::errors::InvalidArgument( "The running environment is not on the CPU place.")); auto out_place = context.GetPlace(); - PADDLE_ENFORCE_EQ(paddle::platform::is_cpu_place(out_place), + PADDLE_ENFORCE_EQ(out_place.GetType() == phi::AllocationType::CPU, true, phi::errors::InvalidArgument( "The running environment is not on the CPU place.")); @@ -204,12 +207,12 @@ struct SelectedRowsAddTo { mixv_in2_rows.Extend(in1_rows.begin(), in1_rows.end()); auto in1_place = input1.place(); - PADDLE_ENFORCE_EQ(paddle::platform::is_cpu_place(in1_place), + PADDLE_ENFORCE_EQ(in1_place.GetType() == phi::AllocationType::CPU, true, phi::errors::InvalidArgument( "The running environment is not on the CPU place.")); auto in2_place = input2->place(); - PADDLE_ENFORCE_EQ(paddle::platform::is_cpu_place(in2_place), + PADDLE_ENFORCE_EQ(in2_place.GetType() == phi::AllocationType::CPU, true, phi::errors::InvalidArgument( "The running environment is not on the CPU place.")); -- GitLab