diff options
Diffstat (limited to 'src/core/NEON/wrapper/traits.h')
-rw-r--r-- | src/core/NEON/wrapper/traits.h | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/src/core/NEON/wrapper/traits.h b/src/core/NEON/wrapper/traits.h index eafbeef372..1dac61af74 100644 --- a/src/core/NEON/wrapper/traits.h +++ b/src/core/NEON/wrapper/traits.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2020 Arm Limited. + * Copyright (c) 2018-2021, 2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,11 +21,24 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef ARM_COMPUTE_WRAPPER_TRAITS_H -#define ARM_COMPUTE_WRAPPER_TRAITS_H +#ifndef ACL_SRC_CORE_NEON_WRAPPER_TRAITS_H +#define ACL_SRC_CORE_NEON_WRAPPER_TRAITS_H + +#include "arm_compute/core/CoreTypes.h" + +#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) +#include "src/cpu/CpuTypes.h" // required for float16_t +#endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) #include <arm_neon.h> +#if defined(ARM_COMPUTE_ENABLE_SVE) && defined(__ARM_FEATURE_SVE) +#include <arm_sve.h> +#endif /* defined(ARM_COMPUTE_ENABLE_SVE) && defined(__ARM_FEATURE_SVE) */ + +#include <cmath> +#include <cstdint> + namespace arm_compute { namespace wrapper @@ -40,7 +53,7 @@ struct vector_64_tag {}; /** 128-bit vector tag */ struct vector_128_tag {}; -/** Create the appropriate NEON vector given its type and size in terms of elements */ +/** Create the appropriate SIMD vector given its type and size in terms of elements */ template <typename T, int S> struct neon_vector; // Specializations @@ -84,7 +97,7 @@ enum class BitWidth W128, /**< 128-bit width */ }; -/** Create the appropriate NEON vector given its type and size in terms of bits */ +/** Create the appropriate SIMD vector given its type and size in terms of bits */ template <typename T, BitWidth BW> struct neon_bitvector; // Specializations #ifndef DOXYGEN_SKIP_THIS @@ -110,6 +123,16 @@ template <> struct neon_bitvector<float_t, BitWidth::W128>{ using type = float32 template <> struct neon_bitvector<float16_t, BitWidth::W64>{ using type = float16x4_t; using tag_type = vector_64_tag; }; template <> struct neon_bitvector<float16_t, BitWidth::W128>{ using type = float16x8_t; using tag_type = vector_128_tag; }; #endif // __ARM_FEATURE_FP16_VECTOR_ARITHMETIC + + +#if defined(ARM_COMPUTE_ENABLE_SVE) && defined(__ARM_FEATURE_SVE) +/** Create the appropriate SVE vector given its type */ +template <typename T> struct sve_vector; + +template <> struct sve_vector<uint8_t>{ using scalar_type = uint8_t; using type = svuint8_t; }; +template <> struct sve_vector<int8_t>{ using scalar_type = int8_t; using type = svint8_t; }; +#endif /* defined(ARM_COMPUTE_ENABLE_SVE) && defined(__ARM_FEATURE_SVE) */ + #endif /* DOXYGEN_SKIP_THIS */ /** Helper type template to get the type of a neon vector */ @@ -137,4 +160,4 @@ using promote_t = typename promote<T>::type; } // namespace traits } // namespace wrapper } // namespace arm_compute -#endif /* ARM_COMPUTE_WRAPPER_TRAITS_H */ +#endif // ACL_SRC_CORE_NEON_WRAPPER_TRAITS_H |