Skip to content

Commit d402234

Browse files
author
chengduo
authored
Feature/op_fuse_pass (#12440)
* Add Preface * Add demo code * Save file * Refine code * seems can work * use elementwise strategy * Use ElementwiseComputeEx * Add comments * extract functions from operator * Refine code * Follow comment * code refine * add op_fuse pass * add backward * code refine * use TopologySortOperations * follow comments * refine IsFusible * code enhance * fix op_fusion_pass * refine code * refine fuse_elemwise_act_op * adjust the input and output * refine logic * add intermediate_edge * disable inplace * follow comments * refine logic * follow comments * Remove the removable IntermediateOut * change strategy * code refine * enable fuse backward * code refine * code refine * rename unit test * follow comments
1 parent 5acdbbb commit d402234

21 files changed

+1651
-528
lines changed

paddle/fluid/framework/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ if(WITH_DISTRIBUTE)
148148
else()
149149
cc_library(executor SRCS executor.cc DEPS op_registry device_context scope framework_proto glog lod_rank_table feed_fetch_method graph_to_program_pass)
150150
endif()
151-
151+
152152
if (NOT WIN32)
153-
cc_library(parallel_executor SRCS parallel_executor.cc DEPS
154-
threaded_ssa_graph_executor scope_buffered_ssa_graph_executor
155-
graph graph_viz_pass multi_devices_graph_pass
156-
multi_devices_graph_print_pass multi_devices_graph_check_pass
157-
fast_threaded_ssa_graph_executor)
153+
cc_library(parallel_executor SRCS parallel_executor.cc DEPS
154+
threaded_ssa_graph_executor scope_buffered_ssa_graph_executor
155+
graph graph_viz_pass multi_devices_graph_pass
156+
multi_devices_graph_print_pass multi_devices_graph_check_pass
157+
fast_threaded_ssa_graph_executor fuse_elewise_add_act_pass)
158158
endif() # NOT WIN32
159159

160160
cc_library(prune SRCS prune.cc DEPS framework_proto)

paddle/fluid/framework/details/build_strategy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ struct BuildStrategy {
5454

5555
std::string debug_graphviz_path_{""};
5656

57+
bool fuse_elewise_add_act_ops_{false};
58+
5759
bool enable_data_balance_{false};
5860
};
5961

paddle/fluid/framework/ir/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ pass_library(fc_lstm_fuse_pass inference)
3737
pass_library(fc_gru_fuse_pass inference)
3838
pass_library(seq_concat_fc_fuse_pass inference)
3939

40+
cc_library(fuse_elewise_add_act_pass SRCS fuse_elewise_add_act_pass.cc DEPS pass graph_pattern_detector )
41+
4042
set(GLOB_PASS_LIB ${PASS_LIBRARY} CACHE INTERNAL "Global PASS library")
4143

4244
cc_test(pass_test SRCS pass_test.cc DEPS graph pass graph_helper)

0 commit comments

Comments
 (0)