Skip to content

Commit afdc730

Browse files
authored
Merge pull request #13816 from PaddlePaddle/revert-13368-mgallus/conv-bias-pass
Revert "[MKLDNN] Pass: Fuse Conv + Bias"
2 parents ce248a1 + 9b11a17 commit afdc730

File tree

7 files changed

+2
-276
lines changed

7 files changed

+2
-276
lines changed

paddle/fluid/framework/ir/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pass_library(graph_to_program_pass base)
3030
pass_library(graph_viz_pass base)
3131
pass_library(fc_fuse_pass inference)
3232
if (WITH_MKLDNN)
33-
pass_library(conv_bias_mkldnn_fuse_pass inference)
3433
pass_library(conv_relu_mkldnn_fuse_pass inference)
3534
endif ()
3635
pass_library(attention_lstm_fuse_pass inference)
@@ -53,7 +52,6 @@ cc_test(graph_helper_test SRCS graph_helper_test.cc DEPS graph graph_helper op_r
5352
cc_test(graph_to_program_pass_test SRCS graph_to_program_pass_test.cc DEPS graph_to_program_pass)
5453
cc_test(test_graph_pattern_detector SRCS graph_pattern_detector_tester.cc DEPS graph_pattern_detector)
5554
cc_test(test_fc_fuse_pass SRCS fc_fuse_pass_tester.cc DEPS fc_fuse_pass framework_proto)
56-
if(WITH_MKLDNN)
57-
cc_test(test_conv_bias_mkldnn_fuse_pass SRCS conv_bias_mkldnn_fuse_pass_tester.cc DEPS conv_bias_mkldnn_fuse_pass)
55+
if (WITH_MKLDNN)
5856
cc_test(test_conv_relu_mkldnn_fuse_pass SRCS conv_relu_mkldnn_fuse_pass_tester.cc DEPS conv_relu_mkldnn_fuse_pass)
59-
endif()
57+
endif ()

paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.cc

Lines changed: 0 additions & 78 deletions
This file was deleted.

paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass.h

Lines changed: 0 additions & 34 deletions
This file was deleted.

paddle/fluid/framework/ir/conv_bias_mkldnn_fuse_pass_tester.cc

Lines changed: 0 additions & 106 deletions
This file was deleted.

paddle/fluid/framework/ir/graph_pattern_detector.cc

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -964,38 +964,6 @@ PDNode *patterns::ElewiseAddActInplaceGrad::operator()(
964964
return ele_add_grad;
965965
}
966966

967-
PDNode *patterns::ConvBias::operator()(
968-
paddle::framework::ir::PDNode *conv_input) {
969-
// Create Operators
970-
conv_input->assert_is_op_input("conv2d", "Input");
971-
auto *conv_op = pattern->NewNode(conv_repr())->assert_is_op("conv2d");
972-
auto *eltiwse_op =
973-
pattern->NewNode(eltwise_repr())->assert_is_op("elementwise_add");
974-
// Create variables
975-
// Filter
976-
auto *conv_weight_var = pattern->NewNode(conv_weight_repr())
977-
->AsInput()
978-
->assert_is_persistable_var()
979-
->assert_is_op_input("conv2d", "Filter");
980-
// intermediate variable, will be removed in the IR after fuse.
981-
auto *conv_out_var = pattern->NewNode(conv_out_repr())
982-
->AsIntermediate()
983-
->assert_is_only_output_of_op("conv2d")
984-
->assert_is_op_input("elementwise_add");
985-
// Bias stored in elementwise_add
986-
auto *eltwise_bias_var = pattern->NewNode(eltwise_bias_repr())
987-
->AsInput()
988-
->assert_is_op_input("elementwise_add", "Y");
989-
// output
990-
auto *eltwise_out_var = pattern->NewNode(eltwise_out_repr())
991-
->AsOutput()
992-
->assert_is_op_output("elementwise_add");
993-
conv_op->LinksFrom({conv_input, conv_weight_var}).LinksTo({conv_out_var});
994-
eltiwse_op->LinksFrom({conv_out_var, eltwise_bias_var})
995-
.LinksTo({eltwise_out_var});
996-
return eltwise_out_var;
997-
}
998-
999967
} // namespace ir
1000968
} // namespace framework
1001969
} // namespace paddle

paddle/fluid/framework/ir/graph_pattern_detector.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -578,27 +578,6 @@ struct ElewiseAddActInplaceGrad : public PatternBase {
578578
PATTERN_DECL_NODE(d_ele_y);
579579
PATTERN_DECL_NODE(ele_y);
580580
};
581-
582-
// Conv with Elementwise_add as bias
583-
// op: conv + elementwise_add
584-
// named nodes:
585-
// conv_input, conv_weight,
586-
// conv_out, conv,
587-
// eltwise_bias, eltwise_out,
588-
// elementwise_add
589-
struct ConvBias : public PatternBase {
590-
ConvBias(PDPattern* pattern, const std::string& name_scope)
591-
: PatternBase(pattern, name_scope, "conv_bias") {}
592-
PDNode* operator()(PDNode* conv_input);
593-
// declare operator node's name
594-
PATTERN_DECL_NODE(conv);
595-
PATTERN_DECL_NODE(eltwise);
596-
// declare variable node's name
597-
PATTERN_DECL_NODE(conv_weight);
598-
PATTERN_DECL_NODE(conv_out);
599-
PATTERN_DECL_NODE(eltwise_bias);
600-
PATTERN_DECL_NODE(eltwise_out);
601-
};
602581
} // namespace patterns
603582

604583
// Link two ir::Nodes from each other.

paddle/fluid/inference/analysis/analyzer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class Analyzer : public OrderedRegistry<PassManager> {
7676
"conv_bn_fuse_pass", //
7777
"conv_eltwiseadd_bn_fuse_pass", //
7878
#ifdef PADDLE_WITH_MKLDNN
79-
"conv_bias_mkldnn_fuse_pass", //
8079
"conv_relu_mkldnn_fuse_pass", //
8180
#endif
8281
}};

0 commit comments

Comments
 (0)