1 /* 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 36 namespace arm_compute 37 { 38 namespace 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 */ 49 class ICLTuningParametersList 50 { 51 public: 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 * 80 * @param[in] tuning_info Tuning info containng which parameters to tune and the tuner mode 81 * @param[in] gws Global worksize values 82 * 83 * @return unique_ptr to the requested ICLTuningParametersList implementation. 84 */ 85 std::unique_ptr<ICLTuningParametersList> get_tuning_parameters_list(CLTuningInfo tuning_info, const cl::NDRange &gws); 86 87 } // namespace cl_tuner 88 } // namespace arm_compute 89 #endif /*ARM_COMPUTE_CL_TUNINGPARAMETERS_LIST_H */ 90