From abee22108f32a5c0d0974dd35c68d712985e1800 Mon Sep 17 00:00:00 2001 From: HongyuJia Date: Fri, 30 Sep 2022 10:20:35 +0800 Subject: [PATCH] change mkldnn kernel layout, ALL_LAYOUT->ONEDNN (#46629) --- .../framework/ir/mkldnn/mkldnn_conv_bn_fuse_pass_tester.cc | 2 +- .../fluid/framework/ir/mkldnn/mkldnn_inplace_pass_tester.cc | 4 ++-- paddle/fluid/imperative/tests/test_prepare_op.cc | 2 +- paddle/fluid/operators/mkldnn/test_mkldnn_caching.cc | 2 +- paddle/fluid/operators/mkldnn/test_mkldnn_op_inplace.cc | 2 +- paddle/fluid/operators/mkldnn/test_mkldnn_op_nhwc.cc | 4 ++-- paddle/phi/kernels/onednn/activation_grad_kernel.cc | 4 ++-- paddle/phi/kernels/onednn/activation_kernel.cc | 4 ++-- paddle/phi/kernels/onednn/shape_kernel.cc | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/paddle/fluid/framework/ir/mkldnn/mkldnn_conv_bn_fuse_pass_tester.cc b/paddle/fluid/framework/ir/mkldnn/mkldnn_conv_bn_fuse_pass_tester.cc index 2d4f626374..e51073385b 100644 --- a/paddle/fluid/framework/ir/mkldnn/mkldnn_conv_bn_fuse_pass_tester.cc +++ b/paddle/fluid/framework/ir/mkldnn/mkldnn_conv_bn_fuse_pass_tester.cc @@ -38,7 +38,7 @@ USE_OP_DEVICE_KERNEL(conv2d_transpose, MKLDNN); USE_OP_ITSELF(elementwise_add); USE_OP_DEVICE_KERNEL(elementwise_add, MKLDNN); USE_OP_ITSELF(gelu); -PD_DECLARE_KERNEL(gelu, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(gelu, OneDNN, ONEDNN); PD_DECLARE_ARG_MAPPING_FN(gelu); namespace paddle { diff --git a/paddle/fluid/framework/ir/mkldnn/mkldnn_inplace_pass_tester.cc b/paddle/fluid/framework/ir/mkldnn/mkldnn_inplace_pass_tester.cc index d78c0c4356..9b0cb0a609 100644 --- a/paddle/fluid/framework/ir/mkldnn/mkldnn_inplace_pass_tester.cc +++ b/paddle/fluid/framework/ir/mkldnn/mkldnn_inplace_pass_tester.cc @@ -27,11 +27,11 @@ USE_OP_DEVICE_KERNEL(softmax, MKLDNN); USE_OP_ITSELF(elementwise_add); USE_OP_DEVICE_KERNEL(elementwise_add, MKLDNN); USE_OP_ITSELF(leaky_relu); -PD_DECLARE_KERNEL(leaky_relu, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(leaky_relu, OneDNN, ONEDNN); USE_OP_ITSELF(gelu); USE_OP_ITSELF(relu); USE_OP_ITSELF(tanh); -PD_DECLARE_KERNEL(tanh, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(tanh, OneDNN, ONEDNN); PD_DECLARE_ARG_MAPPING_FN(gelu); namespace paddle { diff --git a/paddle/fluid/imperative/tests/test_prepare_op.cc b/paddle/fluid/imperative/tests/test_prepare_op.cc index f9501dedfe..38b68bba2f 100644 --- a/paddle/fluid/imperative/tests/test_prepare_op.cc +++ b/paddle/fluid/imperative/tests/test_prepare_op.cc @@ -259,5 +259,5 @@ TEST(test_prepare_op, test_prepare_data_cpu_mkldnn) { USE_OP_ITSELF(split); USE_OP_ITSELF(relu); #ifdef PADDLE_WITH_MKLDNN -PD_DECLARE_KERNEL(relu, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(relu, OneDNN, ONEDNN); #endif diff --git a/paddle/fluid/operators/mkldnn/test_mkldnn_caching.cc b/paddle/fluid/operators/mkldnn/test_mkldnn_caching.cc index f05bd26351..d340e1a060 100644 --- a/paddle/fluid/operators/mkldnn/test_mkldnn_caching.cc +++ b/paddle/fluid/operators/mkldnn/test_mkldnn_caching.cc @@ -32,7 +32,7 @@ USE_OP_DEVICE_KERNEL(elementwise_add, MKLDNN); USE_OP_ITSELF(elementwise_mul); USE_OP_DEVICE_KERNEL(elementwise_mul, MKLDNN); USE_OP_ITSELF(relu); -PD_DECLARE_KERNEL(relu, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(relu, OneDNN, ONEDNN); USE_OP_ITSELF(softmax); USE_OP_DEVICE_KERNEL(softmax, MKLDNN); USE_OP_ITSELF(conv2d); diff --git a/paddle/fluid/operators/mkldnn/test_mkldnn_op_inplace.cc b/paddle/fluid/operators/mkldnn/test_mkldnn_op_inplace.cc index 196e018507..fde1ce5892 100644 --- a/paddle/fluid/operators/mkldnn/test_mkldnn_op_inplace.cc +++ b/paddle/fluid/operators/mkldnn/test_mkldnn_op_inplace.cc @@ -30,7 +30,7 @@ USE_OP_ITSELF(elementwise_add); USE_OP_DEVICE_KERNEL(elementwise_add, MKLDNN); USE_OP_ITSELF(relu); -PD_DECLARE_KERNEL(relu, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(relu, OneDNN, ONEDNN); USE_OP_ITSELF(softmax); USE_OP_DEVICE_KERNEL(softmax, MKLDNN); diff --git a/paddle/fluid/operators/mkldnn/test_mkldnn_op_nhwc.cc b/paddle/fluid/operators/mkldnn/test_mkldnn_op_nhwc.cc index ad2b53de1e..3efea85ec5 100644 --- a/paddle/fluid/operators/mkldnn/test_mkldnn_op_nhwc.cc +++ b/paddle/fluid/operators/mkldnn/test_mkldnn_op_nhwc.cc @@ -30,11 +30,11 @@ USE_OP_ITSELF(pool2d); USE_OP_DEVICE_KERNEL(pool2d, MKLDNN); USE_OP_ITSELF(relu); -PD_DECLARE_KERNEL(relu, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(relu, OneDNN, ONEDNN); USE_OP_ITSELF(transpose); USE_OP_DEVICE_KERNEL(transpose, MKLDNN); USE_OP_ITSELF(shape); -PD_DECLARE_KERNEL(shape, OneDNN, ALL_LAYOUT); +PD_DECLARE_KERNEL(shape, OneDNN, ONEDNN); USE_OP_ITSELF(crop); USE_OP_DEVICE_KERNEL(crop, CPU); diff --git a/paddle/phi/kernels/onednn/activation_grad_kernel.cc b/paddle/phi/kernels/onednn/activation_grad_kernel.cc index 9e183abf02..3e59a2a0df 100644 --- a/paddle/phi/kernels/onednn/activation_grad_kernel.cc +++ b/paddle/phi/kernels/onednn/activation_grad_kernel.cc @@ -260,14 +260,14 @@ void Relu6GradKernel(const Context& dev_ctx, PD_REGISTER_KERNEL(relu_grad, OneDNN, - ALL_LAYOUT, + ONEDNN, phi::ReluGradKernel, float, phi::dtype::bfloat16) {} #define PD_REGISTER_ACTIVATION_GRAD_KERNEL(name, func) \ PD_REGISTER_KERNEL( \ - name, OneDNN, ALL_LAYOUT, phi::func, float, phi::dtype::bfloat16) {} + name, OneDNN, ONEDNN, phi::func, float, phi::dtype::bfloat16) {} PD_REGISTER_ACTIVATION_GRAD_KERNEL(abs_grad, AbsGradKernel) PD_REGISTER_ACTIVATION_GRAD_KERNEL(elu_grad, EluGradKernel) diff --git a/paddle/phi/kernels/onednn/activation_kernel.cc b/paddle/phi/kernels/onednn/activation_kernel.cc index 36ba1be724..b9db43fa03 100644 --- a/paddle/phi/kernels/onednn/activation_kernel.cc +++ b/paddle/phi/kernels/onednn/activation_kernel.cc @@ -192,11 +192,11 @@ void Relu6Kernel(const Context& dev_ctx, } // namespace phi -PD_REGISTER_KERNEL(round, OneDNN, ALL_LAYOUT, phi::RoundKernel, float) {} +PD_REGISTER_KERNEL(round, OneDNN, ONEDNN, phi::RoundKernel, float) {} #define PD_REGISTER_ACTIVATION_KERNEL(name, func) \ PD_REGISTER_KERNEL( \ - name, OneDNN, ALL_LAYOUT, phi::func, float, phi::dtype::bfloat16) {} + name, OneDNN, ONEDNN, phi::func, float, phi::dtype::bfloat16) {} PD_REGISTER_ACTIVATION_KERNEL(abs, AbsKernel) PD_REGISTER_ACTIVATION_KERNEL(elu, EluKernel) diff --git a/paddle/phi/kernels/onednn/shape_kernel.cc b/paddle/phi/kernels/onednn/shape_kernel.cc index b6fcd32f1c..a59e8fa01d 100644 --- a/paddle/phi/kernels/onednn/shape_kernel.cc +++ b/paddle/phi/kernels/onednn/shape_kernel.cc @@ -51,7 +51,7 @@ void ShapeKernel(const Context& dev_ctx, PD_REGISTER_KERNEL(shape, OneDNN, - ALL_LAYOUT, + ONEDNN, phi::ShapeKernel, float, phi::dtype::bfloat16, -- GitLab