未验证 提交 530f6b79 编写于 作者: H HongyuJia 提交者: GitHub

[phi] Migrate coalesce_tensor XPU kernel to PHI (#45579)

* migrate coalesce_tensor_xpu, test=kunlun

* fix xpu SetConstant, test=kunlun

* fix include error, test=kunlun
上级 bef80f32
......@@ -529,16 +529,6 @@ REGISTER_OP_CUDA_KERNEL(
ops::CoalesceTensorOpKernel<paddle::platform::NPUDeviceContext, double>);
#endif
#ifdef PADDLE_WITH_XPU
REGISTER_OP_XPU_KERNEL(
coalesce_tensor,
ops::CoalesceTensorOpKernel<paddle::platform::XPUDeviceContext,
plat::float16>,
ops::CoalesceTensorOpKernel<paddle::platform::XPUDeviceContext, int>,
ops::CoalesceTensorOpKernel<paddle::platform::XPUDeviceContext, float>,
ops::CoalesceTensorOpKernel<paddle::platform::XPUDeviceContext, double>);
#endif
#if defined(PADDLE_WITH_ASCEND_CL)
REGISTER_OP_NPU_KERNEL(
coalesce_tensor,
......
......@@ -22,6 +22,10 @@
#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/math_function.h"
#ifdef PADDLE_WITH_XPU
#include "paddle/phi/backends/xpu/xpu_context.h"
#include "paddle/phi/kernels/funcs/math_function_impl.h"
#endif
namespace phi {
......@@ -280,3 +284,16 @@ PD_REGISTER_KERNEL(coalesce_tensor,
kernel->InputAt(0).SetBackend(phi::Backend::ALL_BACKEND);
}
#endif
#ifdef PADDLE_WITH_XPU
PD_REGISTER_KERNEL(coalesce_tensor,
XPU,
ALL_LAYOUT,
phi::CoalesceTensorKernel,
phi::dtype::float16,
int,
float,
double) {
kernel->InputAt(0).SetBackend(phi::Backend::ALL_BACKEND);
}
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册