Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022 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 | */ |
alerah01 | 4cbcb84 | 2022-02-28 06:38:08 +0200 | [diff] [blame] | 24 | |
| 25 | #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) |
| 26 | |
Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 27 | #include "arm_compute/core/Helpers.h" |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 28 | |
Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 29 | #include "src/cpu/kernels/elementwise_binary/generic/sve/impl.h" |
| 30 | namespace arm_compute |
| 31 | { |
| 32 | namespace cpu |
| 33 | { |
| 34 | template <ArithmeticOperation op> |
| 35 | void sve_fp16_elementwise_binary(const ITensor *in1, const ITensor *in2, ITensor *out, const Window &window) |
| 36 | { |
Michalis Spyrou | e417ff1 | 2022-06-28 19:46:42 +0100 | [diff] [blame] | 37 | return elementwise_arithmetic_op<float16_t>(in1, in2, out, op, window); |
Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 38 | } |
| 39 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 40 | template void sve_fp16_elementwise_binary<ArithmeticOperation::ADD>(const ITensor *in1, |
| 41 | const ITensor *in2, |
| 42 | ITensor *out, |
| 43 | const Window &window); |
| 44 | template void sve_fp16_elementwise_binary<ArithmeticOperation::SUB>(const ITensor *in1, |
| 45 | const ITensor *in2, |
| 46 | ITensor *out, |
| 47 | const Window &window); |
| 48 | template void sve_fp16_elementwise_binary<ArithmeticOperation::DIV>(const ITensor *in1, |
| 49 | const ITensor *in2, |
| 50 | ITensor *out, |
| 51 | const Window &window); |
| 52 | template void sve_fp16_elementwise_binary<ArithmeticOperation::MIN>(const ITensor *in1, |
| 53 | const ITensor *in2, |
| 54 | ITensor *out, |
| 55 | const Window &window); |
| 56 | template void sve_fp16_elementwise_binary<ArithmeticOperation::MAX>(const ITensor *in1, |
| 57 | const ITensor *in2, |
| 58 | ITensor *out, |
| 59 | const Window &window); |
| 60 | template void sve_fp16_elementwise_binary<ArithmeticOperation::SQUARED_DIFF>(const ITensor *in1, |
| 61 | const ITensor *in2, |
| 62 | ITensor *out, |
| 63 | const Window &window); |
| 64 | template void sve_fp16_elementwise_binary<ArithmeticOperation::POWER>(const ITensor *in1, |
| 65 | const ITensor *in2, |
| 66 | ITensor *out, |
| 67 | const Window &window); |
| 68 | template void sve_fp16_elementwise_binary<ArithmeticOperation::PRELU>(const ITensor *in1, |
| 69 | const ITensor *in2, |
| 70 | ITensor *out, |
| 71 | const Window &window); |
Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 72 | |
| 73 | template <ComparisonOperation op> |
| 74 | void sve_fp16_comparison_elementwise_binary(const ITensor *in1, const ITensor *in2, ITensor *out, const Window &window) |
| 75 | { |
Michalis Spyrou | e417ff1 | 2022-06-28 19:46:42 +0100 | [diff] [blame] | 76 | return elementwise_comparison_op<float16_t>(in1, in2, out, op, window); |
Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 77 | } |
| 78 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 79 | template void sve_fp16_comparison_elementwise_binary<ComparisonOperation::Equal>(const ITensor *in1, |
| 80 | const ITensor *in2, |
| 81 | ITensor *out, |
| 82 | const Window &window); |
| 83 | template void sve_fp16_comparison_elementwise_binary<ComparisonOperation::NotEqual>(const ITensor *in1, |
| 84 | const ITensor *in2, |
| 85 | ITensor *out, |
| 86 | const Window &window); |
| 87 | template void sve_fp16_comparison_elementwise_binary<ComparisonOperation::Greater>(const ITensor *in1, |
| 88 | const ITensor *in2, |
| 89 | ITensor *out, |
| 90 | const Window &window); |
| 91 | template void sve_fp16_comparison_elementwise_binary<ComparisonOperation::GreaterEqual>(const ITensor *in1, |
| 92 | const ITensor *in2, |
| 93 | ITensor *out, |
| 94 | const Window &window); |
| 95 | template void sve_fp16_comparison_elementwise_binary<ComparisonOperation::Less>(const ITensor *in1, |
| 96 | const ITensor *in2, |
| 97 | ITensor *out, |
| 98 | const Window &window); |
| 99 | template void sve_fp16_comparison_elementwise_binary<ComparisonOperation::LessEqual>(const ITensor *in1, |
| 100 | const ITensor *in2, |
| 101 | ITensor *out, |
| 102 | const Window &window); |
Dana Zlotnik | d5c496d | 2021-11-28 14:46:12 +0200 | [diff] [blame] | 103 | |
| 104 | } // namespace cpu |
| 105 | } // namespace arm_compute |
alerah01 | 4cbcb84 | 2022-02-28 06:38:08 +0200 | [diff] [blame] | 106 | |
Felix Thomasmathibalan | afd38f0 | 2023-09-27 17:46:17 +0100 | [diff] [blame^] | 107 | #endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) */ |