Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 1 | /* |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2018-2019 ARM Limited. |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 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 | |
| 25 | #include "arm_compute/core/NEON/kernels/assembly/Helpers.h" |
| 26 | |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 27 | #include "arm_compute/core/NEON/kernels/assembly/arm_gemm.hpp" |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 28 | |
| 29 | namespace arm_compute |
| 30 | { |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 31 | arm_gemm::KernelDescription get_gemm_info(DataType input_type, |
| 32 | const CPUInfo &ci, |
| 33 | const unsigned int num_threads, |
| 34 | const INEGEMMWrapperKernel::Params &p, |
| 35 | float alpha, |
| 36 | float beta, |
| 37 | bool pretranspose_hint) |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 38 | { |
| 39 | switch(input_type) |
| 40 | { |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 41 | #ifdef __aarch64__ |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 42 | case DataType::QASYMM8: |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 43 | case DataType::U8: |
| 44 | { |
| 45 | arm_gemm::GemmArgs<uint32_t> args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, alpha, beta, num_threads, pretranspose_hint); |
| 46 | return arm_gemm::get_gemm_method<uint8_t, uint32_t>(args); |
| 47 | } |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 48 | case DataType::S8: |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 49 | { |
| 50 | arm_gemm::GemmArgs<int32_t> args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, alpha, beta, num_threads, pretranspose_hint); |
| 51 | return arm_gemm::get_gemm_method<int8_t, int32_t>(args); |
| 52 | } |
| 53 | #endif // __aarch64__ |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 54 | #ifdef __ARM_FEATURE_FP16_VECTOR_ARITHMETIC |
| 55 | case DataType::F16: |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 56 | { |
| 57 | arm_gemm::GemmArgs<__fp16> args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, alpha, beta, num_threads, pretranspose_hint); |
| 58 | return arm_gemm::get_gemm_method<__fp16, __fp16>(args); |
| 59 | } |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 60 | #endif /* __ARM_FEATURE_FP16_VECTOR_ARITHMETIC */ |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 61 | case DataType::F32: |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 62 | { |
| 63 | arm_gemm::GemmArgs<float> args(&ci, p.M, p.N, p.K, p.batches, p.multis, false, false, alpha, beta, num_threads, pretranspose_hint); |
| 64 | return arm_gemm::get_gemm_method<float, float>(args); |
| 65 | } |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 66 | default: |
Georgios Pinitas | 7cd26d4 | 2019-01-09 18:35:17 +0000 | [diff] [blame] | 67 | return arm_gemm::KernelDescription(); |
Anthony Barbier | ac314c2 | 2018-09-11 17:49:10 +0100 | [diff] [blame] | 68 | } |
| 69 | } |
| 70 | } // namespace arm_compute |