CMakeLists.txt 2.7 KB
Newer Older
L
luotao1 已提交
1 2 3
set(pass_file ${PADDLE_BINARY_DIR}/paddle/fluid/inference/api/paddle_inference_pass.h)
file(WRITE ${pass_file} "// Generated by the paddle/fluid/framework/ir/CMakeLists.txt.  DO NOT EDIT!\n\n")
file(APPEND ${pass_file} "\#include \"paddle/fluid/framework/ir/pass.h\"\n")
Y
Yan Chunwei 已提交
4 5 6 7


# Usage: pass_library(target inference) will append to paddle_inference_pass.h
function(pass_library TARGET DEST)
L
luotao1 已提交
8 9 10 11
    set(options "")
    set(oneValueArgs "")
    set(multiValueArgs SRCS DEPS)
    cmake_parse_arguments(op_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
Y
Yan Chunwei 已提交
12 13 14 15 16 17 18
    cc_library(${TARGET} SRCS ${TARGET}.cc DEPS graph_pattern_detector pass ${op_library_DEPS})
    # add more DEST here, such as train, dist and collect USE_PASS into a file automatically.
    if (${DEST} STREQUAL "base" OR ${DEST} STREQUAL "inference")
        message(STATUS "add pass ${TARGET} ${DEST}")
        file(APPEND ${pass_file} "USE_PASS(${TARGET});\n")
        set(PASS_LIBRARY ${TARGET} ${PASS_LIBRARY} PARENT_SCOPE)
    endif()
L
luotao1 已提交
19 20
endfunction()

Y
yuyang18 已提交
21
cc_library(node SRCS node.cc DEPS proto_desc)
Y
Yan Chunwei 已提交
22
cc_library(graph SRCS graph.cc DEPS node pretty_log)
X
better  
Xin Pan 已提交
23
cc_library(graph_helper SRCS graph_helper.cc DEPS graph)
X
Xin Pan 已提交
24
cc_library(pass SRCS pass.cc DEPS graph node graph_helper)
25
cc_library(graph_traits SRCS graph_traits.cc DEPS graph)
L
luotao1 已提交
26
cc_library(graph_pattern_detector SRCS graph_pattern_detector.cc DEPS graph graph_helper graph_traits)
L
luotao1 已提交
27

Y
Yan Chunwei 已提交
28 29 30
pass_library(graph_to_program_pass base)
pass_library(graph_viz_pass base)
pass_library(fc_fuse_pass inference)
31 32 33
if (WITH_MKLDNN)
    pass_library(conv_relu_mkldnn_fuse_pass inference)
endif ()
Y
Yan Chunwei 已提交
34 35 36
pass_library(attention_lstm_fuse_pass inference)
pass_library(infer_clean_graph_pass inference)
pass_library(fc_lstm_fuse_pass inference)
37
pass_library(fc_gru_fuse_pass inference)
Y
Yan Chunwei 已提交
38
pass_library(seq_concat_fc_fuse_pass inference)
39

C
chengduo 已提交
40 41
cc_library(fuse_elewise_add_act_pass SRCS fuse_elewise_add_act_pass.cc DEPS pass graph_pattern_detector )

L
luotao1 已提交
42
set(GLOB_PASS_LIB ${PASS_LIBRARY} CACHE INTERNAL "Global PASS library")
X
Xin Pan 已提交
43

44 45
cc_library(pass_builder SRCS pass_builder.cc DEPS pass)

X
Xin Pan 已提交
46 47 48
cc_test(pass_test SRCS pass_test.cc DEPS graph pass graph_helper)
cc_test(graph_test SRCS graph_test.cc DEPS graph graph_helper op_registry)
cc_test(graph_helper_test SRCS graph_helper_test.cc DEPS graph graph_helper op_registry)
X
Xin Pan 已提交
49
cc_test(graph_to_program_pass_test SRCS graph_to_program_pass_test.cc DEPS graph_to_program_pass)
50
cc_test(test_graph_pattern_detector SRCS graph_pattern_detector_tester.cc DEPS graph_pattern_detector)
L
luotao1 已提交
51
cc_test(test_fc_fuse_pass SRCS fc_fuse_pass_tester.cc DEPS fc_fuse_pass framework_proto)
52 53 54
if (WITH_MKLDNN)
    cc_test(test_conv_relu_mkldnn_fuse_pass SRCS conv_relu_mkldnn_fuse_pass_tester.cc DEPS conv_relu_mkldnn_fuse_pass)
endif ()