Compute Library
 21.02
MidgardTuner.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020 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  */
25 
27 #include "src/core/CL/CLKernels.h"
28 #include "support/Cast.h"
29 
30 namespace arm_compute
31 {
32 namespace tuners
33 {
34 namespace
35 {
36 void tune_gemm_kernel(CLGEMMMatrixMultiplyKernel &k)
37 {
38  cl::NDRange lws_hint = k.lws_hint();
39  const GPUTarget gpu_target = k.get_target();
40 
41  switch(gpu_target)
42  {
43  case GPUTarget::MIDGARD:
44  case GPUTarget::T600:
45  case GPUTarget::T700:
46  case GPUTarget::T800:
47  if(k._output->info()->dimension(1) == 196)
48  {
49  lws_hint = cl::NDRange(1, 7);
50  }
51  else
52  {
53  lws_hint = cl::NDRange(8, 8);
54  }
55  break;
56  default:
57  lws_hint = cl::NullRange;
58  }
59 
60  k.set_lws_hint(lws_hint);
61 }
62 } // namespace
63 
65 {
66  if(dynamic_cast<CLGEMMMatrixMultiplyKernel *>(&kernel) != nullptr)
67  {
68  tune_gemm_kernel(*utils::cast::polymorphic_downcast<CLGEMMMatrixMultiplyKernel *>(&kernel));
69  }
70 }
71 
73 {
74  ARM_COMPUTE_UNUSED(kernel);
75 }
76 
78 {
79  ARM_COMPUTE_UNUSED(kernel, tensors);
80 }
81 } // namespace tuners
82 } // namespace arm_compute
void tune_kernel_dynamic(ICLKernel &kernel) override
Tune OpenCL kernel dynamically.
Common interface for all the OpenCL kernels.
Definition: ICLKernel.h:46
Copyright (c) 2017-2021 Arm Limited.
void tune_kernel_static(ICLKernel &kernel) override
Tune OpenCL kernel statically.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
GPUTarget
Available GPU Targets.
Definition: GPUTarget.h:34
Tensor packing service.
Definition: ITensorPack.h:37