blob: 26a8ade461f140fae2948ec1399d7b673a3f65d0 [file] [log] [blame]
Anthony Barbier3d677cc2018-07-23 16:42:59 +01001/*
2 * Copyright (c) 2018 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_NEGEMMINTERLEAVEDSTRATEGIES_H__
25#define __ARM_COMPUTE_NEGEMMINTERLEAVEDSTRATEGIES_H__
26
27#include "../arm_gemm/utils.hpp"
28#include "arm_gemm.hpp"
29
30#include "../arm_gemm/mergeresults.hpp"
31#include "../arm_gemm/transform.hpp"
32
33#include "../arm_gemm/kernels/a32_sgemm_8x6.hpp"
34#include "../arm_gemm/kernels/a64_gemm_s8_12x8.hpp"
35#include "../arm_gemm/kernels/a64_gemm_s8_4x4.hpp"
36#include "../arm_gemm/kernels/a64_gemm_u8_12x8.hpp"
37#include "../arm_gemm/kernels/a64_gemm_u8_4x4.hpp"
38#include "../arm_gemm/kernels/a64_hgemm_24x8.hpp"
39#include "../arm_gemm/kernels/a64_sgemm_12x8.hpp"
40
41namespace arm_compute
42{
43namespace
44{
45template <typename To, bool use_dot = false>
46struct Kernel
47{
48};
49
50#ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
51template <>
52struct Kernel<float16_t, false>
53{
54 using strategy = arm_gemm::hgemm_24x8;
55};
56#endif /*__ARM_FEATURE_FP16_VECTOR_ARITHMETIC */
57#ifdef __aarch64__
58template <>
59struct Kernel<float, false>
60{
61 using strategy = arm_gemm::sgemm_12x8;
62};
63template <>
64struct Kernel<int8_t, false>
65{
66 using strategy = arm_gemm::gemm_s8_4x4;
67};
68template <>
69struct Kernel<uint8_t, false>
70{
71 using strategy = arm_gemm::gemm_u8_4x4;
72};
73
74//Use different strategies for 8bit dot product:
75template <>
76struct Kernel<int8_t, true>
77{
78 using strategy = arm_gemm::gemm_s8_12x8;
79};
80template <>
81struct Kernel<uint8_t, true>
82{
83 using strategy = arm_gemm::gemm_u8_12x8;
84};
85#else
86template <>
87struct Kernel<float, false>
88{
89 using strategy = arm_gemm::sgemm_8x6;
90};
91#endif /* __aarch64__ */
92
93} // namespace
94} // namespace arm_compute
95#endif /* __ARM_COMPUTE_NEGEMMINTERLEAVEDSTRATEGIES_H__ */