1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8 
9 #pragma once
10 
11 #include <benchmark/benchmark.h>
12 
13 
14 #define BENCHMARK_CONV(conv_fn) \
15   BENCHMARK_CAPTURE(conv_fn, mobilenet_v1, "MobileNet v1")->Apply(MobileNetV1ConvArguments)->UseRealTime(); \
16   BENCHMARK_CAPTURE(conv_fn, mobilenet_v2, "MobileNet v2")->Apply(MobileNetV2ConvArguments)->UseRealTime(); \
17   BENCHMARK_CAPTURE(conv_fn, mobilenet_v3_small, "MobileNet v3 Small")->Apply(MobileNetV3SmallConvArguments)->UseRealTime(); \
18   BENCHMARK_CAPTURE(conv_fn, mobilenet_v3_large, "MobileNet v3 Large")->Apply(MobileNetV3LargeConvArguments)->UseRealTime(); \
19   BENCHMARK_CAPTURE(conv_fn, shufflenet_v1_g1, "ShuffleNet v1 (1 group)")->Apply(ShuffleNetV1G1ConvArguments)->UseRealTime(); \
20   BENCHMARK_CAPTURE(conv_fn, shufflenet_v1_g2, "ShuffleNet v1 (2 groups)")->Apply(ShuffleNetV1G2ConvArguments)->UseRealTime(); \
21   BENCHMARK_CAPTURE(conv_fn, shufflenet_v1_g3, "ShuffleNet v1 (3 groups)")->Apply(ShuffleNetV1G3ConvArguments)->UseRealTime(); \
22   BENCHMARK_CAPTURE(conv_fn, shufflenet_v1_g4, "ShuffleNet v1 (4 groups)")->Apply(ShuffleNetV1G4ConvArguments)->UseRealTime(); \
23   BENCHMARK_CAPTURE(conv_fn, shufflenet_v1_g8, "ShuffleNet v1 (8 groups)")->Apply(ShuffleNetV1G8ConvArguments)->UseRealTime(); \
24   BENCHMARK_CAPTURE(conv_fn, shufflenet_v2_x05, "ShuffleNet v2 0.5X")->Apply(ShuffleNetV2X05ConvArguments)->UseRealTime(); \
25   BENCHMARK_CAPTURE(conv_fn, shufflenet_v2_x10, "ShuffleNet v2 1.0X")->Apply(ShuffleNetV2X10ConvArguments)->UseRealTime(); \
26   BENCHMARK_CAPTURE(conv_fn, shufflenet_v2_x15, "ShuffleNet v2 1.5X")->Apply(ShuffleNetV2X15ConvArguments)->UseRealTime(); \
27   BENCHMARK_CAPTURE(conv_fn, shufflenet_v2_x20, "ShuffleNet v2 2.0X")->Apply(ShuffleNetV2X20ConvArguments)->UseRealTime(); \
28   BENCHMARK_CAPTURE(conv_fn, inception_v3, "Inception v3")->Apply(InceptionV3ConvArguments)->UseRealTime(); \
29   BENCHMARK_CAPTURE(conv_fn, resnet18, "ResNet-18")->Apply(ResNet18ConvArguments)->UseRealTime(); \
30   BENCHMARK_CAPTURE(conv_fn, resnet50, "ResNet-50")->Apply(ResNet50ConvArguments)->UseRealTime(); \
31   BENCHMARK_CAPTURE(conv_fn, squeezenet_v10, "SqueezeNet 1.0")->Apply(SqueezeNetV10ConvArguments)->UseRealTime(); \
32   BENCHMARK_CAPTURE(conv_fn, squeezenet_v11, "SqueezeNet 1.1")->Apply(SqueezeNetV11ConvArguments)->UseRealTime(); \
33   BENCHMARK_CAPTURE(conv_fn, vgg, "VGG")->Apply(VGGConvArguments)->UseRealTime(); \
34   BENCHMARK_CAPTURE(conv_fn, srcnn915, "SRCNN (9-1-5)")->Apply(SRCNN915ConvArguments)->UseRealTime(); \
35   BENCHMARK_CAPTURE(conv_fn, srcnn935, "SRCNN (9-3-5)")->Apply(SRCNN935ConvArguments)->UseRealTime(); \
36   BENCHMARK_CAPTURE(conv_fn, srcnn955, "SRCNN (9-5-5)")->Apply(SRCNN955ConvArguments)->UseRealTime();
37 
38 
39 // ShuffleNet v1 with 1 group.
ShuffleNetV1G1ConvArguments(benchmark::internal::Benchmark * b)40 static void ShuffleNetV1G1ConvArguments(benchmark::internal::Benchmark* b) {
41   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
42 
43   /*********************** Conv 1 **********************/
44   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
45   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
46   /*************** Stage 2: stride-2 unit **************/
47   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
48   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   36});
49   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   36,  120});
50   /*************** Stage 2: stride-1 units *************/
51   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
52   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  144,   36});
53   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   36,  144});
54   /*************** Stage 3: stride-2 unit **************/
55   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
56   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  144,   72});
57   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   72,  144});
58   /*************** Stage 3: stride-1 units *************/
59   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
60   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  288,   72});
61   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   72,  288});
62   /*************** Stage 4: stride-2 unit **************/
63   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
64   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  288,  144});
65   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  144,  288});
66   /*************** Stage 4: stride-1 units *************/
67   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
68   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  576,  144});
69   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  144,  576});
70 }
71 
72 // ShuffleNet v1 with 2 groups.
ShuffleNetV1G2ConvArguments(benchmark::internal::Benchmark * b)73 static void ShuffleNetV1G2ConvArguments(benchmark::internal::Benchmark* b) {
74   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
75 
76   /*********************** Conv 1 **********************/
77   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
78   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
79   /*************** Stage 2: stride-2 unit **************/
80   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
81   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   50});
82   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   25,   88});
83   /*************** Stage 2: stride-1 units *************/
84   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
85   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  100,   25});
86   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   25,  100});
87   /*************** Stage 3: stride-2 unit **************/
88   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
89   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  100,   50});
90   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   50,  100});
91   /*************** Stage 3: stride-1 units *************/
92   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
93   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  200,   50});
94   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   50,  200});
95   /*************** Stage 4: stride-2 unit **************/
96   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
97   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  200,  100});
98   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  100,  200});
99   /*************** Stage 4: stride-1 units *************/
100   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
101   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  400,  100});
102   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  100,  400});
103 }
104 
105 // ShuffleNet v1 with 3 groups.
ShuffleNetV1G3ConvArguments(benchmark::internal::Benchmark * b)106 static void ShuffleNetV1G3ConvArguments(benchmark::internal::Benchmark* b) {
107   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
108 
109   /*********************** Conv 1 **********************/
110   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
111   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
112   /*************** Stage 2: stride-2 unit **************/
113   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
114   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   60});
115   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   20,   72});
116   /*************** Stage 2: stride-1 units *************/
117   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
118   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   80,   20});
119   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   20,   80});
120   /*************** Stage 3: stride-2 unit **************/
121   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
122   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   80,   40});
123   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   40,   80});
124   /*************** Stage 3: stride-1 units *************/
125   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
126   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  160,   40});
127   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   40,  160});
128   /*************** Stage 4: stride-2 unit **************/
129   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
130   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  160,   80});
131   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   80,  160});
132   /*************** Stage 4: stride-1 units *************/
133   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
134   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  320,   80});
135   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   80,  320});
136 }
137 
138 // ShuffleNet v1 with 4 groups.
ShuffleNetV1G4ConvArguments(benchmark::internal::Benchmark * b)139 static void ShuffleNetV1G4ConvArguments(benchmark::internal::Benchmark* b) {
140   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
141 
142   /*********************** Conv 1 **********************/
143   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
144   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
145   /*************** Stage 2: stride-2 unit **************/
146   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
147   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   68});
148   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   17,   62});
149   /*************** Stage 2: stride-1 units *************/
150   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
151   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   68,   17});
152   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   17,   68});
153   /*************** Stage 3: stride-2 unit **************/
154   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
155   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   68,   34});
156   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   34,   68});
157   /*************** Stage 3: stride-1 units *************/
158   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
159   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  136,   34});
160   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   34,  136});
161   /*************** Stage 4: stride-2 unit **************/
162   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
163   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  136,   68});
164   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   68,  136});
165   /*************** Stage 4: stride-1 units *************/
166   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
167   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  272,   68});
168   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   68,  272});
169 }
170 
171 // ShuffleNet v1 with 8 groups.
ShuffleNetV1G8ConvArguments(benchmark::internal::Benchmark * b)172 static void ShuffleNetV1G8ConvArguments(benchmark::internal::Benchmark* b) {
173   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
174 
175   /*********************** Conv 1 **********************/
176   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
177   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
178   /*************** Stage 2: stride-2 unit **************/
179   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
180   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   96});
181   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   12,   45});
182   /*************** Stage 2: stride-1 units *************/
183   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
184   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   48,   12});
185   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   12,   48});
186   /*************** Stage 3: stride-2 unit **************/
187   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
188   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   48,   24});
189   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   24,   48});
190   /*************** Stage 3: stride-1 units *************/
191   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
192   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,   24});
193   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   24,   96});
194   /*************** Stage 4: stride-2 unit **************/
195   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
196   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,   48});
197   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   48,   96});
198   /*************** Stage 4: stride-1 units *************/
199   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
200   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  192,   48});
201   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   48,  192});
202 }
203 
204 // ShuffleNet v2 (0.5X scale).
ShuffleNetV2X05ConvArguments(benchmark::internal::Benchmark * b)205 static void ShuffleNetV2X05ConvArguments(benchmark::internal::Benchmark* b) {
206   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
207 
208   /*********************** Conv 1 **********************/
209   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
210   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
211   /********************** Stage 2 **********************/
212   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
213   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   24,   24});
214   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   24});
215   /********************** Stage 3 **********************/
216   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
217   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   48,   48});
218   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   48,   48});
219   /********************** Stage 4 **********************/
220   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
221   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   96,   96});
222   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,   96});
223   /*********************** Conv 5 **********************/
224   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
225   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  192, 1024});
226 }
227 
228 // ShuffleNet v2 (1.0X scale).
ShuffleNetV2X10ConvArguments(benchmark::internal::Benchmark * b)229 static void ShuffleNetV2X10ConvArguments(benchmark::internal::Benchmark* b) {
230   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
231 
232   /*********************** Conv 1 **********************/
233   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
234   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
235   /********************** Stage 2 **********************/
236   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
237   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   24,   58});
238   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   58});
239   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   58,   58});
240   /********************** Stage 3 **********************/
241   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
242   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  116,  116});
243   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  116,  116});
244   /********************** Stage 4 **********************/
245   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
246   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  232,  232});
247   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  232,  232});
248   /*********************** Conv 5 **********************/
249   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
250   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  464, 1024});
251 }
252 
253 // ShuffleNet v2 (1.5X scale).
ShuffleNetV2X15ConvArguments(benchmark::internal::Benchmark * b)254 static void ShuffleNetV2X15ConvArguments(benchmark::internal::Benchmark* b) {
255   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
256 
257   /*********************** Conv 1 **********************/
258   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
259   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
260   /********************** Stage 2 **********************/
261   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
262   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   24,   88});
263   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   88});
264   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   88,   88});
265   /********************** Stage 3 **********************/
266   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
267   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  176,  176});
268   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  176,  176});
269   /********************** Stage 4 **********************/
270   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
271   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  352,  352});
272   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  352,  352});
273   /*********************** Conv 5 **********************/
274   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
275   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  704, 1024});
276 }
277 
278 // ShuffleNet v2 (2.0X scale).
ShuffleNetV2X20ConvArguments(benchmark::internal::Benchmark * b)279 static void ShuffleNetV2X20ConvArguments(benchmark::internal::Benchmark* b) {
280   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
281 
282   /*********************** Conv 1 **********************/
283   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
284   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   24});
285   /********************** Stage 2 **********************/
286   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
287   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   24,  122});
288   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,  122});
289   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  122,  122});
290   /********************** Stage 3 **********************/
291   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
292   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  244,  244});
293   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  244,  244});
294   /********************** Stage 4 **********************/
295   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
296   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  488,  488});
297   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  488,  488});
298   /*********************** Conv 5 **********************/
299   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
300   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  976, 2048});
301 }
302 
MobileNetV1ConvArguments(benchmark::internal::Benchmark * b)303 static void MobileNetV1ConvArguments(benchmark::internal::Benchmark* b) {
304   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
305 
306   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
307   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   32});
308   b->Args({112, 112,  1,  1,  0,  0, 1, 1,   32,   64});
309   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   64,  128});
310   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,  128,  128});
311   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  128,  256});
312   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  256,  256});
313   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  256,  512});
314   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  512,  512});
315   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  512, 1024});
316   b->Args({  7,   7,  1,  1,  0,  0, 1, 1, 1024, 1024});
317 }
318 
MobileNetV2ConvArguments(benchmark::internal::Benchmark * b)319 static void MobileNetV2ConvArguments(benchmark::internal::Benchmark* b) {
320   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
321 
322   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
323   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   32});
324 
325   /******************** Bottleneck 1 *******************/
326   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
327   b->Args({112, 112,  1,  1,  0,  0, 1, 1,   32,   16});
328 
329   /******************** Bottleneck 2 *******************/
330   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
331   b->Args({112, 112,  1,  1,  0,  0, 1, 1,   16,   96});
332   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   96,   24});
333   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,  144});
334   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,  144,   24});
335 
336   /******************** Bottleneck 3 *******************/
337   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
338 //b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,  144});
339   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  144,   32});
340   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   32,  192});
341   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  192,   32});
342 //b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   32,  192});
343 //b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  192,   32});
344 
345   /******************** Bottleneck 4 *******************/
346   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
347 //b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   32,  192});
348   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  192,   64});
349   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   64,  384});
350   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  384,   64});
351 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   64,  384});
352 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  384,   64});
353 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   64,  384});
354 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  384,   64});
355 
356   /******************** Bottleneck 5 *******************/
357   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
358 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   64,  384});
359   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  384,   96});
360   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,  576});
361   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  576,   96});
362 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,  576});
363 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  576,   96});
364 
365   /******************** Bottleneck 6 *******************/
366   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
367 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,  576});
368   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  576,  160});
369   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  160,  960});
370   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  960,  160});
371 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  160,  960});
372 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  960,  160});
373 
374   /******************** Bottleneck 7 *******************/
375   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
376 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  160,  960});
377   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  960,  320});
378 
379   /**************** Pre-pooling Conv2D *****************/
380   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
381   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  320, 1280});
382   /**************** Post-pooling Conv2D ****************/
383   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
384   b->Args({  1,   1,  1,  1,  0,  0, 1, 1, 1280, 1000});
385 }
386 
MobileNetV3SmallConvArguments(benchmark::internal::Benchmark * b)387 static void MobileNetV3SmallConvArguments(benchmark::internal::Benchmark* b) {
388   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
389 
390   /******************* Initial Stage *******************/
391   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
392   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   16});
393   /******************** Bottleneck 1 *******************/
394   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
395   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   16,    8});
396   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,    8,   16});
397   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   16,   16});
398   /******************** Bottleneck 2 *******************/
399   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
400   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   16,   72});
401   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   72,   24});
402   /******************** Bottleneck 3 *******************/
403   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
404   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   24,   88});
405   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   88,   24});
406   /******************** Bottleneck 4 *******************/
407   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
408   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   24,   96});
409   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   96,   24});
410   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   24,   96});
411   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   96,   40});
412   /******************** Bottleneck 5 *******************/
413   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
414   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   40,  240});
415   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  240,   64});
416   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   64,  240});
417   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  240,   40});
418   /******************** Bottleneck 6 *******************/
419   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
420 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   40,  240});
421 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  240,   64});
422 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   64,  240});
423 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  240,   40});
424   /******************** Bottleneck 7 *******************/
425   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
426   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   40,  120});
427   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  120,   32});
428   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   32,  120});
429   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  120,   48});
430   /******************** Bottleneck 8 *******************/
431   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
432   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   48,  144});
433   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  144,   40});
434   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   40,  144});
435   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  144,   48});
436   /******************** Bottleneck 9 *******************/
437   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
438   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   48,  288});
439   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  288,   72});
440   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   72,  288});
441   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  288,   96});
442   /******************* Bottleneck 10 *******************/
443   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
444   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   96,  576});
445   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  576,  144});
446   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  144,  576});
447   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  576,   96});
448   /******************* Bottleneck 11 *******************/
449   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
450 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   96,  576});
451 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  576,  144});
452 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  144,  576});
453 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  576,   96});
454   /********************* Last Stage ********************/
455   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
456 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,   96,  576});
457   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  576, 1024});
458   b->Args({  1,   1,  1,  1,  0,  0, 1, 1, 1024, 1001});
459 }
460 
MobileNetV3LargeConvArguments(benchmark::internal::Benchmark * b)461 static void MobileNetV3LargeConvArguments(benchmark::internal::Benchmark* b) {
462   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
463 
464   /******************* Initial Stage *******************/
465   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
466   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   16});
467   /******************** Bottleneck 1 *******************/
468   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
469   b->Args({112, 112,  1,  1,  0,  0, 1, 1,   16,   16});
470   /******************** Bottleneck 2 *******************/
471   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
472   b->Args({112, 112,  1,  1,  0,  0, 1, 1,   16,   64});
473   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   64,   24});
474   /******************** Bottleneck 3 *******************/
475   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
476   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   72});
477   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   72,   24});
478   /******************** Bottleneck 4 *******************/
479   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
480 //b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   24,   72});*/
481   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   72,   24});
482   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   24,   72});
483   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   72,   40});
484   /******************** Bottleneck 5 *******************/
485   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
486   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   40,  120});
487   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  120,   32});
488   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   32,  120});
489   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  120,   40});
490   /******************** Bottleneck 6 *******************/
491   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
492 //b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   40,  120});
493 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  120,   32});
494 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,   32,  120});
495 //b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  120,   40});
496   /******************** Bottleneck 7 *******************/
497   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
498   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,   40,  240});
499   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  240,   80});
500   /******************** Bottleneck 8 *******************/
501   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
502   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   80,  200});
503   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  200,   80});
504   /******************** Bottleneck 9 *******************/
505   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
506   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   80,  184});
507   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  184,   80});
508   /******************* Bottleneck 10 *******************/
509   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
510 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   80,  184});
511 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  184,   80});
512   /******************* Bottleneck 11 *******************/
513   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
514   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,   80,  480});
515   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  480,  120});
516   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  120,  480});
517   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  480,  112});
518   /******************* Bottleneck 12 *******************/
519   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
520   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  112,  672});
521   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  672,  168});
522   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  168,  672});
523   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  672,  112});
524   /******************* Bottleneck 13 *******************/
525   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
526 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  112,  672});
527   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  672,  160});
528   /******************* Bottleneck 14 *******************/
529   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
530   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  160,  960});
531   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  960,  240});
532   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  240,  960});
533   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  960,  160});
534   /******************* Bottleneck 15 *******************/
535   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
536 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  160,  960});
537 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  960,  240});
538 //b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  240,  960});
539 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  960,  160});
540   /******************** Last Stage *********************/
541   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
542 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  160,  960});
543   b->Args({  1,   1,  1,  1,  0,  0, 1, 1,  960, 1280});
544   b->Args({  1,   1,  1,  1,  0,  0, 1, 1, 1280, 1001});
545 }
546 
547 // SqueezeNet 1.0
SqueezeNetV10ConvArguments(benchmark::internal::Benchmark * b)548 static void SqueezeNetV10ConvArguments(benchmark::internal::Benchmark* b) {
549   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
550 
551   /*********************** Conv 1 **********************/
552   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
553   b->Args({224, 224,  7,  7,  6,  6, 2, 1,    3,   96});
554   /*********************** Fire 2 **********************/
555   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
556   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   96,   16});
557   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   16,   64});
558   b->Args({ 55,  55,  3,  3,  2,  2, 1, 1,   16,   64});
559   /*********************** Fire 3 **********************/
560   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
561   b->Args({ 56,  55,  1,  1,  0,  0, 1, 1,  128,   16});
562 //b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   16,   64});
563 //b->Args({ 55,  55,  3,  3,  2,  2, 1, 1,   16,   64});
564   /*********************** Fire 4 **********************/
565   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
566   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,  128,   32});
567   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   32,  128});
568   b->Args({ 55,  55,  3,  3,  2,  2, 1, 1,   32,  128});
569   /*********************** Fire 5 **********************/
570   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
571   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,  256,   32});
572   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,   32,  128});
573   b->Args({ 27,  27,  3,  3,  2,  2, 1, 1,   32,  128});
574   /*********************** Fire 6 **********************/
575   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
576   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,  256,   48});
577   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,   48,  192});
578   b->Args({ 27,  27,  3,  3,  2,  2, 1, 1,   48,  192});
579   /*********************** Fire 7 **********************/
580   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
581   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,  384,   48});
582 //b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,   48,  192});
583 //b->Args({ 27,  27,  3,  3,  2,  2, 1, 1,   48,  192});
584   /*********************** Fire 8 **********************/
585   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
586   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,  384,   64});
587   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,   64,  256});
588   b->Args({ 27,  27,  3,  3,  2,  2, 1, 1,   64,  256});
589   /*********************** Fire 9 **********************/
590   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
591   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  512,   64});
592   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,   64,  256});
593   b->Args({ 13,  13,  3,  3,  2,  2, 1, 1,   64,  256});
594   /********************** Conv 10 **********************/
595   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
596   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  512, 1000});
597 }
598 
599 // SqueezeNet 1.1
SqueezeNetV11ConvArguments(benchmark::internal::Benchmark * b)600 static void SqueezeNetV11ConvArguments(benchmark::internal::Benchmark* b) {
601   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
602 
603   /*********************** Conv 1 **********************/
604   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
605   b->Args({224, 224,  3,  3,  2,  2, 2, 1,    3,   64});
606   /*********************** Fire 2 **********************/
607   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
608   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   64,   16});
609   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   16,   64});
610   b->Args({ 55,  55,  3,  3,  2,  2, 1, 1,   16,   64});
611   /*********************** Fire 3 **********************/
612   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
613   b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,  128,   16});
614 //b->Args({ 55,  55,  1,  1,  0,  0, 1, 1,   16,   64});
615 //b->Args({ 55,  55,  3,  3,  2,  2, 1, 1,   16,   64});
616   /*********************** Fire 4 **********************/
617   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
618   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,  128,   32});
619   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,   32,  128});
620   b->Args({ 27,  27,  3,  3,  2,  2, 1, 1,   32,  128});
621   /*********************** Fire 5 **********************/
622   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
623   b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,  256,   32});
624 //b->Args({ 27,  27,  1,  1,  0,  0, 1, 1,   32,  128});
625 //b->Args({ 27,  27,  3,  3,  2,  2, 1, 1,   32,  128});
626   /*********************** Fire 6 **********************/
627   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
628   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  256,   48});
629   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,   48,  192});
630   b->Args({ 13,  13,  3,  3,  2,  2, 1, 1,   48,  192});
631   /*********************** Fire 7 **********************/
632   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
633   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  384,   48});
634 //b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,   48,  192});
635 //b->Args({ 13,  13,  3,  3,  2,  2, 1, 1,   48,  192});
636   /*********************** Fire 8 **********************/
637   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
638   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  384,   64});
639   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,   64,  256});
640   b->Args({ 13,  13,  3,  3,  2,  2, 1, 1,   64,  256});
641   /*********************** Fire 9 **********************/
642   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
643   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  512,   64});
644 //b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,   64,  256});
645 //b->Args({ 13,  13,  3,  3,  2,  2, 1, 1,   64,  256});
646   /********************** Conv 10 **********************/
647   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
648   b->Args({ 13,  13,  1,  1,  0,  0, 1, 1,  512, 1000});
649 }
650 
InceptionV3ConvArguments(benchmark::internal::Benchmark * b)651 static void InceptionV3ConvArguments(benchmark::internal::Benchmark* b) {
652   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
653 
654   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
655   b->Args({299, 299,  3,  3,  0,  0, 2, 1,    3,   32});
656   b->Args({149, 149,  3,  3,  0,  0, 1, 1,   32,   32});
657   b->Args({147, 147,  3,  3,  2,  2, 1, 1,   32,   64});
658   b->Args({ 73,  73,  1,  1,  0,  0, 1, 1,   64,   80});
659   b->Args({ 73,  73,  3,  3,  0,  0, 1, 1,   80,  192});
660   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  192,   64});
661   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  192,   48});
662   b->Args({ 35,  35,  5,  5,  4,  4, 1, 1,   48,   64});
663   b->Args({ 35,  35,  3,  3,  2,  2, 1, 1,   64,   96});
664   b->Args({ 35,  35,  3,  3,  2,  2, 1, 1,   96,   96});
665   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  192,   32});
666   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  256,   64});
667   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  256,   48});
668   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  288,   64});
669   b->Args({ 35,  35,  1,  1,  0,  0, 1, 1,  288,   48});
670   b->Args({ 35,  35,  3,  3,  0,  0, 2, 1,  288,  384});
671   b->Args({ 35,  35,  3,  3,  0,  0, 2, 1,   96,   96});
672   b->Args({ 17,  17,  1,  1,  0,  0, 1, 1,  768,  192});
673   b->Args({ 17,  17,  1,  1,  0,  0, 1, 1,  768,  128});
674   b->Args({ 17,  17,  1,  7,  0,  6, 1, 1,  128,  128});
675   b->Args({ 17,  17,  7,  1,  6,  0, 1, 1,  128,  192});
676   b->Args({ 17,  17,  7,  1,  6,  0, 1, 1,  128,  128});
677   b->Args({ 17,  17,  1,  7,  0,  6, 1, 1,  128,  192});
678   b->Args({ 17,  17,  1,  1,  0,  0, 1, 1,  768,  160});
679   b->Args({ 17,  17,  1,  7,  0,  6, 1, 1,  160,  160});
680   b->Args({ 17,  17,  7,  1,  6,  0, 1, 1,  160,  192});
681   b->Args({ 17,  17,  7,  1,  6,  0, 1, 1,  160,  160});
682   b->Args({ 17,  17,  1,  7,  0,  6, 1, 1,  160,  192});
683   b->Args({ 17,  17,  1,  7,  0,  6, 1, 1,  192,  192});
684   b->Args({ 17,  17,  7,  1,  6,  0, 1, 1,  192,  192});
685   b->Args({ 17,  17,  3,  3,  0,  0, 2, 1,  192,  320});
686   b->Args({ 17,  17,  3,  3,  0,  0, 2, 1,  192,  192});
687   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 1280,  320});
688   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 1280,  384});
689   b->Args({  8,   8,  1,  3,  0,  2, 1, 1,  384,  384});
690   b->Args({  8,   8,  3,  1,  2,  0, 1, 1,  384,  384});
691   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 1280,  448});
692   b->Args({  8,   8,  3,  3,  2,  2, 1, 1,  448,  384});
693   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 1280,  192});
694   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 2048,  320});
695   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 2048,  384});
696   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 2048,  448});
697   b->Args({  8,   8,  1,  1,  0,  0, 1, 1, 2048,  192});
698   b->Args({  1,   1,  1,  1,  0,  0, 1, 1, 2048, 1001});
699 }
700 
ResNet18ConvArguments(benchmark::internal::Benchmark * b)701 static void ResNet18ConvArguments(benchmark::internal::Benchmark* b) {
702   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
703 
704   /********************** Conv 1 ***********************/
705   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
706   b->Args({224, 224,  7,  7,  6,  6, 2, 1,    3,   64});
707   /********************* Conv 2.X **********************/
708   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
709   b->Args({ 56,  56,  3,  3,  2,  2, 1, 1,   64,   64});
710   /********************* Conv 3.X **********************/
711   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
712   b->Args({ 56,  56,  3,  3,  2,  2, 2, 1,   64,  128});
713   b->Args({ 28,  28,  3,  3,  2,  2, 1, 1,  128,  128});
714   b->Args({ 56,  56,  1,  1,  0,  0, 2, 1,   64,  128});
715   /********************* Conv 4.X **********************/
716   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
717   b->Args({ 28,  28,  3,  3,  2,  2, 2, 1,  128,  256});
718   b->Args({ 14,  14,  3,  3,  2,  2, 1, 1,  256,  256});
719   b->Args({ 28,  28,  1,  1,  0,  0, 2, 1,  128,  256});
720   /********************* Conv 5.X **********************/
721   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
722   b->Args({ 14,  14,  3,  3,  2,  2, 2, 1,  256,  512});
723   b->Args({  7,   7,  3,  3,  2,  2, 1, 1,  512,  512});
724   b->Args({ 14,  14,  1,  1,  0,  0, 2, 1,  256,  512});
725 }
726 
ResNet50ConvArguments(benchmark::internal::Benchmark * b)727 static void ResNet50ConvArguments(benchmark::internal::Benchmark* b) {
728   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
729 
730   /********************** Conv 1 ***********************/
731   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
732   b->Args({224, 224,  7,  7,  6,  6, 2, 1,    3,   64});
733   /********************* Conv 2.1 **********************/
734   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
735   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   64,   64});
736   b->Args({ 56,  56,  3,  3,  2,  2, 1, 1,   64,   64});
737   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   64,  256});
738 //b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   64,  256});
739   /********************* Conv 2.X **********************/
740   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
741   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,  256,   64});
742 //b->Args({ 56,  56,  3,  3,  2,  2, 1, 1,   64,   64});
743 //b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,   64,  256});
744   /********************** Conv 3.1 *********************/
745   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
746   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,  256,  128});
747   b->Args({ 56,  56,  3,  3,  2,  2, 2, 1,  128,  128});
748   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  128,  512});
749   b->Args({ 56,  56,  1,  1,  0,  0, 2, 1,  256,  512});
750   /********************** Conv 3.X *********************/
751   /*         H    W   KH  KW PH  PW  S  D  GCin  GCout */
752   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  512,  128});
753   b->Args({ 28,  28,  3,  3,  2,  2, 1, 1,  128,  128});
754 //b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  128,  512});
755   /********************** Conv 4.1 *********************/
756   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
757   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  512,  256});
758   b->Args({ 28,  28,  3,  3,  2,  2, 2, 1,  256,  256});
759   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  256, 1024});
760   b->Args({ 28,  28,  1,  1,  0,  0, 2, 1,  512, 1024});
761   /********************** Conv 4.X *********************/
762   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
763   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1, 1024,  256});
764   b->Args({ 14,  14,  3,  3,  2,  2, 1, 1,  256,  256});
765 //b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  256, 1024});
766   /********************** Conv 5.1 *********************/
767   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
768   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1, 1024,  512});
769   b->Args({ 14,  14,  3,  3,  2,  2, 2, 1,  512,  512});
770   b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  512, 2048});
771   b->Args({ 14,  14,  1,  1,  0,  0, 2, 1, 1024, 2048});
772   /********************** Conv 5.X *********************/
773   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
774   b->Args({  7,   7,  1,  1,  0,  0, 1, 1, 2048,  512});
775   b->Args({  7,   7,  3,  3,  2,  2, 1, 1,  512,  512});
776 //b->Args({  7,   7,  1,  1,  0,  0, 1, 1,  512, 2048});
777 }
778 
VGGConvArguments(benchmark::internal::Benchmark * b)779 static void VGGConvArguments(benchmark::internal::Benchmark* b) {
780   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
781 
782   /********************** Conv 1.1 *********************/
783   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
784   b->Args({224, 224,  3,  3,  2,  2, 1, 1,    3,   64});
785   /********************** Conv 1.2 *********************/
786   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
787   b->Args({224, 224,  3,  3,  2,  2, 1, 1,   64,   64});
788 
789   /********************** Conv 2.1 *********************/
790   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
791   b->Args({112, 112,  3,  3,  2,  2, 1, 1,   64,  128});
792   /********************** Conv 2.2 *********************/
793   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
794   b->Args({112, 112,  3,  3,  2,  2, 1, 1,  128,  128});
795 
796   /********************** Conv 3.1 *********************/
797   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
798   b->Args({ 56,  56,  3,  3,  2,  2, 1, 1,  128,  256});
799   /********************** Conv 3.2 *********************/
800   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
801   b->Args({ 56,  56,  3,  3,  2,  2, 1, 1,  256,  256});
802   /********************** Conv 3.3 *********************/
803   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
804   b->Args({ 56,  56,  1,  1,  0,  0, 1, 1,  256,  256});
805 
806   /********************** Conv 4.1 *********************/
807   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
808   b->Args({ 28,  28,  3,  3,  2,  2, 1, 1,  256,  512});
809   /********************** Conv 4.2 *********************/
810   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
811   b->Args({ 28,  28,  3,  3,  2,  2, 1, 1,  512,  512});
812   /********************** Conv 4.3 *********************/
813   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
814   b->Args({ 28,  28,  1,  1,  0,  0, 1, 1,  512,  512});
815 
816   /********************** Conv 5.X *********************/
817   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
818   b->Args({ 14,  14,  3,  3,  2,  2, 1, 1,  512,  512});
819   /********************** Conv 5.3 *********************/
820   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
821   b->Args({ 14,  14,  1,  1,  0,  0, 1, 1,  512,  512});
822 }
823 
824 // SRCNN (9-1-5)
SRCNN915ConvArguments(benchmark::internal::Benchmark * b)825 static void SRCNN915ConvArguments(benchmark::internal::Benchmark* b) {
826   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
827 
828   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
829   b->Args({384, 384,  9,  9,  0,  0, 1, 1,    1,   64});
830   b->Args({376, 376,  1,  1,  0,  0, 1, 1,   64,   32});
831   b->Args({376, 376,  5,  5,  0,  0, 1, 1,   32,    1});
832 }
833 
834 // SRCNN (9-3-5)
SRCNN935ConvArguments(benchmark::internal::Benchmark * b)835 static void SRCNN935ConvArguments(benchmark::internal::Benchmark* b) {
836   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
837 
838   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
839   b->Args({384, 384,  9,  9,  0,  0, 1, 1,    1,   64});
840   b->Args({376, 376,  3,  3,  0,  0, 1, 1,   64,   32});
841   b->Args({374, 374,  5,  5,  0,  0, 1, 1,   32,    1});
842 }
843 
844 // SRCNN (9-5-5)
SRCNN955ConvArguments(benchmark::internal::Benchmark * b)845 static void SRCNN955ConvArguments(benchmark::internal::Benchmark* b) {
846   b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "GCin", "GCout"});
847 
848   /*        H    W   KH  KW  PH  PW  S  D  GCin  GCout */
849   b->Args({384, 384,  9,  9,  0,  0, 1, 1,    1,   64});
850   b->Args({376, 376,  5,  5,  0,  0, 1, 1,   64,   32});
851   b->Args({372, 372,  5,  5,  0,  0, 1, 1,   32,    1});
852 }
853