From c918788ba9a94ea55409af2176a934ab15f0972b Mon Sep 17 00:00:00 2001 From: Yiqun Liu Date: Sun, 24 Nov 2019 00:00:52 +0800 Subject: [PATCH] Disable fusion_group pass for windows and mac. We will do some experiments on Linux first. (#21310) * Disable fusion_group pass for windows and mac. We will do some experiments on Linux first. test=develop * Print the subgraph when check failed. test=develop --- paddle/fluid/framework/ir/CMakeLists.txt | 4 +++- paddle/fluid/framework/ir/fusion_group/CMakeLists.txt | 6 ++---- paddle/fluid/framework/ir/fusion_group/subgraph.h | 9 +++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/framework/ir/CMakeLists.txt b/paddle/fluid/framework/ir/CMakeLists.txt index 3859eb3e70..9323882e4e 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 05b0c1cc34..1887f425d1 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 10f2df7746..1dd9caa10c 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); -- GitLab