blob: e7bfb6f10fef78c5a6df342ada0e352080396711 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
2 * Copyright (c) 2017 ARM Limited.
3 *
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#ifndef __ARM_COMPUTE_TEST_BENCHMARK_DATASETS_H__
25#define __ARM_COMPUTE_TEST_BENCHMARK_DATASETS_H__
26
27#include "dataset/ActivationLayerDataset.h"
28#include "dataset/BorderModeDataset.h"
29#include "dataset/ConvolutionLayerDataset.h"
30#include "dataset/DataTypeDatasets.h"
31#include "dataset/FullyConnectedLayerDataset.h"
32#include "dataset/GEMMDataset.h"
33#include "dataset/ImageDatasets.h"
34#include "dataset/InterpolationPolicyDataset.h"
35#include "dataset/NormalizationLayerDataset.h"
36#include "dataset/PoolingLayerDataset.h"
37#include "dataset/ShapeDatasets.h"
38
39#include "benchmark/benchmark_api.h"
40
41#include <array>
42
43namespace arm_compute
44{
45namespace test
46{
47namespace benchmark
48{
49template <typename DataSet, int N>
50void DataSetArg(::benchmark::internal::Benchmark *b)
51{
52 b->Arg(N);
53 b->ArgName(std::string(*(DataSet().begin() + N)));
54}
55
56template <typename DataSet, int N, unsigned int... Args>
57void DataSetArgBatched(::benchmark::internal::Benchmark *b)
58{
59 constexpr std::array<unsigned int, sizeof...(Args)> batches{ { Args... } };
60 for(const auto &el : batches)
61 {
62 b->Args({ N, static_cast<int>(el) });
63 }
64 b->ArgNames({ std::string(*(DataSet().begin() + N)), "batch_size" });
65}
66
67template <typename DataSet>
68void DataSetArgs(::benchmark::internal::Benchmark *b)
69{
70 for(size_t i = 0; i < DataSet().size(); ++i)
71 {
72 b->Arg(i);
73 b->ArgName(*(DataSet().begin() + i));
74 }
75}
76}
77}
78}
79#endif