CMakeLists.txt 2.6 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
    fused_embedding_eltwise_layernorm_op
A
Adam 已提交
15
    fusion_group_op
Z
Zhang Ting 已提交
16
    fusion_gru_op
17
    fusion_lstm_op
Z
Zhang Ting 已提交
18
    fused_bn_add_activation_op)
A
Adam 已提交
19 20 21

# fusion_gru_op does not have CUDA kernel
op_library(fusion_gru_op)
22
op_library(fusion_lstm_op)
23
file(APPEND ${pybind_file} "USE_CPU_ONLY_OP(fusion_gru);\n")
24 25
file(APPEND ${pybind_file} "USE_CPU_ONLY_OP(fusion_lstm);\n")

26

27
if (WITH_GPU)
Z
Zhen Wang 已提交
28 29 30 31 32
    # fused_bn_activation_op needs cudnn 7.4.1 above
    if (NOT ${CUDNN_VERSION} VERSION_LESS 7401)
        op_library(fused_bn_activation_op)
        file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fused_batch_norm_act);\n")
    endif()
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
    # conv_fusion_op needs cudnn 7 above
    if (NOT ${CUDNN_VERSION} VERSION_LESS 7100)
        op_library(conv_fusion_op)
        file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_fusion);\n")
    endif()
    # fusion_transpose_flatten_concat_op
    op_library(fusion_transpose_flatten_concat_op)
    file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fusion_transpose_flatten_concat);\n")
    # fusion_conv_inception_op needs cudnn 7 above
    if (NOT ${CUDNN_VERSION} VERSION_LESS 7100)
        op_library(fusion_conv_inception_op)
        file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(conv2d_inception_fusion);\n")
    endif()
    # fused_fc_elementwise_layernorm_op
    op_library(fused_fc_elementwise_layernorm_op)
    file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fused_fc_elementwise_layernorm);\n")
    # multihead_matmul_op
    op_library(multihead_matmul_op)
    file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(multihead_matmul);\n")
52 53
    op_library(skip_layernorm_op)
    file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(skip_layernorm);\n")
54 55
    op_library(fused_embedding_eltwise_layernorm_op)
    file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fused_embedding_eltwise_layernorm);\n")
56 57 58 59 60 61
    # fusion_group
    if(NOT APPLE AND NOT WIN32)
        op_library(fusion_group_op DEPS device_code)
        file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fusion_group);\n")
        cc_test(test_fusion_group_op SRCS fusion_group_op_test.cc DEPS fusion_group_op)
    endif()
Z
Zhang Ting 已提交
62 63 64 65 66
    # fused_bn_add_activation
    if (NOT ${CUDNN_VERSION} VERSION_LESS 7401)
    op_library(fused_bn_add_activation_op)
    file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(fused_bn_add_activation);\n")
    endif()
67
endif()