CMakeLists.txt 3.8 KB
Newer Older
W
Wu Yi 已提交
1
include(operators)
2 3 4 5
if(WITH_UNITY_BUILD)
    # Load Unity Build rules for operators in paddle/fluid/operators/fused.
    include(unity_build_rule.cmake)
endif()
6
register_operators(EXCLUDES
Z
Zhen Wang 已提交
7
    fused_bn_activation_op
8 9 10 11
    conv_fusion_op
    fusion_transpose_flatten_concat_op
    fusion_conv_inception_op
    fused_fc_elementwise_layernorm_op
12
    multihead_matmul_op
13
    skip_layernorm_op
14 15
    yolo_box_head_op
    yolo_box_post_op
16
    fused_embedding_eltwise_layernorm_op
A
Adam 已提交
17
    fusion_group_op
Z
Zhang Ting 已提交
18
    fusion_gru_op
19
    fusion_lstm_op
F
Feng Xing 已提交
20
    fused_bn_add_activation_op
L
Li Min 已提交
21
    fused_attention_op
22
    fused_transformer_op
23
    fused_feedforward_op
24
    fused_multi_transformer_op
25
    fused_bias_dropout_residual_layer_norm_op
26
    resnet_unit_op
27 28
    fused_gemm_epilogue_op
    fused_gate_attention_op)
A
Adam 已提交
29 30 31

# fusion_gru_op does not have CUDA kernel
op_library(fusion_gru_op)
32 33
op_library(fusion_lstm_op)

34

35
if (WITH_GPU OR WITH_ROCM)
Z
Zhen Wang 已提交
36
    # fused_bn_activation_op needs cudnn 7.4.1 above
37 38
    # HIP not support bn act fuse in MIOPEN
    if ((NOT WITH_ROCM) AND (NOT ${CUDNN_VERSION} VERSION_LESS 7401))
Z
Zhen Wang 已提交
39 40
        op_library(fused_bn_activation_op)
    endif()
41
    # conv_fusion_op needs cudnn 7 above
R
ronnywang 已提交
42
    if (NOT ${CUDNN_VERSION} VERSION_LESS 7100)
43 44 45
        op_library(conv_fusion_op)
    endif()
    # fusion_transpose_flatten_concat_op
46 47 48 49
    # HIP not support cudnnTransformTensor
    if(NOT WITH_ROCM)
        op_library(fusion_transpose_flatten_concat_op)
    endif()
50
    # fusion_conv_inception_op needs cudnn 7 above
51 52
    # HIP not support cudnnConvolutionBiasActivationForward
    if ((NOT WITH_ROCM) AND (NOT ${CUDNN_VERSION} VERSION_LESS 7100))
53 54 55 56 57 58
        op_library(fusion_conv_inception_op)
    endif()
    # fused_fc_elementwise_layernorm_op
    op_library(fused_fc_elementwise_layernorm_op)
    # multihead_matmul_op
    op_library(multihead_matmul_op)
59
    op_library(skip_layernorm_op)
60 61
    op_library(yolo_box_head_op)
    op_library(yolo_box_post_op)
62
    op_library(fused_embedding_eltwise_layernorm_op)
63
    op_library(fused_gate_attention_op)
64 65 66 67 68
    # 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()
Z
Zhang Ting 已提交
69
    # fused_bn_add_activation
70 71 72
    # HIP not support bn act fuse in MIOPEN
    if ((NOT WITH_ROCM) AND (NOT ${CUDNN_VERSION} VERSION_LESS 7401))
        op_library(fused_bn_add_activation_op)
Z
Zhang Ting 已提交
73
    endif()
74 75 76
    # fused_dropout
    # only support CUDA
    if(NOT WITH_ROCM)
77 78 79
        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)
80 81

        op_library(fused_feedforward_op)
L
Li Min 已提交
82 83
        # fused_attention_op
        op_library(fused_attention_op)
84
        op_library(fused_multi_transformer_op)
85
        op_library(fused_bias_dropout_residual_layer_norm_op)
86
    endif()
87
    # resnet_unit needs cudnn 8.0 above
88
    if ((NOT WITH_ROCM) AND (NOT ${CUDNN_VERSION} VERSION_LESS 8000))
89
        op_library(resnet_unit_op)
90
        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)
91
        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)
92
    endif()
93 94 95 96

    if (CUDA_VERSION GREATER_EQUAL 11.6)
        op_library(fused_gemm_epilogue_op)
    endif()
97
endif()