tests: benchdnn: graph: add cases for post-sum zps

This commit is contained in:
Bao, Yixin
2023-05-25 11:37:43 +08:00
committed by Tao Lv
parent b856b94e86
commit 02972141ae
3 changed files with 1154 additions and 0 deletions
@@ -12,8 +12,12 @@
--reset --in-shapes=0:1x2048x14x14+1:2048x64x3x3+2:2048 --op-attrs=4:strides:1x1*dilations:1x1*pads_begin:1x1*pads_end:1x1*groups:32 --case=pattern/int8/int8_conv_bias_relu_fusion_2.json
--reset --in-shapes=0:1x2048x14x14+1:2048x64x3x3+2:2048 --op-attrs=4:strides:1x1*dilations:1x1*pads_begin:1x1*pads_end:1x1*groups:32 --case=pattern/int8/int8_conv_bias_relu_fusion_3.json
--reset --in-shapes=0:50x64x56x56+1:64x64x1x1+2:1x1x1x1+3:1x1x1x1 --op-attrs=4:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_conv_add_add_fusion.json
--reset --op-attrs=8209:zps:1 --case=pattern/int8/int8_conv_add_add_fusion.json
--reset --in-shapes=0:50x64x56x56+1:64x64x1x1+2:1x1x1x1+3:1x64x1x1 --op-attrs=4:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_conv_add_mul_fusion.json
--reset --op-attrs=8209:zps:2 --case=pattern/int8/int8_conv_add_mul_fusion.json
--reset --in-shapes=0:50x64x56x56+1:64x64x1x1 --op-attrs=4:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_conv_relu_fusion.json
--reset --case=pattern/int8/int8_bf16_conv_add_fusion.json
--reset --op-attrs=8209:zps:1 --case=pattern/int8/int8_bf16_conv_add_fusion.json
# quantized conv
--reset --in-shapes=0:50x64x56x56+1:64x64x1x1+2:64 --op-attrs=4:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_conv_2d_fusion.json
--reset --in-shapes=0:2x3x224x224+1:64x3x7x7+2:64 --op-attrs=4:strides:2x2*dilations:1x1*pads_begin:3x3*pads_end:2x2*groups:1 --case=pattern/int8/int8_conv_2d_fusion_2.json
@@ -28,6 +32,7 @@
--reset --in-shapes=0:2x64x3x3 --case=pattern/int8/int8_reorder_fusion_3.json
# matmul
--reset --in-shapes=0:16x256+1:256x1+2:1x1+3:1x1 --case=pattern/int8/int8_matmul_add_mul_fusion.json
--reset --op-attrs=8209:zps:3 --case=pattern/int8/int8_matmul_add_mul_fusion.json
--reset --in-shapes=0:16x256+1:256x1+2:1x1+3:1x1+4:1x1 --case=pattern/int8/int8_matmul_mul_add_mul_fusion.json
--reset --in-shapes=0:16x256+1:256x1+2:1x1 --case=pattern/int8/int8_matmul_logistic_fusion.json
--reset --in-shapes=0:16x1024+1:1024x1024+2:1x1024 --case=pattern/int8/int8_matmul_bia_relu_fusion.json
@@ -36,6 +41,8 @@
--reset --in-shapes=0:16x256+1:256x128+2:1x128 --case=pattern/int8/int8_matmul_bia_relu_fusion.json
--reset --in-shapes=0:16x479+1:479x1024+2:1x1024 --case=pattern/int8/int8_matmul_bia_relu_fusion.json
--reset --in-shapes=0:16x512+1:512x256+2:1x256 --case=pattern/int8/int8_matmul_bia_relu_fusion.json
--reset --in-shapes=0:16x13+3:13x512+6208:16x512 --case=pattern/int8/int8_bf16_matmul_add_fusion.json
--reset --op-attrs=8209:zps:4 --case=pattern/int8/int8_bf16_matmul_add_fusion.json
--reset --in-shapes=0:16x13+1:13x512+2:1x1+3:1x1 --case=pattern/int8/int8_bf16_matmul_mul_add_fusion_2.json
--reset --in-shapes=0:16x512+1:512x256+2:1x1+3:1x1 --case=pattern/int8/int8_f32_matmul_mul_add_fusion.json
--reset --in-shapes=0:16x1024+1:1024x512+2:1x512+3:16x512 --case=pattern/int8/int8_matmul_bias_sum_fusion.json
@@ -46,6 +53,7 @@
--reset --in-shapes=0:2x16x5x5+1:16x4x3x3 --op-attrs=5:strides:1x1*dilations:1x1*pads_begin:1x1*pads_end:1x1*groups:4 --case=pattern/int8/int8_convtranspose_post_ops_square_fusion.json
--reset --in-shapes=0:50x64x56x56+1:64x64x1x1+2:1x1x1x1+3:1x64x1x1 --op-attrs=5:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_convtranspose_post_ops_chain_fusion.json
--reset --in-shapes=0:2x17x8x8+1:17x16x3x3+2:2x16x5x5 --op-attrs=5:strides:1x1*dilations:1x1*pads_begin:3x3*pads_end:2x2*groups:1 --case=pattern/int8/int8_convtranspose_post_ops_sum_fusion.json
--reset --op-attrs=8209:zps:4 --case=pattern/int8/int8_convtranspose_post_ops_sum_fusion.json
--reset --in-shapes=0:2x16x5x5+1:16x16x1x1+2:2x16x5x5 --op-attrs=5:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_convtranspose_post_ops_sum_fusion.json
--reset --in-shapes=0:2x16x5x5+1:16x16x3x3+2:2x16x5x5 --op-attrs=5:strides:1x1*dilations:1x1*pads_begin:1x1*pads_end:1x1*groups:1 --case=pattern/int8/int8_convtranspose_post_ops_sum_fusion.json
--reset --in-shapes=0:2x16x5x5+1:16x17x1x1+2:2x17x5x5 --op-attrs=5:strides:1x1*dilations:1x1*pads_begin:0x0*pads_end:0x0*groups:1 --case=pattern/int8/int8_convtranspose_post_ops_sum_fusion.json
@@ -0,0 +1,633 @@
{
"version": "3.0.0",
"engine_kind": "cpu",
"fpmath_mode": "strict",
"graph": [
{
"id": 2065,
"name": "DEQUANTIZE_1",
"kind": "Dequantize",
"attrs": {
"axis": {
"type": "s64",
"value": 0
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"zps": {
"type": "s64[]",
"value": [
0
]
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 0,
"dtype": "s8",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 36,
"dtype": "f32",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 2066,
"name": "TYPECAST_1",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 36,
"dtype": "f32",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 37,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 4113,
"name": "DEQUANTIZE_2",
"kind": "Dequantize",
"attrs": {
"axis": {
"type": "s64",
"value": 0
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"zps": {
"type": "s64[]",
"value": [
0
]
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 1,
"dtype": "s8",
"shape": [
64,
64,
1,
1
],
"stride": [
64,
1,
1,
1
],
"layout_type": "strided",
"property_type": "constant"
}
],
"outputs": [
{
"id": 100,
"dtype": "f32",
"shape": [
64,
64,
1,
1
],
"stride": [
64,
1,
1,
1
],
"layout_type": "strided",
"property_type": "constant"
}
]
},
{
"id": 4114,
"name": "TYPECAST_2",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 100,
"dtype": "f32",
"shape": [
64,
64,
1,
1
],
"stride": [
64,
1,
1,
1
],
"layout_type": "strided",
"property_type": "constant"
}
],
"outputs": [
{
"id": 101,
"dtype": "bf16",
"shape": [
64,
64,
1,
1
],
"stride": [
64,
1,
1,
1
],
"layout_type": "strided",
"property_type": "constant"
}
]
},
{
"id": 4,
"name": "CONV_0",
"kind": "Convolution",
"attrs": {
"weights_format": {
"type": "string",
"value": "OIX"
},
"auto_pad": {
"type": "string",
"value": "None"
},
"dilations": {
"type": "s64[]",
"value": [
1,
1
]
},
"pads_end": {
"type": "s64[]",
"value": [
0,
0
]
},
"pads_begin": {
"type": "s64[]",
"value": [
0,
0
]
},
"data_format": {
"type": "string",
"value": "NCX"
},
"groups": {
"type": "s64",
"value": 1
},
"strides": {
"type": "s64[]",
"value": [
1,
1
]
}
},
"inputs": [
{
"id": 37,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
},
{
"id": 101,
"dtype": "bf16",
"shape": [
64,
64,
1,
1
],
"stride": [
64,
1,
1,
1
],
"layout_type": "strided",
"property_type": "constant"
}
],
"outputs": [
{
"id": 164,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8209,
"name": "DEQUANTIZE_4",
"kind": "Dequantize",
"attrs": {
"axis": {
"type": "s64",
"value": 1
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"zps": {
"type": "s64[]",
"value": [
0
]
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 2,
"dtype": "s8",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 6209,
"dtype": "f32",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8210,
"name": "TYPECAST_4",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 6209,
"dtype": "f32",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 6210,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 6145,
"name": "SUM_3",
"kind": "Add",
"attrs": {
"auto_broadcast": {
"type": "string",
"value": "numpy"
}
},
"inputs": [
{
"id": 164,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
},
{
"id": 6210,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 6305,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 6146,
"name": "TYPECAST_4",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 6305,
"dtype": "bf16",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 6306,
"dtype": "f32",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 14352,
"name": "QUANTIZE_7",
"kind": "Quantize",
"attrs": {
"axis": {
"type": "s64",
"value": 0
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"zps": {
"type": "s64[]",
"value": [
0
]
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 6306,
"dtype": "f32",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 14512,
"dtype": "s8",
"shape": [
50,
64,
56,
56
],
"stride": [
200704,
3136,
56,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
}
]
}
@@ -0,0 +1,513 @@
{
"version": "3.0.0",
"engine_kind": "cpu",
"fpmath_mode": "strict",
"graph": [
{
"id": 8205,
"name": "DEQUANTIZE_1",
"kind": "Dequantize",
"attrs": {
"zps": {
"type": "s64[]",
"value": [
0
]
},
"axis": {
"type": "s64",
"value": 0
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 0,
"dtype": "u8",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 1,
"dtype": "f32",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8206,
"name": "TYPECAST_1",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 1,
"dtype": "f32",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 2,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8207,
"name": "DEQUANTIZE_2",
"kind": "Dequantize",
"attrs": {
"zps": {
"type": "s64[]",
"value": [
0
]
},
"axis": {
"type": "s64",
"value": 0
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 3,
"dtype": "s8",
"shape": [
1024,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "constant"
}
],
"outputs": [
{
"id": 4,
"dtype": "f32",
"shape": [
1024,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "constant"
}
]
},
{
"id": 8208,
"name": "TYPECAST_2",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 4,
"dtype": "f32",
"shape": [
1024,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "constant"
}
],
"outputs": [
{
"id": 5,
"dtype": "bf16",
"shape": [
1024,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "constant"
}
]
},
{
"id": 8211,
"name": "MATMUL_0",
"kind": "MatMul",
"attrs": {
"transpose_b": {
"type": "bool",
"value": 0
},
"transpose_a": {
"type": "bool",
"value": 0
}
},
"inputs": [
{
"id": 2,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
},
{
"id": 5,
"dtype": "bf16",
"shape": [
1024,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "constant"
}
],
"outputs": [
{
"id": 6,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8209,
"name": "DEQUANTIZE_3",
"kind": "Dequantize",
"attrs": {
"axis": {
"type": "s64",
"value": 1
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"zps": {
"type": "s64[]",
"value": [
0
]
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 6208,
"dtype": "s8",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 6209,
"dtype": "f32",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8210,
"name": "TYPECAST_3",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 6209,
"dtype": "f32",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 6210,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8212,
"name": "BINARY_4",
"kind": "Add",
"attrs": {
"auto_broadcast": {
"type": "string",
"value": "numpy"
}
},
"inputs": [
{
"id": 6,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
},
{
"id": 6210,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 10,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8213,
"name": "TYPECAST_4",
"kind": "TypeCast",
"attrs": {},
"inputs": [
{
"id": 10,
"dtype": "bf16",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 11,
"dtype": "f32",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
},
{
"id": 8,
"name": "QUANTIZE_4",
"kind": "Quantize",
"attrs": {
"zps": {
"type": "s64[]",
"value": [
0
]
},
"axis": {
"type": "s64",
"value": 0
},
"qtype": {
"type": "string",
"value": "per_tensor"
},
"scales": {
"type": "f32[]",
"value": [
1
]
}
},
"inputs": [
{
"id": 11,
"dtype": "f32",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
],
"outputs": [
{
"id": 12,
"dtype": "s8",
"shape": [
16,
1024
],
"stride": [
1024,
1
],
"layout_type": "strided",
"property_type": "undef"
}
]
}
]
}