1
1
set (pass_file ${PADDLE_BINARY_DIR} /paddle/fluid/inference/api/paddle_inference_pass.h )
2
2
file (WRITE ${pass_file} "// Generated by the paddle/fluid/framework/ir/CMakeLists.txt. DO NOT EDIT!\n\n " )
3
3
file (APPEND ${pass_file} "\# include \" paddle/fluid/framework/ir/pass.h\"\n " )
4
- function (pass_library TARGET )
4
+
5
+
6
+ # Usage: pass_library(target inference) will append to paddle_inference_pass.h
7
+ function (pass_library TARGET DEST )
5
8
set (options "" )
6
9
set (oneValueArgs "" )
7
10
set (multiValueArgs SRCS DEPS )
8
11
cmake_parse_arguments (op_library "${options} " "${oneValueArgs} " "${multiValueArgs} " ${ARGN} )
9
- cc_library (${TARGET} SRCS ${TARGET} .cc DEPS graph_pattern_detector pass )
10
- file (APPEND ${pass_file} "USE_PASS(${TARGET} );\n " )
11
- set (PASS_LIBRARY ${TARGET} ${PASS_LIBRARY} PARENT_SCOPE )
12
+ cc_library (${TARGET} SRCS ${TARGET} .cc DEPS graph_pattern_detector pass ${op_library_DEPS} )
13
+ # add more DEST here, such as train, dist and collect USE_PASS into a file automatically.
14
+ if (${DEST} STREQUAL "base" OR ${DEST} STREQUAL "inference" )
15
+ message (STATUS "add pass ${TARGET} ${DEST} " )
16
+ file (APPEND ${pass_file} "USE_PASS(${TARGET} );\n " )
17
+ set (PASS_LIBRARY ${TARGET} ${PASS_LIBRARY} PARENT_SCOPE )
18
+ endif ()
12
19
endfunction ()
13
20
14
21
cc_library (node SRCS node.cc DEPS proto_desc )
@@ -18,13 +25,13 @@ cc_library(pass SRCS pass.cc DEPS graph node graph_helper)
18
25
cc_library (graph_traits SRCS graph_traits.cc DEPS graph )
19
26
cc_library (graph_pattern_detector SRCS graph_pattern_detector.cc DEPS graph graph_helper graph_traits )
20
27
21
- pass_library (graph_to_program_pass )
22
- pass_library (graph_viz_pass )
23
- pass_library (fc_fuse_pass )
24
- pass_library (attention_lstm_fuse_pass )
25
- pass_library (infer_clean_graph_pass )
26
- pass_library (fc_lstm_fuse_pass )
27
- pass_library (seq_concat_fc_fuse_pass )
28
+ pass_library (graph_to_program_pass base )
29
+ pass_library (graph_viz_pass base )
30
+ pass_library (fc_fuse_pass inference )
31
+ pass_library (attention_lstm_fuse_pass inference )
32
+ pass_library (infer_clean_graph_pass inference )
33
+ pass_library (fc_lstm_fuse_pass inference )
34
+ pass_library (seq_concat_fc_fuse_pass inference )
28
35
set (GLOB_PASS_LIB ${PASS_LIBRARY} CACHE INTERNAL "Global PASS library" )
29
36
30
37
cc_test (pass_test SRCS pass_test.cc DEPS graph pass graph_helper )
0 commit comments