未验证 提交 7b6d5ac0 编写于 作者: G gouzil 提交者: GitHub

【Hackathon No.69】[PHI decoupling] move device_wrapper from fluid to phi (#50749)

* [phi] move device_wrapper from fluid to phi

* [phi] fix ‘PADDLE_ENFORCE_XDNN_SUCCESS’ was not declared in this scope
上级 e00ab78d
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <ThreadPool.h> #include <ThreadPool.h>
#include "paddle/fluid/platform/device/device_wrapper.h"
#include "paddle/phi/backends/device_guard.h" #include "paddle/phi/backends/device_guard.h"
#include "paddle/phi/core/enforce.h" #include "paddle/phi/core/enforce.h"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "paddle/phi/backends/event.h" #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/device_guard.h"
#include "paddle/phi/backends/stream.h" #include "paddle/phi/backends/stream.h"
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "paddle/phi/backends/stream.h" #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/device_guard.h"
#include "paddle/phi/backends/event.h" #include "paddle/phi/backends/event.h"
......
...@@ -14,9 +14,12 @@ limitations under the License. */ ...@@ -14,9 +14,12 @@ limitations under the License. */
#include "paddle/phi/kernels/funcs/selected_rows_functor.h" #include "paddle/phi/kernels/funcs/selected_rows_functor.h"
#include "paddle/fluid/platform/device/device_wrapper.h"
#include "paddle/phi/core/mixed_vector.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 #ifdef PADDLE_WITH_MKLDNN
#include "paddle/phi/backends/onednn/axpy_handler.h" #include "paddle/phi/backends/onednn/axpy_handler.h"
#endif #endif
...@@ -73,17 +76,17 @@ struct SelectedRowsAdd<phi::CPUContext, T> { ...@@ -73,17 +76,17 @@ struct SelectedRowsAdd<phi::CPUContext, T> {
out_value->numel() / out_rows.size())); out_value->numel() / out_rows.size()));
auto in1_place = input1.place(); 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, true,
phi::errors::InvalidArgument( phi::errors::InvalidArgument(
"The running environment is not on the CPU place.")); "The running environment is not on the CPU place."));
auto in2_place = input2.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, true,
phi::errors::InvalidArgument( phi::errors::InvalidArgument(
"The running environment is not on the CPU place.")); "The running environment is not on the CPU place."));
auto out_place = context.GetPlace(); 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, true,
phi::errors::InvalidArgument( phi::errors::InvalidArgument(
"The running environment is not on the CPU place.")); "The running environment is not on the CPU place."));
...@@ -204,12 +207,12 @@ struct SelectedRowsAddTo<phi::CPUContext, T> { ...@@ -204,12 +207,12 @@ struct SelectedRowsAddTo<phi::CPUContext, T> {
mixv_in2_rows.Extend(in1_rows.begin(), in1_rows.end()); mixv_in2_rows.Extend(in1_rows.begin(), in1_rows.end());
auto in1_place = input1.place(); 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, true,
phi::errors::InvalidArgument( phi::errors::InvalidArgument(
"The running environment is not on the CPU place.")); "The running environment is not on the CPU place."));
auto in2_place = input2->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, true,
phi::errors::InvalidArgument( phi::errors::InvalidArgument(
"The running environment is not on the CPU place.")); "The running environment is not on the CPU place."));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册