blob: 46de98504e8ddf1050fd89527d3bdfd952fedf26 [file] [log] [blame]
Georgios Pinitas7cd26d42019-01-09 18:35:17 +00001/*
Georgios Pinitas0cc50ed2020-07-06 19:10:38 +01002 * Copyright (c) 2019-2020 Arm Limited.
Georgios Pinitas7cd26d42019-01-09 18:35:17 +00003 *
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 *
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000013 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000015 *
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
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000023 */
24#pragma once
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000025#if defined(__aarch64__) && (defined(FP16_KERNELS) || defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC))
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000026
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000027#include "../std_transforms_fixed.hpp"
28
29#define ARGLIST \
30 unsigned int, const unsigned int *, \
31 IndirectInputArg<__fp16>, \
32 size_t, size_t, \
33 const __fp16 *, \
34 IndirectOutputArg<__fp16>, \
35 const __fp16 *, Activation, bool
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000036
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000037namespace arm_gemm
38{
39
40// Actual kernel implementations
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000041void a64_hybrid_fp16_mla_6x32( ARGLIST );
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000042
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000043class cls_a64_hybrid_fp16_mla_6x32
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000044{
45public:
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000046 typedef __fp16 operand_type;
47 typedef __fp16 result_type;
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000048
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000049 typedef void (*kern_type)( ARGLIST );
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000050
51 /* Kernel blocking parameters */
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010052 static constexpr unsigned int out_height()
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000053 {
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000054 return 6;
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000055 }
56
Georgios Pinitas1d480652019-01-23 11:24:50 +000057 static unsigned int out_width()
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000058 {
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000059 return 32;
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000060 }
61
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010062 static constexpr unsigned int k_unroll()
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000063 {
64 return 1;
65 }
66
Georgios Pinitas0cc50ed2020-07-06 19:10:38 +010067 static constexpr bool supports_accumulate()
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010068 {
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010069 return true;
70 }
71
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000072 StdTransformsFixed<operand_type, result_type, 6, 32, 1> transforms = {};
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000073
74 // Default to the generic kernel
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000075 kern_type kernel=a64_hybrid_fp16_mla_6x32;
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000076
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000077 cls_a64_hybrid_fp16_mla_6x32(const CPUInfo *)
Georgios Pinitas5aa1a0b2020-07-02 20:02:20 +010078 {
Georgios Pinitas5aa1a0b2020-07-02 20:02:20 +010079 }
Georgios Pinitas7cd26d42019-01-09 18:35:17 +000080};
81
82} // namespace arm_gemm
83
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000084#undef ARGLIST
Georgios Pinitas48b3ef82019-10-14 19:03:09 +010085#endif // __aarch64__