diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-01-06 19:42:21 +0000 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2021-01-08 15:38:18 +0000 |
commit | 70eb53b09adf57cc6ff7435c795e65a4f4697f67 (patch) | |
tree | def5f3e7fbc0df9dcfd6bb15336c97057a09c457 /src | |
parent | c216545a9ede448213e76bd50cba4ebd481b942c (diff) | |
download | ComputeLibrary-70eb53b09adf57cc6ff7435c795e65a4f4697f67.tar.gz |
Make CpuFloorKernel kernel stateless
- Rename NEFloorKernel to CpuFloorKernel to accomodate new ISA
implementations
- Remove state and instead pass tensors to operate during run
- Add member function to generate an execution window given an input and
output tensor description
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I9240b8ec534589c0f15c354f771f1ac5d7010c3b
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4773
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'src')
34 files changed, 370 insertions, 178 deletions
diff --git a/src/core/NEON/NEKernels.h b/src/core/NEON/NEKernels.h index d6cd696414..1e0b1f08d6 100644 --- a/src/core/NEON/NEKernels.h +++ b/src/core/NEON/NEKernels.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 Arm Limited. + * Copyright (c) 2016-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -69,7 +69,6 @@ #include "src/core/NEON/kernels/NEFastCornersKernel.h" #include "src/core/NEON/kernels/NEFillArrayKernel.h" #include "src/core/NEON/kernels/NEFillBorderKernel.h" -#include "src/core/NEON/kernels/NEFloorKernel.h" #include "src/core/NEON/kernels/NEFuseBatchNormalizationKernel.h" #include "src/core/NEON/kernels/NEGEMMInterleave4x4Kernel.h" #include "src/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.h" diff --git a/src/core/NEON/SVEMath.h b/src/core/NEON/SVEMath.h index 2b30e20e8d..075cb457e3 100644 --- a/src/core/NEON/SVEMath.h +++ b/src/core/NEON/SVEMath.h @@ -28,7 +28,6 @@ #include "src/core/NEON/wrapper/intrinsics/svcvt.h" #include "src/core/NEON/wrapper/intrinsics/svdup_n.h" #include "src/core/NEON/wrapper/intrinsics/svreinterpret.h" -#include "src/core/common/StdTypes.h" #include <arm_sve.h> #include <array> diff --git a/src/core/NEON/kernels/NEArithmeticAdditionKernel.cpp b/src/core/NEON/kernels/NEArithmeticAdditionKernel.cpp index f706ee5694..4b53d26a5a 100644 --- a/src/core/NEON/kernels/NEArithmeticAdditionKernel.cpp +++ b/src/core/NEON/kernels/NEArithmeticAdditionKernel.cpp @@ -32,7 +32,6 @@ #include "src/core/NEON/kernels/arithmetic_addition/impl/SVE/list.h" #include "src/core/NEON/wrapper/wrapper.h" #include "src/core/common/Registrars.h" -#include "src/core/common/StdTypes.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/core/helpers/WindowHelpers.h" diff --git a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp index ed1cb6fca4..fdd2aabf60 100644 --- a/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp +++ b/src/core/NEON/kernels/NEElementwiseUnaryKernel.cpp @@ -31,7 +31,6 @@ #include "src/core/NEON/kernels/elementwise/impl/elementwise_unary_list.h" #include "src/core/SVE/kernels/elementwise/impl/elementwise_unary_list.h" #include "src/core/common/Registrars.h" -#include "src/core/common/StdTypes.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/core/helpers/WindowHelpers.h" #include "support/ToolchainSupport.h" @@ -55,35 +54,35 @@ static const ElementwiseUnaryKernel available_kernels[] = { "fp32_sve_elementwise_unary", [](DataType dt) { return dt == DataType::F32; }, - REGISTER_FP32_SVE(arm_compute::cpu::elementwise_sve_op<f32>), + REGISTER_FP32_SVE(arm_compute::cpu::elementwise_sve_op<float>), }, { "fp16_sve_elementwise_unary", [](DataType dt) { return dt == DataType::F16; }, - REGISTER_FP16_SVE(arm_compute::cpu::elementwise_sve_op<f16>), + REGISTER_FP16_SVE(arm_compute::cpu::elementwise_sve_op<__fp16>), }, { "s32_sve_elementwise_unary", [](DataType dt) { return dt == DataType::S32; }, - REGISTER_INTEGER_SVE(arm_compute::cpu::elementwise_sve_op<s32>), + REGISTER_INTEGER_SVE(arm_compute::cpu::elementwise_sve_op<int32_t>), }, #endif // defined(__ARM_FEATURE_SVE) { "fp32_neon_elementwise_unary", [](DataType dt) { return dt == DataType::F32; }, - REGISTER_FP32_NEON(arm_compute::cpu::elementwise_op<f32>), + REGISTER_FP32_NEON(arm_compute::cpu::elementwise_op<float>), }, #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) { "fp16_neon_elementwise_unary", [](DataType dt) { return dt == DataType::F16; }, - REGISTER_FP32_NEON(arm_compute::cpu::elementwise_op<f16>), + REGISTER_FP32_NEON(arm_compute::cpu::elementwise_op<__fp16>), }, #endif // defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) { "s32_neon_elementwise_unary", [](DataType dt) { return dt == DataType::S32; }, - REGISTER_INTEGER_NEON(arm_compute::cpu::elementwise_op<s32>), + REGISTER_INTEGER_NEON(arm_compute::cpu::elementwise_op<int32_t>), }, }; diff --git a/src/core/NEON/kernels/NEFloorKernel.h b/src/core/NEON/kernels/NEFloorKernel.h deleted file mode 100644 index 99c016bac5..0000000000 --- a/src/core/NEON/kernels/NEFloorKernel.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2017-2020 Arm Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_NEFLOORKERNEL_H -#define ARM_COMPUTE_NEFLOORKERNEL_H - -#include "src/core/NEON/INESimpleKernel.h" - -namespace arm_compute -{ -class ITensor; - -/** NEON kernel to perform a floor operation */ -class NEFloorKernel : public INESimpleKernel -{ -public: - const char *name() const override - { - return "NEFloorKernel"; - } - /** Constructor */ - NEFloorKernel() = default; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEFloorKernel(const NEFloorKernel &) = delete; - /** Prevent instances of this class from being copied (As this class contains pointers) */ - NEFloorKernel &operator=(const NEFloorKernel &) = delete; - /** Allow instances of this class to be moved */ - NEFloorKernel(NEFloorKernel &&) = default; - /** Allow instances of this class to be moved */ - NEFloorKernel &operator=(NEFloorKernel &&) = default; - /** Default destructor */ - ~NEFloorKernel() = default; - /** Set the source, destination of the kernel - * - * @param[in] input Source tensor. Data type supported: F16/F32. - * @param[out] output Destination tensor. Same as @p input - */ - void configure(const ITensor *input, ITensor *output); - /** Static function to check if given info will lead to a valid configuration of @ref NEFloorKernel - * - * @param[in] input Source tensor info. Data type supported: F16/F32. - * @param[in] output Destination tensor info. Same as @p input - * - * @return a status - */ - static Status validate(const ITensorInfo *input, const ITensorInfo *output); - - // Inherited methods overridden: - void run(const Window &window, const ThreadInfo &info) override; -}; -} // namespace arm_compute -#endif /*ARM_COMPUTE_NEFLOORKERNEL_H */ diff --git a/src/core/NEON/kernels/activation/impl/NEON/fp16.cpp b/src/core/NEON/kernels/activation/impl/NEON/fp16.cpp index 58e1cfcf23..27ae2830cc 100644 --- a/src/core/NEON/kernels/activation/impl/NEON/fp16.cpp +++ b/src/core/NEON/kernels/activation/impl/NEON/fp16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,7 +26,6 @@ #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Validate.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/activation/impl/NEON/fp32.cpp b/src/core/NEON/kernels/activation/impl/NEON/fp32.cpp index 610db05224..0687646be7 100644 --- a/src/core/NEON/kernels/activation/impl/NEON/fp32.cpp +++ b/src/core/NEON/kernels/activation/impl/NEON/fp32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,7 +26,6 @@ #include "arm_compute/core/Window.h" #include "src/core/NEON/NEMath.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/activation/impl/NEON/qasymm8.cpp b/src/core/NEON/kernels/activation/impl/NEON/qasymm8.cpp index 7b26441824..7506a8294f 100644 --- a/src/core/NEON/kernels/activation/impl/NEON/qasymm8.cpp +++ b/src/core/NEON/kernels/activation/impl/NEON/qasymm8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -27,7 +27,6 @@ #include "src/core/NEON/NEAsymm.h" #include "src/core/NEON/NEMath.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/activation/impl/NEON/qasymm8_signed.cpp b/src/core/NEON/kernels/activation/impl/NEON/qasymm8_signed.cpp index c616c5e27d..8f75abea8e 100644 --- a/src/core/NEON/kernels/activation/impl/NEON/qasymm8_signed.cpp +++ b/src/core/NEON/kernels/activation/impl/NEON/qasymm8_signed.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -26,7 +26,6 @@ #include "src/core/NEON/NEAsymm.h" #include "src/core/NEON/NEMath.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/activation/impl/NEON/qsymm16.cpp b/src/core/NEON/kernels/activation/impl/NEON/qsymm16.cpp index 0bef807db9..9eee360427 100644 --- a/src/core/NEON/kernels/activation/impl/NEON/qsymm16.cpp +++ b/src/core/NEON/kernels/activation/impl/NEON/qsymm16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -28,7 +28,6 @@ #include "src/core/NEON/NEMath.h" #include "src/core/NEON/NESymm.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/activation/impl/SVE/fp16.cpp b/src/core/NEON/kernels/activation/impl/SVE/fp16.cpp index 8d6f4f2351..8208813cd3 100644 --- a/src/core/NEON/kernels/activation/impl/SVE/fp16.cpp +++ b/src/core/NEON/kernels/activation/impl/SVE/fp16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,7 +24,6 @@ #include "arm_compute/core/Helpers.h" #include "arm_compute/core/ITensorPack.h" #include "arm_compute/core/Window.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <cmath> diff --git a/src/core/NEON/kernels/activation/impl/SVE/fp32.cpp b/src/core/NEON/kernels/activation/impl/SVE/fp32.cpp index 2c276028a0..55bdc9999e 100644 --- a/src/core/NEON/kernels/activation/impl/SVE/fp32.cpp +++ b/src/core/NEON/kernels/activation/impl/SVE/fp32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -25,7 +25,6 @@ #include "arm_compute/core/ITensorPack.h" #include "arm_compute/core/Window.h" #include "src/core/NEON/SVEMath.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <cmath> diff --git a/src/core/NEON/kernels/activation/impl/SVE/qasymm8.cpp b/src/core/NEON/kernels/activation/impl/SVE/qasymm8.cpp index 55133f074c..3e29a68788 100644 --- a/src/core/NEON/kernels/activation/impl/SVE/qasymm8.cpp +++ b/src/core/NEON/kernels/activation/impl/SVE/qasymm8.cpp @@ -24,7 +24,6 @@ #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Window.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/activation/impl/SVE/qasymm8_signed.cpp b/src/core/NEON/kernels/activation/impl/SVE/qasymm8_signed.cpp index 5b010d9453..f21d0657ab 100644 --- a/src/core/NEON/kernels/activation/impl/SVE/qasymm8_signed.cpp +++ b/src/core/NEON/kernels/activation/impl/SVE/qasymm8_signed.cpp @@ -24,7 +24,6 @@ #include "arm_compute/core/Helpers.h" #include "arm_compute/core/Window.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <cmath> diff --git a/src/core/NEON/kernels/activation/impl/SVE/qsymm16.cpp b/src/core/NEON/kernels/activation/impl/SVE/qsymm16.cpp index 1432e3bbdf..dbaf267bf9 100644 --- a/src/core/NEON/kernels/activation/impl/SVE/qsymm16.cpp +++ b/src/core/NEON/kernels/activation/impl/SVE/qsymm16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -25,7 +25,6 @@ #include "arm_compute/core/ITensorPack.h" #include "arm_compute/core/Window.h" #include "arm_compute/core/experimental/Types.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <cmath> diff --git a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/integer.cpp b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/integer.cpp index 8dd58cec6d..0aededfcfd 100644 --- a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/integer.cpp +++ b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/integer.cpp @@ -26,7 +26,6 @@ #include "arm_compute/core/Types.h" #include "arm_compute/core/utils/misc/Traits.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/helpers/WindowHelpers.h" namespace arm_compute diff --git a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8.cpp b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8.cpp index b93dad20f1..0b3a851fc5 100644 --- a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8.cpp +++ b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8.cpp @@ -26,7 +26,6 @@ #include "arm_compute/core/Types.h" #include "arm_compute/core/utils/misc/Traits.h" #include "src/core/NEON/wrapper/intrinsics/intrinsics.h" -#include "src/core/common/StdTypes.h" #include "src/core/helpers/WindowHelpers.h" namespace arm_compute diff --git a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8_signed.cpp b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8_signed.cpp index ba81cfcc03..18f5aabb21 100644 --- a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8_signed.cpp +++ b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qasymm8_signed.cpp @@ -26,7 +26,6 @@ #include "arm_compute/core/Types.h" #include "arm_compute/core/utils/misc/Traits.h" #include "src/core/NEON/wrapper/intrinsics/intrinsics.h" -#include "src/core/common/StdTypes.h" #include "src/core/helpers/WindowHelpers.h" namespace arm_compute diff --git a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qsymm16.cpp b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qsymm16.cpp index 538c600187..650f25ed5a 100644 --- a/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qsymm16.cpp +++ b/src/core/NEON/kernels/arithmetic_addition/impl/NEON/qsymm16.cpp @@ -26,7 +26,6 @@ #include "arm_compute/core/Types.h" #include "arm_compute/core/utils/misc/Traits.h" #include "src/core/NEON/wrapper/intrinsics/intrinsics.h" -#include "src/core/common/StdTypes.h" #include "src/core/helpers/WindowHelpers.h" namespace arm_compute diff --git a/src/core/NEON/kernels/batchnormalization/impl/NEON/fp16.cpp b/src/core/NEON/kernels/batchnormalization/impl/NEON/fp16.cpp index fd17b98f7b..704f003521 100644 --- a/src/core/NEON/kernels/batchnormalization/impl/NEON/fp16.cpp +++ b/src/core/NEON/kernels/batchnormalization/impl/NEON/fp16.cpp @@ -27,7 +27,6 @@ #include "src/core/NEON/NEMath.h" #include "src/core/NEON/kernels/detail/NEActivationFunctionDetail.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/batchnormalization/impl/NEON/fp32.cpp b/src/core/NEON/kernels/batchnormalization/impl/NEON/fp32.cpp index 5b375e5d4d..76a71ed738 100644 --- a/src/core/NEON/kernels/batchnormalization/impl/NEON/fp32.cpp +++ b/src/core/NEON/kernels/batchnormalization/impl/NEON/fp32.cpp @@ -27,7 +27,6 @@ #include "src/core/NEON/NEMath.h" #include "src/core/NEON/kernels/detail/NEActivationFunctionDetail.h" #include "src/core/NEON/wrapper/wrapper.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> diff --git a/src/core/NEON/kernels/batchnormalization/impl/SVE/fp16.cpp b/src/core/NEON/kernels/batchnormalization/impl/SVE/fp16.cpp index 00326ffc8d..5638dcef0a 100644 --- a/src/core/NEON/kernels/batchnormalization/impl/SVE/fp16.cpp +++ b/src/core/NEON/kernels/batchnormalization/impl/SVE/fp16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -25,7 +25,6 @@ #include "arm_compute/core/ITensorPack.h" #include "arm_compute/core/Window.h" #include "src/core/NEON/SVEMath.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <cmath> diff --git a/src/core/NEON/kernels/batchnormalization/impl/SVE/fp32.cpp b/src/core/NEON/kernels/batchnormalization/impl/SVE/fp32.cpp index 317befd61e..51397aca3a 100644 --- a/src/core/NEON/kernels/batchnormalization/impl/SVE/fp32.cpp +++ b/src/core/NEON/kernels/batchnormalization/impl/SVE/fp32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -25,7 +25,6 @@ #include "arm_compute/core/ITensorPack.h" #include "arm_compute/core/Window.h" #include "src/core/NEON/SVEMath.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <cmath> diff --git a/src/core/common/Macros.h b/src/core/common/Macros.h new file mode 100644 index 0000000000..d791154e5c --- /dev/null +++ b/src/core/common/Macros.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_COMMON_MACROS_H +#define ARM_COMPUTE_COMMON_MACROS_H + +#define ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(TypeName) \ + TypeName(const TypeName &) = delete; \ + TypeName &operator=(const TypeName &) = delete; \ + TypeName(TypeName &&) = default; \ + TypeName &operator=(TypeName &&) = default + +#endif /* ARM_COMPUTE_COMMON_MACROS_H */ diff --git a/src/core/common/StdTypes.h b/src/core/cpu/ICpuKernel.h index 3fba6187a3..650b3a7d0b 100644 --- a/src/core/common/StdTypes.h +++ b/src/core/cpu/ICpuKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,23 +21,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#ifndef SRC_CORE_COMMON_STDTYPES_H -#define SRC_CORE_COMMON_STDTYPES_H +#ifndef ARM_COMPUTE_ICPUKERNEL_H +#define ARM_COMPUTE_ICPUKERNEL_H -#include <cstdint> +#include "arm_compute/core/CPP/ICPPKernel.h" namespace arm_compute { -using u8 = uint8_t; -using s8 = int8_t; -using u16 = uint16_t; -using s16 = int16_t; -using u32 = uint32_t; -using s32 = int32_t; -using f32 = float; -#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) -using f16 = __fp16; -#endif /* defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) */ +namespace cpu +{ +using ICpuKernel = arm_compute::ICPPKernel; +} // namespace cpu } // namespace arm_compute - -#endif /* SRC_CORE_COMMON_STDTYPES_H */ +#endif /* ARM_COMPUTE_ICPUKERNEL_H */ diff --git a/src/core/cpu/kernels/CpuFloorKernel.h b/src/core/cpu/kernels/CpuFloorKernel.h new file mode 100644 index 0000000000..dc3a9d5ff1 --- /dev/null +++ b/src/core/cpu/kernels/CpuFloorKernel.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2017-2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_CPU_FLOOR_KERNEL_H +#define ARM_COMPUTE_CPU_FLOOR_KERNEL_H + +#include "src/core/common/Macros.h" +#include "src/core/cpu/ICpuKernel.h" + +namespace arm_compute +{ +namespace cpu +{ +namespace kernels +{ +/** Cpu accelarated kernel to perform a floor operation */ +class CpuFloorKernel : public ICpuKernel +{ +public: + CpuFloorKernel() = default; + ARM_COMPUTE_DISALLOW_COPY_ALLOW_MOVE(CpuFloorKernel); + /** Set the source, destination of the kernel + * + * @param[in] src Source tensor. Data type supported: F16/F32. + * @param[out] dst Destination tensor. Same as @p src + */ + void configure(const ITensorInfo *src, ITensorInfo *dst); + /** Static function to check if given info will lead to a valid configuration of @ref CpuFloorKernel + * + * @param[in] src Source tensor info. Data type supported: F16/F32. + * @param[in] dst Destination tensor info. Same as @p src + * + * @return a status + */ + static Status validate(const ITensorInfo *src, const ITensorInfo *dst); + /** Infer execution window + * + * @param[in] src Source tensor info. Data type supported: F16/F32. + * @param[in] dst Destination tensor info. Same as @p src + * + * @return an execution Window + */ + Window infer_window(const ITensorInfo *src, const ITensorInfo *dst); + + // Inherited methods overridden: + void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) final; + const char *name() const final; +}; +} // namespace kernels +} // namespace cpu +} // namespace arm_compute +#endif /* ARM_COMPUTE_CPU_FLOOR_KERNEL_H */ diff --git a/src/core/NEON/kernels/NEFloorKernel.cpp b/src/core/cpu/kernels/floor/CpuFloorKernel.cpp index 2750acdda7..738f04d14a 100644 --- a/src/core/NEON/kernels/NEFloorKernel.cpp +++ b/src/core/cpu/kernels/floor/CpuFloorKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -21,39 +21,43 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#include "src/core/NEON/kernels/NEFloorKernel.h" +#include "src/core/cpu/kernels/CpuFloorKernel.h" #include "arm_compute/core/Coordinates.h" #include "arm_compute/core/Helpers.h" #include "arm_compute/core/ITensor.h" #include "arm_compute/core/Validate.h" #include "src/core/CPP/Validate.h" -#include "src/core/NEON/INEKernel.h" #include "src/core/helpers/AutoConfiguration.h" #include "src/core/helpers/WindowHelpers.h" -#include "src/core/NEON/kernels/floor/impl/list.h" #include "src/core/common/Registrars.h" +#include "src/core/cpu/kernels/floor/impl/list.h" namespace arm_compute { +namespace cpu +{ +namespace kernels +{ namespace { struct FloorSelectorData { DataType dt; }; + using FloorSelectorPtr = std::add_pointer<bool(const FloorSelectorData &data)>::type; using FloorUKernelPtr = std::add_pointer<void(const void *, void *, int)>::type; -struct FloorKernel +struct FloorUKernel { const char *name; const FloorSelectorPtr is_selected; - FloorUKernelPtr ukernel; + FloorUKernelPtr func; }; -static const FloorKernel available_kernels[] = +static const FloorUKernel available_kernels[] = { { "fp16_neon_floor", @@ -67,7 +71,13 @@ static const FloorKernel available_kernels[] = }, }; -const FloorKernel *get_implementation(const FloorSelectorData &data) +/** Micro-kernel selector + * + * @param[in] data Selection data passed to help pick the appropriate micro-kernel + * + * @return A matching micro-kernel else nullptr + */ +const FloorUKernel *get_implementation(const FloorSelectorData &data) { for(const auto &uk : available_kernels) { @@ -79,72 +89,91 @@ const FloorKernel *get_implementation(const FloorSelectorData &data) return nullptr; } -Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output) +Status validate_arguments(const ITensorInfo *src, const ITensorInfo *dst) { - ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(src, dst); - const auto *uk = get_implementation(FloorSelectorData{ input->data_type() }); - ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->ukernel == nullptr); + const auto *uk = get_implementation(FloorSelectorData{ src->data_type() }); + ARM_COMPUTE_RETURN_ERROR_ON(uk == nullptr || uk->func == nullptr); // Validate in case of configured output - if(output->total_size() > 0) + if(dst->total_size() > 0) { - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); - ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(src, dst); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(src, dst); } return Status{}; } } // namespace -void NEFloorKernel::configure(const ITensor *input, ITensor *output) +void CpuFloorKernel::configure(const ITensorInfo *src, ITensorInfo *dst) { - ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); // Auto initialize output - auto_init_if_empty(*output->info(), input->info()->tensor_shape(), 1, input->info()->data_type()); + auto_init_if_empty(*dst, src->tensor_shape(), 1, src->data_type()); // Validate - ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info())); - - _input = input; - _output = output; + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, dst)); // Configure kernel window - Window win = calculate_max_window(*input->info(), Steps()); + const Window win = calculate_max_window(*src, Steps()); Coordinates coord; - coord.set_num_dimensions(output->info()->num_dimensions()); - output->info()->set_valid_region(ValidRegion(coord, output->info()->tensor_shape())); + coord.set_num_dimensions(dst->num_dimensions()); + dst->set_valid_region(ValidRegion(coord, dst->tensor_shape())); + + ICPPKernel::configure(win); +} - INEKernel::configure(win); +Window CpuFloorKernel::infer_window(const ITensorInfo *src, const ITensorInfo *dst) +{ + ARM_COMPUTE_UNUSED(dst); + ARM_COMPUTE_ERROR_ON(!bool(validate_arguments(src, dst))); + + Window win; + win.use_tensor_dimensions(src->tensor_shape()); + return win; } -Status NEFloorKernel::validate(const ITensorInfo *input, const ITensorInfo *output) +Status CpuFloorKernel::validate(const ITensorInfo *input, const ITensorInfo *output) { ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output)); return Status{}; } -void NEFloorKernel::run(const Window &window, const ThreadInfo &info) +void CpuFloorKernel::run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info); ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); - ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(INEKernel::window(), window); + ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window); + + ARM_COMPUTE_ERROR_ON(tensors.empty()); + + const ITensor *src = tensors.get_const_tensor(TensorType::ACL_SRC); + ITensor *dst = tensors.get_tensor(TensorType::ACL_DST); + + const auto len = static_cast<int>(window.x().end()) - static_cast<int>(window.x().start()); + const auto *ukernel = get_implementation(FloorSelectorData{ src->info()->data_type() }); Window win{ window }; win.set(Window::DimX, Window::Dimension(0, 1, 1)); - const auto len = static_cast<int>(window.x().end()) - static_cast<int>(window.x().start()); - const auto *uk = get_implementation(FloorSelectorData{ _input->info()->data_type() }); - - Iterator input(_input, win); - Iterator output(_output, win); + Iterator src_it(src, win); + Iterator dst_it(dst, win); execute_window_loop(win, [&](const Coordinates &) { - uk->ukernel(input.ptr(), output.ptr(), len); + ukernel->func(src_it.ptr(), dst_it.ptr(), len); }, - input, output); + src_it, dst_it); +} + +const char *CpuFloorKernel::name() const +{ + return "CpuFloorKernel"; } +} // namespace kernels +} // namespace cpu } // namespace arm_compute diff --git a/src/core/NEON/kernels/floor/impl/NEON/fp16.cpp b/src/core/cpu/kernels/floor/impl/NEON/fp16.cpp index 4f56ca9daf..0d31eb77f8 100644 --- a/src/core/NEON/kernels/floor/impl/NEON/fp16.cpp +++ b/src/core/cpu/kernels/floor/impl/NEON/fp16.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,7 +24,6 @@ #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(ENABLE_FP16_KERNELS) #include "src/core/NEON/NEMath.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> @@ -43,8 +42,8 @@ void fp16_neon_floor(const void *src, void *dst, int len) ARM_COMPUTE_ASSERT_NOT_NULLPTR(dst); ARM_COMPUTE_ASSERT(len >= 0); - auto psrc = static_cast<const f16 *>(src); - auto pdst = static_cast<f16 *>(dst); + auto psrc = static_cast<const __fp16 *>(src); + auto pdst = static_cast<__fp16 *>(dst); for(; len >= step; len -= step) { diff --git a/src/core/NEON/kernels/floor/impl/NEON/fp32.cpp b/src/core/cpu/kernels/floor/impl/NEON/fp32.cpp index 3f4b14b3e5..dd63f9f9d7 100644 --- a/src/core/NEON/kernels/floor/impl/NEON/fp32.cpp +++ b/src/core/cpu/kernels/floor/impl/NEON/fp32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -22,7 +22,6 @@ * SOFTWARE. */ #include "src/core/NEON/NEMath.h" -#include "src/core/common/StdTypes.h" #include "src/core/common/Validate.h" #include <arm_neon.h> @@ -41,8 +40,8 @@ void fp32_neon_floor(const void *src, void *dst, int len) ARM_COMPUTE_ASSERT_NOT_NULLPTR(dst); ARM_COMPUTE_ASSERT(len >= 0); - auto psrc = static_cast<const f32 *>(src); - auto pdst = static_cast<f32 *>(dst); + auto psrc = static_cast<const float *>(src); + auto pdst = static_cast<float *>(dst); for(; len >= step; len -= step) { diff --git a/src/core/NEON/kernels/floor/impl/list.h b/src/core/cpu/kernels/floor/impl/list.h index 0eb66e0090..4367e0ffc9 100644 --- a/src/core/NEON/kernels/floor/impl/list.h +++ b/src/core/cpu/kernels/floor/impl/list.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2021 Arm Limited. * * SPDX-License-Identifier: MIT * diff --git a/src/runtime/NEON/functions/NEFloor.cpp b/src/runtime/NEON/functions/NEFloor.cpp index 74149e6f24..b4ecb1ef38 100644 --- a/src/runtime/NEON/functions/NEFloor.cpp +++ b/src/runtime/NEON/functions/NEFloor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -23,19 +23,44 @@ */ #include "arm_compute/runtime/NEON/functions/NEFloor.h" -#include "src/core/NEON/kernels/NEFloorKernel.h" +#include "src/runtime/cpu/operators/CpuFloor.h" namespace arm_compute { +NEFloor::NEFloor() + : _impl(std::make_unique<Impl>()) +{ +} +NEFloor::NEFloor(NEFloor &&) = default; +NEFloor &NEFloor::operator=(NEFloor &&) = default; +NEFloor::~NEFloor() = default; + +struct NEFloor::Impl +{ + const ITensor *src{ nullptr }; + ITensor *dst{ nullptr }; + std::unique_ptr<cpu::CpuFloor> op{ nullptr }; +}; + void NEFloor::configure(const ITensor *input, ITensor *output) { - auto k = std::make_unique<NEFloorKernel>(); - k->configure(input, output); - _kernel = std::move(k); + _impl->src = input; + _impl->dst = output; + + _impl->op = std::make_unique<cpu::CpuFloor>(); + _impl->op->configure(_impl->src->info(), _impl->dst->info()); } Status NEFloor::validate(const ITensorInfo *input, const ITensorInfo *output) { - return NEFloorKernel::validate(input, output); + return cpu::CpuFloor::validate(input, output); +} + +void NEFloor::run() +{ + ITensorPack pack; + pack.add_tensor(TensorType::ACL_SRC, _impl->src); + pack.add_tensor(TensorType::ACL_DST, _impl->dst); + _impl->op->run(pack); } } // namespace arm_compute diff --git a/src/runtime/cpu/ICpuOperator.h b/src/runtime/cpu/ICpuOperator.h new file mode 100644 index 0000000000..bb7de1b69e --- /dev/null +++ b/src/runtime/cpu/ICpuOperator.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_ICPUOPERATOR_H +#define ARM_COMPUTE_ICPUOPERATOR_H + +#include "arm_compute/runtime/NEON/INEOperator.h" + +namespace arm_compute +{ +namespace cpu +{ +using ICpuOperator = arm_compute::experimental::INEOperator; +} // namespace cpu +} // namespace arm_compute +#endif /* ARM_COMPUTE_ICPUOPERATOR_H */ diff --git a/src/runtime/cpu/operators/CpuFloor.cpp b/src/runtime/cpu/operators/CpuFloor.cpp new file mode 100644 index 0000000000..4e169a04be --- /dev/null +++ b/src/runtime/cpu/operators/CpuFloor.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "src/runtime/cpu/operators/CpuFloor.h" + +#include "src/core/cpu/kernels/CpuFloorKernel.h" + +namespace arm_compute +{ +namespace cpu +{ +void CpuFloor::configure(const ITensorInfo *src, ITensorInfo *dst) +{ + auto k = std::make_unique<kernels::CpuFloorKernel>(); + k->configure(src, dst); + _kernel = std::move(k); +} + +Status CpuFloor::validate(const ITensorInfo *src, const ITensorInfo *dst) +{ + return kernels::CpuFloorKernel::validate(src, dst); +} +} // namespace cpu +} // namespace arm_compute diff --git a/src/runtime/cpu/operators/CpuFloor.h b/src/runtime/cpu/operators/CpuFloor.h new file mode 100644 index 0000000000..30c850a2ca --- /dev/null +++ b/src/runtime/cpu/operators/CpuFloor.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_CPU_FLOOR_H +#define ARM_COMPUTE_CPU_FLOOR_H + +#include "src/runtime/cpu/ICpuOperator.h" + +namespace arm_compute +{ +namespace cpu +{ +/** Basic function to run @ref CpuFloorKernel */ +class CpuFloor : public ICpuOperator +{ +public: + /** Constructor */ + CpuFloor() = default; + /** Set the input and output tensor. + * + * @param[in] src Source tensor info. Data types supported: F16/F32. + * @param[in] dst Destination tensor info. Data type supported: same as @p src + */ + void configure(const ITensorInfo *src, ITensorInfo *dst); + /** Static function to check if given info will lead to a valid configuration of @ref CpuFloor + * + * @param[in] src Source tensor info. Data types supported: F16/F32. + * @param[in] dst Destination tensor info. Data type supported: same as @p src + * + * @return a status + */ + static Status validate(const ITensorInfo *input, const ITensorInfo *output); +}; +} // namespace cpu +} // namespace arm_compute +#endif /* ARM_COMPUTE_CPU_FLOOR_H */ |