blob: 2ae893bdec5083bb9506aa01557277071761ce7d [file] [log] [blame]
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01001/*
giuros01154bc1c2019-03-26 17:44:40 +00002 * Copyright (c) 2017-2019 ARM Limited.
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/core/TensorShape.h"
25#include "arm_compute/core/Types.h"
26#include "arm_compute/runtime/NEON/functions/NEConvolutionLayer.h"
giuros01154bc1c2019-03-26 17:44:40 +000027#include "arm_compute/runtime/NEON/functions/NEFFTConvolutionLayer.h"
Georgios Pinitas9fb11592018-04-26 20:34:58 +010028#include "arm_compute/runtime/NEON/functions/NEWinogradConvolutionLayer.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010029#include "arm_compute/runtime/Tensor.h"
30#include "arm_compute/runtime/TensorAllocator.h"
Moritz Pflanzerd58cec02017-07-18 15:44:21 +010031#include "tests/NEON/Accessor.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010032#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h"
giuros01154bc1c2019-03-26 17:44:40 +000033#include "tests/benchmark/fixtures/FFTConvolutionLayerFixture.h"
Georgios Pinitas9fb11592018-04-26 20:34:58 +010034#include "tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h"
giuros01154bc1c2019-03-26 17:44:40 +000035#include "tests/datasets/SmallConvolutionLayerDataset.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010036#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h"
37#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h"
38#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h"
39#include "tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h"
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000040#include "tests/datasets/system_tests/mobilenet/MobileNetConvolutionLayerDataset.h"
giuros01154bc1c2019-03-26 17:44:40 +000041#include "tests/datasets/system_tests/resnet12/ResNet12ConvolutionLayerDataset.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010042#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h"
43#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h"
44#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h"
45#include "tests/framework/Macros.h"
46#include "tests/framework/datasets/Datasets.h"
Anthony Barbier2a07e182017-08-04 18:20:27 +010047#include "utils/TypePrinter.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010048
49namespace arm_compute
50{
51namespace test
52{
Michalis Spyrou724079d2017-12-15 11:37:37 +000053namespace benchmark
54{
Pablo Tello40b29272017-07-19 16:56:05 +010055namespace
56{
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000057#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
Isabella Gottardie6630e42018-01-18 15:50:39 +000058const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32, DataType::QASYMM8 });
59#else /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
60const auto data_types = framework::dataset::make("DataType", { DataType::F32, DataType::QASYMM8 });
61
Ioan-Cristian Szabo5edbd1c2017-11-13 13:34:08 +000062#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Pablo Tello40b29272017-07-19 16:56:05 +010063} // namespace
64
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +000065using NEGEMMConvolutionLayerFixture = ConvolutionLayerFixture<Tensor, NEGEMMConvolutionLayer, Accessor>;
giuros01154bc1c2019-03-26 17:44:40 +000066using NEFFTConvolutionLayerFixture = FFTConvolutionLayerFixture<Tensor, NEFFTConvolutionLayer, Accessor>;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010067
68TEST_SUITE(NEON)
Pablo Tello8108d2e2017-12-01 09:58:32 +000069#if defined(__aarch64__)
Georgios Pinitas9fb11592018-04-26 20:34:58 +010070using NEWinogradConvolutionLayerFixture = WinogradConvolutionLayerFixture<Tensor, NEWinogradConvolutionLayer, Accessor>;
Pablo Tello8108d2e2017-12-01 09:58:32 +000071
Georgios Pinitas9fb11592018-04-26 20:34:58 +010072REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetWinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000073 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::AlexNetWinogradLayerDataset(),
74 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
75 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +000076 framework::dataset::make("Batches", 1)));
77
Georgios Pinitas9fb11592018-04-26 20:34:58 +010078REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1WinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000079 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1WinogradLayerDataset(),
80 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
81 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +000082 framework::dataset::make("Batches", 1)));
83
Georgios Pinitas9fb11592018-04-26 20:34:58 +010084REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4WinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000085 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4WinogradLayerDataset(),
86 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
87 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +000088 framework::dataset::make("Batches", 1)));
89
Georgios Pinitas9fb11592018-04-26 20:34:58 +010090REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetWinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +000091 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetWinogradLayerDataset(),
92 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
93 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +000094 framework::dataset::make("Batches", 1)));
95#endif /* __aarch64__ */
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010096
giuros01154bc1c2019-03-26 17:44:40 +000097REGISTER_FIXTURE_DATA_TEST_CASE(ResNet12FFTLayer, NEFFTConvolutionLayerFixture, framework::DatasetMode::ALL,
98 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::ResNet12FFTConvolutionLayerDataset(),
99 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
100 framework::dataset::make("DataType", { DataType::F32 })),
101 framework::dataset::make("Batches", 1)));
102
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000103REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000104 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(),
105 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
106 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100107 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100108
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000109REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000110 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(),
111 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
112 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100113 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100114
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000115REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000116 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1ConvolutionLayerDataset(),
117 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
118 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100119 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100120
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000121REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000122 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4ConvolutionLayerDataset(),
123 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
124 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100125 framework::dataset::make("Batches", 1)));
SiCong Lif583fb72017-08-15 15:09:18 +0100126
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000127REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000128 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(),
129 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
130 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100131 framework::dataset::make("Batches", 1)));
SiCong Li0aea8902017-07-21 18:24:36 +0100132
Gian Marco Iodice2bc74412018-03-01 16:32:10 +0000133REGISTER_FIXTURE_DATA_TEST_CASE(MobileNetConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000134 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::MobileNetConvolutionLayerDataset(),
135 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
136 data_types),
Gian Marco Iodice2bc74412018-03-01 16:32:10 +0000137 framework::dataset::make("Batches", 1)));
138
SiCong Li1e5c1572017-07-27 17:58:52 +0100139TEST_SUITE(NIGHTLY)
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000140REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000141 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(),
142 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
143 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100144 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100145
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000146REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000147 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(),
148 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
149 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100150 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100151
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000152REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000153 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1ConvolutionLayerDataset(),
154 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
155 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100156 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100157
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000158REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000159 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4ConvolutionLayerDataset(),
160 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
161 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100162 framework::dataset::make("Batches", { 4, 8 })));
SiCong Lif583fb72017-08-15 15:09:18 +0100163
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000164REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000165 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(),
166 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
167 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100168 framework::dataset::make("Batches", { 4, 8 })));
169
Moritz Pflanzer70e9bc22017-09-08 16:07:10 +0100170// 8 batches use about 2GB of memory which is too much for most devices!
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000171REGISTER_FIXTURE_DATA_TEST_CASE(VGG16ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000172 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::VGG16ConvolutionLayerDataset(),
173 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
174 data_types),
Gian Marco33da05b2017-11-08 14:13:33 +0000175 framework::dataset::make("Batches", { 1, 2 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100176
Isabella Gottardi6acc6ad2018-02-02 17:19:18 +0000177REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ConvolutionLayer, NEGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000178 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(),
179 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
180 data_types),
SiCong Li1e5c1572017-07-27 17:58:52 +0100181 framework::dataset::make("Batches", { 1, 4, 8 })));
SiCong Licc65bbe2017-08-18 11:58:21 +0100182
Pablo Tello8108d2e2017-12-01 09:58:32 +0000183#if defined(__aarch64__)
Georgios Pinitas9fb11592018-04-26 20:34:58 +0100184REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetWinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000185 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::AlexNetWinogradLayerDataset(),
186 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
187 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +0000188 framework::dataset::make("Batches", { 4, 8 })));
189
Georgios Pinitas9fb11592018-04-26 20:34:58 +0100190REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1WinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000191 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1WinogradLayerDataset(),
192 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
193 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +0000194 framework::dataset::make("Batches", { 4, 8 })));
195
Georgios Pinitas9fb11592018-04-26 20:34:58 +0100196REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4WinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000197 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4WinogradLayerDataset(),
198 framework::dataset::make("ActivationInfo", ActivationLayerInfo())),
199 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +0000200 framework::dataset::make("Batches", { 4, 8 })));
201
Georgios Pinitas9fb11592018-04-26 20:34:58 +0100202REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetWinogradLayer, NEWinogradConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
Isabella Gottardi3f217ec2018-02-12 14:59:19 +0000203 framework::dataset::combine(framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetWinogradLayerDataset(),
204 framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU))),
205 framework::dataset::make("DataType", DataType::F32)),
Pablo Tello8108d2e2017-12-01 09:58:32 +0000206 framework::dataset::make("Batches", { 4, 8 })));
207#endif /* __aarch64__ */
208
SiCong Li1e5c1572017-07-27 17:58:52 +0100209TEST_SUITE_END()
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100210TEST_SUITE_END()
Michalis Spyrou724079d2017-12-15 11:37:37 +0000211} // namespace benchmark
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100212} // namespace test
213} // namespace arm_compute