Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHI] Migrate elementwise_sub kernel #48611

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

9 changes: 9 additions & 0 deletions paddle/phi/kernels/elementwise_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,15 @@ PD_REGISTER_KERNEL(elementwise_pow,
#endif

#if defined PADDLE_WITH_MKLDNN
PD_REGISTER_KERNEL(subtract,
OneDNN,
ONEDNN,
phi::SubtractKernel,
float,
phi::dtype::bfloat16,
int8_t,
uint8_t) {}

PD_REGISTER_KERNEL(
divide, OneDNN, ONEDNN, phi::DivideKernel, float, phi::dtype::bfloat16) {}
#endif
10 changes: 10 additions & 0 deletions paddle/phi/kernels/onednn/elementwise_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,20 @@ void ElementwiseKernel(const OneDNNContext& dev_ctx,
ElementwiseKernel<T, algorithm>(dev_ctx, x, y, axis, out); \
}

DEFINE_ONEDNN_ELEMENTWISE_KERNEL(Subtract, dnnl::algorithm::binary_sub)
DEFINE_ONEDNN_ELEMENTWISE_KERNEL(Divide, dnnl::algorithm::binary_div)

} // namespace phi

PD_REGISTER_KERNEL(subtract_raw,
OneDNN,
ONEDNN,
phi::SubtractRawKernel,
float,
phi::dtype::bfloat16,
int8_t,
uint8_t) {}

PD_REGISTER_KERNEL(divide_raw,
OneDNN,
ONEDNN,
Expand Down