diff --git a/paddle/fluid/operators/elementwise/mkldnn/elementwise_sub_mkldnn_op.cc b/paddle/fluid/operators/elementwise/mkldnn/elementwise_sub_mkldnn_op.cc deleted file mode 100644 index 91660b79b09ac3e164c9da676d6a8d10a9695c2a..0000000000000000000000000000000000000000 --- a/paddle/fluid/operators/elementwise/mkldnn/elementwise_sub_mkldnn_op.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "paddle/fluid/operators/elementwise/mkldnn/elementwise_mkldnn_op.h" - -namespace ops = paddle::operators; - -REGISTER_OP_KERNEL( - elementwise_sub, - MKLDNN, - paddle::platform::CPUPlace, - ops::EltwiseMKLDNNKernel, - ops::EltwiseMKLDNNKernel, - ops::EltwiseMKLDNNKernel, - ops::EltwiseMKLDNNKernel) diff --git a/paddle/phi/kernels/elementwise_kernel.cc b/paddle/phi/kernels/elementwise_kernel.cc index c0b99b8ddf03684a433a00d0f69e468b0069ce5e..d4ffd49b5fc48b7b67d070a4afaef8ffa12dee60 100644 --- a/paddle/phi/kernels/elementwise_kernel.cc +++ b/paddle/phi/kernels/elementwise_kernel.cc @@ -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 diff --git a/paddle/phi/kernels/onednn/elementwise_kernel.cc b/paddle/phi/kernels/onednn/elementwise_kernel.cc index e103f23df0dc62dcb59d6261ccdb339d532bf5fd..29d527a523fbfe4df6d2c78d5de24f42629d733a 100644 --- a/paddle/phi/kernels/onednn/elementwise_kernel.cc +++ b/paddle/phi/kernels/onednn/elementwise_kernel.cc @@ -133,10 +133,20 @@ void ElementwiseKernel(const OneDNNContext& dev_ctx, ElementwiseKernel(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,