|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once |
|
|
|
#include <benchmark/benchmark.h> |
|
|
|
|
|
#define BENCHMARK_DWCONV(dwconv_fn) \ |
|
BENCHMARK_CAPTURE(dwconv_fn, mobilenet_v1, "MobileNet v1")->Apply(MobileNetV1DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, mobilenet_v2, "MobileNet v2")->Apply(MobileNetV2DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, mobilenet_v3_small, "MobileNet v3 Small")->Apply(MobileNetV3SmallDWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, mobilenet_v3_large, "MobileNet v3 Large")->Apply(MobileNetV3LargeDWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v1_g1, "ShuffleNet v1 (1 group)")->Apply(ShuffleNetV1G1DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v1_g2, "ShuffleNet v1 (2 groups)")->Apply(ShuffleNetV1G2DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v1_g3, "ShuffleNet v1 (3 groups)")->Apply(ShuffleNetV1G3DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v1_g4, "ShuffleNet v1 (4 groups)")->Apply(ShuffleNetV1G4DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v1_g8, "ShuffleNet v1 (8 groups)")->Apply(ShuffleNetV1G8DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v2_x05, "ShuffleNet v2 0.5X")->Apply(ShuffleNetV2X05DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v2_x10, "ShuffleNet v2 1.0X")->Apply(ShuffleNetV2X10DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v2_x15, "ShuffleNet v2 1.5X")->Apply(ShuffleNetV2X15DWConvArguments)->UseRealTime(); \ |
|
BENCHMARK_CAPTURE(dwconv_fn, shufflenet_v2_x20, "ShuffleNet v2 2.0X")->Apply(ShuffleNetV2X20DWConvArguments)->UseRealTime(); |
|
|
|
|
|
|
|
static void ShuffleNetV1G1DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 36}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 36}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 72}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 72}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 144}); |
|
|
|
|
|
b->Args({ 7, 7, 3, 3, 2, 2, 2, 1, 144}); |
|
} |
|
|
|
|
|
static void ShuffleNetV1G2DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 50}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 50}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 100}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 100}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 200}); |
|
|
|
|
|
b->Args({ 7, 7, 3, 3, 2, 2, 2, 1, 200}); |
|
} |
|
|
|
|
|
static void ShuffleNetV1G3DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 60}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 60}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 120}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 120}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 240}); |
|
|
|
|
|
b->Args({ 7, 7, 3, 3, 2, 2, 2, 1, 240}); |
|
} |
|
|
|
|
|
static void ShuffleNetV1G4DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 68}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 68}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 136}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 136}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 272}); |
|
|
|
|
|
b->Args({ 7, 7, 3, 3, 2, 2, 2, 1, 272}); |
|
} |
|
|
|
|
|
static void ShuffleNetV1G8DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 96}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 96}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 192}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 192}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 384}); |
|
|
|
|
|
b->Args({ 7, 7, 3, 3, 2, 2, 2, 1, 384}); |
|
} |
|
|
|
|
|
static void ShuffleNetV2X05DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 24}); |
|
b->Args({28, 28, 3, 3, 2, 2, 1, 1, 24}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 48}); |
|
b->Args({14, 14, 3, 3, 2, 2, 1, 1, 48}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 96}); |
|
b->Args({ 7, 7, 3, 3, 2, 2, 1, 1, 96}); |
|
} |
|
|
|
|
|
static void ShuffleNetV2X10DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 24}); |
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 58}); |
|
b->Args({28, 28, 3, 3, 2, 2, 1, 1, 58}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 116}); |
|
b->Args({14, 14, 3, 3, 2, 2, 1, 1, 116}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 232}); |
|
b->Args({ 7, 7, 3, 3, 2, 2, 1, 1, 232}); |
|
} |
|
|
|
|
|
static void ShuffleNetV2X15DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 24}); |
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 88}); |
|
b->Args({28, 28, 3, 3, 2, 2, 1, 1, 88}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 176}); |
|
b->Args({14, 14, 3, 3, 2, 2, 1, 1, 176}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 352}); |
|
b->Args({ 7, 7, 3, 3, 2, 2, 1, 1, 352}); |
|
} |
|
|
|
|
|
static void ShuffleNetV2X20DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 24}); |
|
b->Args({56, 56, 3, 3, 2, 2, 2, 1, 122}); |
|
b->Args({28, 28, 3, 3, 2, 2, 1, 1, 122}); |
|
|
|
|
|
b->Args({28, 28, 3, 3, 2, 2, 2, 1, 244}); |
|
b->Args({14, 14, 3, 3, 2, 2, 1, 1, 244}); |
|
|
|
|
|
b->Args({14, 14, 3, 3, 2, 2, 2, 1, 488}); |
|
b->Args({ 7, 7, 3, 3, 2, 2, 1, 1, 488}); |
|
} |
|
|
|
static void MobileNetV1DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
b->Args({112, 112, 3, 3, 2, 2, 1, 1, 32}); |
|
b->Args({112, 112, 3, 3, 2, 2, 2, 1, 64}); |
|
b->Args({ 56, 56, 3, 3, 2, 2, 1, 1, 128}); |
|
b->Args({ 56, 56, 3, 3, 2, 2, 2, 1, 128}); |
|
b->Args({ 28, 28, 3, 3, 2, 2, 1, 1, 256}); |
|
b->Args({ 28, 28, 3, 3, 2, 2, 2, 1, 256}); |
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 512}); |
|
b->Args({ 14, 14, 3, 3, 2, 2, 2, 1, 512}); |
|
b->Args({ 7, 7, 3, 3, 2, 2, 1, 1, 1024}); |
|
} |
|
|
|
static void MobileNetV2DWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({112, 112, 3, 3, 2, 2, 1, 1, 32}); |
|
|
|
|
|
|
|
b->Args({112, 112, 3, 3, 2, 2, 2, 1, 96}); |
|
b->Args({ 56, 56, 3, 3, 2, 2, 1, 1, 144}); |
|
|
|
|
|
|
|
b->Args({ 56, 56, 3, 3, 2, 2, 2, 1, 144}); |
|
b->Args({ 28, 28, 3, 3, 2, 2, 1, 1, 192}); |
|
|
|
|
|
|
|
|
|
b->Args({ 28, 28, 3, 3, 2, 2, 2, 1, 192}); |
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 384}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 576}); |
|
|
|
|
|
|
|
|
|
b->Args({ 14, 14, 3, 3, 2, 2, 2, 1, 576}); |
|
b->Args({ 7, 7, 3, 3, 2, 2, 1, 1, 960}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
static void MobileNetV3SmallDWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({112, 112, 3, 3, 2, 2, 2, 1, 16}); |
|
|
|
|
|
b->Args({ 56, 56, 3, 3, 2, 2, 2, 1, 72}); |
|
|
|
|
|
b->Args({ 28, 28, 3, 3, 2, 2, 1, 1, 88}); |
|
|
|
|
|
b->Args({ 28, 28, 5, 5, 4, 4, 2, 1, 96}); |
|
|
|
|
|
b->Args({ 14, 14, 5, 5, 4, 4, 1, 1, 240}); |
|
|
|
|
|
|
|
|
|
|
|
b->Args({ 14, 14, 5, 5, 4, 4, 1, 1, 120}); |
|
|
|
|
|
b->Args({ 14, 14, 5, 5, 4, 4, 1, 1, 144}); |
|
|
|
|
|
b->Args({ 14, 14, 5, 5, 4, 4, 2, 1, 288}); |
|
|
|
|
|
b->Args({ 7, 7, 5, 5, 4, 4, 1, 1, 576}); |
|
|
|
|
|
|
|
} |
|
|
|
static void MobileNetV3LargeDWConvArguments(benchmark::internal::Benchmark* b) { |
|
b->ArgNames({"H", "W", "KH", "KW", "PH", "PW", "S", "D", "G"}); |
|
|
|
|
|
|
|
b->Args({112, 112, 3, 3, 2, 2, 1, 1, 16}); |
|
|
|
|
|
b->Args({112, 112, 3, 3, 2, 2, 2, 1, 64}); |
|
|
|
|
|
b->Args({ 56, 56, 3, 3, 2, 2, 1, 1, 72}); |
|
|
|
|
|
b->Args({ 56, 56, 5, 5, 4, 4, 2, 1, 72}); |
|
|
|
|
|
b->Args({ 28, 28, 5, 5, 4, 4, 1, 1, 120}); |
|
|
|
|
|
|
|
|
|
|
|
b->Args({ 28, 28, 3, 3, 2, 2, 2, 1, 240}); |
|
|
|
|
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 200}); |
|
|
|
|
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 184}); |
|
|
|
|
|
|
|
|
|
|
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 480}); |
|
|
|
|
|
b->Args({ 14, 14, 3, 3, 2, 2, 1, 1, 672}); |
|
|
|
|
|
b->Args({ 14, 14, 5, 5, 4, 4, 2, 1, 672}); |
|
|
|
|
|
b->Args({ 7, 7, 5, 5, 4, 4, 1, 1, 960}); |
|
|
|
|
|
|
|
} |
|
|