Compute Library
 22.05
ICLTuner.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2020, 2022 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_ICLTUNER_H
25 #define ARM_COMPUTE_ICLTUNER_H
26 
28 
29 namespace arm_compute
30 {
31 class ICLKernel;
32 
33 #if defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
34 namespace experimental
35 {
36 namespace dynamic_fusion
37 {
38 struct ClExecutionDescriptor;
39 } // namespace dynamic_fusion
40 } // namespace experimental
41 #endif // defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
42 /** Basic interface for tuning the OpenCL kernels */
43 class ICLTuner
44 {
45 public:
46  /** Virtual destructor */
47  virtual ~ICLTuner() = default;
48  /** Tune OpenCL kernel statically
49  *
50  * @note Tuning is performed using only kernel and tensor metadata,
51  * thus can be performed when memory is not available
52  *
53  * @param[in] kernel Kernel to tune
54  */
55  virtual void tune_kernel_static(ICLKernel &kernel) = 0;
56  /** Tune OpenCL kernel dynamically
57  *
58  * @note Tuning requires memory to be available on all kernel tensors and objects in order to be performed
59  *
60  * @param[in] kernel Kernel to tune
61  */
62  virtual void tune_kernel_dynamic(ICLKernel &kernel) = 0;
63  /** Tune OpenCL kernel dynamically
64  *
65  * @param[in] kernel Kernel to tune
66  * @param[in, out] tensors Tensors for the kernel to use
67  */
68  virtual void tune_kernel_dynamic(ICLKernel &kernel, ITensorPack &tensors) = 0;
69 #if defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
70  /** Tune OpenCL kernel dynamically for dynamic fusion interface
71  *
72  * @param[in] kernel Kernel to tune
73  * @param[in, out] tensors Tensors for the kernel to use
74  * @param[in] exec_desc Execution descriptor
75  */
76  virtual void tune_kernel_dynamic(ICLKernel &kernel, ITensorPack &tensors, const experimental::dynamic_fusion::ClExecutionDescriptor &exec_desc) = 0;
77 #endif // defined(ENABLE_EXPERIMENTAL_DYNAMIC_FUSION)
78 };
79 } // namespace arm_compute
80 #endif /*ARM_COMPUTE_ICLTUNER_H */
Common interface for all the OpenCL kernels.
Definition: ICLKernel.h:81
Copyright (c) 2017-2022 Arm Limited.
Descriptor containing information required to run a single ClWorkload.
Definition: ClWorkload.h:91
Tensor packing service.
Definition: ITensorPack.h:39
Basic interface for tuning the OpenCL kernels.
Definition: ICLTuner.h:43