blob: 3a02a6065011ed1b695fec99ae8dd98e8eb2ee84 [file] [log] [blame]
Gian Marco Iodice352c07d2023-05-03 12:21:38 +01001/*
2 * Copyright (c) 2023 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#include "src/runtime/heuristics/matmul_native/ClMatMulNativeDefaultConfigValhall.h"
25
26#include "arm_compute/core/CL/CLHelpers.h"
27#include "arm_compute/core/CL/CLKernelLibrary.h"
28#include "arm_compute/core/GPUTarget.h"
29#include "arm_compute/core/KernelDescriptors.h"
30#include "arm_compute/core/TensorInfo.h"
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010031
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010032#include "src/gpu/cl/kernels/ClMatMulNativeKernel.h"
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010033#include "src/runtime/heuristics/matmul_native/ClMatMulNativeHelpers.h"
34
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010035#include <utility>
36
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010037namespace arm_compute
38{
39namespace cl_matmul
40{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010041ClMatMulNativeDefaultConfigValhall::ClMatMulNativeDefaultConfigValhall(GPUTarget gpu) : IClMatMulNativeKernelConfig(gpu)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010042{
43}
44
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010045MatMulKernelInfo
46ClMatMulNativeDefaultConfigValhall::configure(const ITensorInfo *lhs, const ITensorInfo *rhs, const MatMulInfo &info)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010047{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010048 using ConfigurationFunctionExecutorPtr = MatMulKernelInfo (ClMatMulNativeDefaultConfigValhall::*)(
49 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info);
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010050
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010051 ClMatMulNativeConfigArray<ConfigurationFunctionExecutorPtr> configs_G710(
52 &ClMatMulNativeDefaultConfigValhall::configure_G710_f32,
53 &ClMatMulNativeDefaultConfigValhall::configure_G710_f16,
54 &ClMatMulNativeDefaultConfigValhall::configure_G710_u8);
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010055
Gunes Bayirc1204c72023-10-10 17:41:56 +010056 ClMatMulNativeConfigArray<ConfigurationFunctionExecutorPtr> configs_G715(
57 &ClMatMulNativeDefaultConfigValhall::configure_G715_f32,
58 &ClMatMulNativeDefaultConfigValhall::configure_G715_f16,
59 &ClMatMulNativeDefaultConfigValhall::configure_G715_u8);
60
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010061 ConfigurationFunctionExecutorPtr func = nullptr;
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010062 switch (_target)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010063 {
Gunes Bayirc1204c72023-10-10 17:41:56 +010064 case GPUTarget::G715:
Gunes Bayir85cafff2023-12-18 13:29:31 +000065 case GPUTarget::G615:
Gunes Bayirc1204c72023-10-10 17:41:56 +010066 func = configs_G715.get_function(lhs->data_type());
67 break;
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010068 case GPUTarget::G710:
69 default:
70 func = configs_G710.get_function(lhs->data_type());
71 break;
72 }
73
74 const bool adj_lhs = info.adj_lhs();
75 const bool adj_rhs = info.adj_rhs();
76
77 TensorShape lhs_shape = lhs->tensor_shape();
78 TensorShape rhs_shape = rhs->tensor_shape();
79
80 const bool is_batched = lhs_shape.num_dimensions() > 2;
81
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010082 if (is_batched == true)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +010083 {
84 lhs_shape.collapse_from(2);
85 }
86
87 const unsigned int m = adj_lhs ? lhs_shape.x() : lhs_shape.y();
88 const unsigned int n = adj_rhs ? rhs_shape.y() : rhs_shape.x();
89 const unsigned int k = adj_lhs ? lhs_shape.y() : lhs_shape.x();
90 const unsigned int b = lhs_shape.z();
91
92 ARM_COMPUTE_ERROR_ON_MSG(func == nullptr, "Data type not supported for matmul native");
93 return (this->*func)(m, n, k, b, rhs->lock_paddings(), info);
94}
95
Gunes Bayirc1204c72023-10-10 17:41:56 +010096MatMulKernelInfo ClMatMulNativeDefaultConfigValhall::configure_G715_f32(
97 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info)
98{
99 ARM_COMPUTE_UNUSED(m, n, k, b, rhs_lock_padding);
100 return {info.adj_lhs(), info.adj_rhs(), /* m0 */ 1, /* n0 */ 4, /* k0 */ 1, /* export_to_cl_image */ false};
101}
102
103MatMulKernelInfo ClMatMulNativeDefaultConfigValhall::configure_G715_f16(
104 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info)
105{
106 return configure_G715_f32(m, n, k, b, rhs_lock_padding, info);
107}
108
109MatMulKernelInfo ClMatMulNativeDefaultConfigValhall::configure_G715_u8(
110 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info)
111{
112 ARM_COMPUTE_UNUSED(m, n, k, b, rhs_lock_padding);
Gian Marco Iodice4a9dbed2023-11-07 10:27:13 +0000113 return {info.adj_lhs(), info.adj_rhs(), /* m0 */ 4, /* n0 */ 16, /* k0 */ 4, /* export_to_cl_image */ false};
Gunes Bayirc1204c72023-10-10 17:41:56 +0100114}
115
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100116MatMulKernelInfo ClMatMulNativeDefaultConfigValhall::configure_G710_f32(
117 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100118{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100119 const MatMulNativeConfigsMatrix configs_mnkb_best_nt_nt = {
120 {3136, 64, 64, 36, 4, 4, 16, 1}, {4096, 48, 32, 36, 4, 4, 4, 1}, {688, 92, 68, 32, 2, 8, 4, 1},
121 {24, 464, 412, 24, 2, 8, 4, 1}, {112, 184, 144, 28, 4, 4, 16, 1}, {5776, 64, 32, 36, 2, 4, 16, 1},
122 {1568, 64, 40, 36, 2, 8, 8, 1}, {2920, 64, 64, 24, 4, 4, 16, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100123
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100124 const MatMulNativeConfigsMatrix configs_mnkb_fallback_nt_nt = {
125 {3136, 64, 64, 36, 4, 4, 8, 0}, {4096, 48, 32, 36, 4, 4, 8, 0}, {688, 92, 68, 32, 5, 4, 4, 0},
126 {24, 464, 412, 24, 6, 2, 8, 0}, {112, 184, 144, 28, 6, 4, 4, 0}, {5776, 64, 32, 36, 5, 4, 4, 0},
127 {1568, 64, 40, 36, 4, 4, 8, 0}, {2920, 64, 64, 24, 4, 4, 8, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100128
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100129 const MatMulNativeConfigsMatrix configs_mnkb_best_nt_t = {
130 {3136, 64, 64, 36, 4, 4, 4, 1}, {4096, 48, 32, 36, 2, 2, 16, 1}, {688, 92, 68, 32, 4, 4, 4, 1},
131 {24, 464, 412, 24, 6, 2, 8, 1}, {112, 184, 144, 28, 4, 2, 16, 1}, {5776, 64, 32, 36, 4, 4, 4, 1},
132 {1568, 64, 40, 36, 4, 4, 8, 1}, {2920, 64, 64, 24, 4, 4, 4, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100133
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100134 const MatMulNativeConfigsMatrix configs_mnkb_fallback_nt_t = {
135 {3136, 64, 64, 36, 5, 4, 4, 0}, {4096, 48, 32, 36, 5, 4, 4, 0}, {688, 92, 68, 32, 5, 4, 4, 0},
136 {24, 464, 412, 24, 6, 2, 4, 0}, {112, 184, 144, 28, 5, 4, 4, 0}, {5776, 64, 32, 36, 5, 4, 4, 0},
137 {1568, 64, 40, 36, 5, 4, 4, 0}, {2920, 64, 64, 24, 6, 2, 4, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100138
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100139 const MatMulNativeConfigsMatrix configs_mnkb_best_t_nt = {
140 {3136, 64, 64, 36, 4, 4, 16, 1}, {4096, 48, 32, 36, 4, 4, 4, 1}, {688, 92, 68, 32, 2, 8, 4, 1},
141 {24, 464, 412, 24, 2, 8, 4, 1}, {112, 184, 144, 28, 4, 4, 16, 1}, {5776, 64, 32, 36, 2, 8, 8, 1},
142 {1568, 64, 40, 36, 4, 4, 8, 1}, {2920, 64, 64, 24, 4, 4, 16, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100143
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100144 const MatMulNativeConfigsMatrix configs_mnkb_fallback_t_nt = {
145 {3136, 64, 64, 36, 4, 4, 4, 0}, {4096, 48, 32, 36, 4, 4, 4, 0}, {688, 92, 68, 32, 4, 4, 4, 0},
146 {24, 464, 412, 24, 4, 4, 4, 0}, {112, 184, 144, 28, 4, 4, 4, 0}, {5776, 64, 32, 36, 4, 4, 8, 0},
147 {1568, 64, 40, 36, 4, 4, 4, 0}, {2920, 64, 64, 24, 4, 4, 4, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100148
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100149 const MatMulNativeConfigsMatrix configs_mnkb_best_t_t = {
150 {3136, 64, 64, 36, 4, 4, 4, 1}, {4096, 48, 32, 36, 4, 4, 4, 1}, {688, 92, 68, 32, 4, 4, 4, 1},
151 {24, 464, 412, 24, 2, 2, 16, 1}, {112, 184, 144, 28, 4, 4, 4, 1}, {5776, 64, 32, 36, 4, 4, 4, 1},
152 {1568, 64, 40, 36, 4, 4, 4, 1}, {2920, 64, 64, 24, 4, 4, 4, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100153
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100154 const MatMulNativeConfigsMatrix configs_mnkb_fallback_t_t = {
155 {3136, 64, 64, 36, 4, 4, 4, 0}, {4096, 48, 32, 36, 4, 4, 4, 0}, {688, 92, 68, 32, 4, 4, 4, 0},
156 {24, 464, 412, 24, 4, 2, 8, 0}, {112, 184, 144, 28, 4, 4, 4, 0}, {5776, 64, 32, 36, 4, 4, 4, 0},
157 {1568, 64, 40, 36, 4, 4, 4, 0}, {2920, 64, 64, 24, 4, 4, 4, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100158
159 const bool adj_lhs = info.adj_lhs();
160 const bool adj_rhs = info.adj_rhs();
161
162 const MatMulNativeConfigsMatrix *configs_best_to_use = nullptr;
163 const MatMulNativeConfigsMatrix *configs_fallback_to_use = nullptr;
164
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100165 if ((adj_lhs == false) && (adj_rhs == false))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100166 {
167 configs_best_to_use = &configs_mnkb_best_nt_nt;
168 configs_fallback_to_use = &configs_mnkb_fallback_nt_nt;
169 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100170 else if ((adj_lhs == false) && (adj_rhs == true))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100171 {
172 configs_best_to_use = &configs_mnkb_best_nt_t;
173 configs_fallback_to_use = &configs_mnkb_fallback_nt_t;
174 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100175 else if ((adj_lhs == true) && (adj_rhs == false))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100176 {
177 configs_best_to_use = &configs_mnkb_best_t_nt;
178 configs_fallback_to_use = &configs_mnkb_fallback_t_nt;
179 }
180 else
181 {
182 configs_best_to_use = &configs_mnkb_best_t_t;
183 configs_fallback_to_use = &configs_mnkb_fallback_t_t;
184 }
185
186 MatMulKernelInfo desc0 = find_info(*configs_best_to_use, adj_lhs, adj_rhs, m, n, k, b);
187 MatMulKernelInfo desc1 = find_info(*configs_fallback_to_use, adj_lhs, adj_rhs, m, n, k, b);
188
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100189 return select_info(desc0, desc1, m, n, k, b, DataType::F32, rhs_lock_padding);
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100190}
191
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100192MatMulKernelInfo ClMatMulNativeDefaultConfigValhall::configure_G710_f16(
193 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100194{
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100195 const MatMulNativeConfigsMatrix configs_mnkb_best_nt_nt = {
196 {3136, 64, 64, 36, 4, 4, 16, 1}, {4096, 48, 32, 36, 4, 4, 8, 1}, {688, 92, 68, 32, 4, 4, 16, 1},
197 {24, 464, 412, 24, 4, 4, 4, 1}, {112, 184, 144, 28, 4, 4, 16, 1}, {5776, 64, 32, 36, 4, 4, 8, 1},
198 {1568, 64, 40, 36, 4, 4, 8, 1}, {2920, 64, 64, 24, 4, 4, 16, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100199
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100200 const MatMulNativeConfigsMatrix configs_mnkb_fallback_nt_nt = {
201 {3136, 64, 64, 36, 6, 4, 8, 0}, {4096, 48, 32, 36, 6, 4, 8, 0}, {688, 92, 68, 32, 6, 4, 8, 0},
202 {24, 464, 412, 24, 4, 4, 8, 0}, {112, 184, 144, 28, 6, 4, 8, 0}, {5776, 64, 32, 36, 6, 4, 8, 0},
203 {1568, 64, 40, 36, 6, 4, 8, 0}, {2920, 64, 64, 24, 6, 4, 8, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100204
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100205 const MatMulNativeConfigsMatrix configs_mnkb_best_nt_t = {
206 {3136, 64, 64, 36, 6, 4, 8, 1}, {4096, 48, 32, 36, 6, 4, 8, 1}, {688, 92, 68, 32, 4, 4, 4, 1},
207 {24, 464, 412, 24, 6, 2, 4, 1}, {112, 184, 144, 28, 4, 2, 16, 1}, {5776, 64, 32, 36, 6, 4, 8, 1},
208 {1568, 64, 40, 36, 6, 4, 8, 1}, {2920, 64, 64, 24, 6, 4, 8, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100209
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100210 const MatMulNativeConfigsMatrix configs_mnkb_fallback_nt_t = {
211 {3136, 64, 64, 36, 6, 2, 16, 0}, {4096, 48, 32, 36, 5, 4, 8, 0}, {688, 92, 68, 32, 6, 2, 16, 0},
212 {24, 464, 412, 24, 6, 2, 16, 0}, {112, 184, 144, 28, 6, 2, 16, 0}, {5776, 64, 32, 36, 5, 4, 8, 0},
213 {1568, 64, 40, 36, 5, 4, 8, 0}, {2920, 64, 64, 24, 6, 2, 16, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100214
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100215 const MatMulNativeConfigsMatrix configs_mnkb_best_t_nt = {
216 {3136, 64, 64, 36, 4, 4, 16, 1}, {4096, 48, 32, 36, 4, 4, 4, 1}, {688, 92, 68, 32, 4, 4, 4, 1},
217 {24, 464, 412, 24, 4, 4, 4, 1}, {112, 184, 144, 28, 4, 4, 4, 1}, {5776, 64, 32, 36, 4, 4, 4, 1},
218 {1568, 64, 40, 36, 4, 4, 4, 1}, {2920, 64, 64, 24, 4, 4, 4, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100219
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100220 const MatMulNativeConfigsMatrix configs_mnkb_fallback_t_nt = {
221 {3136, 64, 64, 36, 4, 4, 4, 0}, {4096, 48, 32, 36, 4, 4, 4, 0}, {688, 92, 68, 32, 4, 4, 4, 0},
222 {24, 464, 412, 24, 4, 4, 4, 0}, {112, 184, 144, 28, 4, 4, 4, 0}, {5776, 64, 32, 36, 4, 4, 4, 0},
223 {1568, 64, 40, 36, 4, 4, 4, 0}, {2920, 64, 64, 24, 4, 4, 4, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100224
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100225 const MatMulNativeConfigsMatrix configs_mnkb_best_t_t = {
226 {3136, 64, 64, 36, 4, 4, 16, 1}, {4096, 48, 32, 36, 4, 4, 8, 1}, {688, 92, 68, 32, 4, 4, 4, 1},
227 {24, 464, 412, 24, 4, 2, 8, 1}, {112, 184, 144, 28, 4, 2, 16, 1}, {5776, 64, 32, 36, 4, 4, 16, 1},
228 {1568, 64, 40, 36, 4, 4, 8, 1}, {2920, 64, 64, 24, 4, 4, 16, 1}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100229
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100230 const MatMulNativeConfigsMatrix configs_mnkb_fallback_t_t = {
231 {3136, 64, 64, 36, 4, 4, 8, 0}, {4096, 48, 32, 36, 4, 4, 8, 0}, {688, 92, 68, 32, 4, 4, 8, 0},
232 {24, 464, 412, 24, 4, 4, 8, 0}, {112, 184, 144, 28, 4, 4, 8, 0}, {5776, 64, 32, 36, 4, 4, 8, 0},
233 {1568, 64, 40, 36, 4, 4, 8, 0}, {2920, 64, 64, 24, 4, 4, 8, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100234
235 const bool adj_lhs = info.adj_lhs();
236 const bool adj_rhs = info.adj_rhs();
237
238 const MatMulNativeConfigsMatrix *configs_best_to_use = nullptr;
239 const MatMulNativeConfigsMatrix *configs_fallback_to_use = nullptr;
240
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100241 if ((adj_lhs == false) && (adj_rhs == false))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100242 {
243 configs_best_to_use = &configs_mnkb_best_nt_nt;
244 configs_fallback_to_use = &configs_mnkb_fallback_nt_nt;
245 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100246 else if ((adj_lhs == false) && (adj_rhs == true))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100247 {
248 configs_best_to_use = &configs_mnkb_best_nt_t;
249 configs_fallback_to_use = &configs_mnkb_fallback_nt_t;
250 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100251 else if ((adj_lhs == true) && (adj_rhs == false))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100252 {
253 configs_best_to_use = &configs_mnkb_best_t_nt;
254 configs_fallback_to_use = &configs_mnkb_fallback_t_nt;
255 }
256 else
257 {
258 configs_best_to_use = &configs_mnkb_best_t_t;
259 configs_fallback_to_use = &configs_mnkb_fallback_t_t;
260 }
261
262 MatMulKernelInfo desc0 = find_info(*configs_best_to_use, adj_lhs, adj_rhs, m, n, k, b);
263 MatMulKernelInfo desc1 = find_info(*configs_fallback_to_use, adj_lhs, adj_rhs, m, n, k, b);
264
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100265 return select_info(desc0, desc1, m, n, k, b, DataType::F16, rhs_lock_padding);
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100266}
267
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100268MatMulKernelInfo ClMatMulNativeDefaultConfigValhall::configure_G710_u8(
269 unsigned int m, unsigned int n, unsigned int k, unsigned int b, bool rhs_lock_padding, const MatMulInfo &info)
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100270{
271 ARM_COMPUTE_UNUSED(rhs_lock_padding);
272
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100273 const MatMulNativeConfigsMatrix configs_mnkb_best_nt_nt = {
274 {3136, 64, 64, 36, 6, 4, 4, 0}, {4096, 48, 32, 36, 6, 4, 4, 0}, {688, 92, 68, 32, 2, 8, 4, 0},
275 {24, 464, 412, 24, 4, 4, 4, 0}, {112, 184, 144, 28, 6, 4, 4, 0}, {5776, 64, 32, 36, 6, 4, 4, 0},
276 {1568, 64, 40, 36, 6, 4, 4, 0}, {2920, 64, 64, 24, 5, 4, 4, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100277
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100278 const MatMulNativeConfigsMatrix configs_mnkb_best_nt_t = {
279 {3136, 64, 64, 36, 4, 4, 16, 0}, {4096, 48, 32, 36, 4, 4, 16, 0}, {688, 92, 68, 32, 4, 4, 16, 0},
280 {24, 464, 412, 24, 6, 2, 16, 0}, {112, 184, 144, 28, 4, 4, 16, 0}, {5776, 64, 32, 36, 4, 4, 16, 0},
281 {1568, 64, 40, 36, 6, 4, 4, 0}, {2920, 64, 64, 24, 4, 4, 16, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100282
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100283 const MatMulNativeConfigsMatrix configs_mnkb_best_t_nt = {
284 {3136, 64, 64, 36, 4, 4, 8, 0}, {4096, 48, 32, 36, 4, 4, 8, 0}, {688, 92, 68, 32, 4, 4, 4, 0},
285 {24, 464, 412, 24, 4, 4, 4, 0}, {112, 184, 144, 28, 4, 4, 8, 0}, {5776, 64, 32, 36, 4, 4, 8, 0},
286 {1568, 64, 40, 36, 4, 4, 8, 0}, {2920, 64, 64, 24, 4, 4, 8, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100287
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100288 const MatMulNativeConfigsMatrix configs_mnkb_best_t_t = {
289 {3136, 64, 64, 36, 4, 2, 16, 0}, {4096, 48, 32, 36, 4, 4, 4, 0}, {688, 92, 68, 32, 4, 4, 8, 0},
290 {24, 464, 412, 24, 4, 2, 16, 0}, {112, 184, 144, 28, 4, 2, 16, 0}, {5776, 64, 32, 36, 4, 4, 4, 0},
291 {1568, 64, 40, 36, 4, 4, 8, 0}, {2920, 64, 64, 24, 4, 2, 16, 0}};
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100292
293 const bool adj_lhs = info.adj_lhs();
294 const bool adj_rhs = info.adj_rhs();
295
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100296 if ((adj_lhs == false) && (adj_rhs == false))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100297 {
298 return find_info(configs_mnkb_best_nt_nt, adj_lhs, adj_rhs, m, n, k, b);
299 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100300 else if ((adj_lhs == false) && (adj_rhs == true))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100301 {
302 return find_info(configs_mnkb_best_nt_t, adj_lhs, adj_rhs, m, n, k, b);
303 }
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100304 else if ((adj_lhs == true) && (adj_rhs == false))
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100305 {
306 return find_info(configs_mnkb_best_t_nt, adj_lhs, adj_rhs, m, n, k, b);
307 }
308 else
309 {
310 return find_info(configs_mnkb_best_t_t, adj_lhs, adj_rhs, m, n, k, b);
311 }
312}
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +0100313} // namespace cl_matmul
Gian Marco Iodice352c07d2023-05-03 12:21:38 +0100314} // namespace arm_compute