未验证 提交 05643dc3 编写于 作者: 王明冬 提交者: GitHub

[pass_enhance]add global extra attributes for op def, test=develop (#34009)

上级 80bd093a
......@@ -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<std::string> 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)) {
......
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
......
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
......
......@@ -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
}
}
......@@ -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
......
......@@ -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
......
......@@ -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
}
}
......@@ -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
}
}
......@@ -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
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册