xref: /aosp_15_r20/external/XNNPACK/bench/dconv.h (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
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_DCONV(conv_fn) \
15   BENCHMARK_CAPTURE(conv_fn, mobilenet_v1, "MobileNet v1/v2")->Apply(MobileNetConvArguments)->UseRealTime(); \
16   BENCHMARK_CAPTURE(conv_fn, mobilenet_v3, "MobileNet v3")->Apply(MobileNetV3ConvArguments)->UseRealTime(); \
17   BENCHMARK_CAPTURE(conv_fn, shufflenet, "ShuffleNet v1/v2")->Apply(ShuffleNetConvArguments)->UseRealTime(); \
18   BENCHMARK_CAPTURE(conv_fn, squeezenet_v11, "SqueezeNet 1.1")->Apply(SqueezeNetV11ConvArguments)->UseRealTime();
19 
20 
21 // ShuffleNet v1/v2.
ShuffleNetConvArguments(benchmark::internal::Benchmark * b)22 static void ShuffleNetConvArguments(benchmark::internal::Benchmark* b) {
23   b->ArgNames({"H", "W", "Cout"});
24 
25   /********* Conv 1 ********/
26   /*        H    W   GCout */
27   b->Args({224, 224,   24});
28 }
29 
30 // MobileNet v1/v2.
MobileNetConvArguments(benchmark::internal::Benchmark * b)31 static void MobileNetConvArguments(benchmark::internal::Benchmark* b) {
32   b->ArgNames({"H", "W", "Cout"});
33 
34   /*        H    W   GCout */
35   b->Args({224, 224,   32});
36 }
37 
38 // MobileNet v3 Small/Large.
MobileNetV3ConvArguments(benchmark::internal::Benchmark * b)39 static void MobileNetV3ConvArguments(benchmark::internal::Benchmark* b) {
40   b->ArgNames({"H", "W", "Cout"});
41 
42   /******************* Initial Stage *******************/
43   /*        H    W   GCout */
44   b->Args({224, 224,   16});
45 }
46 
47 // SqueezeNet 1.1
SqueezeNetV11ConvArguments(benchmark::internal::Benchmark * b)48 static void SqueezeNetV11ConvArguments(benchmark::internal::Benchmark* b) {
49   b->ArgNames({"H", "W", "GCout"});
50 
51   /*********************** Conv 1 **********************/
52   /*        H    W   GCout */
53   b->Args({224, 224,   64});
54 }
55