blob: 72734f2207568141ad8bba9ef73c82b92e51d359 [file] [log] [blame]
Georgios Pinitas17812ba2018-06-04 19:27:13 +01001/*
Georgios Pinitas9c82e012020-07-17 12:47:56 +01002 * Copyright (c) 2018-2020 Arm Limited.
Georgios Pinitas17812ba2018-06-04 19:27:13 +01003 *
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 */
Anthony Barbiercdb43bd2018-07-11 11:36:48 +010024#include "arm_compute/runtime/CL/tuners/MidgardTuner.h"
Georgios Pinitas17812ba2018-06-04 19:27:13 +010025
26#include "arm_compute/core/CL/CLHelpers.h"
Sang-Hoon Parkbef7fa22020-10-21 15:58:54 +010027#include "src/core/CL/CLKernels.h"
Sang-Hoon Park68dd25f2020-10-19 16:00:11 +010028#include "support/Cast.h"
Georgios Pinitas17812ba2018-06-04 19:27:13 +010029
30namespace arm_compute
31{
32namespace tuners
33{
34namespace
35{
36void 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
64void MidgardTuner::tune_kernel_static(ICLKernel &kernel)
65{
66 if(dynamic_cast<CLGEMMMatrixMultiplyKernel *>(&kernel) != nullptr)
67 {
68 tune_gemm_kernel(*utils::cast::polymorphic_downcast<CLGEMMMatrixMultiplyKernel *>(&kernel));
69 }
70}
71
72void MidgardTuner::tune_kernel_dynamic(ICLKernel &kernel)
73{
74 ARM_COMPUTE_UNUSED(kernel);
75}
Georgios Pinitas9c82e012020-07-17 12:47:56 +010076
Georgios Pinitas0499dff2020-07-31 22:21:38 +010077void MidgardTuner::tune_kernel_dynamic(ICLKernel &kernel, ITensorPack &tensors)
Georgios Pinitas9c82e012020-07-17 12:47:56 +010078{
Georgios Pinitas0499dff2020-07-31 22:21:38 +010079 ARM_COMPUTE_UNUSED(kernel, tensors);
Georgios Pinitas9c82e012020-07-17 12:47:56 +010080}
Georgios Pinitas17812ba2018-06-04 19:27:13 +010081} // namespace tuners
Anthony Barbiercdb43bd2018-07-11 11:36:48 +010082} // namespace arm_compute