blob: 69572c98d2b234dd5edbeff2eedcd9b7e7f7fd98 [file] [log] [blame]
Manuel Bottinib56c1752020-11-18 17:56:30 +00001/*
2 * Copyright (c) 2020-2021 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_CL_TUNINGPARAMETERS_LIST_H
25#define ARM_COMPUTE_CL_TUNINGPARAMETERS_LIST_H
26
27#include "arm_compute/core/CL/OpenCL.h"
28#include "arm_compute/core/Error.h"
29#include "arm_compute/core/Helpers.h"
30#include "arm_compute/runtime/CL/CLTunerTypes.h"
31#include "arm_compute/runtime/CL/CLTuningParams.h"
32#include "support/ToolchainSupport.h"
33
34#include <memory>
35
36namespace arm_compute
37{
38namespace cl_tuner
39{
40/** Interface for Tuning Parameters lists
41 *
42 * The tuning parameter lists contain a set of tuning parameters to estimate.
43 * There are 3 tuner modes, each using its specific list:
44 * - Exhaustive tuner mode is the slowest during the tuning but will find faster tuning parameters
45 * - Normal tuner mode is the average modality in terms of tuning time and tuning parameters found
46 * - Rapid tuner mode is the fastest but the tuning parameters might not be the fastest
47 *
48 */
49class ICLTuningParametersList
50{
51public:
52 /** Constructor */
53 ICLTuningParametersList() = default;
54 /** Copy Constructor */
55 ICLTuningParametersList(const ICLTuningParametersList &) = default;
56 /** Move Constructor */
57 ICLTuningParametersList(ICLTuningParametersList &&) noexcept(true) = default;
58 /** Assignment */
59 ICLTuningParametersList &operator=(const ICLTuningParametersList &) = default;
60 /** Move Assignment */
61 ICLTuningParametersList &operator=(ICLTuningParametersList &&) noexcept(true) = default;
62 /** Destructor */
63 virtual ~ICLTuningParametersList() = default;
64
65 /** Return the tuning parameter values at the given index.
66 *
67 * @return tuning parameter values at the given index
68 */
69 virtual CLTuningParams operator[](size_t) = 0;
70
71 /** Tuning parameters list size.
72 *
73 * @return Tuning parameters list size
74 */
75 virtual size_t size() = 0;
76};
77
78/** Construct an ICLTuningParametersList object for the given tuner mode and gws configuration.
79 *
Manuel Bottinibe9f9f92021-01-25 15:07:17 +000080 * @param[in] tuning_info Tuning info containng which parameters to tune and the tuner mode
81 * @param[in] gws Global worksize values
82 *
Manuel Bottinib56c1752020-11-18 17:56:30 +000083 * @return unique_ptr to the requested ICLTuningParametersList implementation.
84 */
Manuel Bottinibe9f9f92021-01-25 15:07:17 +000085std::unique_ptr<ICLTuningParametersList> get_tuning_parameters_list(CLTuningInfo tuning_info, const cl::NDRange &gws);
Manuel Bottinib56c1752020-11-18 17:56:30 +000086
87} // namespace cl_tuner
88} // namespace arm_compute
89#endif /*ARM_COMPUTE_CL_TUNINGPARAMETERS_LIST_H */