diff --git a/paddle/fluid/framework/ir/CMakeLists.txt b/paddle/fluid/framework/ir/CMakeLists.txt index 3859eb3e7067d7e071b7da1843c827bc952287a6..9323882e4ee90ff4b9534a3e42d2c58b038f0af8 100644 --- a/paddle/fluid/framework/ir/CMakeLists.txt +++ b/paddle/fluid/framework/ir/CMakeLists.txt @@ -6,7 +6,9 @@ file(APPEND ${pass_file} "\#include \"paddle/fluid/framework/ir/pass.h\"\n") add_subdirectory(fuse_optimizer_ops_pass) add_subdirectory(memory_optimize_pass) add_subdirectory(multi_devices_graph_pass) -add_subdirectory(fusion_group) +if(NOT APPLE AND NOT WIN32) + add_subdirectory(fusion_group) +endif() # Usage: pass_library(target inference) will append to paddle_inference_pass.h unset(INFER_IR_PASSES CACHE) # clear the global variable diff --git a/paddle/fluid/framework/ir/fusion_group/CMakeLists.txt b/paddle/fluid/framework/ir/fusion_group/CMakeLists.txt index 05b0c1cc34e4302315779b035130f4fa019805e3..1887f425d12a054efad1c5cafd27072778bdb6dc 100644 --- a/paddle/fluid/framework/ir/fusion_group/CMakeLists.txt +++ b/paddle/fluid/framework/ir/fusion_group/CMakeLists.txt @@ -1,8 +1,6 @@ cc_library(code_generator SRCS operation.cc code_generator.cc code_generator_helper.cc DEPS graph) -if(NOT APPLE AND NOT WIN32) - if(WITH_GPU) - cc_test(test_code_generator SRCS code_generator_tester.cc DEPS code_generator device_code lod_tensor graph_viz_pass) - endif() +if(WITH_GPU) + cc_test(test_code_generator SRCS code_generator_tester.cc DEPS code_generator device_code lod_tensor graph_viz_pass) endif() cc_library(fusion_group_pass diff --git a/paddle/fluid/framework/ir/fusion_group/subgraph.h b/paddle/fluid/framework/ir/fusion_group/subgraph.h index 10f2df77462d08e91b8626daf3b61a27a8747d95..1dd9caa10c98a9389d1468fb84975a9890d46109 100644 --- a/paddle/fluid/framework/ir/fusion_group/subgraph.h +++ b/paddle/fluid/framework/ir/fusion_group/subgraph.h @@ -20,6 +20,7 @@ limitations under the License. */ #include #include "paddle/fluid/framework/ir/fusion_group/operation.h" #include "paddle/fluid/framework/ir/node.h" +#include "paddle/fluid/framework/ir/pass_tester_helper.h" namespace paddle { namespace framework { @@ -170,6 +171,11 @@ struct SubGraph { } } + if (from > to) { + LOG(INFO) << "subgraph: {\n" << DebugString(Nodes()) << "}\n"; + LOG(INFO) << "sorted nodes: {\n" + << DebugString(sorted_nodes) << "}\n"; + } PADDLE_ENFORCE_LE(from, to, "Range [%d, %d] is invalid.", from, to); sorted_nodes.insert(sorted_nodes.begin() + to, n); sorted_vars[n->Name()] = n; @@ -225,6 +231,9 @@ struct SubGraph { } } if (found_connected_ops) { + if (from > to) { + LOG(INFO) << "subgraph: {\n" << DebugString(Nodes()) << "}\n"; + } PADDLE_ENFORCE_LE(from, to, "Range [%d, %d] is invalid.", from, to); sorted_ops.insert(sorted_ops.begin() + to, op_n); erased_ops.insert(op_n);