From 903c5638d37615873a0ad5f2342286c9ed1dc1a0 Mon Sep 17 00:00:00 2001 From: gouzil <66515297+gouzil@users.noreply.github.com> Date: Fri, 5 May 2023 10:22:55 +0800 Subject: [PATCH] [test]mv fluid op fused to test/cpp/fluid/fused (#53434) --- paddle/fluid/operators/fused/CMakeLists.txt | 59 ---------------- test/cpp/fluid/CMakeLists.txt | 2 +- test/cpp/fluid/fused/CMakeLists.txt | 68 +++++++++++++++++++ .../fluid}/fused/cudnn_bn_add_relu_test.cc | 0 .../cpp/fluid}/fused/cudnn_norm_conv_test.cc | 0 .../fused/fused_dropout_act_bias_test.cu | 2 +- .../cpp/fluid}/fused/fused_dropout_test.h | 0 ...ed_layernorm_residual_dropout_bias_test.cu | 2 +- .../fused/fused_residual_dropout_bias_test.cu | 2 +- .../cpp/fluid}/fused/fusion_group_op_test.cc | 0 10 files changed, 72 insertions(+), 63 deletions(-) create mode 100644 test/cpp/fluid/fused/CMakeLists.txt rename {paddle/fluid/operators => test/cpp/fluid}/fused/cudnn_bn_add_relu_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/fused/cudnn_norm_conv_test.cc (100%) rename {paddle/fluid/operators => test/cpp/fluid}/fused/fused_dropout_act_bias_test.cu (99%) rename {paddle/fluid/operators => test/cpp/fluid}/fused/fused_dropout_test.h (100%) rename {paddle/fluid/operators => test/cpp/fluid}/fused/fused_layernorm_residual_dropout_bias_test.cu (99%) rename {paddle/fluid/operators => test/cpp/fluid}/fused/fused_residual_dropout_bias_test.cu (99%) rename {paddle/fluid/operators => test/cpp/fluid}/fused/fusion_group_op_test.cc (100%) diff --git a/paddle/fluid/operators/fused/CMakeLists.txt b/paddle/fluid/operators/fused/CMakeLists.txt index becef73569b..261d1905246 100755 --- a/paddle/fluid/operators/fused/CMakeLists.txt +++ b/paddle/fluid/operators/fused/CMakeLists.txt @@ -74,10 +74,6 @@ if(WITH_GPU OR WITH_ROCM) # fusion_group if(NOT APPLE AND NOT WIN32) op_library(fusion_group_op DEPS device_code) - cc_test( - test_fusion_group_op - SRCS fusion_group_op_test.cc - DEPS fusion_group_op) endif() # fused_bn_add_activation # HIP not support bn act fuse in MIOPEN @@ -87,37 +83,6 @@ if(WITH_GPU OR WITH_ROCM) # fused_dropout # only support CUDA if(NOT WITH_ROCM) - nv_test( - test_fused_residual_dropout_bias - SRCS fused_residual_dropout_bias_test.cu - DEPS tensor - op_registry - dropout_op - layer_norm_op - device_context - generator - memory) - nv_test( - test_fused_dropout_act_bias - SRCS fused_dropout_act_bias_test.cu - DEPS tensor - op_registry - dropout_op - layer_norm_op - device_context - generator - memory) - nv_test( - test_fused_layernorm_residual_dropout_bias - SRCS fused_layernorm_residual_dropout_bias_test.cu - DEPS tensor - op_registry - dropout_op - layer_norm_op - device_context - generator - memory) - op_library(fused_feedforward_op) # fused_attention_op op_library(fused_attention_op) @@ -128,30 +93,6 @@ if(WITH_GPU OR WITH_ROCM) # resnet_unit needs cudnn 8.0 above if((NOT WITH_ROCM) AND (NOT ${CUDNN_VERSION} VERSION_LESS 8000)) op_library(resnet_unit_op) - cc_test( - test_cudnn_norm_conv - SRCS cudnn_norm_conv_test.cc - DEPS conv_op - blas - im2col - vol2col - depthwise_conv - eigen_function - tensor - op_registry - device_context - generator - memory) - cc_test( - test_cudnn_bn_add_relu - SRCS cudnn_bn_add_relu_test.cc - DEPS batch_norm_op - fused_bn_add_activation_op - tensor - op_registry - device_context - generator - memory) endif() if(CUDA_VERSION GREATER_EQUAL 11.6) diff --git a/test/cpp/fluid/CMakeLists.txt b/test/cpp/fluid/CMakeLists.txt index 872e7c71d25..c1bf46dce29 100644 --- a/test/cpp/fluid/CMakeLists.txt +++ b/test/cpp/fluid/CMakeLists.txt @@ -6,7 +6,7 @@ endif() # add_subdirectory(detection) # add_subdirectory(dlnne) add_subdirectory(elementwise) -# add_subdirectory(fused) +add_subdirectory(fused) if(WITH_LITE) add_subdirectory(lite) endif() diff --git a/test/cpp/fluid/fused/CMakeLists.txt b/test/cpp/fluid/fused/CMakeLists.txt new file mode 100644 index 00000000000..4bbcfbb93d2 --- /dev/null +++ b/test/cpp/fluid/fused/CMakeLists.txt @@ -0,0 +1,68 @@ +if(WITH_GPU OR WITH_ROCM) + # fusion_group + if(NOT APPLE AND NOT WIN32) + cc_test( + test_fusion_group_op + SRCS fusion_group_op_test.cc + DEPS fusion_group_op) + endif() + if(NOT WITH_ROCM) + nv_test( + test_fused_residual_dropout_bias + SRCS fused_residual_dropout_bias_test.cu + DEPS tensor + op_registry + dropout_op + layer_norm_op + device_context + generator + memory) + nv_test( + test_fused_dropout_act_bias + SRCS fused_dropout_act_bias_test.cu + DEPS tensor + op_registry + dropout_op + layer_norm_op + device_context + generator + memory) + nv_test( + test_fused_layernorm_residual_dropout_bias + SRCS fused_layernorm_residual_dropout_bias_test.cu + DEPS tensor + op_registry + dropout_op + layer_norm_op + device_context + generator + memory) + endif() + # resnet_unit needs cudnn 8.0 above + if((NOT WITH_ROCM) AND (NOT ${CUDNN_VERSION} VERSION_LESS 8000)) + cc_test( + test_cudnn_norm_conv + SRCS cudnn_norm_conv_test.cc + DEPS conv_op + blas + im2col + vol2col + depthwise_conv + eigen_function + tensor + op_registry + device_context + generator + memory) + cc_test( + test_cudnn_bn_add_relu + SRCS cudnn_bn_add_relu_test.cc + DEPS batch_norm_op + fused_bn_add_activation_op + tensor + op_registry + device_context + generator + memory) + endif() +endif() diff --git a/paddle/fluid/operators/fused/cudnn_bn_add_relu_test.cc b/test/cpp/fluid/fused/cudnn_bn_add_relu_test.cc similarity index 100% rename from paddle/fluid/operators/fused/cudnn_bn_add_relu_test.cc rename to test/cpp/fluid/fused/cudnn_bn_add_relu_test.cc diff --git a/paddle/fluid/operators/fused/cudnn_norm_conv_test.cc b/test/cpp/fluid/fused/cudnn_norm_conv_test.cc similarity index 100% rename from paddle/fluid/operators/fused/cudnn_norm_conv_test.cc rename to test/cpp/fluid/fused/cudnn_norm_conv_test.cc diff --git a/paddle/fluid/operators/fused/fused_dropout_act_bias_test.cu b/test/cpp/fluid/fused/fused_dropout_act_bias_test.cu similarity index 99% rename from paddle/fluid/operators/fused/fused_dropout_act_bias_test.cu rename to test/cpp/fluid/fused/fused_dropout_act_bias_test.cu index 56f150c2dce..ddcc3f513d5 100644 --- a/paddle/fluid/operators/fused/fused_dropout_act_bias_test.cu +++ b/test/cpp/fluid/fused/fused_dropout_act_bias_test.cu @@ -19,9 +19,9 @@ limitations under the License. */ #include "paddle/fluid/operators/amp/fp16_type_traits.h" #include "paddle/fluid/operators/fused/fused_dropout_act_bias.h" -#include "paddle/fluid/operators/fused/fused_dropout_test.h" #include "paddle/phi/core/kernel_registry.h" #include "paddle/phi/kernels/funcs/functors.h" +#include "test/cpp/fluid/fused/fused_dropout_test.h" #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) PD_DECLARE_KERNEL(dropout, GPU, ALL_LAYOUT); diff --git a/paddle/fluid/operators/fused/fused_dropout_test.h b/test/cpp/fluid/fused/fused_dropout_test.h similarity index 100% rename from paddle/fluid/operators/fused/fused_dropout_test.h rename to test/cpp/fluid/fused/fused_dropout_test.h diff --git a/paddle/fluid/operators/fused/fused_layernorm_residual_dropout_bias_test.cu b/test/cpp/fluid/fused/fused_layernorm_residual_dropout_bias_test.cu similarity index 99% rename from paddle/fluid/operators/fused/fused_layernorm_residual_dropout_bias_test.cu rename to test/cpp/fluid/fused/fused_layernorm_residual_dropout_bias_test.cu index e57f39ec01e..60cb67c837a 100644 --- a/paddle/fluid/operators/fused/fused_layernorm_residual_dropout_bias_test.cu +++ b/test/cpp/fluid/fused/fused_layernorm_residual_dropout_bias_test.cu @@ -17,9 +17,9 @@ limitations under the License. */ #include #include -#include "paddle/fluid/operators/fused/fused_dropout_test.h" #include "paddle/fluid/operators/fused/fused_layernorm_residual_dropout_bias.h" #include "paddle/phi/core/kernel_registry.h" +#include "test/cpp/fluid/fused/fused_dropout_test.h" #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) PD_DECLARE_KERNEL(dropout, GPU, ALL_LAYOUT); diff --git a/paddle/fluid/operators/fused/fused_residual_dropout_bias_test.cu b/test/cpp/fluid/fused/fused_residual_dropout_bias_test.cu similarity index 99% rename from paddle/fluid/operators/fused/fused_residual_dropout_bias_test.cu rename to test/cpp/fluid/fused/fused_residual_dropout_bias_test.cu index d74bd9bfe17..823eb2ce7c6 100644 --- a/paddle/fluid/operators/fused/fused_residual_dropout_bias_test.cu +++ b/test/cpp/fluid/fused/fused_residual_dropout_bias_test.cu @@ -17,9 +17,9 @@ limitations under the License. */ #include #include -#include "paddle/fluid/operators/fused/fused_dropout_test.h" #include "paddle/fluid/operators/fused/fused_residual_dropout_bias.h" #include "paddle/phi/core/kernel_registry.h" +#include "test/cpp/fluid/fused/fused_dropout_test.h" #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) PD_DECLARE_KERNEL(dropout, GPU, ALL_LAYOUT); diff --git a/paddle/fluid/operators/fused/fusion_group_op_test.cc b/test/cpp/fluid/fused/fusion_group_op_test.cc similarity index 100% rename from paddle/fluid/operators/fused/fusion_group_op_test.cc rename to test/cpp/fluid/fused/fusion_group_op_test.cc -- GitLab