blob: e9cc23c284e21fd68c5c28351645cb24c1c56041 [file] [log] [blame]
Moritz Pflanzeree493ae2017-07-05 10:52:21 +01001/*
Georgios Pinitas51a67302018-01-17 12:55:26 +00002 * Copyright (c) 2017-2018 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/CL/CLTensor.h"
27#include "arm_compute/runtime/CL/CLTensorAllocator.h"
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000028#include "arm_compute/runtime/CL/functions/CLGEMMConvolutionLayer.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010029#include "tests/CL/CLAccessor.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010030#include "tests/benchmark/fixtures/ConvolutionLayerFixture.h"
31#include "tests/datasets/system_tests/alexnet/AlexNetConvolutionLayerDataset.h"
32#include "tests/datasets/system_tests/googlenet/inceptionv1/GoogLeNetInceptionV1ConvolutionLayerDataset.h"
33#include "tests/datasets/system_tests/googlenet/inceptionv4/GoogLeNetInceptionV4ConvolutionLayerDataset.h"
34#include "tests/datasets/system_tests/lenet5/LeNet5ConvolutionLayerDataset.h"
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000035#include "tests/datasets/system_tests/mobilenet/MobileNetConvolutionLayerDataset.h"
Moritz Pflanzera09de0c2017-09-01 20:41:12 +010036#include "tests/datasets/system_tests/squeezenet/SqueezeNetConvolutionLayerDataset.h"
37#include "tests/datasets/system_tests/vgg/vgg16/VGG16ConvolutionLayerDataset.h"
38#include "tests/datasets/system_tests/yolo/v2/YOLOV2ConvolutionLayerDataset.h"
39#include "tests/framework/Macros.h"
40#include "tests/framework/datasets/Datasets.h"
Anthony Barbier2a07e182017-08-04 18:20:27 +010041#include "utils/TypePrinter.h"
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010042
43namespace arm_compute
44{
45namespace test
46{
SiCong Li1e5c1572017-07-27 17:58:52 +010047namespace
48{
Georgios Pinitas51a67302018-01-17 12:55:26 +000049const auto data_types = framework::dataset::make("DataType", { DataType::F16, DataType::F32 });
SiCong Li1e5c1572017-07-27 17:58:52 +010050} // namespace
51
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000052using CLGEMMConvolutionLayerFixture = ConvolutionLayerFixture<CLTensor, CLGEMMConvolutionLayer, CLAccessor>;
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010053
54TEST_SUITE(CL)
55
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000056REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
SiCong Li1e5c1572017-07-27 17:58:52 +010057 framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(),
58 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010059 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010060
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000061REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
SiCong Li1e5c1572017-07-27 17:58:52 +010062 framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(),
63 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010064 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010065
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000066REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
SiCong Lid763cfb2017-08-15 12:38:51 +010067 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1ConvolutionLayerDataset(),
SiCong Li1e5c1572017-07-27 17:58:52 +010068 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010069 framework::dataset::make("Batches", 1)));
Moritz Pflanzeree493ae2017-07-05 10:52:21 +010070
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000071REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
SiCong Lif583fb72017-08-15 15:09:18 +010072 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4ConvolutionLayerDataset(),
73 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010074 framework::dataset::make("Batches", 1)));
SiCong Lif583fb72017-08-15 15:09:18 +010075
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000076REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
SiCong Li1e5c1572017-07-27 17:58:52 +010077 framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(),
78 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010079 framework::dataset::make("Batches", 1)));
SiCong Li0aea8902017-07-21 18:24:36 +010080
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000081REGISTER_FIXTURE_DATA_TEST_CASE(MobileNetConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::ALL,
82 framework::dataset::combine(framework::dataset::combine(datasets::MobileNetConvolutionLayerDataset(),
83 data_types),
84 framework::dataset::make("Batches", 1)));
85
SiCong Li1e5c1572017-07-27 17:58:52 +010086TEST_SUITE(NIGHTLY)
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000087REGISTER_FIXTURE_DATA_TEST_CASE(AlexNetConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Li1e5c1572017-07-27 17:58:52 +010088 framework::dataset::combine(framework::dataset::combine(datasets::AlexNetConvolutionLayerDataset(),
89 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010090 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010091
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000092REGISTER_FIXTURE_DATA_TEST_CASE(LeNet5ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Li1e5c1572017-07-27 17:58:52 +010093 framework::dataset::combine(framework::dataset::combine(datasets::LeNet5ConvolutionLayerDataset(),
94 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +010095 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +010096
Gian Marco Iodice2bc74412018-03-01 16:32:10 +000097REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV1ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Lid763cfb2017-08-15 12:38:51 +010098 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV1ConvolutionLayerDataset(),
SiCong Li1e5c1572017-07-27 17:58:52 +010099 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100100 framework::dataset::make("Batches", { 4, 8 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100101
Gian Marco Iodice2bc74412018-03-01 16:32:10 +0000102REGISTER_FIXTURE_DATA_TEST_CASE(GoogLeNetInceptionV4ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Lif583fb72017-08-15 15:09:18 +0100103 framework::dataset::combine(framework::dataset::combine(datasets::GoogLeNetInceptionV4ConvolutionLayerDataset(),
104 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100105 framework::dataset::make("Batches", { 4, 8 })));
SiCong Lif583fb72017-08-15 15:09:18 +0100106
Gian Marco Iodice2bc74412018-03-01 16:32:10 +0000107REGISTER_FIXTURE_DATA_TEST_CASE(SqueezeNetConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Li1e5c1572017-07-27 17:58:52 +0100108 framework::dataset::combine(framework::dataset::combine(datasets::SqueezeNetConvolutionLayerDataset(),
109 data_types),
SiCong Licc65bbe2017-08-18 11:58:21 +0100110 framework::dataset::make("Batches", { 4, 8 })));
111
Moritz Pflanzer351c20a2017-09-11 14:28:56 +0100112// 8 batches use about 1.8GB of memory which is too much for most devices!
Gian Marco Iodice2bc74412018-03-01 16:32:10 +0000113REGISTER_FIXTURE_DATA_TEST_CASE(VGG16ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Licc65bbe2017-08-18 11:58:21 +0100114 framework::dataset::combine(framework::dataset::combine(datasets::VGG16ConvolutionLayerDataset(),
115 data_types),
Moritz Pflanzer351c20a2017-09-11 14:28:56 +0100116 framework::dataset::make("Batches", { 1, 4 })));
SiCong Li1e5c1572017-07-27 17:58:52 +0100117
Gian Marco Iodice2bc74412018-03-01 16:32:10 +0000118REGISTER_FIXTURE_DATA_TEST_CASE(YOLOV2ConvolutionLayer, CLGEMMConvolutionLayerFixture, framework::DatasetMode::NIGHTLY,
SiCong Li1e5c1572017-07-27 17:58:52 +0100119 framework::dataset::combine(framework::dataset::combine(datasets::YOLOV2ConvolutionLayerDataset(),
120 data_types),
121 framework::dataset::make("Batches", { 1, 4, 8 })));
122TEST_SUITE_END()
Moritz Pflanzeree493ae2017-07-05 10:52:21 +0100123TEST_SUITE_END()
124} // namespace test
125} // namespace arm_compute