diff --git a/paddle/fluid/framework/ir/op_compat_sensible_pass.cc b/paddle/fluid/framework/ir/op_compat_sensible_pass.cc index c0f17af3160ccd24ce83c97448edb7c7bc0958e2..1574bb739dd02a62b5c457ddaebbf562ee01fd69 100644 --- a/paddle/fluid/framework/ir/op_compat_sensible_pass.cc +++ b/paddle/fluid/framework/ir/op_compat_sensible_pass.cc @@ -19,6 +19,15 @@ limitations under the License. */ #include "paddle/fluid/framework/op_def_api.h" #include "paddle/fluid/framework/op_info.h" +namespace { +std::unordered_set global_extra_attrs = { + "op_role", "op_role_var", "op_namescope", + "op_callstack", "op_device", "@ENABLE_CACHE_RUNTIME_CONTEXT@", + "is_test", "use_mkldnn", "mkldnn_data_type", + "use_quantizer", "mkldnn_data_type", "use_cudnn", + "name"}; +} + namespace paddle { namespace framework { namespace ir { @@ -171,7 +180,8 @@ bool OpCompat::Judge(const OpDesc& op_desc) { for (auto& attr_map : op_desc.GetAttrMap()) { if (attr_compats_.find(attr_map.first) == attr_compats_.end()) { - if (extra_attrs_.find(attr_map.first) != extra_attrs_.end()) { + if (global_extra_attrs.find(attr_map.first) != global_extra_attrs.end() || + extra_attrs_.find(attr_map.first) != extra_attrs_.end()) { continue; } if (!AttrCompat(attr_map.first, this).IsLeftDefault()(op_desc)) { diff --git a/paddle/fluid/operators/compat/affine_channel.pbtxt b/paddle/fluid/operators/compat/affine_channel.pbtxt index 444fde59a9631c75ec4a5626a22f2d3a785ffd3d..83a55ab3a7d19fabc4c176ee9e434895c76e2484 100644 --- a/paddle/fluid/operators/compat/affine_channel.pbtxt +++ b/paddle/fluid/operators/compat/affine_channel.pbtxt @@ -17,25 +17,3 @@ def { name: "Out" } } -extra { - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } -} diff --git a/paddle/fluid/operators/compat/batch_norm.pbtxt b/paddle/fluid/operators/compat/batch_norm.pbtxt index 92b5647a5071aa69d95f6c049fa7356933b7dcd1..4bfd08421327fd8a1ae127eb23446ab780dd11fc 100644 --- a/paddle/fluid/operators/compat/batch_norm.pbtxt +++ b/paddle/fluid/operators/compat/batch_norm.pbtxt @@ -15,6 +15,9 @@ def { inputs { name: "Variance" } + inputs { + name: "MomentumTensor" + } outputs { name: "Y" } @@ -39,29 +42,18 @@ def { } } extra { - inputs { - name: "MomentumTensor" - } - attrs { - name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" - type: BOOLEAN - } attrs { - name: "is_test" - type: BOOLEAN + name: "momentum" + type: FLOAT } attrs { - name: "momentum" + name: "Y0_threshold" type: FLOAT } attrs { name: "data_layout" type: STRING } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } attrs { name: "fuse_with_relu" type: BOOLEAN @@ -74,25 +66,5 @@ extra { name: "trainable_statistics" type: BOOLEAN } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } } diff --git a/paddle/fluid/operators/compat/concat.pbtxt b/paddle/fluid/operators/compat/concat.pbtxt index 54c8e089829eb1910820c363f422cecea3af45c5..24e62fc30a913f9df84bf6ae94ef4b8b4a663562 100644 --- a/paddle/fluid/operators/compat/concat.pbtxt +++ b/paddle/fluid/operators/compat/concat.pbtxt @@ -14,37 +14,3 @@ def { type: INT } } -extra { - attrs { - name: "use_mkldnn" - type: BOOLEAN - } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } -} diff --git a/paddle/fluid/operators/compat/conv2d.pbtxt b/paddle/fluid/operators/compat/conv2d.pbtxt index 9e4c8b796a898083070431b34ed72028c73151bd..ca07d4a36ff3cafd88d833287b7bf5b17ec81f4d 100644 --- a/paddle/fluid/operators/compat/conv2d.pbtxt +++ b/paddle/fluid/operators/compat/conv2d.pbtxt @@ -45,6 +45,14 @@ extra { name: "Input_scale" type: FLOAT } + attrs { + name: "Input0_threshold" + type: FLOAT + } + attrs { + name: "weight_scale" + type: FLOAT + } attrs { name: "quantization_type" type: STRING @@ -57,42 +65,14 @@ extra { name: "out_threshold" type: FLOAT } - attrs { - name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" - type: BOOLEAN - } attrs { name: "skip_quant" type: BOOLEAN } - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "name" - type: STRING - } - attrs { - name: "use_cudnn" - type: BOOLEAN - } attrs { name: "fuse_relu_before_depthwise_conv" type: BOOLEAN } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "fuse_relu" type: BOOLEAN @@ -153,25 +133,5 @@ extra { name: "exhaustive_search" type: BOOLEAN } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } } diff --git a/paddle/fluid/operators/compat/conv2d_transpose.pbtxt b/paddle/fluid/operators/compat/conv2d_transpose.pbtxt index 474043718e4f971c6349b20432ae0aad95e33893..0654907934025607c393f5ea8dc95375679a03ab 100644 --- a/paddle/fluid/operators/compat/conv2d_transpose.pbtxt +++ b/paddle/fluid/operators/compat/conv2d_transpose.pbtxt @@ -46,26 +46,10 @@ def { } } extra { - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "use_cudnn" - type: BOOLEAN - } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } attrs { name: "force_fp32_output" type: BOOLEAN } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "fuse_relu" type: BOOLEAN @@ -86,25 +70,5 @@ extra { name: "workspace_size_MB" type: INT } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } } diff --git a/paddle/fluid/operators/compat/conv3d.pbtxt b/paddle/fluid/operators/compat/conv3d.pbtxt index 51d4c0d8e3bbb6b6f333687b93df8918121ec63f..ec88172faabc1447669b23edf04475df1ca6f07c 100644 --- a/paddle/fluid/operators/compat/conv3d.pbtxt +++ b/paddle/fluid/operators/compat/conv3d.pbtxt @@ -6,6 +6,9 @@ def { inputs { name: "Filter" } + inputs { + name: "ResidualData" + } outputs { name: "Output" } @@ -35,33 +38,10 @@ def { } } extra { - inputs { - name: "ResidualData" - } - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "use_cudnn" - type: BOOLEAN - } attrs { name: "fuse_relu_before_depthwise_conv" type: BOOLEAN } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "fuse_relu" type: BOOLEAN diff --git a/paddle/fluid/operators/compat/cvm.pbtxt b/paddle/fluid/operators/compat/cvm.pbtxt index ccbeabc1f1511c902b9f2f905ae17ad285a92fb6..f94e6d276c328bb77a6a64935fede5060242478f 100644 --- a/paddle/fluid/operators/compat/cvm.pbtxt +++ b/paddle/fluid/operators/compat/cvm.pbtxt @@ -14,26 +14,4 @@ def { type: BOOLEAN } } -extra { - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } -} diff --git a/paddle/fluid/operators/compat/depthwise_conv2d.pbtxt b/paddle/fluid/operators/compat/depthwise_conv2d.pbtxt index 901ed1646080718dea924cd4039734b8738fb83c..ded143986159fdc973e345092543b4080366ad0c 100644 --- a/paddle/fluid/operators/compat/depthwise_conv2d.pbtxt +++ b/paddle/fluid/operators/compat/depthwise_conv2d.pbtxt @@ -57,42 +57,14 @@ extra { name: "out_threshold" type: FLOAT } - attrs { - name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" - type: BOOLEAN - } attrs { name: "skip_quant" type: BOOLEAN } - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "name" - type: STRING - } - attrs { - name: "use_cudnn" - type: BOOLEAN - } attrs { name: "fuse_relu_before_depthwise_conv" type: BOOLEAN } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "fuse_relu" type: BOOLEAN @@ -153,25 +125,5 @@ extra { name: "exhaustive_search" type: BOOLEAN } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } } diff --git a/paddle/fluid/operators/compat/elementwise_add.pbtxt b/paddle/fluid/operators/compat/elementwise_add.pbtxt index 25da11905d42324da80f37180eafb4863492065a..081c0b6cd6e8e97c80c7377885099b71a0a8595e 100644 --- a/paddle/fluid/operators/compat/elementwise_add.pbtxt +++ b/paddle/fluid/operators/compat/elementwise_add.pbtxt @@ -15,10 +15,6 @@ def { } } extra { - attrs { - name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" - type: BOOLEAN - } attrs { name: "out_threshold" type: FLOAT @@ -37,19 +33,6 @@ extra { type: STRING # no longer to use } - attrs { - name: "use_quantizer" - type: BOOLEAN - # no longer to use, Use 'mkldnn_data_type' instead. - } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "Scale_x" type: FLOAT @@ -62,24 +45,4 @@ extra { name: "Scale_out" type: FLOAT } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } } diff --git a/paddle/fluid/operators/compat/elementwise_div.pbtxt b/paddle/fluid/operators/compat/elementwise_div.pbtxt index 40e9d90dbfd89a9deefe4c6d6bec0cc432b63c13..a73d2072029a3a00c19f35dfd72adce739fc2f5e 100644 --- a/paddle/fluid/operators/compat/elementwise_div.pbtxt +++ b/paddle/fluid/operators/compat/elementwise_div.pbtxt @@ -15,10 +15,6 @@ def { } } extra { - attrs { - name: "use_mkldnn" - type: BOOLEAN - } attrs { name: "x_data_format" type: STRING @@ -27,14 +23,6 @@ extra { name: "y_data_format" type: STRING } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "Scale_x" type: FLOAT @@ -47,26 +35,6 @@ extra { name: "Scale_out" type: FLOAT } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } attrs { name: "act" type: STRING diff --git a/paddle/fluid/operators/compat/elementwise_mul.pbtxt b/paddle/fluid/operators/compat/elementwise_mul.pbtxt index 3bc2186ba30e9ea3399b40ced85d3873f2361440..22289e2689c10a7339a0e34a38f90b40c9453588 100644 --- a/paddle/fluid/operators/compat/elementwise_mul.pbtxt +++ b/paddle/fluid/operators/compat/elementwise_mul.pbtxt @@ -15,10 +15,6 @@ def { } } extra { - attrs { - name: "use_mkldnn" - type: BOOLEAN - } attrs { name: "x_data_format" type: STRING @@ -27,14 +23,6 @@ extra { name: "y_data_format" type: STRING } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "Scale_x" type: FLOAT @@ -47,24 +35,4 @@ extra { name: "Scale_out" type: FLOAT } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } } diff --git a/paddle/fluid/operators/compat/elementwise_pow.pbtxt b/paddle/fluid/operators/compat/elementwise_pow.pbtxt index 3ad21423e40aba18ef99ff9959a601c1011fd4b3..a2ab73f409b7801d375b25c90e24ed1f65ed82f0 100644 --- a/paddle/fluid/operators/compat/elementwise_pow.pbtxt +++ b/paddle/fluid/operators/compat/elementwise_pow.pbtxt @@ -15,10 +15,6 @@ def { } } extra { - attrs { - name: "use_mkldnn" - type: BOOLEAN - } attrs { name: "x_data_format" type: STRING @@ -27,14 +23,6 @@ extra { name: "y_data_format" type: STRING } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "Scale_x" type: FLOAT @@ -47,26 +35,6 @@ extra { name: "Scale_out" type: FLOAT } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } attrs { name: "act" type: STRING diff --git a/paddle/fluid/operators/compat/elementwise_sub.pbtxt b/paddle/fluid/operators/compat/elementwise_sub.pbtxt index b449e76ca06443a8adf65d0691654ec39c9c14f5..9f38601f585ea8aabdf67fbd2fc9f9189a3f21a0 100644 --- a/paddle/fluid/operators/compat/elementwise_sub.pbtxt +++ b/paddle/fluid/operators/compat/elementwise_sub.pbtxt @@ -15,10 +15,6 @@ def { } } extra { - attrs { - name: "use_mkldnn" - type: BOOLEAN - } attrs { name: "x_data_format" type: STRING @@ -27,14 +23,6 @@ extra { name: "y_data_format" type: STRING } - attrs { - name: "use_quantizer" - type: BOOLEAN - } - attrs { - name: "mkldnn_data_type" - type: STRING - } attrs { name: "Scale_x" type: FLOAT @@ -47,26 +35,6 @@ extra { name: "Scale_out" type: FLOAT } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } attrs { name: "act" type: STRING diff --git a/paddle/fluid/operators/compat/fake_channel_wise_dequantize_max_abs.pbtxt b/paddle/fluid/operators/compat/fake_channel_wise_dequantize_max_abs.pbtxt index 542a0ff649ff9cc82f93094219671d4c4afa8815..ec80ffaaf32ae10b4d340b320e06cf24d72f21e5 100644 --- a/paddle/fluid/operators/compat/fake_channel_wise_dequantize_max_abs.pbtxt +++ b/paddle/fluid/operators/compat/fake_channel_wise_dequantize_max_abs.pbtxt @@ -18,30 +18,3 @@ def { type: INT } } -extra { - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } -} - diff --git a/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt b/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt index 22954c9ba22ce4d4a88deca4f7e8b4a559971a78..04fa10cc2b3d1671c4b32afa4d659b86a191f00e 100644 --- a/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt +++ b/paddle/fluid/operators/compat/fake_channel_wise_quantize_abs_max.pbtxt @@ -18,29 +18,3 @@ def { type: INT } } -extra { - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } -} diff --git a/paddle/fluid/operators/compat/relu.pbtxt b/paddle/fluid/operators/compat/relu.pbtxt index b70458aaa3c471a4d2ad2457c4e9259fda9bd89f..a3dc65ae35c008fe9e5838f16bc28d71e0eff811 100644 --- a/paddle/fluid/operators/compat/relu.pbtxt +++ b/paddle/fluid/operators/compat/relu.pbtxt @@ -8,9 +8,9 @@ def { } } extra { - attrs { - name: "@ENABLE_CACHE_RUNTIME_CONTEXT@" - type: BOOLEAN + attrs { + name: "X0_threshold" + type: FLOAT } attrs { name: "X0_threshold" @@ -24,40 +24,4 @@ extra { name: "Out0_threshold" type: FLOAT } - attrs { - name: "use_mkldnn" - type: BOOLEAN - } - attrs { - name: "use_cudnn" - type: BOOLEAN - } - attrs { - name: "op_role" - type: INT - } - attrs { - name: "op_role_var" - type: STRINGS - } - attrs { - name: "op_namescope" - type: STRING - } - attrs { - name: "op_callstack" - type: STRINGS - } - attrs { - name: "op_device" - type: STRING - } - attrs { - name: "is_test" - type: BOOLEAN - } - attrs { - name: "name" - type: STRINGS - } }