awu12 commited on
Commit
f25167e
·
verified ·
1 Parent(s): 06f6695

Replace pre-PR#15 conv2d-only trace with current simd-loop set (definitions + workloads + reference/autovec solutions)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. definitions/conv/conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256.json +0 -112
  2. definitions/conv/conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128.json +0 -112
  3. definitions/conv/conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256.json +0 -112
  4. definitions/conv/conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128.json +0 -112
  5. definitions/conv/conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64.json +0 -112
  6. definitions/conv/conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64.json +0 -112
  7. definitions/conv1d/conv1d_kw1_sw1_dw1_cout512_p0.json +0 -75
  8. definitions/conv1d/conv1d_kw3_sw1_dw1_cout512_p1.json +0 -75
  9. definitions/conv2d_depthwise/conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1.json +0 -101
  10. definitions/conv2d_depthwise/conv2d_depthwise_kh3_kw3_sh2_sw2_dh1_dw1_p1.json +0 -101
  11. definitions/conv2d_depthwise/conv2d_depthwise_kh5_kw5_sh1_sw1_dh1_dw1_p2.json +0 -101
  12. definitions/deconv2d/deconv2d_kh3_kw3_sh1_sw1_cout256.json +0 -102
  13. definitions/deconv2d/deconv2d_kh3_kw3_sh2_sw2_cout256.json +0 -102
  14. definitions/deconv2d/deconv2d_kh4_kw4_sh1_sw1_cout128.json +0 -102
  15. definitions/deconv2d/deconv2d_kh4_kw4_sh2_sw2_cout128.json +0 -102
  16. definitions/deconv2d_depthwise/deconv2d_depthwise_kh2_kw2_sh2_sw2.json +0 -97
  17. definitions/deconv2d_depthwise/deconv2d_depthwise_kh3_kw3_sh1_sw1.json +0 -97
  18. definitions/simd-loop/loop_005.json +36 -0
  19. definitions/simd-loop/loop_006.json +36 -0
  20. definitions/simd-loop/loop_034.json +42 -0
  21. definitions/simd-loop/loop_037.json +54 -0
  22. definitions/simd-loop/loop_038.json +49 -0
  23. definitions/simd-loop/loop_101.json +44 -0
  24. definitions/simd-loop/loop_102.json +46 -0
  25. definitions/simd-loop/loop_103.json +36 -0
  26. definitions/simd-loop/loop_104.json +46 -0
  27. definitions/simd-loop/loop_105.json +41 -0
  28. definitions/simd-loop/loop_106.json +40 -0
  29. definitions/simd-loop/loop_109.json +54 -0
  30. definitions/simd-loop/loop_110.json +58 -0
  31. definitions/simd-loop/loop_112.json +54 -0
  32. definitions/simd-loop/loop_114.json +51 -0
  33. definitions/simd-loop/loop_130.json +59 -0
  34. definitions/simd-loop/loop_135.json +59 -0
  35. definitions/simd-loop/loop_216.json +52 -0
  36. definitions/simd-loop/loop_217.json +52 -0
  37. definitions/simd-loop/loop_218.json +52 -0
  38. definitions/simd-loop/loop_219.json +52 -0
  39. definitions/simd-loop/loop_220.json +52 -0
  40. definitions/simd-loop/loop_221.json +52 -0
  41. definitions/simd-loop/loop_223.json +47 -0
  42. solutions/ncnn/baseline-ncnn-arm/conv1d/conv1d_kw1_sw1_dw1_cout512_p0.json +0 -40
  43. solutions/ncnn/baseline-ncnn-arm/conv1d/conv1d_kw3_sw1_dw1_cout512_p1.json +0 -40
  44. solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256.json +0 -40
  45. solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128.json +0 -40
  46. solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256.json +0 -40
  47. solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128.json +0 -40
  48. solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64.json +0 -40
  49. solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64.json +0 -40
  50. solutions/ncnn/baseline-ncnn-arm/conv2d_depthwise/conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1.json +0 -40
definitions/conv/conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "name": "conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256",
3
- "op_type": "conv2d",
4
- "description": "2D conv 1x1 stride=(1,1) dilation=(1,1) pad=(0,0) C_out=256. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 256
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 1
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 1
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- },
59
- "pad_top": {
60
- "type": "const",
61
- "value": 0
62
- },
63
- "pad_left": {
64
- "type": "const",
65
- "value": 0
66
- }
67
- },
68
- "inputs": {
69
- "input": {
70
- "shape": [
71
- "N",
72
- "C_in",
73
- "H",
74
- "W"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "weight": {
79
- "shape": [
80
- "C_out",
81
- "C_in",
82
- "Kh",
83
- "Kw"
84
- ],
85
- "dtype": "float32"
86
- },
87
- "activation_type": {
88
- "shape": null,
89
- "dtype": "int32"
90
- },
91
- "with_bias": {
92
- "shape": null,
93
- "dtype": "int32"
94
- }
95
- },
96
- "outputs": {
97
- "output": {
98
- "shape": [
99
- "N",
100
- "C_out",
101
- "H_out",
102
- "W_out"
103
- ],
104
- "dtype": "float32"
105
- }
106
- },
107
- "constraints": [
108
- "H_out == (H + 2*pad_top - Dh*(Kh-1) - 1) // Sh + 1",
109
- "W_out == (W + 2*pad_left - Dw*(Kw-1) - 1) // Sw + 1"
110
- ],
111
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, activation_type, with_bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight)\n return F.conv2d(x, w, None, stride=(1, 1), padding=(0, 0), dilation=(1, 1)).numpy()\n"
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv/conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "name": "conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128",
3
- "op_type": "conv2d",
4
- "description": "2D conv 3x3 stride=(1,1) dilation=(1,1) pad=(1,1) C_out=128. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 128
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 3
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- },
59
- "pad_top": {
60
- "type": "const",
61
- "value": 1
62
- },
63
- "pad_left": {
64
- "type": "const",
65
- "value": 1
66
- }
67
- },
68
- "inputs": {
69
- "input": {
70
- "shape": [
71
- "N",
72
- "C_in",
73
- "H",
74
- "W"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "weight": {
79
- "shape": [
80
- "C_out",
81
- "C_in",
82
- "Kh",
83
- "Kw"
84
- ],
85
- "dtype": "float32"
86
- },
87
- "activation_type": {
88
- "shape": null,
89
- "dtype": "int32"
90
- },
91
- "with_bias": {
92
- "shape": null,
93
- "dtype": "int32"
94
- }
95
- },
96
- "outputs": {
97
- "output": {
98
- "shape": [
99
- "N",
100
- "C_out",
101
- "H_out",
102
- "W_out"
103
- ],
104
- "dtype": "float32"
105
- }
106
- },
107
- "constraints": [
108
- "H_out == (H + 2*pad_top - Dh*(Kh-1) - 1) // Sh + 1",
109
- "W_out == (W + 2*pad_left - Dw*(Kw-1) - 1) // Sw + 1"
110
- ],
111
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, activation_type, with_bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight)\n return F.conv2d(x, w, None, stride=(1, 1), padding=(1, 1), dilation=(1, 1)).numpy()\n"
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv/conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "name": "conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256",
3
- "op_type": "conv2d",
4
- "description": "2D conv 3x3 stride=(1,1) dilation=(2,2) pad=(2,2) C_out=256. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 256
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 3
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 2
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 2
58
- },
59
- "pad_top": {
60
- "type": "const",
61
- "value": 2
62
- },
63
- "pad_left": {
64
- "type": "const",
65
- "value": 2
66
- }
67
- },
68
- "inputs": {
69
- "input": {
70
- "shape": [
71
- "N",
72
- "C_in",
73
- "H",
74
- "W"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "weight": {
79
- "shape": [
80
- "C_out",
81
- "C_in",
82
- "Kh",
83
- "Kw"
84
- ],
85
- "dtype": "float32"
86
- },
87
- "activation_type": {
88
- "shape": null,
89
- "dtype": "int32"
90
- },
91
- "with_bias": {
92
- "shape": null,
93
- "dtype": "int32"
94
- }
95
- },
96
- "outputs": {
97
- "output": {
98
- "shape": [
99
- "N",
100
- "C_out",
101
- "H_out",
102
- "W_out"
103
- ],
104
- "dtype": "float32"
105
- }
106
- },
107
- "constraints": [
108
- "H_out == (H + 2*pad_top - Dh*(Kh-1) - 1) // Sh + 1",
109
- "W_out == (W + 2*pad_left - Dw*(Kw-1) - 1) // Sw + 1"
110
- ],
111
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, activation_type, with_bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight)\n return F.conv2d(x, w, None, stride=(1, 1), padding=(2, 2), dilation=(2, 2)).numpy()\n"
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv/conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "name": "conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128",
3
- "op_type": "conv2d",
4
- "description": "2D conv 3x3 stride=(2,2) dilation=(1,1) pad=(1,1) C_out=128. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 128
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 3
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 2
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 2
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- },
59
- "pad_top": {
60
- "type": "const",
61
- "value": 1
62
- },
63
- "pad_left": {
64
- "type": "const",
65
- "value": 1
66
- }
67
- },
68
- "inputs": {
69
- "input": {
70
- "shape": [
71
- "N",
72
- "C_in",
73
- "H",
74
- "W"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "weight": {
79
- "shape": [
80
- "C_out",
81
- "C_in",
82
- "Kh",
83
- "Kw"
84
- ],
85
- "dtype": "float32"
86
- },
87
- "activation_type": {
88
- "shape": null,
89
- "dtype": "int32"
90
- },
91
- "with_bias": {
92
- "shape": null,
93
- "dtype": "int32"
94
- }
95
- },
96
- "outputs": {
97
- "output": {
98
- "shape": [
99
- "N",
100
- "C_out",
101
- "H_out",
102
- "W_out"
103
- ],
104
- "dtype": "float32"
105
- }
106
- },
107
- "constraints": [
108
- "H_out == (H + 2*pad_top - Dh*(Kh-1) - 1) // Sh + 1",
109
- "W_out == (W + 2*pad_left - Dw*(Kw-1) - 1) // Sw + 1"
110
- ],
111
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, activation_type, with_bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight)\n return F.conv2d(x, w, None, stride=(2, 2), padding=(1, 1), dilation=(1, 1)).numpy()\n"
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv/conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "name": "conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64",
3
- "op_type": "conv2d",
4
- "description": "2D conv 5x5 stride=(1,1) dilation=(1,1) pad=(2,2) C_out=64. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 64
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 5
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 5
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- },
59
- "pad_top": {
60
- "type": "const",
61
- "value": 2
62
- },
63
- "pad_left": {
64
- "type": "const",
65
- "value": 2
66
- }
67
- },
68
- "inputs": {
69
- "input": {
70
- "shape": [
71
- "N",
72
- "C_in",
73
- "H",
74
- "W"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "weight": {
79
- "shape": [
80
- "C_out",
81
- "C_in",
82
- "Kh",
83
- "Kw"
84
- ],
85
- "dtype": "float32"
86
- },
87
- "activation_type": {
88
- "shape": null,
89
- "dtype": "int32"
90
- },
91
- "with_bias": {
92
- "shape": null,
93
- "dtype": "int32"
94
- }
95
- },
96
- "outputs": {
97
- "output": {
98
- "shape": [
99
- "N",
100
- "C_out",
101
- "H_out",
102
- "W_out"
103
- ],
104
- "dtype": "float32"
105
- }
106
- },
107
- "constraints": [
108
- "H_out == (H + 2*pad_top - Dh*(Kh-1) - 1) // Sh + 1",
109
- "W_out == (W + 2*pad_left - Dw*(Kw-1) - 1) // Sw + 1"
110
- ],
111
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, activation_type, with_bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight)\n return F.conv2d(x, w, None, stride=(1, 1), padding=(2, 2), dilation=(1, 1)).numpy()\n"
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv/conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64.json DELETED
@@ -1,112 +0,0 @@
1
- {
2
- "name": "conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64",
3
- "op_type": "conv2d",
4
- "description": "2D conv 7x7 stride=(2,2) dilation=(1,1) pad=(3,3) C_out=64. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 64
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 7
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 7
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 2
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 2
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- },
59
- "pad_top": {
60
- "type": "const",
61
- "value": 3
62
- },
63
- "pad_left": {
64
- "type": "const",
65
- "value": 3
66
- }
67
- },
68
- "inputs": {
69
- "input": {
70
- "shape": [
71
- "N",
72
- "C_in",
73
- "H",
74
- "W"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "weight": {
79
- "shape": [
80
- "C_out",
81
- "C_in",
82
- "Kh",
83
- "Kw"
84
- ],
85
- "dtype": "float32"
86
- },
87
- "activation_type": {
88
- "shape": null,
89
- "dtype": "int32"
90
- },
91
- "with_bias": {
92
- "shape": null,
93
- "dtype": "int32"
94
- }
95
- },
96
- "outputs": {
97
- "output": {
98
- "shape": [
99
- "N",
100
- "C_out",
101
- "H_out",
102
- "W_out"
103
- ],
104
- "dtype": "float32"
105
- }
106
- },
107
- "constraints": [
108
- "H_out == (H + 2*pad_top - Dh*(Kh-1) - 1) // Sh + 1",
109
- "W_out == (W + 2*pad_left - Dw*(Kw-1) - 1) // Sw + 1"
110
- ],
111
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, activation_type, with_bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight)\n return F.conv2d(x, w, None, stride=(2, 2), padding=(3, 3), dilation=(1, 1)).numpy()\n"
112
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv1d/conv1d_kw1_sw1_dw1_cout512_p0.json DELETED
@@ -1,75 +0,0 @@
1
- {
2
- "name": "conv1d_kw1_sw1_dw1_cout512_p0",
3
- "op_type": "conv1d",
4
- "description": "1D conv kw=1 stride=1 dilation=1 pad=0 C_out=512. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "W": {
10
- "type": "var"
11
- },
12
- "W_out": {
13
- "type": "var"
14
- },
15
- "C_in": {
16
- "type": "var"
17
- },
18
- "C_out": {
19
- "type": "const",
20
- "value": 512
21
- },
22
- "Kw": {
23
- "type": "const",
24
- "value": 1
25
- },
26
- "Sw": {
27
- "type": "const",
28
- "value": 1
29
- },
30
- "Dw": {
31
- "type": "const",
32
- "value": 1
33
- },
34
- "pad": {
35
- "type": "const",
36
- "value": 0
37
- }
38
- },
39
- "inputs": {
40
- "input": {
41
- "shape": [
42
- "C_in",
43
- "W"
44
- ],
45
- "dtype": "float32"
46
- },
47
- "weight": {
48
- "shape": [
49
- "C_out",
50
- "C_in",
51
- "Kw"
52
- ],
53
- "dtype": "float32"
54
- },
55
- "bias": {
56
- "shape": [
57
- "C_out"
58
- ],
59
- "dtype": "float32"
60
- }
61
- },
62
- "outputs": {
63
- "output": {
64
- "shape": [
65
- "C_out",
66
- "W_out"
67
- ],
68
- "dtype": "float32"
69
- }
70
- },
71
- "constraints": [
72
- "W_out == (W + 2*pad - Dw*(Kw-1) - 1) // Sw + 1"
73
- ],
74
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n x = torch.from_numpy(input).unsqueeze(0)\n w = torch.from_numpy(weight)\n b = torch.from_numpy(bias)\n return F.conv1d(x, w, b, stride=1, padding=0, dilation=1).squeeze(0).numpy()\n"
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv1d/conv1d_kw3_sw1_dw1_cout512_p1.json DELETED
@@ -1,75 +0,0 @@
1
- {
2
- "name": "conv1d_kw3_sw1_dw1_cout512_p1",
3
- "op_type": "conv1d",
4
- "description": "1D conv kw=3 stride=1 dilation=1 pad=1 C_out=512. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "W": {
10
- "type": "var"
11
- },
12
- "W_out": {
13
- "type": "var"
14
- },
15
- "C_in": {
16
- "type": "var"
17
- },
18
- "C_out": {
19
- "type": "const",
20
- "value": 512
21
- },
22
- "Kw": {
23
- "type": "const",
24
- "value": 3
25
- },
26
- "Sw": {
27
- "type": "const",
28
- "value": 1
29
- },
30
- "Dw": {
31
- "type": "const",
32
- "value": 1
33
- },
34
- "pad": {
35
- "type": "const",
36
- "value": 1
37
- }
38
- },
39
- "inputs": {
40
- "input": {
41
- "shape": [
42
- "C_in",
43
- "W"
44
- ],
45
- "dtype": "float32"
46
- },
47
- "weight": {
48
- "shape": [
49
- "C_out",
50
- "C_in",
51
- "Kw"
52
- ],
53
- "dtype": "float32"
54
- },
55
- "bias": {
56
- "shape": [
57
- "C_out"
58
- ],
59
- "dtype": "float32"
60
- }
61
- },
62
- "outputs": {
63
- "output": {
64
- "shape": [
65
- "C_out",
66
- "W_out"
67
- ],
68
- "dtype": "float32"
69
- }
70
- },
71
- "constraints": [
72
- "W_out == (W + 2*pad - Dw*(Kw-1) - 1) // Sw + 1"
73
- ],
74
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n x = torch.from_numpy(input).unsqueeze(0)\n w = torch.from_numpy(weight)\n b = torch.from_numpy(bias)\n return F.conv1d(x, w, b, stride=1, padding=1, dilation=1).squeeze(0).numpy()\n"
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv2d_depthwise/conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1.json DELETED
@@ -1,101 +0,0 @@
1
- {
2
- "name": "conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1",
3
- "op_type": "conv2d_depthwise",
4
- "description": "Depthwise 2D conv 3x3 stride=(1,1) dilation=(1,1) pad=1. C varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C": {
29
- "type": "var"
30
- },
31
- "Kh": {
32
- "type": "const",
33
- "value": 3
34
- },
35
- "Kw": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Sh": {
40
- "type": "const",
41
- "value": 1
42
- },
43
- "Sw": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Dh": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dw": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "pad": {
56
- "type": "const",
57
- "value": 1
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C",
73
- "Kh",
74
- "Kw"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "bias": {
79
- "shape": [
80
- "C"
81
- ],
82
- "dtype": "float32"
83
- }
84
- },
85
- "outputs": {
86
- "output": {
87
- "shape": [
88
- "N",
89
- "C",
90
- "H_out",
91
- "W_out"
92
- ],
93
- "dtype": "float32"
94
- }
95
- },
96
- "constraints": [
97
- "H_out == (H + 2*pad - Dh*(Kh-1) - 1) // Sh + 1",
98
- "W_out == (W + 2*pad - Dw*(Kw-1) - 1) // Sw + 1"
99
- ],
100
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n c = input.shape[1]\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).unsqueeze(1)\n b = torch.from_numpy(bias)\n return F.conv2d(x, w, b, stride=(1, 1), padding=(1, 1), dilation=(1, 1), groups=c).numpy()\n"
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv2d_depthwise/conv2d_depthwise_kh3_kw3_sh2_sw2_dh1_dw1_p1.json DELETED
@@ -1,101 +0,0 @@
1
- {
2
- "name": "conv2d_depthwise_kh3_kw3_sh2_sw2_dh1_dw1_p1",
3
- "op_type": "conv2d_depthwise",
4
- "description": "Depthwise 2D conv 3x3 stride=(2,2) dilation=(1,1) pad=1. C varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C": {
29
- "type": "var"
30
- },
31
- "Kh": {
32
- "type": "const",
33
- "value": 3
34
- },
35
- "Kw": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Sh": {
40
- "type": "const",
41
- "value": 2
42
- },
43
- "Sw": {
44
- "type": "const",
45
- "value": 2
46
- },
47
- "Dh": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dw": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "pad": {
56
- "type": "const",
57
- "value": 1
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C",
73
- "Kh",
74
- "Kw"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "bias": {
79
- "shape": [
80
- "C"
81
- ],
82
- "dtype": "float32"
83
- }
84
- },
85
- "outputs": {
86
- "output": {
87
- "shape": [
88
- "N",
89
- "C",
90
- "H_out",
91
- "W_out"
92
- ],
93
- "dtype": "float32"
94
- }
95
- },
96
- "constraints": [
97
- "H_out == (H + 2*pad - Dh*(Kh-1) - 1) // Sh + 1",
98
- "W_out == (W + 2*pad - Dw*(Kw-1) - 1) // Sw + 1"
99
- ],
100
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n c = input.shape[1]\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).unsqueeze(1)\n b = torch.from_numpy(bias)\n return F.conv2d(x, w, b, stride=(2, 2), padding=(1, 1), dilation=(1, 1), groups=c).numpy()\n"
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/conv2d_depthwise/conv2d_depthwise_kh5_kw5_sh1_sw1_dh1_dw1_p2.json DELETED
@@ -1,101 +0,0 @@
1
- {
2
- "name": "conv2d_depthwise_kh5_kw5_sh1_sw1_dh1_dw1_p2",
3
- "op_type": "conv2d_depthwise",
4
- "description": "Depthwise 2D conv 5x5 stride=(1,1) dilation=(1,1) pad=2. C varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C": {
29
- "type": "var"
30
- },
31
- "Kh": {
32
- "type": "const",
33
- "value": 5
34
- },
35
- "Kw": {
36
- "type": "const",
37
- "value": 5
38
- },
39
- "Sh": {
40
- "type": "const",
41
- "value": 1
42
- },
43
- "Sw": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Dh": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dw": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "pad": {
56
- "type": "const",
57
- "value": 2
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C",
73
- "Kh",
74
- "Kw"
75
- ],
76
- "dtype": "float32"
77
- },
78
- "bias": {
79
- "shape": [
80
- "C"
81
- ],
82
- "dtype": "float32"
83
- }
84
- },
85
- "outputs": {
86
- "output": {
87
- "shape": [
88
- "N",
89
- "C",
90
- "H_out",
91
- "W_out"
92
- ],
93
- "dtype": "float32"
94
- }
95
- },
96
- "constraints": [
97
- "H_out == (H + 2*pad - Dh*(Kh-1) - 1) // Sh + 1",
98
- "W_out == (W + 2*pad - Dw*(Kw-1) - 1) // Sw + 1"
99
- ],
100
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n c = input.shape[1]\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).unsqueeze(1)\n b = torch.from_numpy(bias)\n return F.conv2d(x, w, b, stride=(1, 1), padding=(2, 2), dilation=(1, 1), groups=c).numpy()\n"
101
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/deconv2d/deconv2d_kh3_kw3_sh1_sw1_cout256.json DELETED
@@ -1,102 +0,0 @@
1
- {
2
- "name": "deconv2d_kh3_kw3_sh1_sw1_cout256",
3
- "op_type": "deconv2d",
4
- "description": "Transposed 2D conv 3x3 stride=(1,1) dilation=(1,1) pad=0 C_out=256. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 256
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 3
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C_in",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C_out",
73
- "C_in",
74
- "Kh",
75
- "Kw"
76
- ],
77
- "dtype": "float32"
78
- },
79
- "bias": {
80
- "shape": [
81
- "C_out"
82
- ],
83
- "dtype": "float32"
84
- }
85
- },
86
- "outputs": {
87
- "output": {
88
- "shape": [
89
- "N",
90
- "C_out",
91
- "H_out",
92
- "W_out"
93
- ],
94
- "dtype": "float32"
95
- }
96
- },
97
- "constraints": [
98
- "H_out == (H - 1) * Sh + Kh",
99
- "W_out == (W - 1) * Sw + Kw"
100
- ],
101
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).permute(1, 0, 2, 3)\n b = torch.from_numpy(bias)\n return F.conv_transpose2d(x, w, b, stride=(1, 1), padding=(0, 0), dilation=(1, 1)).numpy()\n"
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/deconv2d/deconv2d_kh3_kw3_sh2_sw2_cout256.json DELETED
@@ -1,102 +0,0 @@
1
- {
2
- "name": "deconv2d_kh3_kw3_sh2_sw2_cout256",
3
- "op_type": "deconv2d",
4
- "description": "Transposed 2D conv 3x3 stride=(2,2) dilation=(1,1) pad=0 C_out=256. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 256
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 3
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 2
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 2
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C_in",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C_out",
73
- "C_in",
74
- "Kh",
75
- "Kw"
76
- ],
77
- "dtype": "float32"
78
- },
79
- "bias": {
80
- "shape": [
81
- "C_out"
82
- ],
83
- "dtype": "float32"
84
- }
85
- },
86
- "outputs": {
87
- "output": {
88
- "shape": [
89
- "N",
90
- "C_out",
91
- "H_out",
92
- "W_out"
93
- ],
94
- "dtype": "float32"
95
- }
96
- },
97
- "constraints": [
98
- "H_out == (H - 1) * Sh + Kh",
99
- "W_out == (W - 1) * Sw + Kw"
100
- ],
101
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).permute(1, 0, 2, 3)\n b = torch.from_numpy(bias)\n return F.conv_transpose2d(x, w, b, stride=(2, 2), padding=(0, 0), dilation=(1, 1)).numpy()\n"
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/deconv2d/deconv2d_kh4_kw4_sh1_sw1_cout128.json DELETED
@@ -1,102 +0,0 @@
1
- {
2
- "name": "deconv2d_kh4_kw4_sh1_sw1_cout128",
3
- "op_type": "deconv2d",
4
- "description": "Transposed 2D conv 4x4 stride=(1,1) dilation=(1,1) pad=0 C_out=128. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 128
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 4
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 4
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C_in",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C_out",
73
- "C_in",
74
- "Kh",
75
- "Kw"
76
- ],
77
- "dtype": "float32"
78
- },
79
- "bias": {
80
- "shape": [
81
- "C_out"
82
- ],
83
- "dtype": "float32"
84
- }
85
- },
86
- "outputs": {
87
- "output": {
88
- "shape": [
89
- "N",
90
- "C_out",
91
- "H_out",
92
- "W_out"
93
- ],
94
- "dtype": "float32"
95
- }
96
- },
97
- "constraints": [
98
- "H_out == (H - 1) * Sh + Kh",
99
- "W_out == (W - 1) * Sw + Kw"
100
- ],
101
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).permute(1, 0, 2, 3)\n b = torch.from_numpy(bias)\n return F.conv_transpose2d(x, w, b, stride=(1, 1), padding=(0, 0), dilation=(1, 1)).numpy()\n"
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/deconv2d/deconv2d_kh4_kw4_sh2_sw2_cout128.json DELETED
@@ -1,102 +0,0 @@
1
- {
2
- "name": "deconv2d_kh4_kw4_sh2_sw2_cout128",
3
- "op_type": "deconv2d",
4
- "description": "Transposed 2D conv 4x4 stride=(2,2) dilation=(1,1) pad=0 C_out=128. C_in varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C_in": {
29
- "type": "var"
30
- },
31
- "C_out": {
32
- "type": "const",
33
- "value": 128
34
- },
35
- "Kh": {
36
- "type": "const",
37
- "value": 4
38
- },
39
- "Kw": {
40
- "type": "const",
41
- "value": 4
42
- },
43
- "Sh": {
44
- "type": "const",
45
- "value": 2
46
- },
47
- "Sw": {
48
- "type": "const",
49
- "value": 2
50
- },
51
- "Dh": {
52
- "type": "const",
53
- "value": 1
54
- },
55
- "Dw": {
56
- "type": "const",
57
- "value": 1
58
- }
59
- },
60
- "inputs": {
61
- "input": {
62
- "shape": [
63
- "N",
64
- "C_in",
65
- "H",
66
- "W"
67
- ],
68
- "dtype": "float32"
69
- },
70
- "weight": {
71
- "shape": [
72
- "C_out",
73
- "C_in",
74
- "Kh",
75
- "Kw"
76
- ],
77
- "dtype": "float32"
78
- },
79
- "bias": {
80
- "shape": [
81
- "C_out"
82
- ],
83
- "dtype": "float32"
84
- }
85
- },
86
- "outputs": {
87
- "output": {
88
- "shape": [
89
- "N",
90
- "C_out",
91
- "H_out",
92
- "W_out"
93
- ],
94
- "dtype": "float32"
95
- }
96
- },
97
- "constraints": [
98
- "H_out == (H - 1) * Sh + Kh",
99
- "W_out == (W - 1) * Sw + Kw"
100
- ],
101
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).permute(1, 0, 2, 3)\n b = torch.from_numpy(bias)\n return F.conv_transpose2d(x, w, b, stride=(2, 2), padding=(0, 0), dilation=(1, 1)).numpy()\n"
102
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/deconv2d_depthwise/deconv2d_depthwise_kh2_kw2_sh2_sw2.json DELETED
@@ -1,97 +0,0 @@
1
- {
2
- "name": "deconv2d_depthwise_kh2_kw2_sh2_sw2",
3
- "op_type": "deconv2d_depthwise",
4
- "description": "Depthwise transposed 2D conv 2x2 stride=(2,2) dilation=(1,1) pad=0. C varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C": {
29
- "type": "var"
30
- },
31
- "Kh": {
32
- "type": "const",
33
- "value": 2
34
- },
35
- "Kw": {
36
- "type": "const",
37
- "value": 2
38
- },
39
- "Sh": {
40
- "type": "const",
41
- "value": 2
42
- },
43
- "Sw": {
44
- "type": "const",
45
- "value": 2
46
- },
47
- "Dh": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dw": {
52
- "type": "const",
53
- "value": 1
54
- }
55
- },
56
- "inputs": {
57
- "input": {
58
- "shape": [
59
- "N",
60
- "C",
61
- "H",
62
- "W"
63
- ],
64
- "dtype": "float32"
65
- },
66
- "weight": {
67
- "shape": [
68
- "C",
69
- "Kh",
70
- "Kw"
71
- ],
72
- "dtype": "float32"
73
- },
74
- "bias": {
75
- "shape": [
76
- "C"
77
- ],
78
- "dtype": "float32"
79
- }
80
- },
81
- "outputs": {
82
- "output": {
83
- "shape": [
84
- "N",
85
- "C",
86
- "H_out",
87
- "W_out"
88
- ],
89
- "dtype": "float32"
90
- }
91
- },
92
- "constraints": [
93
- "H_out == (H - 1) * Sh + Kh",
94
- "W_out == (W - 1) * Sw + Kw"
95
- ],
96
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n c = input.shape[1]\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).unsqueeze(1)\n b = torch.from_numpy(bias)\n return F.conv_transpose2d(x, w, b, stride=(2, 2), padding=(0, 0), dilation=(1, 1), groups=c).numpy()\n"
97
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/deconv2d_depthwise/deconv2d_depthwise_kh3_kw3_sh1_sw1.json DELETED
@@ -1,97 +0,0 @@
1
- {
2
- "name": "deconv2d_depthwise_kh3_kw3_sh1_sw1",
3
- "op_type": "deconv2d_depthwise",
4
- "description": "Depthwise transposed 2D conv 3x3 stride=(1,1) dilation=(1,1) pad=0. C varies per workload.",
5
- "tags": [
6
- "status:active"
7
- ],
8
- "axes": {
9
- "N": {
10
- "type": "var"
11
- },
12
- "H": {
13
- "type": "var",
14
- "parent": "N"
15
- },
16
- "W": {
17
- "type": "var",
18
- "parent": "N"
19
- },
20
- "H_out": {
21
- "type": "var",
22
- "parent": "N"
23
- },
24
- "W_out": {
25
- "type": "var",
26
- "parent": "N"
27
- },
28
- "C": {
29
- "type": "var"
30
- },
31
- "Kh": {
32
- "type": "const",
33
- "value": 3
34
- },
35
- "Kw": {
36
- "type": "const",
37
- "value": 3
38
- },
39
- "Sh": {
40
- "type": "const",
41
- "value": 1
42
- },
43
- "Sw": {
44
- "type": "const",
45
- "value": 1
46
- },
47
- "Dh": {
48
- "type": "const",
49
- "value": 1
50
- },
51
- "Dw": {
52
- "type": "const",
53
- "value": 1
54
- }
55
- },
56
- "inputs": {
57
- "input": {
58
- "shape": [
59
- "N",
60
- "C",
61
- "H",
62
- "W"
63
- ],
64
- "dtype": "float32"
65
- },
66
- "weight": {
67
- "shape": [
68
- "C",
69
- "Kh",
70
- "Kw"
71
- ],
72
- "dtype": "float32"
73
- },
74
- "bias": {
75
- "shape": [
76
- "C"
77
- ],
78
- "dtype": "float32"
79
- }
80
- },
81
- "outputs": {
82
- "output": {
83
- "shape": [
84
- "N",
85
- "C",
86
- "H_out",
87
- "W_out"
88
- ],
89
- "dtype": "float32"
90
- }
91
- },
92
- "constraints": [
93
- "H_out == (H - 1) * Sh + Kh",
94
- "W_out == (W - 1) * Sw + Kw"
95
- ],
96
- "reference": "import torch\nimport torch.nn.functional as F\n\ndef run(input, weight, bias):\n c = input.shape[1]\n x = torch.from_numpy(input)\n w = torch.from_numpy(weight).unsqueeze(1)\n b = torch.from_numpy(bias)\n return F.conv_transpose2d(x, w, b, stride=(1, 1), padding=(0, 0), dilation=(1, 1), groups=c).numpy()\n"
97
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
definitions/simd-loop/loop_005.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_005",
3
+ "op_type": "loop_005",
4
+ "description": "Compute the length of many short null-terminated strings",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "N": {
10
+ "type": "var",
11
+ "description": "Buffer length (bytes)"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "p": {
16
+ "shape": [
17
+ "N"
18
+ ],
19
+ "dtype": "uint8"
20
+ }
21
+ },
22
+ "outputs": {
23
+ "checksum": {
24
+ "shape": null,
25
+ "dtype": "uint32",
26
+ "description": "Scalar checksum"
27
+ }
28
+ },
29
+ "reference": "import numpy as np\n\ndef run(p):\n b = p; n = len(b); i = 0; res = 0\n while i < n:\n j = i\n while j < n and int(b[j]) != 0: j += 1\n length = j - i; i = j + 1\n res = (res + 1) & 0xffffffff\n res ^= ((length % 0xffff) << 16) & 0xffffffff\n res &= 0xffffffff\n return np.uint32(res)\n",
30
+ "simd_loop_meta": {
31
+ "output_inplace": false,
32
+ "array_pad": 0,
33
+ "scratch": [],
34
+ "axes_order": []
35
+ }
36
+ }
definitions/simd-loop/loop_006.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_006",
3
+ "op_type": "loop_006",
4
+ "description": "Compute the length of many long null-terminated strings",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "N": {
10
+ "type": "var",
11
+ "description": "Buffer length (bytes)"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "p": {
16
+ "shape": [
17
+ "N"
18
+ ],
19
+ "dtype": "uint8"
20
+ }
21
+ },
22
+ "outputs": {
23
+ "checksum": {
24
+ "shape": null,
25
+ "dtype": "uint32",
26
+ "description": "Scalar checksum"
27
+ }
28
+ },
29
+ "reference": "import numpy as np\n\ndef run(p):\n b = p; n = len(b); i = 0; res = 0\n while i < n:\n j = i\n while j < n and int(b[j]) != 0: j += 1\n length = j - i; i = j + 1\n res = (res + 1) & 0xffffffff\n res ^= ((length % 0xffff) << 16) & 0xffffffff\n res &= 0xffffffff\n return np.uint32(res)\n",
30
+ "simd_loop_meta": {
31
+ "output_inplace": false,
32
+ "array_pad": 0,
33
+ "scratch": [],
34
+ "axes_order": []
35
+ }
36
+ }
definitions/simd-loop/loop_034.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_034",
3
+ "op_type": "loop_034",
4
+ "description": "Compare many short null-terminated strings for equality",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "N": {
10
+ "type": "var",
11
+ "description": "Buffer length (bytes)"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "a": {
16
+ "shape": [
17
+ "N"
18
+ ],
19
+ "dtype": "uint8"
20
+ },
21
+ "b": {
22
+ "shape": [
23
+ "N"
24
+ ],
25
+ "dtype": "uint8"
26
+ }
27
+ },
28
+ "outputs": {
29
+ "checksum": {
30
+ "shape": null,
31
+ "dtype": "uint32",
32
+ "description": "Scalar checksum"
33
+ }
34
+ },
35
+ "reference": "import numpy as np\n\ndef run(a, b):\n n = len(a); res = 0; cnt = 0; length = 13; off = 0\n while off < n:\n k = off\n while k < n and a[k] == b[k] and int(a[k]) != 0: k += 1\n av = int(a[k]) if k < n else 0\n bv = int(b[k]) if k < n else 0\n r = av - bv\n cmp = 2 if r > 0 else (3 if r < 0 else 1)\n res = (res + cnt * cmp) & 0xffffffff\n off += length; cnt += 1; length = 3 + (length + 11) % 43\n return np.uint32(res)\n",
36
+ "simd_loop_meta": {
37
+ "output_inplace": false,
38
+ "array_pad": 0,
39
+ "scratch": [],
40
+ "axes_order": []
41
+ }
42
+ }
definitions/simd-loop/loop_037.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_037",
3
+ "op_type": "loop_037",
4
+ "description": "Element-wise complex multiplication of two FP32 complex-number arrays (interleaved re/im)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "size": {
10
+ "type": "var",
11
+ "description": "axis size"
12
+ },
13
+ "cdim": {
14
+ "type": "const",
15
+ "value": 2,
16
+ "description": "const cdim"
17
+ }
18
+ },
19
+ "inputs": {
20
+ "a0": {
21
+ "shape": [
22
+ "size",
23
+ "cdim"
24
+ ],
25
+ "dtype": "float32"
26
+ },
27
+ "b0": {
28
+ "shape": [
29
+ "size",
30
+ "cdim"
31
+ ],
32
+ "dtype": "float32"
33
+ }
34
+ },
35
+ "outputs": {
36
+ "c0": {
37
+ "shape": [
38
+ "size",
39
+ "cdim"
40
+ ],
41
+ "dtype": "float32",
42
+ "description": "Output array"
43
+ }
44
+ },
45
+ "reference": "import numpy as np\n\ndef run(a0, b0):\n ar, ai = a0[:, 0], a0[:, 1]\n br, bi = b0[:, 0], b0[:, 1]\n cr = ar * br - ai * bi\n ci = ar * bi + ai * br\n return np.stack([cr, ci], axis=1).astype(np.float32)\n",
46
+ "simd_loop_meta": {
47
+ "output_inplace": false,
48
+ "array_pad": 0,
49
+ "scratch": [],
50
+ "axes_order": [
51
+ "size"
52
+ ]
53
+ }
54
+ }
definitions/simd-loop/loop_038.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_038",
3
+ "op_type": "loop_038",
4
+ "description": "1D convolution of an FP16 signal with an FP16 filter kernel",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "dim": {
10
+ "type": "var",
11
+ "description": "axis dim"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "a": {
16
+ "shape": [
17
+ "dim",
18
+ "dim"
19
+ ],
20
+ "dtype": "float16"
21
+ },
22
+ "b": {
23
+ "shape": [
24
+ "dim",
25
+ "dim"
26
+ ],
27
+ "dtype": "float16"
28
+ }
29
+ },
30
+ "outputs": {
31
+ "c": {
32
+ "shape": [
33
+ "dim",
34
+ "dim"
35
+ ],
36
+ "dtype": "float16",
37
+ "description": "Output array"
38
+ }
39
+ },
40
+ "reference": "import numpy as np\n\ndef run(a, b):\n dim = a.shape[0]\n c = np.zeros((dim, dim), dtype=np.float16)\n if dim >= 2:\n k = np.float16(0.25)\n s0 = a[:-1, :-1]; s1 = a[:-1, 1:]; s2 = a[1:, :-1]; s3 = a[1:, 1:]\n r = (b[:-1, :-1] + s0 * k).astype(np.float16)\n r = (r + s1 * k).astype(np.float16)\n r = (r + s2 * k).astype(np.float16)\n r = (r + s3 * k).astype(np.float16)\n c[:-1, :-1] = r\n return c\n",
41
+ "simd_loop_meta": {
42
+ "output_inplace": false,
43
+ "array_pad": 0,
44
+ "scratch": [],
45
+ "axes_order": [
46
+ "dim"
47
+ ]
48
+ }
49
+ }
definitions/simd-loop/loop_101.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_101",
3
+ "op_type": "loop_101",
4
+ "description": "Upscale a pixel buffer by splitting each element into its high and low halves",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "n": {
10
+ "type": "var",
11
+ "description": "axis n"
12
+ },
13
+ "out_len": {
14
+ "type": "var",
15
+ "description": "axis out_len"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "b": {
20
+ "shape": [
21
+ "n"
22
+ ],
23
+ "dtype": "uint8"
24
+ }
25
+ },
26
+ "outputs": {
27
+ "a": {
28
+ "shape": [
29
+ "out_len"
30
+ ],
31
+ "dtype": "uint8",
32
+ "description": "Output array"
33
+ }
34
+ },
35
+ "reference": "import numpy as np\n\ndef run(b):\n n = b.shape[0]\n a = np.zeros(2 * (n - 1), dtype=np.uint8)\n if n >= 2:\n s1 = b[:-1].astype(np.uint16)\n s2 = b[1:].astype(np.uint16)\n a[0::2] = ((3 * s1 + s2 + 2) >> 2).astype(np.uint8)\n a[1::2] = ((3 * s2 + s1 + 2) >> 2).astype(np.uint8)\n return a\n",
36
+ "simd_loop_meta": {
37
+ "output_inplace": false,
38
+ "array_pad": 0,
39
+ "scratch": [],
40
+ "axes_order": [
41
+ "n"
42
+ ]
43
+ }
44
+ }
definitions/simd-loop/loop_102.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_102",
3
+ "op_type": "loop_102",
4
+ "description": "Count the frequency of each byte value in a large buffer (histogram)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "num_records": {
10
+ "type": "var",
11
+ "description": "axis num_records"
12
+ },
13
+ "histogram_size": {
14
+ "type": "const",
15
+ "value": 128,
16
+ "description": "const histogram_size"
17
+ }
18
+ },
19
+ "inputs": {
20
+ "records": {
21
+ "shape": [
22
+ "num_records"
23
+ ],
24
+ "dtype": "uint32"
25
+ }
26
+ },
27
+ "outputs": {
28
+ "histogram": {
29
+ "shape": [
30
+ "histogram_size"
31
+ ],
32
+ "dtype": "uint32",
33
+ "description": "Output array"
34
+ }
35
+ },
36
+ "reference": "import numpy as np\n\ndef run(records):\n return np.bincount(records.astype(np.int64), minlength=128)[:128].astype(np.uint32)\n",
37
+ "simd_loop_meta": {
38
+ "output_inplace": false,
39
+ "array_pad": 0,
40
+ "scratch": [],
41
+ "axes_order": [
42
+ "histogram_size",
43
+ "num_records"
44
+ ]
45
+ }
46
+ }
definitions/simd-loop/loop_103.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_103",
3
+ "op_type": "loop_103",
4
+ "description": "Find all whitespace character positions in a byte string",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "N": {
10
+ "type": "var",
11
+ "description": "Buffer length (bytes)"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "p": {
16
+ "shape": [
17
+ "N"
18
+ ],
19
+ "dtype": "uint8"
20
+ }
21
+ },
22
+ "outputs": {
23
+ "checksum": {
24
+ "shape": null,
25
+ "dtype": "int32",
26
+ "description": "Scalar checksum"
27
+ }
28
+ },
29
+ "reference": "import numpy as np\n\n_WS = {32, 10, 13, 9}\n\ndef run(p):\n b = p; n = len(b); i = 0\n while i < n and int(b[i]) in _WS: i += 1\n count = 0\n while i < n:\n count += 1\n while i < n and int(b[i]) not in _WS: i += 1\n while i < n and int(b[i]) in _WS: i += 1\n return np.int32(count)\n",
30
+ "simd_loop_meta": {
31
+ "output_inplace": false,
32
+ "array_pad": 0,
33
+ "scratch": [],
34
+ "axes_order": []
35
+ }
36
+ }
definitions/simd-loop/loop_104.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_104",
3
+ "op_type": "loop_104",
4
+ "description": "Compute byte-value frequency histogram using segmented counting",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "n": {
10
+ "type": "var",
11
+ "description": "axis n"
12
+ },
13
+ "histogram_size": {
14
+ "type": "const",
15
+ "value": 256,
16
+ "description": "const histogram_size"
17
+ }
18
+ },
19
+ "inputs": {
20
+ "data": {
21
+ "shape": [
22
+ "n"
23
+ ],
24
+ "dtype": "uint8"
25
+ }
26
+ },
27
+ "outputs": {
28
+ "histogram": {
29
+ "shape": [
30
+ "histogram_size"
31
+ ],
32
+ "dtype": "uint32",
33
+ "description": "Output array"
34
+ }
35
+ },
36
+ "reference": "import numpy as np\n\ndef run(data):\n return np.bincount(data.astype(np.int64), minlength=256)[:256].astype(np.uint32)\n",
37
+ "simd_loop_meta": {
38
+ "output_inplace": false,
39
+ "array_pad": 0,
40
+ "scratch": [],
41
+ "axes_order": [
42
+ "histogram_size",
43
+ "n"
44
+ ]
45
+ }
46
+ }
definitions/simd-loop/loop_105.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_105",
3
+ "op_type": "loop_105",
4
+ "description": "Sum adjacent FP value pairs in a cascading pairwise reduction",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "N": {
10
+ "type": "var",
11
+ "description": "Array length"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "a": {
16
+ "shape": [
17
+ "N"
18
+ ],
19
+ "dtype": "float32"
20
+ },
21
+ "b": {
22
+ "shape": [
23
+ "N"
24
+ ],
25
+ "dtype": "float32"
26
+ }
27
+ },
28
+ "outputs": {
29
+ "res": {
30
+ "shape": null,
31
+ "dtype": "float32",
32
+ "description": "Scalar result"
33
+ }
34
+ },
35
+ "reference": "import numpy as np\n\ndef run(a, b):\n return np.float32(np.sum(a.astype(np.float64)))\n",
36
+ "simd_loop_meta": {
37
+ "output_inplace": false,
38
+ "array_pad": 0,
39
+ "scratch": []
40
+ }
41
+ }
definitions/simd-loop/loop_106.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_106",
3
+ "op_type": "loop_106",
4
+ "description": "Partition a vector by bit flag, concentrating set-bit elements to one side",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "n": {
10
+ "type": "var",
11
+ "description": "axis n"
12
+ }
13
+ },
14
+ "inputs": {
15
+ "a": {
16
+ "shape": [
17
+ "n"
18
+ ],
19
+ "dtype": "uint32"
20
+ }
21
+ },
22
+ "outputs": {
23
+ "b": {
24
+ "shape": [
25
+ "n"
26
+ ],
27
+ "dtype": "uint32",
28
+ "description": "Output array"
29
+ }
30
+ },
31
+ "reference": "import numpy as np\n\n_M = 0xFFFFFFFF\n\ndef _popcount(x):\n return bin(x & _M).count('1')\n\ndef _compress(x, m):\n x &= m\n mk = (~m << 1) & _M\n for i in range(5):\n mp = (mk ^ (mk << 1)) & _M\n mp = (mp ^ (mp << 2)) & _M\n mp = (mp ^ (mp << 4)) & _M\n mp = (mp ^ (mp << 8)) & _M\n mp = (mp ^ (mp << 16)) & _M\n mv = mp & m\n m = (m ^ mv) | (mv >> (1 << i))\n t = x & mv\n x = (x ^ t) | (t >> (1 << i))\n mk &= (~mp) & _M\n return x & _M\n\ndef _sag(x, m):\n return (((_compress(x, m) << _popcount(m)) & _M) | _compress(x, (~m) & _M)) & _M\n\n_PC = [0xaaaaaaaa, 0xcccccccc, 0x0f0f0f0f, 0x0ff00ff0, 0x0ffff000]\n_P = [_PC[0], _sag(_PC[1], _PC[0]), _sag(_PC[2], _PC[0]),\n _sag(_PC[3], _PC[0]), _sag(_PC[4], _PC[0])]\n\ndef _permute(x):\n for pi in _P:\n x = _sag(x, pi)\n return x\n\ndef run(a):\n return np.array([_permute(int(v)) for v in a], dtype=np.uint32)\n",
32
+ "simd_loop_meta": {
33
+ "output_inplace": false,
34
+ "array_pad": 0,
35
+ "scratch": [],
36
+ "axes_order": [
37
+ "n"
38
+ ]
39
+ }
40
+ }
definitions/simd-loop/loop_109.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_109",
3
+ "op_type": "loop_109",
4
+ "description": "Element-wise addition of complex numbers stored as interleaved uint32 (re, im) pairs",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "size": {
10
+ "type": "var",
11
+ "description": "axis size"
12
+ },
13
+ "cdim": {
14
+ "type": "const",
15
+ "value": 2,
16
+ "description": "const cdim"
17
+ }
18
+ },
19
+ "inputs": {
20
+ "a0": {
21
+ "shape": [
22
+ "size",
23
+ "cdim"
24
+ ],
25
+ "dtype": "uint32"
26
+ },
27
+ "b0": {
28
+ "shape": [
29
+ "size",
30
+ "cdim"
31
+ ],
32
+ "dtype": "uint32"
33
+ }
34
+ },
35
+ "outputs": {
36
+ "c0": {
37
+ "shape": [
38
+ "size",
39
+ "cdim"
40
+ ],
41
+ "dtype": "uint32",
42
+ "description": "Output array"
43
+ }
44
+ },
45
+ "reference": "import numpy as np\n\n_M = np.uint64(0xffffffff)\n\ndef run(a0, b0):\n cr = (a0[:, 0].astype(np.uint64) - b0[:, 1].astype(np.uint64)) & _M\n ci = (a0[:, 1].astype(np.uint64) + b0[:, 0].astype(np.uint64)) & _M\n return np.stack([cr, ci], axis=1).astype(np.uint32)\n",
46
+ "simd_loop_meta": {
47
+ "output_inplace": false,
48
+ "array_pad": 0,
49
+ "scratch": [],
50
+ "axes_order": [
51
+ "size"
52
+ ]
53
+ }
54
+ }
definitions/simd-loop/loop_110.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_110",
3
+ "op_type": "loop_110",
4
+ "description": "Compute complex dot product of two arrays of uint32 complex numbers",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "size": {
10
+ "type": "var",
11
+ "description": "axis size"
12
+ },
13
+ "size2": {
14
+ "type": "var",
15
+ "description": "axis size2"
16
+ },
17
+ "cdim": {
18
+ "type": "const",
19
+ "value": 2,
20
+ "description": "const cdim"
21
+ }
22
+ },
23
+ "inputs": {
24
+ "a0": {
25
+ "shape": [
26
+ "size2",
27
+ "cdim"
28
+ ],
29
+ "dtype": "int8"
30
+ },
31
+ "b0": {
32
+ "shape": [
33
+ "size2",
34
+ "cdim"
35
+ ],
36
+ "dtype": "int8"
37
+ }
38
+ },
39
+ "outputs": {
40
+ "c0": {
41
+ "shape": [
42
+ "size",
43
+ "cdim"
44
+ ],
45
+ "dtype": "int32",
46
+ "description": "Output array"
47
+ }
48
+ },
49
+ "reference": "import numpy as np\n\ndef run(a0, b0):\n a = a0.astype(np.int64); b = b0.astype(np.int64)\n ae, ao = a[0::2], a[1::2]; be, bo = b[0::2], b[1::2]\n cr = (ae[:, 0]*be[:, 0] - ae[:, 1]*be[:, 1]) + (ao[:, 0]*bo[:, 0] - ao[:, 1]*bo[:, 1])\n ci = (ae[:, 1]*be[:, 0] + ae[:, 0]*be[:, 1]) + (ao[:, 1]*bo[:, 0] + ao[:, 0]*bo[:, 1])\n return np.stack([cr, ci], axis=1).astype(np.int32)\n",
50
+ "simd_loop_meta": {
51
+ "output_inplace": false,
52
+ "array_pad": 0,
53
+ "scratch": [],
54
+ "axes_order": [
55
+ "size"
56
+ ]
57
+ }
58
+ }
definitions/simd-loop/loop_112.json ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_112",
3
+ "op_type": "loop_112",
4
+ "description": "Complex multiply-accumulate over arrays of uint32 complex numbers",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "size": {
10
+ "type": "var",
11
+ "description": "axis size"
12
+ },
13
+ "cdim": {
14
+ "type": "const",
15
+ "value": 2,
16
+ "description": "const cdim"
17
+ }
18
+ },
19
+ "inputs": {
20
+ "a0": {
21
+ "shape": [
22
+ "size",
23
+ "cdim"
24
+ ],
25
+ "dtype": "uint32"
26
+ },
27
+ "b0": {
28
+ "shape": [
29
+ "size",
30
+ "cdim"
31
+ ],
32
+ "dtype": "uint32"
33
+ }
34
+ },
35
+ "outputs": {
36
+ "c0": {
37
+ "shape": [
38
+ "size",
39
+ "cdim"
40
+ ],
41
+ "dtype": "uint32",
42
+ "description": "Output array"
43
+ }
44
+ },
45
+ "reference": "import numpy as np\n\n_M = np.uint64(0xffffffff)\n\ndef run(a0, b0):\n ar = a0[:, 0].astype(np.uint64); ai = a0[:, 1].astype(np.uint64)\n br = b0[:, 0].astype(np.uint64); bi = b0[:, 1].astype(np.uint64)\n cr = (ar * br - ai * bi) & _M\n ci = (ar * bi + ai * br) & _M\n return np.stack([cr, ci], axis=1).astype(np.uint32)\n",
46
+ "simd_loop_meta": {
47
+ "output_inplace": false,
48
+ "array_pad": 0,
49
+ "scratch": [],
50
+ "axes_order": [
51
+ "size"
52
+ ]
53
+ }
54
+ }
definitions/simd-loop/loop_114.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_114",
3
+ "op_type": "loop_114",
4
+ "description": "Compute auto-correlation of an integer array with widening accumulation",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "n": {
10
+ "type": "var",
11
+ "description": "axis n"
12
+ },
13
+ "lags": {
14
+ "type": "var",
15
+ "description": "axis lags"
16
+ },
17
+ "scale": {
18
+ "type": "const",
19
+ "value": 4,
20
+ "description": "const scale"
21
+ }
22
+ },
23
+ "inputs": {
24
+ "data": {
25
+ "shape": [
26
+ "n"
27
+ ],
28
+ "dtype": "int16"
29
+ }
30
+ },
31
+ "outputs": {
32
+ "res": {
33
+ "shape": [
34
+ "lags"
35
+ ],
36
+ "dtype": "int16",
37
+ "description": "Output array"
38
+ }
39
+ },
40
+ "reference": "import numpy as np\n\ndef run(data):\n n = int(data.shape[0])\n scale = 4\n d = data.astype(np.int64)\n res = np.zeros(n, dtype=np.int16)\n for lag in range(n):\n acc = int(((d[:n - lag] * d[lag:]) >> scale).sum())\n res[lag] = np.int16(acc >> 16)\n return res\n",
41
+ "simd_loop_meta": {
42
+ "output_inplace": false,
43
+ "array_pad": 0,
44
+ "scratch": [],
45
+ "axes_order": [
46
+ "n",
47
+ "lags",
48
+ "scale"
49
+ ]
50
+ }
51
+ }
definitions/simd-loop/loop_130.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_130",
3
+ "op_type": "loop_130",
4
+ "description": "Multiply two FP32 matrices using tiled register accumulation",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ },
17
+ "k": {
18
+ "type": "var",
19
+ "description": "axis k"
20
+ }
21
+ },
22
+ "inputs": {
23
+ "a": {
24
+ "shape": [
25
+ "m",
26
+ "k"
27
+ ],
28
+ "dtype": "float32"
29
+ },
30
+ "b": {
31
+ "shape": [
32
+ "k",
33
+ "n"
34
+ ],
35
+ "dtype": "float32"
36
+ }
37
+ },
38
+ "outputs": {
39
+ "c": {
40
+ "shape": [
41
+ "m",
42
+ "n"
43
+ ],
44
+ "dtype": "float32",
45
+ "description": "Output array"
46
+ }
47
+ },
48
+ "reference": "import numpy as np\n\ndef run(a, b):\n return (a.astype(np.float64) @ b.astype(np.float64)).astype(np.float32)\n",
49
+ "simd_loop_meta": {
50
+ "output_inplace": false,
51
+ "array_pad": 0,
52
+ "scratch": [],
53
+ "axes_order": [
54
+ "m",
55
+ "n",
56
+ "k"
57
+ ]
58
+ }
59
+ }
definitions/simd-loop/loop_135.json ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_135",
3
+ "op_type": "loop_135",
4
+ "description": "Multiply INT8 matrices accumulating into INT32 using tiled 4-element dot products",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ },
17
+ "k": {
18
+ "type": "var",
19
+ "description": "axis k"
20
+ }
21
+ },
22
+ "inputs": {
23
+ "a": {
24
+ "shape": [
25
+ "m",
26
+ "k"
27
+ ],
28
+ "dtype": "int8"
29
+ },
30
+ "b": {
31
+ "shape": [
32
+ "k",
33
+ "n"
34
+ ],
35
+ "dtype": "int8"
36
+ }
37
+ },
38
+ "outputs": {
39
+ "c": {
40
+ "shape": [
41
+ "m",
42
+ "n"
43
+ ],
44
+ "dtype": "int32",
45
+ "description": "Output array"
46
+ }
47
+ },
48
+ "reference": "import numpy as np\n\ndef run(a, b):\n return (a.astype(np.int64) @ b.astype(np.int64)).astype(np.int32)\n",
49
+ "simd_loop_meta": {
50
+ "output_inplace": false,
51
+ "array_pad": 0,
52
+ "scratch": [],
53
+ "axes_order": [
54
+ "m",
55
+ "n",
56
+ "k"
57
+ ]
58
+ }
59
+ }
definitions/simd-loop/loop_216.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_216",
3
+ "op_type": "loop_216",
4
+ "description": "Multiply an FP32 matrix by an FP32 vector (column-major GEMV)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "n",
22
+ "m"
23
+ ],
24
+ "dtype": "float32"
25
+ },
26
+ "x": {
27
+ "shape": [
28
+ "n"
29
+ ],
30
+ "dtype": "float32"
31
+ }
32
+ },
33
+ "outputs": {
34
+ "b": {
35
+ "shape": [
36
+ "m"
37
+ ],
38
+ "dtype": "float32",
39
+ "description": "Output array"
40
+ }
41
+ },
42
+ "reference": "import numpy as np\n\ndef run(a, x):\n return (a.astype(np.float64).T @ x.astype(np.float64)).astype(np.float32)\n",
43
+ "simd_loop_meta": {
44
+ "output_inplace": false,
45
+ "array_pad": 0,
46
+ "scratch": [],
47
+ "axes_order": [
48
+ "m",
49
+ "n"
50
+ ]
51
+ }
52
+ }
definitions/simd-loop/loop_217.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_217",
3
+ "op_type": "loop_217",
4
+ "description": "Multiply an INT8 matrix by an INT8 vector accumulating into INT32 (row-major GEMV)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "m",
22
+ "n"
23
+ ],
24
+ "dtype": "uint8"
25
+ },
26
+ "b": {
27
+ "shape": [
28
+ "n"
29
+ ],
30
+ "dtype": "uint8"
31
+ }
32
+ },
33
+ "outputs": {
34
+ "c": {
35
+ "shape": [
36
+ "m"
37
+ ],
38
+ "dtype": "uint32",
39
+ "description": "Output array"
40
+ }
41
+ },
42
+ "reference": "import numpy as np\n\ndef run(a, b):\n return (a.astype(np.uint64) @ b.astype(np.uint64)).astype(np.uint32)\n",
43
+ "simd_loop_meta": {
44
+ "output_inplace": false,
45
+ "array_pad": 0,
46
+ "scratch": [],
47
+ "axes_order": [
48
+ "m",
49
+ "n"
50
+ ]
51
+ }
52
+ }
definitions/simd-loop/loop_218.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_218",
3
+ "op_type": "loop_218",
4
+ "description": "Multiply an FP64 matrix by an FP64 vector (column-major GEMV)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "n",
22
+ "m"
23
+ ],
24
+ "dtype": "float64"
25
+ },
26
+ "x": {
27
+ "shape": [
28
+ "n"
29
+ ],
30
+ "dtype": "float64"
31
+ }
32
+ },
33
+ "outputs": {
34
+ "b": {
35
+ "shape": [
36
+ "m"
37
+ ],
38
+ "dtype": "float64",
39
+ "description": "Output array"
40
+ }
41
+ },
42
+ "reference": "import numpy as np\n\ndef run(a, x):\n return a.astype(np.float64).T @ x.astype(np.float64)\n",
43
+ "simd_loop_meta": {
44
+ "output_inplace": false,
45
+ "array_pad": 0,
46
+ "scratch": [],
47
+ "axes_order": [
48
+ "m",
49
+ "n"
50
+ ]
51
+ }
52
+ }
definitions/simd-loop/loop_219.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_219",
3
+ "op_type": "loop_219",
4
+ "description": "Multiply an INT8 matrix by an INT8 vector accumulating into INT32 (column-major GEMV)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "n",
22
+ "m"
23
+ ],
24
+ "dtype": "uint8"
25
+ },
26
+ "b": {
27
+ "shape": [
28
+ "n"
29
+ ],
30
+ "dtype": "uint8"
31
+ }
32
+ },
33
+ "outputs": {
34
+ "c": {
35
+ "shape": [
36
+ "m"
37
+ ],
38
+ "dtype": "uint32",
39
+ "description": "Output array"
40
+ }
41
+ },
42
+ "reference": "import numpy as np\n\ndef run(a, b):\n return (a.astype(np.uint64).T @ b.astype(np.uint64)).astype(np.uint32)\n",
43
+ "simd_loop_meta": {
44
+ "output_inplace": false,
45
+ "array_pad": 0,
46
+ "scratch": [],
47
+ "axes_order": [
48
+ "m",
49
+ "n"
50
+ ]
51
+ }
52
+ }
definitions/simd-loop/loop_220.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_220",
3
+ "op_type": "loop_220",
4
+ "description": "Multiply an FP32 matrix by an FP32 vector (row-major GEMV)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "m",
22
+ "n"
23
+ ],
24
+ "dtype": "float32"
25
+ },
26
+ "x": {
27
+ "shape": [
28
+ "n"
29
+ ],
30
+ "dtype": "float32"
31
+ }
32
+ },
33
+ "outputs": {
34
+ "b": {
35
+ "shape": [
36
+ "m"
37
+ ],
38
+ "dtype": "float32",
39
+ "description": "Output array"
40
+ }
41
+ },
42
+ "reference": "import numpy as np\n\ndef run(a, x):\n return (a.astype(np.float64) @ x.astype(np.float64)).astype(np.float32)\n",
43
+ "simd_loop_meta": {
44
+ "output_inplace": false,
45
+ "array_pad": 0,
46
+ "scratch": [],
47
+ "axes_order": [
48
+ "m",
49
+ "n"
50
+ ]
51
+ }
52
+ }
definitions/simd-loop/loop_221.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_221",
3
+ "op_type": "loop_221",
4
+ "description": "Multiply an FP64 matrix by an FP64 vector (row-major GEMV)",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "m",
22
+ "n"
23
+ ],
24
+ "dtype": "float64"
25
+ },
26
+ "x": {
27
+ "shape": [
28
+ "n"
29
+ ],
30
+ "dtype": "float64"
31
+ }
32
+ },
33
+ "outputs": {
34
+ "b": {
35
+ "shape": [
36
+ "m"
37
+ ],
38
+ "dtype": "float64",
39
+ "description": "Output array"
40
+ }
41
+ },
42
+ "reference": "import numpy as np\n\ndef run(a, x):\n return a.astype(np.float64) @ x.astype(np.float64)\n",
43
+ "simd_loop_meta": {
44
+ "output_inplace": false,
45
+ "array_pad": 0,
46
+ "scratch": [],
47
+ "axes_order": [
48
+ "m",
49
+ "n"
50
+ ]
51
+ }
52
+ }
definitions/simd-loop/loop_223.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loop_223",
3
+ "op_type": "loop_223",
4
+ "description": "Transpose a matrix in-place using interleaved load and store",
5
+ "tags": [
6
+ "simd-loop"
7
+ ],
8
+ "axes": {
9
+ "m": {
10
+ "type": "var",
11
+ "description": "axis m"
12
+ },
13
+ "n": {
14
+ "type": "var",
15
+ "description": "axis n"
16
+ }
17
+ },
18
+ "inputs": {
19
+ "a": {
20
+ "shape": [
21
+ "m",
22
+ "n"
23
+ ],
24
+ "dtype": "uint32"
25
+ }
26
+ },
27
+ "outputs": {
28
+ "at": {
29
+ "shape": [
30
+ "n",
31
+ "m"
32
+ ],
33
+ "dtype": "uint32",
34
+ "description": "Output array"
35
+ }
36
+ },
37
+ "reference": "import numpy as np\n\ndef run(a):\n return np.ascontiguousarray(a.T)\n",
38
+ "simd_loop_meta": {
39
+ "output_inplace": false,
40
+ "array_pad": 0,
41
+ "scratch": [],
42
+ "axes_order": [
43
+ "m",
44
+ "n"
45
+ ]
46
+ }
47
+ }
solutions/ncnn/baseline-ncnn-arm/conv1d/conv1d_kw1_sw1_dw1_cout512_p0.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv1d_kw1_sw1_dw1_cout512_p0",
3
- "definition": "conv1d_kw1_sw1_dw1_cout512_p0",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv1d_kw1_sw1_dw1_cout512_p0. binding.cpp bakes constexpr params and implements armbench_entry_conv1d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv1d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv1d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv1d baseline.\n// Called by armbench_entry_conv1d (binding.cpp); implemented by kernel.cpp.\n// Input/output are 2D ncnn::Mats (w=seq_len, h=channels).\n// num_output is encoded in top_blob.h (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution1d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_w, int stride_w, int dilation_w,\n int activation_type, const Mat& activation_params,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv1d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int out_c = 512;\nconstexpr int kernel_w = 1;\nconstexpr int stride_w = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_left = 0;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv1d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n // bottom is 2D ncnn::Mat (w=seq_len, h=C_in) \u2014 created by NcnnDataset.\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& act = *reinterpret_cast<const ncnn::Mat*>(act_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Pad the sequence (w) dimension symmetrically.\n ncnn::Mat bordered;\n ncnn::copy_make_border(bottom, bordered, 0, 0, pad_left, pad_left,\n ncnn::BORDER_CONSTANT, 0.f, opt);\n\n // Compute output sequence length.\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int out_w = (bordered.w - ext_kw) / stride_w + 1;\n\n // Pre-allocate top as 2D (w=out_w, h=out_c) so kernel reads out_c from top.h.\n top.create(out_w, out_c, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution1d_kernel(\n bordered, top, weight, bias,\n kernel_w, stride_w, dilation_w,\n activation_type, act, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv1d.h\"\n#include \"convolution1d_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution1d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_w, int stride_w, int dilation_w,\n int activation_type, const Mat& activation_params,\n const Option& opt)\n{\n // top_blob is pre-allocated 2D (w=out_w, h=out_c); read out_c from top_blob.h.\n const int num_output = top_blob.h;\n\n // Use heap allocation: stack-allocated ncnn ARM layers fail to populate\n // weight_data_tm in create_pipeline on AArch64 with -O3.\n Convolution1D_arm* conv = new Convolution1D_arm();\n conv->num_output = num_output;\n conv->kernel_w = kernel_w;\n conv->stride_w = stride_w;\n conv->dilation_w = dilation_w;\n conv->pad_left = 0;\n conv->pad_right = 0;\n conv->pad_value = 0.f;\n conv->bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv->weight_data_size = static_cast<int>(weight_data.total());\n conv->activation_type = activation_type;\n conv->activation_params = activation_params;\n conv->dynamic_weight = 0;\n conv->weight_data = const_cast<Mat&>(weight_data);\n if (conv->bias_term) conv->bias_data = const_cast<Mat&>(bias_data);\n\n if (conv->create_pipeline(opt) != 0) { delete conv; return -1; }\n\n Mat local_top;\n int ret = conv->forward(bottom_blob, local_top, opt);\n delete conv;\n if (ret != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob (both 2D, same shape).\n for (int c = 0; c < num_output; ++c)\n std::memcpy(top_blob.row(c), local_top.row(c), top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv1d/conv1d_kw3_sw1_dw1_cout512_p1.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv1d_kw3_sw1_dw1_cout512_p1",
3
- "definition": "conv1d_kw3_sw1_dw1_cout512_p1",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv1d_kw3_sw1_dw1_cout512_p1. binding.cpp bakes constexpr params and implements armbench_entry_conv1d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv1d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv1d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv1d baseline.\n// Called by armbench_entry_conv1d (binding.cpp); implemented by kernel.cpp.\n// Input/output are 2D ncnn::Mats (w=seq_len, h=channels).\n// num_output is encoded in top_blob.h (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution1d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_w, int stride_w, int dilation_w,\n int activation_type, const Mat& activation_params,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv1d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int out_c = 512;\nconstexpr int kernel_w = 3;\nconstexpr int stride_w = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_left = 1;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv1d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n // bottom is 2D ncnn::Mat (w=seq_len, h=C_in) \u2014 created by NcnnDataset.\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& act = *reinterpret_cast<const ncnn::Mat*>(act_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Pad the sequence (w) dimension symmetrically.\n ncnn::Mat bordered;\n ncnn::copy_make_border(bottom, bordered, 0, 0, pad_left, pad_left,\n ncnn::BORDER_CONSTANT, 0.f, opt);\n\n // Compute output sequence length.\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int out_w = (bordered.w - ext_kw) / stride_w + 1;\n\n // Pre-allocate top as 2D (w=out_w, h=out_c) so kernel reads out_c from top.h.\n top.create(out_w, out_c, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution1d_kernel(\n bordered, top, weight, bias,\n kernel_w, stride_w, dilation_w,\n activation_type, act, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv1d.h\"\n#include \"convolution1d_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution1d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_w, int stride_w, int dilation_w,\n int activation_type, const Mat& activation_params,\n const Option& opt)\n{\n // top_blob is pre-allocated 2D (w=out_w, h=out_c); read out_c from top_blob.h.\n const int num_output = top_blob.h;\n\n // Use heap allocation: stack-allocated ncnn ARM layers fail to populate\n // weight_data_tm in create_pipeline on AArch64 with -O3.\n Convolution1D_arm* conv = new Convolution1D_arm();\n conv->num_output = num_output;\n conv->kernel_w = kernel_w;\n conv->stride_w = stride_w;\n conv->dilation_w = dilation_w;\n conv->pad_left = 0;\n conv->pad_right = 0;\n conv->pad_value = 0.f;\n conv->bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv->weight_data_size = static_cast<int>(weight_data.total());\n conv->activation_type = activation_type;\n conv->activation_params = activation_params;\n conv->dynamic_weight = 0;\n conv->weight_data = const_cast<Mat&>(weight_data);\n if (conv->bias_term) conv->bias_data = const_cast<Mat&>(bias_data);\n\n if (conv->create_pipeline(opt) != 0) { delete conv; return -1; }\n\n Mat local_top;\n int ret = conv->forward(bottom_blob, local_top, opt);\n delete conv;\n if (ret != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob (both 2D, same shape).\n for (int c = 0; c < num_output; ++c)\n std::memcpy(top_blob.row(c), local_top.row(c), top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256",
3
- "definition": "conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_kh1_kw1_sh1_sw1_dh1_dw1_cout256. binding.cpp bakes constexpr params and implements armbench_entry_conv2d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d baseline.\n// Called by armbench_entry_conv2d (binding.cpp); implemented by kernel.cpp.\n// num_output is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int num_output = 256;\nconstexpr int kernel_h = 1;\nconstexpr int kernel_w = 1;\nconstexpr int stride_h = 1;\nconstexpr int stride_w = 1;\nconstexpr int dilation_h = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_top = 0;\nconstexpr int pad_left = 0;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Compute output spatial dims.\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad_top - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad_left - ext_kw) / stride_w + 1;\n\n // Pre-allocate top so kernel reads num_output from top.c.\n top.create(W_out, H_out, num_output, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution2d_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad_top, pad_left,\n activation_type, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d.h\"\n#include \"convolution_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt)\n{\n const int num_output = top_blob.c; // pre-set by binding.cpp\n\n Convolution_arm conv;\n conv.num_output = num_output;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad_top; conv.pad_bottom = pad_top;\n conv.pad_left = pad_left; conv.pad_right = pad_left;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.int8_scale_term = 0;\n conv.activation_type = activation_type;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob, channel by channel.\n for (int c = 0; c < num_output; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128",
3
- "definition": "conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_kh3_kw3_sh1_sw1_dh1_dw1_cout128. binding.cpp bakes constexpr params and implements armbench_entry_conv2d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d baseline.\n// Called by armbench_entry_conv2d (binding.cpp); implemented by kernel.cpp.\n// num_output is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int num_output = 128;\nconstexpr int kernel_h = 3;\nconstexpr int kernel_w = 3;\nconstexpr int stride_h = 1;\nconstexpr int stride_w = 1;\nconstexpr int dilation_h = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_top = 1;\nconstexpr int pad_left = 1;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Compute output spatial dims.\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad_top - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad_left - ext_kw) / stride_w + 1;\n\n // Pre-allocate top so kernel reads num_output from top.c.\n top.create(W_out, H_out, num_output, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution2d_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad_top, pad_left,\n activation_type, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d.h\"\n#include \"convolution_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt)\n{\n const int num_output = top_blob.c; // pre-set by binding.cpp\n\n Convolution_arm conv;\n conv.num_output = num_output;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad_top; conv.pad_bottom = pad_top;\n conv.pad_left = pad_left; conv.pad_right = pad_left;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.int8_scale_term = 0;\n conv.activation_type = activation_type;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob, channel by channel.\n for (int c = 0; c < num_output; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256",
3
- "definition": "conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_kh3_kw3_sh1_sw1_dh2_dw2_cout256. binding.cpp bakes constexpr params and implements armbench_entry_conv2d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d baseline.\n// Called by armbench_entry_conv2d (binding.cpp); implemented by kernel.cpp.\n// num_output is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int num_output = 256;\nconstexpr int kernel_h = 3;\nconstexpr int kernel_w = 3;\nconstexpr int stride_h = 1;\nconstexpr int stride_w = 1;\nconstexpr int dilation_h = 2;\nconstexpr int dilation_w = 2;\nconstexpr int pad_top = 2;\nconstexpr int pad_left = 2;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Compute output spatial dims.\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad_top - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad_left - ext_kw) / stride_w + 1;\n\n // Pre-allocate top so kernel reads num_output from top.c.\n top.create(W_out, H_out, num_output, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution2d_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad_top, pad_left,\n activation_type, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d.h\"\n#include \"convolution_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt)\n{\n const int num_output = top_blob.c; // pre-set by binding.cpp\n\n Convolution_arm conv;\n conv.num_output = num_output;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad_top; conv.pad_bottom = pad_top;\n conv.pad_left = pad_left; conv.pad_right = pad_left;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.int8_scale_term = 0;\n conv.activation_type = activation_type;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob, channel by channel.\n for (int c = 0; c < num_output; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128",
3
- "definition": "conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_kh3_kw3_sh2_sw2_dh1_dw1_cout128. binding.cpp bakes constexpr params and implements armbench_entry_conv2d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d baseline.\n// Called by armbench_entry_conv2d (binding.cpp); implemented by kernel.cpp.\n// num_output is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int num_output = 128;\nconstexpr int kernel_h = 3;\nconstexpr int kernel_w = 3;\nconstexpr int stride_h = 2;\nconstexpr int stride_w = 2;\nconstexpr int dilation_h = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_top = 1;\nconstexpr int pad_left = 1;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Compute output spatial dims.\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad_top - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad_left - ext_kw) / stride_w + 1;\n\n // Pre-allocate top so kernel reads num_output from top.c.\n top.create(W_out, H_out, num_output, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution2d_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad_top, pad_left,\n activation_type, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d.h\"\n#include \"convolution_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt)\n{\n const int num_output = top_blob.c; // pre-set by binding.cpp\n\n Convolution_arm conv;\n conv.num_output = num_output;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad_top; conv.pad_bottom = pad_top;\n conv.pad_left = pad_left; conv.pad_right = pad_left;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.int8_scale_term = 0;\n conv.activation_type = activation_type;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob, channel by channel.\n for (int c = 0; c < num_output; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64",
3
- "definition": "conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_kh5_kw5_sh1_sw1_dh1_dw1_cout64. binding.cpp bakes constexpr params and implements armbench_entry_conv2d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d baseline.\n// Called by armbench_entry_conv2d (binding.cpp); implemented by kernel.cpp.\n// num_output is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int num_output = 64;\nconstexpr int kernel_h = 5;\nconstexpr int kernel_w = 5;\nconstexpr int stride_h = 1;\nconstexpr int stride_w = 1;\nconstexpr int dilation_h = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_top = 2;\nconstexpr int pad_left = 2;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Compute output spatial dims.\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad_top - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad_left - ext_kw) / stride_w + 1;\n\n // Pre-allocate top so kernel reads num_output from top.c.\n top.create(W_out, H_out, num_output, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution2d_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad_top, pad_left,\n activation_type, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d.h\"\n#include \"convolution_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt)\n{\n const int num_output = top_blob.c; // pre-set by binding.cpp\n\n Convolution_arm conv;\n conv.num_output = num_output;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad_top; conv.pad_bottom = pad_top;\n conv.pad_left = pad_left; conv.pad_right = pad_left;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.int8_scale_term = 0;\n conv.activation_type = activation_type;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob, channel by channel.\n for (int c = 0; c < num_output; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d/conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64",
3
- "definition": "conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_kh7_kw7_sh2_sw2_dh1_dw1_cout64. binding.cpp bakes constexpr params and implements armbench_entry_conv2d with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d baseline.\n// Called by armbench_entry_conv2d (binding.cpp); implemented by kernel.cpp.\n// num_output is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int num_output = 64;\nconstexpr int kernel_h = 7;\nconstexpr int kernel_w = 7;\nconstexpr int stride_h = 2;\nconstexpr int stride_w = 2;\nconstexpr int dilation_h = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad_top = 3;\nconstexpr int pad_left = 3;\nconstexpr int activation_type = 0;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Compute output spatial dims.\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad_top - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad_left - ext_kw) / stride_w + 1;\n\n // Pre-allocate top so kernel reads num_output from top.c.\n top.create(W_out, H_out, num_output, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::convolution2d_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad_top, pad_left,\n activation_type, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d.h\"\n#include \"convolution_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::convolution2d_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad_top, int pad_left,\n int activation_type,\n const Option& opt)\n{\n const int num_output = top_blob.c; // pre-set by binding.cpp\n\n Convolution_arm conv;\n conv.num_output = num_output;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad_top; conv.pad_bottom = pad_top;\n conv.pad_left = pad_left; conv.pad_right = pad_left;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.int8_scale_term = 0;\n conv.activation_type = activation_type;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n // Copy from local_top to pre-allocated top_blob, channel by channel.\n for (int c = 0; c < num_output; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
solutions/ncnn/baseline-ncnn-arm/conv2d_depthwise/conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "name": "baseline-ncnn-arm_conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1",
3
- "definition": "conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1",
4
- "dataset": "ncnn",
5
- "author": "baseline-ncnn-arm",
6
- "description": "ncnn::*_arm baseline for conv2d_depthwise_kh3_kw3_sh1_sw1_dh1_dw1_p1. binding.cpp bakes constexpr params and implements armbench_entry_conv2d_depthwise with void* ncnn::Mat ABI; kernel.cpp delegates to libncnn.a. Timing baseline for speedup computation.",
7
- "spec": {
8
- "language": "cpp",
9
- "target_hardware": [
10
- "graviton3",
11
- "aarch64-sve",
12
- "graviton4",
13
- "aarch64-sve2"
14
- ],
15
- "entry_point": "binding.cpp::armbench_entry_conv2d_depthwise",
16
- "dependencies": [],
17
- "isa_features": [],
18
- "compile_flags": [
19
- "-O3",
20
- "-std=c++17"
21
- ],
22
- "link_flags": [
23
- "-fopenmp"
24
- ]
25
- },
26
- "sources": [
27
- {
28
- "path": "conv2d_depthwise.h",
29
- "content": "#pragma once\n#include \"mat.h\"\n#include \"option.h\"\n\n// Harness contract for conv2d_depthwise baseline.\n// Called by armbench_entry_conv2d_depthwise (binding.cpp); implemented by kernel.cpp.\n// num_output (== C, group == C) is encoded in top_blob.c (pre-allocated by binding.cpp).\nnamespace ncnn {\nint conv2d_depthwise_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad,\n const Option& opt);\n}\n"
30
- },
31
- {
32
- "path": "binding.cpp",
33
- "content": "#include \"conv2d_depthwise.h\"\n#include \"mat.h\"\n#include \"option.h\"\n\nnamespace {\nconstexpr int kernel_h = 3;\nconstexpr int kernel_w = 3;\nconstexpr int stride_h = 1;\nconstexpr int stride_w = 1;\nconstexpr int dilation_h = 1;\nconstexpr int dilation_w = 1;\nconstexpr int pad = 1;\n} // namespace\n\nextern \"C\" {\nint armbench_entry_conv2d_depthwise(\n void* bottom_v, void* top_v,\n void* weight_v, void* bias_v,\n void* act_v, void* opt_v)\n{\n const auto& bottom = *reinterpret_cast<const ncnn::Mat*>(bottom_v);\n auto& top = *reinterpret_cast<ncnn::Mat*>(top_v);\n const auto& weight = *reinterpret_cast<const ncnn::Mat*>(weight_v);\n const auto& bias = *reinterpret_cast<const ncnn::Mat*>(bias_v);\n const auto& opt = *reinterpret_cast<const ncnn::Option*>(opt_v);\n\n // Depthwise: num_output == input channels.\n const int C = bottom.c;\n const int ext_kh = dilation_h * (kernel_h - 1) + 1;\n const int ext_kw = dilation_w * (kernel_w - 1) + 1;\n const int H_out = (bottom.h + 2 * pad - ext_kh) / stride_h + 1;\n const int W_out = (bottom.w + 2 * pad - ext_kw) / stride_w + 1;\n\n top.create(W_out, H_out, C, (size_t)4u, opt.blob_allocator);\n if (top.empty()) return -1;\n\n return ncnn::conv2d_depthwise_kernel(\n bottom, top, weight, bias,\n kernel_h, kernel_w,\n stride_h, stride_w,\n dilation_h, dilation_w,\n pad, opt);\n}\n} // extern \"C\"\n"
34
- },
35
- {
36
- "path": "kernel.cpp",
37
- "content": "#include \"conv2d_depthwise.h\"\n#include \"convolutiondepthwise_arm.h\"\n#include \"mat.h\"\n#include \"option.h\"\n#include <cstring>\n\nint ncnn::conv2d_depthwise_kernel(\n const Mat& bottom_blob, Mat& top_blob,\n const Mat& weight_data, const Mat& bias_data,\n int kernel_h, int kernel_w,\n int stride_h, int stride_w,\n int dilation_h, int dilation_w,\n int pad,\n const Option& opt)\n{\n const int C = top_blob.c; // pre-set by binding.cpp (== input channels)\n\n // ncnn's pack1 convdw3x3s1_neon reads 12 floats per iteration (for 8 outputs),\n // potentially overreading past the last channel's allocation when the bordered blob\n // lands near a page boundary. Use pack4 (4-channel interleaved) when possible to\n // take the safe convdw3x3s1_pack4_neon path instead.\n if (C % 4 == 0) {\n Option opt4 = opt;\n opt4.use_packing_layout = true;\n\n Mat bottom_pack4;\n convert_packing(bottom_blob, bottom_pack4, 4, opt4);\n\n ConvolutionDepthWise_arm conv;\n conv.num_output = C;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad; conv.pad_bottom = pad;\n conv.pad_left = pad; conv.pad_right = pad;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.group = C;\n conv.int8_scale_term = 0;\n conv.activation_type = 0;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt4) != 0) return -1;\n Mat top_pack4;\n if (conv.forward(bottom_pack4, top_pack4, opt4) != 0) return -1;\n\n Mat local_top;\n convert_packing(top_pack4, local_top, 1, opt);\n\n for (int c = 0; c < C; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n }\n\n // Fallback pack1 path for C not divisible by 4.\n ConvolutionDepthWise_arm conv;\n conv.num_output = C;\n conv.kernel_h = kernel_h; conv.kernel_w = kernel_w;\n conv.stride_h = stride_h; conv.stride_w = stride_w;\n conv.dilation_h = dilation_h; conv.dilation_w = dilation_w;\n conv.pad_top = pad; conv.pad_bottom = pad;\n conv.pad_left = pad; conv.pad_right = pad;\n conv.pad_value = 0.f;\n conv.bias_term = (!bias_data.empty() && bias_data.total() > 0) ? 1 : 0;\n conv.weight_data_size = static_cast<int>(weight_data.total());\n conv.group = C;\n conv.int8_scale_term = 0;\n conv.activation_type = 0;\n conv.activation_params = Mat();\n conv.dynamic_weight = 0;\n conv.weight_data = const_cast<Mat&>(weight_data);\n if (conv.bias_term) conv.bias_data = const_cast<Mat&>(bias_data);\n\n if (conv.create_pipeline(opt) != 0) return -1;\n Mat local_top;\n if (conv.forward(bottom_blob, local_top, opt) != 0) return -1;\n\n for (int c = 0; c < C; ++c)\n std::memcpy((float*)top_blob.channel(c), (const float*)local_top.channel(c),\n top_blob.h * top_blob.w * sizeof(float));\n return 0;\n}\n"
38
- }
39
- ]
40
- }