blob: 5990505a59c1f93f1976bce945113a38bb30c0a4 [file] [log] [blame]
Anthony Barbierac314c22018-09-11 17:49:10 +01001/*
Michele Di Giorgio6ad60af2020-06-09 14:52:15 +01002 * Copyright (c) 2018-2020 ARM Limited.
Anthony Barbierac314c22018-09-11 17:49:10 +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 */
24
Michele Di Giorgio6ad60af2020-06-09 14:52:15 +010025#include "src/core/NEON/kernels/assembly/Helpers.h"
Anthony Barbierac314c22018-09-11 17:49:10 +010026
Anthony Barbierac314c22018-09-11 17:49:10 +010027namespace arm_compute
28{
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000029arm_gemm::KernelDescription get_gemm_info(DataType input_type,
30 const CPUInfo &ci,
31 const unsigned int num_threads,
32 const INEGEMMWrapperKernel::Params &p,
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010033 arm_gemm::Activation activation,
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000034 bool pretranspose_hint)
Anthony Barbierac314c22018-09-11 17:49:10 +010035{
36 switch(input_type)
37 {
Anthony Barbierac314c22018-09-11 17:49:10 +010038#ifdef __aarch64__
Anthony Barbierac314c22018-09-11 17:49:10 +010039 case DataType::QASYMM8:
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000040 case DataType::U8:
41 {
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010042 arm_gemm::GemmArgs args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, activation, num_threads, pretranspose_hint);
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000043 return arm_gemm::get_gemm_method<uint8_t, uint32_t>(args);
44 }
Anthony Barbierac314c22018-09-11 17:49:10 +010045 case DataType::S8:
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000046 {
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010047 arm_gemm::GemmArgs args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, activation, num_threads, pretranspose_hint);
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000048 return arm_gemm::get_gemm_method<int8_t, int32_t>(args);
49 }
50#endif // __aarch64__
Anthony Barbierac314c22018-09-11 17:49:10 +010051#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
52 case DataType::F16:
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000053 {
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010054 arm_gemm::GemmArgs args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, activation, num_threads, pretranspose_hint);
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000055 return arm_gemm::get_gemm_method<__fp16, __fp16>(args);
56 }
Anthony Barbierac314c22018-09-11 17:49:10 +010057#endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
Anthony Barbierac314c22018-09-11 17:49:10 +010058 case DataType::F32:
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000059 {
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010060 arm_gemm::GemmArgs args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, activation, num_threads, pretranspose_hint);
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000061 return arm_gemm::get_gemm_method<float, float>(args);
62 }
Anthony Barbierac314c22018-09-11 17:49:10 +010063 default:
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000064 return arm_gemm::KernelDescription();
Anthony Barbierac314c22018-09-11 17:49:10 +010065 }
66}
67} // namespace arm_compute