From 8f49f9d5c9d01eb1d32f9a14fcda2bd7e3a18509 Mon Sep 17 00:00:00 2001 From: wawltor Date: Tue, 29 Dec 2020 19:24:38 +0800 Subject: [PATCH] change the elementwise ops version check, test=op_version change the elementwise ops version check, test=op_version --- paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/conv_bn_fuse_pass.cc | 2 +- .../fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc | 2 +- .../fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/fc_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/fc_gru_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc | 2 +- paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc | 4 ++-- paddle/fluid/framework/ir/unsqueeze2_eltwise_fuse_pass.cc | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc b/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc index c0ebf6de9de..407ef0958e1 100644 --- a/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_affine_channel_fuse_pass.cc @@ -244,5 +244,5 @@ REGISTER_PASS_CAPABILITY(conv_eltwiseadd_affine_channel_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .LE("conv2d", 1) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("affine_channel", 0)); diff --git a/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc b/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc index 6f8591fd825..a232f7ebb89 100644 --- a/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_bn_fuse_pass.cc @@ -389,5 +389,5 @@ REGISTER_PASS_CAPABILITY(conv_eltwiseadd_bn_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .LE("conv2d", 1) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("batch_norm", 0)); diff --git a/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc index 545beb34e78..e7656171700 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add2_act_fuse_pass.cc @@ -122,6 +122,6 @@ REGISTER_PASS_CAPABILITY(conv_elementwise_add2_act_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .LE("conv2d", 1) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("relu", 0) .EQ("identity", 0)); diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc index d01a2f26223..24263e66320 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add_act_fuse_pass.cc @@ -109,6 +109,6 @@ REGISTER_PASS_CAPABILITY(conv_elementwise_add_act_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .LE("conv2d", 1) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("relu", 0) .EQ("identity", 0)); diff --git a/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc b/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc index e34a2d96581..9121047d2fa 100644 --- a/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc +++ b/paddle/fluid/framework/ir/conv_elementwise_add_fuse_pass.cc @@ -95,4 +95,4 @@ REGISTER_PASS_CAPABILITY(conv_elementwise_add_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .LE("conv2d", 1) - .EQ("elementwise_add", 0)); + .LE("elementwise_add", 1)); diff --git a/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.cc b/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.cc index 02e3e2542f6..855ac2eb619 100644 --- a/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/embedding_fc_lstm_fuse_pass.cc @@ -263,6 +263,6 @@ REGISTER_PASS_CAPABILITY(embedding_fc_lstm_fuse_pass) paddle::framework::compatible::OpVersionComparatorCombination() .EQ("lookup_table_v2", 0) .EQ("mul", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("lstm", 0) .EQ("fused_embedding_fc_lstm", 0)); diff --git a/paddle/fluid/framework/ir/fc_fuse_pass.cc b/paddle/fluid/framework/ir/fc_fuse_pass.cc index 0248aeedd0a..103fa0f5faf 100644 --- a/paddle/fluid/framework/ir/fc_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_fuse_pass.cc @@ -187,6 +187,6 @@ REGISTER_PASS_CAPABILITY(fc_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .EQ("mul", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("relu", 0) .EQ("fc", 0)); diff --git a/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc b/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc index fe347d6a45d..f0e1beeae85 100644 --- a/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_gru_fuse_pass.cc @@ -208,6 +208,6 @@ REGISTER_PASS_CAPABILITY(fc_gru_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .EQ("mul", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("gru", 0) .LE("fusion_gru", 1)); diff --git a/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc b/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc index 9dca4d1b29f..d515e5e4d95 100644 --- a/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/fc_lstm_fuse_pass.cc @@ -202,7 +202,7 @@ REGISTER_PASS_CAPABILITY(fc_lstm_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .EQ("mul", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("lstm", 0) .EQ("fusion_lstm", 0)); REGISTER_PASS_CAPABILITY(mul_lstm_fuse_pass) diff --git a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc index cd6d1d57034..bb9613d0c17 100644 --- a/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc +++ b/paddle/fluid/framework/ir/multihead_matmul_fuse_pass.cc @@ -716,7 +716,7 @@ REGISTER_PASS_CAPABILITY(multihead_matmul_fuse_pass_v2) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .EQ("mul", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("reshape2", 0) .EQ("transpose2", 0) .EQ("scale", 0) diff --git a/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc b/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc index 4101d593086..dfbf97c69b3 100644 --- a/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc +++ b/paddle/fluid/framework/ir/seq_concat_fc_fuse_pass.cc @@ -262,7 +262,7 @@ REGISTER_PASS_CAPABILITY(seq_concat_fc_fuse_pass) .EQ("sequence_expand", 0) .EQ("concat", 0) .EQ("mul", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("sigmoid", 0) .EQ("tanh", 0) .EQ("relu", 0) diff --git a/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc b/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc index d9a1348e05a..c2e18ca1efb 100644 --- a/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc +++ b/paddle/fluid/framework/ir/seqconv_eltadd_relu_fuse_pass.cc @@ -106,5 +106,5 @@ REGISTER_PASS_CAPABILITY(seqconv_eltadd_relu_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .EQ("sequence_conv", 0) - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("relu", 0)); diff --git a/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc b/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc index b708f2eff10..69bf3eda614 100644 --- a/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc +++ b/paddle/fluid/framework/ir/skip_layernorm_fuse_pass.cc @@ -193,5 +193,5 @@ REGISTER_PASS(skip_layernorm_fuse_pass, REGISTER_PASS_CAPABILITY(skip_layernorm_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() - .EQ("elementwise_add", 0) + .LE("elementwise_add", 1) .EQ("layer_norm", 0)); diff --git a/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc b/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc index 542aadbe53d..d17212f4aa3 100644 --- a/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc +++ b/paddle/fluid/framework/ir/squared_mat_sub_fuse_pass.cc @@ -392,7 +392,7 @@ REGISTER_PASS_CAPABILITY(squared_mat_sub_fuse_pass) .EQ("matmul", 0) .EQ("matmul_v2", 0) .EQ("square", 0) - .EQ("elementwise_mul", 0) - .EQ("elementwise_sub", 0) + .LE("elementwise_mul", 1) + .LE("elementwise_sub", 1) .EQ("fill_constant", 1) .EQ("fusion_squared_mat_sub", 0)); diff --git a/paddle/fluid/framework/ir/unsqueeze2_eltwise_fuse_pass.cc b/paddle/fluid/framework/ir/unsqueeze2_eltwise_fuse_pass.cc index f984744532f..d4d3c41e658 100644 --- a/paddle/fluid/framework/ir/unsqueeze2_eltwise_fuse_pass.cc +++ b/paddle/fluid/framework/ir/unsqueeze2_eltwise_fuse_pass.cc @@ -131,4 +131,4 @@ REGISTER_PASS_CAPABILITY(unsqueeze2_eltwise_fuse_pass) .AddCombination( paddle::framework::compatible::OpVersionComparatorCombination() .EQ("unsqueeze2", 0) - .EQ("elementwise_mul", 0)); + .LE("elementwise_mul", 1)); -- GitLab