diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2019-12-16 17:00:49 +0000 |
---|---|---|
committer | Manuel Bottini <manuel.bottini@arm.com> | 2019-12-18 17:13:27 +0000 |
commit | d0bbf0351e560bfd35f248ac6137ce88fff23c30 (patch) | |
tree | 2fc1fee5727caf95cfd3700c34276190b997a3e9 /tests/benchmark/fixtures | |
parent | 27f223db96c6f5389b3e11a64d815edbd85dfd4c (diff) | |
download | ComputeLibrary-d0bbf0351e560bfd35f248ac6137ce88fff23c30.tar.gz |
COMPMID-2932: Clear untracked benchmarks
- Removes untracked benchmarks
- Leaves a couple per backend for public show-case
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Change-Id: I5fac2aec8617b03131ec0f3d64ed40fbbd4a63c2
Reviewed-on: https://review.mlplatform.org/c/2492
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Michalis Spyrou <michalis.spyrou@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/benchmark/fixtures')
50 files changed, 0 insertions, 5046 deletions
diff --git a/tests/benchmark/fixtures/ActivationLayerFixture.h b/tests/benchmark/fixtures/ActivationLayerFixture.h deleted file mode 100644 index 2ac10b2746..0000000000 --- a/tests/benchmark/fixtures/ActivationLayerFixture.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2017-2019 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_TEST_ACTIVATIONLAYERFIXTURE -#define ARM_COMPUTE_TEST_ACTIVATIONLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class ActivationLayerFixture : public framework::Fixture -{ -public: - ActivationLayerFixture() - : src(), dst(), act_layer(parameters->get_ctx<TensorType>()) - { - } - - template <typename...> - void setup(TensorShape shape, ActivationLayerInfo info, DataType data_type, int batches) - { - // Set batched in source and destination shapes - shape.set(shape.num_dimensions(), batches); - - // Create tensors - const QuantizationInfo q_info(0.5f, -10); - src = create_tensor<TensorType>(shape, data_type, 1, q_info); - dst = create_tensor<TensorType>(shape, data_type, 1, q_info); - - // Create and configure function - act_layer.configure(&src, &dst, info); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - act_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src; - TensorType dst; - Function act_layer; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ACTIVATIONLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h b/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h deleted file mode 100644 index 42adefeef6..0000000000 --- a/tests/benchmark/fixtures/BatchNormalizationLayerFixture.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_BATCHNORMALIZATIONLAYERFIXTURE -#define ARM_COMPUTE_TEST_BATCHNORMALIZATIONLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class BatchNormalizationLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape tensor_shape, TensorShape param_shape, float epsilon, bool use_gamma, bool use_beta, ActivationLayerInfo act_info, DataType data_type, DataLayout data_layout, int batches) - { - // Set batched in source and destination shapes - - tensor_shape.set(tensor_shape.num_dimensions(), batches); - if(data_layout == DataLayout::NHWC) - { - permute(tensor_shape, PermutationVector(2U, 0U, 1U)); - } - - // Create tensors - src = create_tensor<TensorType>(tensor_shape, data_type, 1, QuantizationInfo(), data_layout); - dst = create_tensor<TensorType>(tensor_shape, data_type, 1, QuantizationInfo(), data_layout); - mean = create_tensor<TensorType>(param_shape, data_type, 1); - variance = create_tensor<TensorType>(param_shape, data_type, 1); - beta = create_tensor<TensorType>(param_shape, data_type, 1); - gamma = create_tensor<TensorType>(param_shape, data_type, 1); - - // Create and configure function - TensorType *beta_ptr = use_beta ? &beta : nullptr; - TensorType *gamma_ptr = use_gamma ? &gamma : nullptr; - batch_norm_layer.configure(&src, &dst, &mean, &variance, beta_ptr, gamma_ptr, epsilon, act_info); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - mean.allocator()->allocate(); - variance.allocator()->allocate(); - beta.allocator()->allocate(); - gamma.allocator()->allocate(); - } - - void run() - { - batch_norm_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - mean.allocator()->free(); - variance.allocator()->free(); - beta.allocator()->free(); - gamma.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - TensorType mean{}; - TensorType variance{}; - TensorType beta{}; - TensorType gamma{}; - Function batch_norm_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_BATCHNORMALIZATIONLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/CannyEdgeFixture.h b/tests/benchmark/fixtures/CannyEdgeFixture.h deleted file mode 100644 index e2aec24b3e..0000000000 --- a/tests/benchmark/fixtures/CannyEdgeFixture.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_CANNY_EDGE_FIXTURE -#define ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -class CLCannyEdge; -class NECannyEdge; - -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class CannyEdgeFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(std::string image, int gradient_size, MagnitudeType norm_type, BorderMode border_mode, Format format) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - src = create_tensor<TensorType>(raw.shape(), format); - dst = create_tensor<TensorType>(raw.shape(), format); - - canny_edge_func.configure(&src, &dst, upper_thresh, lower_thresh, gradient_size, static_cast<int>(norm_type) + 1, border_mode, constant_border_value); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - library->fill(Accessor(src), raw); - } - - void run() - { - canny_edge_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - -private: - static const int32_t lower_thresh = 0; - static const int32_t upper_thresh = 255; - static const uint8_t constant_border_value = 0; - - TensorType src{}; - TensorType dst{}; - Function canny_edge_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CANNY_EDGE_FIXTURE */ diff --git a/tests/benchmark/fixtures/ColorConvertFixture.h b/tests/benchmark/fixtures/ColorConvertFixture.h deleted file mode 100644 index 6656e1482e..0000000000 --- a/tests/benchmark/fixtures/ColorConvertFixture.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_COLOR_CONVERT_FIXTURE -#define ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename MultiImageType, typename TensorType, typename AccessorType, typename FunctionType> -class ColorConvertFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape input_shape, Format src_format, Format dst_format) - { - _src_num_planes = num_planes_from_format(src_format); - _dst_num_planes = num_planes_from_format(dst_format); - - TensorShape dst_shape = adjust_odd_shape(input_shape, src_format); - dst_shape = adjust_odd_shape(dst_shape, dst_format); - - // Create tensors - ref_src = create_multi_image<MultiImageType>(dst_shape, src_format); - ref_dst = create_multi_image<MultiImageType>(dst_shape, dst_format); - - if(1U == _src_num_planes) - { - const TensorType *plane_src = static_cast<TensorType *>(ref_src.plane(0)); - - if(1U == _dst_num_planes) - { - TensorType *plane_dst = static_cast<TensorType *>(ref_dst.plane(0)); - colorconvert_func.configure(plane_src, plane_dst); - } - else - { - colorconvert_func.configure(plane_src, &ref_dst); - } - } - else - { - if(1U == _dst_num_planes) - { - TensorType *plane_dst = static_cast<TensorType *>(ref_dst.plane(0)); - colorconvert_func.configure(&ref_src, plane_dst); - } - else - { - colorconvert_func.configure(&ref_src, &ref_dst); - } - } - - // Allocate tensors - ref_src.allocate(); - ref_dst.allocate(); - - // Fill tensor planes - for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx) - { - TensorType *src_plane = static_cast<TensorType *>(ref_src.plane(plane_idx)); - - fill(AccessorType(*src_plane), plane_idx); - } - } - - void run() - { - colorconvert_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - TensorType *dst_plane = static_cast<TensorType *>(ref_dst.plane(plane_idx)); - sync_tensor_if_necessary<TensorType>(*dst_plane); - } - } - - void teardown() - { - for(unsigned int plane_idx = 0; plane_idx < _src_num_planes; ++plane_idx) - { - TensorType *src_plane = static_cast<TensorType *>(ref_src.plane(plane_idx)); - src_plane->allocator()->free(); - } - for(unsigned int plane_idx = 0; plane_idx < _dst_num_planes; ++plane_idx) - { - TensorType *dst_plane = static_cast<TensorType *>(ref_dst.plane(plane_idx)); - dst_plane->allocator()->free(); - } - } - -protected: - template <typename U> - void fill(U &&tensor, int i) - { - library->fill_tensor_uniform(tensor, i); - } - -private: - MultiImageType ref_src{}; - MultiImageType ref_dst{}; - FunctionType colorconvert_func{}; - - unsigned int _src_num_planes{}; - unsigned int _dst_num_planes{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_COLOR_CONVERT_FIXTURE */ diff --git a/tests/benchmark/fixtures/ConvolutionFixture.h b/tests/benchmark/fixtures/ConvolutionFixture.h deleted file mode 100644 index f355168ec1..0000000000 --- a/tests/benchmark/fixtures/ConvolutionFixture.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2018-2019 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_TEST_CONVOLUTIONFIXTURE -#define ARM_COMPUTE_TEST_CONVOLUTIONFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Parent fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class ConvolutionFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width, unsigned int height, bool is_separable = false) - { - std::mt19937 gen(library->seed()); - const uint8_t constant_border_value = 0; - - // Generate random scale value between 1 and 255. - std::uniform_int_distribution<uint8_t> distribution_scale(1, 255); - const uint32_t scale = distribution_scale(gen); - - ARM_COMPUTE_ERROR_ON(3 != width && 5 != width && 7 != width && 9 != width); - ARM_COMPUTE_ERROR_ON(3 != height && 5 != height && 7 != height && 9 != height); - - std::vector<int16_t> conv(width * height); - - _width = width; - _height = height; - - if(is_separable) - { - init_separable_conv(conv.data(), width, height, seed); - } - else - { - init_conv(conv.data(), width, height, seed); - } - - // Create tensors - src = create_tensor<TensorType>(src_shape, DataType::U8); - dst = create_tensor<TensorType>(src_shape, output_data_type); - - // Configure function - configure_target(src, dst, conv.data(), scale, border_mode, constant_border_value); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - - // Fill tensors - library->fill_tensor_uniform(Accessor(src), 0); - library->fill_tensor_uniform(Accessor(dst), 1); - } - - void run() - { - convolution_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - -protected: - virtual void configure_target(TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale, - BorderMode border_mode, uint8_t border_value) = 0; - -protected: - unsigned int _width{}; - unsigned int _height{}; - Function convolution_func{}; - -private: - const std::random_device::result_type seed = 0; - TensorType src{}; - TensorType dst{}; -}; - -/** Child fixture used for square convolutions */ -template <typename TensorType, typename Function, typename Accessor> -class ConvolutionSquareFixture : public ConvolutionFixture<TensorType, Function, Accessor> -{ -public: - template <typename...> - void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width) - { - ConvolutionFixture<TensorType, Function, Accessor>::setup(src_shape, output_data_type, border_mode, width, width); - } - -protected: - void configure_target(TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale, - BorderMode border_mode, uint8_t constant_border_value) - { - this->convolution_func.configure(&src, &dst, conv, scale, border_mode, constant_border_value); - } -}; - -/** Child fixture used for rectangular convolutions */ -template <typename TensorType, typename Function, typename Accessor> -class ConvolutionRectangleFixture : public ConvolutionFixture<TensorType, Function, Accessor> -{ -public: - template <typename...> - void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width, unsigned int height) - { - ConvolutionFixture<TensorType, Function, Accessor>::setup(src_shape, output_data_type, border_mode, width, height); - } - -protected: - void configure_target(TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale, - BorderMode border_mode, uint8_t constant_border_value) - { - this->convolution_func.configure(&src, &dst, conv, this->_width, this->_height, scale, border_mode, constant_border_value); - } -}; - -/** Child fixture used for separable convolutions */ -template <typename TensorType, typename Function, typename Accessor> -class ConvolutionSeperableFixture : public ConvolutionFixture<TensorType, Function, Accessor> -{ -public: - template <typename...> - void setup(TensorShape src_shape, DataType output_data_type, BorderMode border_mode, unsigned int width) - { - ConvolutionFixture<TensorType, Function, Accessor>::setup(src_shape, output_data_type, border_mode, width, width, true); - } - -protected: - void configure_target(TensorType &src, TensorType &dst, const int16_t *conv, uint32_t scale, - BorderMode border_mode, uint8_t constant_border_value) - { - this->convolution_func.configure(&src, &dst, conv, scale, border_mode, constant_border_value); - } -}; - -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CONVOLUTIONFIXTURE */ diff --git a/tests/benchmark/fixtures/ConvolutionLayerFixture.h b/tests/benchmark/fixtures/ConvolutionLayerFixture.h deleted file mode 100644 index b23c3457ab..0000000000 --- a/tests/benchmark/fixtures/ConvolutionLayerFixture.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_CONVOLUTIONLAYERFIXTURE -#define ARM_COMPUTE_TEST_CONVOLUTIONLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class ConvolutionLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, PadStrideInfo info, Size2D dilation, ActivationLayerInfo act_info, DataType data_type, - int batches) - { - // Set batched in source and destination shapes - src_shape.set(3 /* batch */, batches); - dst_shape.set(3 /* batch */, batches); - DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; - const QuantizationInfo qinfo(2.f / 255.f, 127); - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1, qinfo); - weights = create_tensor<TensorType>(weights_shape, data_type, 1, qinfo); - biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1); - dst = create_tensor<TensorType>(dst_shape, data_type, 1, qinfo); - - // Create and configure function - conv_layer.configure(&src, &weights, &biases, &dst, info, WeightsInfo(), dilation, act_info); - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - conv_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - weights.allocator()->free(); - biases.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function conv_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_CONVOLUTIONLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h b/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h deleted file mode 100644 index 272da38952..0000000000 --- a/tests/benchmark/fixtures/DepthConcatenateLayerFixture.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2017-2019 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_TEST_DEPTHCONCATENATELAYERFIXTURE -#define ARM_COMPUTE_TEST_DEPTHCONCATENATELAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/Utils.h" -#include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -#include <random> - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NE/CL/GC */ -template <typename TensorType, typename ITensorType, typename Function, typename AccessorType> -class DepthConcatenateLayerFixture : public framework::Fixture -{ -public: - inline std::vector<TensorShape> generate_input_shapes(TensorShape shape) - { - // Create input shapes - std::mt19937 gen(library->seed()); - std::uniform_int_distribution<> num_dis(2, 4); - const int num_tensors = num_dis(gen); - - std::vector<TensorShape> shapes(num_tensors, shape); - std::uniform_int_distribution<> depth_dis(1, 3); - - // Generate more shapes based on the input - for(auto &s : shapes) - { - // Set the depth of the tensor - s.set(2, depth_dis(gen)); - } - - return shapes; - } - - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - // Generate input shapes - std::vector<TensorShape> src_shapes = generate_input_shapes(shape); - - // Create tensors - _srcs.reserve(src_shapes.size()); - - std::vector<ITensorType *> src_ptrs; - - for(const auto &shape : src_shapes) - { - _srcs.emplace_back(create_tensor<TensorType>(shape, data_type, 1)); - src_ptrs.emplace_back(&_srcs.back()); - } - - TensorShape dst_shape = misc::shape_calculator::calculate_concatenate_shape(src_ptrs, Window::DimZ); - _dst = create_tensor<TensorType>(dst_shape, data_type, 1); - - _depth_concat.configure(src_ptrs, &_dst, 2); - - for(auto &src : _srcs) - { - src.allocator()->allocate(); - } - - _dst.allocator()->allocate(); - } - - void run() - { - _depth_concat.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(_dst); - } - - void teardown() - { - for(auto &src : _srcs) - { - src.allocator()->free(); - } - - _srcs.clear(); - - _dst.allocator()->free(); - } - -private: - std::vector<TensorType> _srcs{}; - TensorType _dst{}; - Function _depth_concat{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DEPTHCONCATENATELAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h b/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h deleted file mode 100644 index 09da816fd4..0000000000 --- a/tests/benchmark/fixtures/DepthwiseConvolutionLayerFixture.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2017-2019 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_TEST_DEPTHWISECONVOLUTIONFIXTURE -#define ARM_COMPUTE_TEST_DEPTHWISECONVOLUTIONFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -using namespace arm_compute::misc::shape_calculator; - -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class DepthwiseConvolutionLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, Size2D kernel_size, PadStrideInfo info, Size2D Dilation, DataType data_type, int batches) - { - ARM_COMPUTE_UNUSED(Dilation); - - // Get shapes - TensorShape weights_shape(kernel_size.width, kernel_size.height); - - const TensorInfo in_info(src_shape, 1, data_type); - const TensorInfo we_info(weights_shape, 1, data_type); - TensorShape dst_shape = compute_depthwise_convolution_shape(in_info, we_info, info, 1); - - weights_shape.set(2, dst_shape.z()); - - // Set batched in source and destination shapes - - src_shape.set(3 /* batch */, batches); - dst_shape.set(3 /* batch */, batches); - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1, QuantizationInfo(0.5f, 10)); - weights = create_tensor<TensorType>(weights_shape, data_type, 1, QuantizationInfo(0.5f, 10)); - biases = create_tensor<TensorType>(TensorShape(weights_shape[2]), is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type, 1); - dst = create_tensor<TensorType>(dst_shape, data_type, 1, QuantizationInfo(0.5f, 10)); - - // Create and configure function - depth_conv.configure(&src, &weights, &biases, &dst, info); - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - depth_conv.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - weights.allocator()->free(); - biases.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function depth_conv{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DEPTHWISECONVOLUTIONFIXTURE */ diff --git a/tests/benchmark/fixtures/DequantizationLayerFixture.h b/tests/benchmark/fixtures/DequantizationLayerFixture.h deleted file mode 100644 index 316098b220..0000000000 --- a/tests/benchmark/fixtures/DequantizationLayerFixture.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017-2019 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_TEST_DEQUANTIZATION_LAYER_FIXTURE -#define ARM_COMPUTE_TEST_DEQUANTIZATION_LAYER_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class DequantizationLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type_src, DataType data_type_dst) - { - const QuantizationInfo q_info(0.5f, -10); - - // Create tensors - src = create_tensor<TensorType>(shape, data_type_src, 1, q_info); - dst = create_tensor<TensorType>(shape, data_type_dst, 1, q_info); - - // Create and configure function - dequantization_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - dequantization_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function dequantization_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DEQUANTIZATION_LAYER_FIXTURE */ diff --git a/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h b/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h deleted file mode 100644 index f74f0ece1a..0000000000 --- a/tests/benchmark/fixtures/DirectConvolutionLayerFixture.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_DIRECTCONVOLUTIONLAYERFIXTURE -#define ARM_COMPUTE_TEST_DIRECTCONVOLUTIONLAYERFIXTURE - -#include "arm_compute/core/Error.h" -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class DirectConvolutionLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, PadStrideInfo info, Size2D dilation, ActivationLayerInfo act_info, DataType data_type, - int batches) - { - ARM_COMPUTE_UNUSED(dilation); - - // Set batched in source and destination shapes - - src_shape.set(3 /* batch */, batches); - dst_shape.set(3 /* batch */, batches); - DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1); - weights = create_tensor<TensorType>(weights_shape, data_type, 1); - biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1); - dst = create_tensor<TensorType>(dst_shape, data_type, 1); - - // Create and configure function - conv_layer.configure(&src, &weights, &biases, &dst, info, act_info); - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - conv_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - weights.allocator()->free(); - biases.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function conv_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DIRECTCONVOLUTIONLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/ElementWiseUnaryFixture.h b/tests/benchmark/fixtures/ElementWiseUnaryFixture.h deleted file mode 100644 index a26f7c84c0..0000000000 --- a/tests/benchmark/fixtures/ElementWiseUnaryFixture.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2019 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_TEST_ELEMENTWISE_UNARY_FIXTURE -#define ARM_COMPUTE_TEST_ELEMENTWISE_UNARY_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/AssetsLibrary.h" -#include "tests/Globals.h" -#include "tests/IAccessor.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/ElementWiseUnary.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class ElementWiseUnaryBenchmarkFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape input_shape, DataType input_data_type) - { - src = create_tensor<TensorType>(input_shape, input_data_type); - dst = create_tensor<TensorType>(input_shape, input_data_type); - - elwiseunary_layer.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - elwiseunary_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - -private: - TensorType src{}; - TensorType dst{}; - FunctionType elwiseunary_layer{}; -}; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class RsqrtBenchmarkFixture : public ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T> -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type); - } -}; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class ExpBenchmarkFixture : public ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T> -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type); - } -}; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class NegBenchmarkFixture : public ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T> -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type); - } -}; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class LogBenchmarkFixture : public ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T> -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type); - } -}; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class AbsBenchmarkFixture : public ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T> -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type); - } -}; - -template <typename TensorType, typename AccessorType, typename FunctionType, typename T> -class SinBenchmarkFixture : public ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T> -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - ElementWiseUnaryBenchmarkFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type); - } -}; -} // namespace validation -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ELEMENTWISE_UNARY_FIXTURE */ diff --git a/tests/benchmark/fixtures/EqualizeHistogramFixture.h b/tests/benchmark/fixtures/EqualizeHistogramFixture.h deleted file mode 100644 index 751415a4e0..0000000000 --- a/tests/benchmark/fixtures/EqualizeHistogramFixture.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_EQUALIZE_HISTOGRAM_FIXTURE -#define ARM_COMPUTE_TEST_EQUALIZE_HISTOGRAM_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class EqualizeHistogramFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, Format format) - { - // Create tensors - src = create_tensor<TensorType>(shape, format); - dst = create_tensor<TensorType>(shape, format); - - // Create and configure function - equalize_histogram_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - equalize_histogram_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function equalize_histogram_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_EQUALIZE_HISTOGRAM_FIXTURE */ diff --git a/tests/benchmark/fixtures/FFTConvolutionLayerFixture.h b/tests/benchmark/fixtures/FFTConvolutionLayerFixture.h deleted file mode 100644 index 2c53e3ad9b..0000000000 --- a/tests/benchmark/fixtures/FFTConvolutionLayerFixture.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2019 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_TEST_FFT_CONVOLUTION_LAYER_FIXTURE -#define ARM_COMPUTE_TEST_FFT_CONVOLUTION_LAYER_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class FFTConvolutionLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, PadStrideInfo info, Size2D dilation, ActivationLayerInfo act_info, DataType data_type, - int batches) - { - ARM_COMPUTE_UNUSED(dilation); - - // Set batched in source and destination shapes - - src_shape.set(3 /* batch */, batches); - dst_shape.set(3 /* batch */, batches); - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1); - weights = create_tensor<TensorType>(weights_shape, data_type, 1); - biases = create_tensor<TensorType>(biases_shape, data_type, 1); - dst = create_tensor<TensorType>(dst_shape, data_type, 1); - - // Create and configure function - conv_layer.configure(&src, &weights, &biases, &dst, info, act_info); - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - conv_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - weights.allocator()->free(); - biases.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function conv_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FFT_CONVOLUTION_LAYER_FIXTURE */ diff --git a/tests/benchmark/fixtures/FFTFixture.h b/tests/benchmark/fixtures/FFTFixture.h deleted file mode 100644 index 53897b1b14..0000000000 --- a/tests/benchmark/fixtures/FFTFixture.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2019 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_TEST_FFT_FIXTURE -#define ARM_COMPUTE_TEST_FFT_FIXTURE - -#include "arm_compute/core/Types.h" -#include "arm_compute/runtime/FunctionDescriptors.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename FFTInfo, typename Accessor> -class FFTFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - // Create tensors - src = create_tensor<TensorType>(shape, data_type, 2); - dst = create_tensor<TensorType>(shape, data_type, 2); - - // Create and configure function - fft_func.configure(&src, &dst, FFTInfo()); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - fft_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function fft_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FFT_FIXTURE */ diff --git a/tests/benchmark/fixtures/FastCornersFixture.h b/tests/benchmark/fixtures/FastCornersFixture.h deleted file mode 100644 index 636d25819f..0000000000 --- a/tests/benchmark/fixtures/FastCornersFixture.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_FAST_CORNERS_FIXTURE -#define ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -class CLFastCorners; -class NEFastCorners; - -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename ArrayType> -class FastCornersFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(std::string image, Format format, float threshold, bool suppress_nonmax, BorderMode border_mode) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create tensor - src = create_tensor<TensorType>(raw.shape(), format); - - // Create and configure function - configure_target<Function>(fast_corners_func, src, corners, &num_corners, threshold, suppress_nonmax, border_mode, 0); - - // Allocate tensor - src.allocator()->allocate(); - - // Copy image data to tensor - library->fill(Accessor(src), raw); - } - - void run() - { - fast_corners_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - - void teardown() - { - src.allocator()->free(); - } - -protected: - template <typename F, typename std::enable_if<std::is_same<F, CLFastCorners>::value, int>::type = 0> - void configure_target(F &func, TensorType &src, ArrayType &corners, unsigned int *num_corners, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value) - { - func.configure(&src, threshold, suppress_nonmax, &corners, num_corners, border_mode, constant_border_value); - } - - template <typename F, typename std::enable_if<std::is_same<F, NEFastCorners>::value, int>::type = 0> - void configure_target(F &func, TensorType &src, ArrayType &corners, unsigned int *num_corners, float threshold, bool suppress_nonmax, BorderMode border_mode, uint8_t constant_border_value) - { - ARM_COMPUTE_UNUSED(num_corners); - func.configure(&src, threshold, suppress_nonmax, &corners, border_mode, constant_border_value); - } - -private: - const static size_t max_corners = 20000; - - TensorType src{}; - ArrayType corners{ max_corners }; - unsigned int num_corners{ max_corners }; - Function fast_corners_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FAST_CORNERS_FIXTURE */ diff --git a/tests/benchmark/fixtures/FlattenLayerFixture.h b/tests/benchmark/fixtures/FlattenLayerFixture.h deleted file mode 100644 index 3d46989f71..0000000000 --- a/tests/benchmark/fixtures/FlattenLayerFixture.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_FLATTEN_LAYER_FIXTURE -#define ARM_COMPUTE_TEST_FLATTEN_LAYER_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class FlattenLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - TensorShape shape_flatten(shape); - shape_flatten.collapse(3); - - // Create tensors - src = create_tensor<TensorType>(shape, data_type, 1); - dst = create_tensor<TensorType>(shape_flatten, data_type, 1); - - // Create and configure function - flatten_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - flatten_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function flatten_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FLATTEN_LAYER_FIXTURE */ diff --git a/tests/benchmark/fixtures/FloorFixture.h b/tests/benchmark/fixtures/FloorFixture.h deleted file mode 100644 index 8c80fa386f..0000000000 --- a/tests/benchmark/fixtures/FloorFixture.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_FLOORFIXTURE -#define ARM_COMPUTE_TEST_FLOORFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class FloorFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(shape, data_type); - - // Create and configure function - floor_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - floor_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function floor_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FLOORFIXTURE */ diff --git a/tests/benchmark/fixtures/FullyConnectedLayerFixture.h b/tests/benchmark/fixtures/FullyConnectedLayerFixture.h deleted file mode 100644 index caef5bebc9..0000000000 --- a/tests/benchmark/fixtures/FullyConnectedLayerFixture.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_FULLYCONNECTEDLAYERFIXTURE -#define ARM_COMPUTE_TEST_FULLYCONNECTEDLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class FullyConnectedLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, DataType data_type, int batches) - { - // Set batched in source and destination shapes - - src_shape.set(src_shape.num_dimensions() /* batch */, batches); - dst_shape.set(dst_shape.num_dimensions() /* batch */, batches); - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1); - weights = create_tensor<TensorType>(weights_shape, data_type, 1); - biases = create_tensor<TensorType>(biases_shape, data_type, 1); - dst = create_tensor<TensorType>(dst_shape, data_type, 1); - - // Create and configure function - fc_layer.configure(&src, &weights, &biases, &dst); - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - fc_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - weights.allocator()->free(); - biases.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function fc_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FULLYCONNECTEDLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/GEMMFixture.h b/tests/benchmark/fixtures/GEMMFixture.h deleted file mode 100644 index 7628abca01..0000000000 --- a/tests/benchmark/fixtures/GEMMFixture.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_GEMMFIXTURE -#define ARM_COMPUTE_TEST_GEMMFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class GEMMFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape shape_dst, float alpha, float beta, DataType data_type, bool reshape_b_only_on_first_run) - { - // Create tensors - a = create_tensor<TensorType>(shape_a, data_type, 1); - b = create_tensor<TensorType>(shape_b, data_type, 1); - c = create_tensor<TensorType>(shape_c, data_type, 1); - dst = create_tensor<TensorType>(shape_dst, data_type, 1); - - // Create and configure function - gemm.configure(&a, &b, &c, &dst, alpha, beta, GEMMInfo(false, false, reshape_b_only_on_first_run)); - - // Allocate tensors - a.allocator()->allocate(); - b.allocator()->allocate(); - c.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - gemm.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - a.allocator()->free(); - b.allocator()->free(); - c.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType a{}; - TensorType b{}; - TensorType c{}; - TensorType dst{}; - Function gemm{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_GEMMFIXTURE */ diff --git a/tests/benchmark/fixtures/GEMMLowpFixture.h b/tests/benchmark/fixtures/GEMMLowpFixture.h deleted file mode 100644 index 33c6415d20..0000000000 --- a/tests/benchmark/fixtures/GEMMLowpFixture.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_GEMMLOWPFIXTURE -#define ARM_COMPUTE_TEST_GEMMLOWPFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class GEMMLowpMatrixMultiplyCoreFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape_a, TensorShape shape_b, TensorShape shape_c, TensorShape shape_dst, float alpha, float beta) - { - // TODO (COMPMID-717): The interface used for GEMMLowp is the same one used for GEMM in order to re-use the datasets - // However the interface for both GEMM and GEMMLowp should be reworked in order to accepts only the 3 dimensions M, N and K - ARM_COMPUTE_UNUSED(shape_c); - ARM_COMPUTE_UNUSED(alpha); - ARM_COMPUTE_UNUSED(beta); - - // Note: The offsets for matrix A and matrix B are set to 0 in order to skip the computation for the offset contribution - - // Create tensors - a = create_tensor<TensorType>(shape_a, DataType::QASYMM8, 1, QuantizationInfo(1.0f / 255.0f, 0)); - b = create_tensor<TensorType>(shape_b, DataType::QASYMM8, 1, QuantizationInfo(1.0f / 255.0f, 0)); - c = create_tensor<TensorType>(shape_dst, DataType::S32, 1, QuantizationInfo(1.0f / 255.0f, 0)); - - // Create and configure function - gemmlowp.configure(&a, &b, nullptr, &c); - - // Allocate tensors - a.allocator()->allocate(); - b.allocator()->allocate(); - c.allocator()->allocate(); - } - void run() - { - gemmlowp.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(c); - } - - void teardown() - { - a.allocator()->free(); - b.allocator()->free(); - c.allocator()->free(); - } - -private: - TensorType a{}; - TensorType b{}; - TensorType c{}; - Function gemmlowp{}; -}; - -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_GEMMLOWPFIXTURE */ diff --git a/tests/benchmark/fixtures/GaussianPyramidFixture.h b/tests/benchmark/fixtures/GaussianPyramidFixture.h deleted file mode 100644 index 0df7c1afb3..0000000000 --- a/tests/benchmark/fixtures/GaussianPyramidFixture.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2018 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_GAUSSIAN_PYRAMID_HALF_FIXTURE -#define ARM_COMPUTE_GAUSSIAN_PYRAMID_HALF_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename PyramidType> -class GaussianPyramidHalfFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, BorderMode border_mode, size_t num_levels) - { - const uint8_t constant_border_value = 0; - - // Create tensors - src = create_tensor<TensorType>(shape, DataType::U8); - PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, shape, Format::U8); - pyramid.init(pyramid_info); - - // Configure function - gaussian_pyramid_func.configure(&src, &pyramid, border_mode, constant_border_value); - - // Allocate input tensor and pyramid - src.allocator()->allocate(); - pyramid.allocate(); - - // Fill tensor - library->fill_tensor_uniform(Accessor(src), 0); - } - - void run() - { - gaussian_pyramid_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - -private: - TensorType src{}; - PyramidType pyramid{}; - Function gaussian_pyramid_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_GAUSSIAN_PYRAMID_HALF_FIXTURE */ diff --git a/tests/benchmark/fixtures/HOGDescriptorFixture.h b/tests/benchmark/fixtures/HOGDescriptorFixture.h deleted file mode 100644 index 312959347b..0000000000 --- a/tests/benchmark/fixtures/HOGDescriptorFixture.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_HOG_DESCRIPTOR_FIXTURE -#define ARM_COMPUTE_TEST_HOG_DESCRIPTOR_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename HOGType, typename Function, typename Accessor> -class HOGDescriptorFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(std::string image, HOGInfo hog_info, Format format, BorderMode border_mode) - { - std::mt19937 generator(library->seed()); - std::uniform_int_distribution<uint8_t> distribution_u8(0, 255); - uint8_t constant_border_value = static_cast<uint8_t>(distribution_u8(generator)); - - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create tensor info for HOG descriptor - TensorInfo tensor_info_hog_descriptor(hog_info, raw.shape().x(), raw.shape().y()); - - // Create tensor - src = create_tensor<TensorType>(raw.shape(), format); - dst = create_tensor<TensorType>(tensor_info_hog_descriptor.tensor_shape(), - DataType::F32, tensor_info_hog_descriptor.num_channels()); - - // Create HOG - HOGType hog = create_HOG<HOGType>(hog_info); - - // Create and configure function - hog_descriptor_func.configure(&src, &dst, &hog, border_mode, constant_border_value); - - // Allocate tensor - src.allocator()->allocate(); - dst.allocator()->allocate(); - - // Copy image data to tensor - library->fill(Accessor(src), raw); - } - - void run() - { - hog_descriptor_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - -protected: - TensorType dst{}; - -private: - TensorType src{}; - Function hog_descriptor_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HOG_DESCRIPTOR_FIXTURE */ diff --git a/tests/benchmark/fixtures/HOGDetectorFixture.h b/tests/benchmark/fixtures/HOGDetectorFixture.h deleted file mode 100644 index 48404d84ae..0000000000 --- a/tests/benchmark/fixtures/HOGDetectorFixture.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_HOG_DETECTOR_FIXTURE -#define ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/benchmark/fixtures/HOGDescriptorFixture.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, - typename HOGType, - typename Function, - typename Accessor, - typename HOGAccessor, - typename HOGDescriptorType, - typename ArrayType> -class HOGDetectorFixture : public HOGDescriptorFixture<TensorType, HOGType, HOGDescriptorType, Accessor> -{ -public: - template <typename...> - void setup(Size2D detection_window_stride, std::string image, HOGInfo hog_info, Format format, BorderMode border_mode) - { - HDF::setup(image, hog_info, format, border_mode); - HDF::run(); - - // Initialise descriptor (linear SVM coefficients). - // NOTE: Fixed values are used to keep the number of detection windows detected - // consistent in order to have meaningful validation tolerances. - // The values are "unbalanced" to reduce the number of detected objects - const std::random_device::result_type seed = 0; - std::vector<float> descriptor = generate_random_real(hog_info.descriptor_size(), -0.505f, 0.495f, seed); - - // Create HOG - hog = create_HOG<HOGType>(hog_info); - - // Copy HOG descriptor values to HOG memory - { - HOGAccessor hog_accessor(hog); - std::memcpy(hog_accessor.descriptor(), descriptor.data(), descriptor.size() * sizeof(float)); - } - - // Create and configure function - hog_detector_func.configure(&(HDF::dst), &hog, &detection_windows, detection_window_stride); - - // Reset detection windows - detection_windows.clear(); - } - - void run() - { - hog_detector_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - -private: - static const unsigned int max_num_detection_windows = 100000; - - HOGType hog{}; - Function hog_detector_func{}; - ArrayType detection_windows{ max_num_detection_windows }; - - using HDF = HOGDescriptorFixture<TensorType, HOGType, HOGDescriptorType, Accessor>; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HOG_DETECTOR_FIXTURE */ diff --git a/tests/benchmark/fixtures/HOGMultiDetectionFixture.h b/tests/benchmark/fixtures/HOGMultiDetectionFixture.h deleted file mode 100644 index 947646cdfc..0000000000 --- a/tests/benchmark/fixtures/HOGMultiDetectionFixture.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_HOG_MULTI_DETECTION_FIXTURE -#define ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, - typename HOGType, - typename MultiHOGType, - typename DetectionWindowArrayType, - typename DetectionWindowStrideType, - typename Function, - typename Accessor, - typename HOGAccessorType, - typename Size2DArrayAccessorType> -class HOGMultiDetectionFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(std::string image, std::vector<HOGInfo> models, Format format, BorderMode border_mode, bool non_maxima_suppression) - { - // Only defined borders supported - ARM_COMPUTE_ERROR_ON(border_mode == BorderMode::UNDEFINED); - - std::mt19937 generator(library->seed()); - std::uniform_int_distribution<uint8_t> distribution_u8(0, 255); - uint8_t constant_border_value = static_cast<uint8_t>(distribution_u8(generator)); - - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Initialize descriptors vector - std::vector<std::vector<float>> descriptors(models.size()); - - // Resize detection window_strides for index access - detection_window_strides.resize(models.size()); - - // Initialiize MultiHOG and detection windows - initialize_batch(models, multi_hog, descriptors, detection_window_strides); - - // Create tensors - src = create_tensor<TensorType>(raw.shape(), format); - - // Use default values for threshold and min_distance - const float threshold = 0.f; - const float min_distance = 1.f; - - hog_multi_detection_func.configure(&src, - &multi_hog, - &detection_windows, - &detection_window_strides, - border_mode, - constant_border_value, - threshold, - non_maxima_suppression, - min_distance); - - // Reset detection windows - detection_windows.clear(); - - // Allocate tensor - src.allocator()->allocate(); - - library->fill(Accessor(src), raw); - } - - void run() - { - hog_multi_detection_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - -private: - void initialize_batch(const std::vector<HOGInfo> &models, MultiHOGType &multi_hog, - std::vector<std::vector<float>> &descriptors, DetectionWindowStrideType &detection_window_strides) - { - for(unsigned i = 0; i < models.size(); ++i) - { - auto hog_model = reinterpret_cast<HOGType *>(multi_hog.model(i)); - hog_model->init(models[i]); - - // Initialise descriptor (linear SVM coefficients). - std::random_device::result_type seed = 0; - descriptors.at(i) = generate_random_real(models[i].descriptor_size(), -0.505f, 0.495f, seed); - - // Copy HOG descriptor values to HOG memory - { - HOGAccessorType hog_accessor(*hog_model); - std::memcpy(hog_accessor.descriptor(), descriptors.at(i).data(), descriptors.at(i).size() * sizeof(float)); - } - - // Initialize detection window stride - Size2DArrayAccessorType accessor(detection_window_strides); - accessor.at(i) = models[i].block_stride(); - } - } - -private: - static const unsigned int model_size = 4; - static const unsigned int max_num_detection_windows = 100000; - - MultiHOGType multi_hog{ model_size }; - DetectionWindowStrideType detection_window_strides{ model_size }; - DetectionWindowArrayType detection_windows{ max_num_detection_windows }; - - TensorType src{}; - Function hog_multi_detection_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HOG_MULTI_DETECTION_FIXTURE */ diff --git a/tests/benchmark/fixtures/HarrisCornersFixture.h b/tests/benchmark/fixtures/HarrisCornersFixture.h deleted file mode 100644 index 29d1741156..0000000000 --- a/tests/benchmark/fixtures/HarrisCornersFixture.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_HARRIS_CORNERS_FIXTURE -#define ARM_COMPUTE_TEST_HARRIS_CORNERS_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename ArrayType> -class HarrisCornersFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(std::string image, Format format, float threshold, float min_dist, float sensitivity, - int32_t gradient_size, int32_t block_size, BorderMode border_mode) - { - // Load the image (cached by the library if loaded before) - const RawTensor &raw = library->get(image, format); - - // Create tensor - src = create_tensor<TensorType>(raw.shape(), format); - - // Create and configure function - harris_corners_func.configure(&src, threshold, min_dist, sensitivity, gradient_size, block_size, &out, border_mode, 0); - - // Allocate tensor - src.allocator()->allocate(); - - // Copy image data to tensor - library->fill(Accessor(src), raw); - } - - void run() - { - harris_corners_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - - void teardown() - { - src.allocator()->free(); - } - -private: - TensorType src{}; - ArrayType out{ 20000 }; - Function harris_corners_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HARRIS_CORNERS_FIXTURE */
\ No newline at end of file diff --git a/tests/benchmark/fixtures/HistogramFixture.h b/tests/benchmark/fixtures/HistogramFixture.h deleted file mode 100644 index 355cddb6e7..0000000000 --- a/tests/benchmark/fixtures/HistogramFixture.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_HISTOGRAM_FIXTURE -#define ARM_COMPUTE_TEST_HISTOGRAM_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename DistributionType> -class HistogramFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, Format format) - { - // Create tensors - src = create_tensor<TensorType>(shape, format); - - // Create and configure function - histogram_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - } - - void run() - { - histogram_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - - void teardown() - { - src.allocator()->free(); - } - -private: - TensorType src{}; - DistributionType dst{ 30, 125, 255 }; - Function histogram_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_HISTOGRAM_FIXTURE */ diff --git a/tests/benchmark/fixtures/IntegralImageFixture.h b/tests/benchmark/fixtures/IntegralImageFixture.h deleted file mode 100644 index dc6399047d..0000000000 --- a/tests/benchmark/fixtures/IntegralImageFixture.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_INTEGRAL_IMAGE_FIXTURE -#define ARM_COMPUTE_TEST_INTEGRAL_IMAGE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class IntegralImageFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape) - { - // Create tensors - src = create_tensor<TensorType>(shape, DataType::U8); - dst = create_tensor<TensorType>(shape, DataType::U32); - - // Create and configure function - integral_image_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - integral_image_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function integral_image_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_INTEGRAL_IMAGE_FIXTURE */ diff --git a/tests/benchmark/fixtures/L2NormalizeLayerFixture.h b/tests/benchmark/fixtures/L2NormalizeLayerFixture.h deleted file mode 100644 index e68c5a76a4..0000000000 --- a/tests/benchmark/fixtures/L2NormalizeLayerFixture.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_FLOORFIXTURE -#define ARM_COMPUTE_TEST_FLOORFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class L2NormalizeLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type, unsigned int axis) - { - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(shape, data_type); - - // Create and configure function - l2norm_func.configure(&src, &dst, axis, 1.f); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - l2norm_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function l2norm_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_FLOORFIXTURE */ diff --git a/tests/benchmark/fixtures/LaplacianPyramidFixture.h b/tests/benchmark/fixtures/LaplacianPyramidFixture.h deleted file mode 100644 index 7bc3370312..0000000000 --- a/tests/benchmark/fixtures/LaplacianPyramidFixture.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_LAPLACIAN_PYRAMID_FIXTURE -#define ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename PyramidType> -class LaplacianPyramidFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out) - { - const uint8_t constant_border_value = 0; - - // Initialize pyramid - PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, input_shape, format_out); - - // Use conservative padding strategy to fit all subsequent kernels - pyramid.init_auto_padding(pyramid_info); - - // Create tensor - src = create_tensor<TensorType>(input_shape, format_in); - - // The first two dimensions of the output tensor must match the first - // two dimensions of the tensor in the last level of the pyramid - TensorShape dst_shape(input_shape); - dst_shape.set(0, pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(0)); - dst_shape.set(1, pyramid.get_pyramid_level(num_levels - 1)->info()->dimension(1)); - - // The lowest resolution tensor necessary to reconstruct the input - // tensor from the pyramid. - dst = create_tensor<TensorType>(dst_shape, format_out); - - laplacian_pyramid_func.configure(&src, &pyramid, &dst, border_mode, constant_border_value); - - src.allocator()->allocate(); - dst.allocator()->allocate(); - - pyramid.allocate(); - - // Fill tensor - library->fill_tensor_uniform(Accessor(src), 0); - } - - void run() - { - laplacian_pyramid_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - -protected: - TensorType dst{}; - PyramidType pyramid{}; - -private: - TensorType src{}; - Function laplacian_pyramid_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_LAPLACIAN_PYRAMID_FIXTURE */ diff --git a/tests/benchmark/fixtures/LaplacianReconstructFixture.h b/tests/benchmark/fixtures/LaplacianReconstructFixture.h deleted file mode 100644 index 39906977a1..0000000000 --- a/tests/benchmark/fixtures/LaplacianReconstructFixture.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE -#define ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/benchmark/fixtures/LaplacianPyramidFixture.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename LaplacianPyramidFunc, typename PyramidType> -class LaplacianReconstructFixture : public LaplacianPyramidFixture<TensorType, LaplacianPyramidFunc, Accessor, PyramidType> -{ -public: - template <typename...> - void setup(TensorShape input_shape, BorderMode border_mode, size_t num_levels, Format format_in, Format format_out) - { - const uint8_t constant_border_value = 0; - - LPF::setup(input_shape, border_mode, num_levels, format_out, format_in); - LPF::run(); - - // Create tensor - dst = create_tensor<TensorType>(input_shape, DataType::U8); - - laplacian_reconstruct_func.configure(&(LPF::pyramid), &(LPF::dst), &dst, border_mode, constant_border_value); - - dst.allocator()->allocate(); - } - - void run() - { - laplacian_reconstruct_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - -private: - TensorType dst{}; - Function laplacian_reconstruct_func{}; - - using LPF = LaplacianPyramidFixture<TensorType, LaplacianPyramidFunc, Accessor, PyramidType>; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_LAPLACIAN_RECONSTRUCT_FIXTURE */ diff --git a/tests/benchmark/fixtures/LocallyConnectedLayerFixture.h b/tests/benchmark/fixtures/LocallyConnectedLayerFixture.h deleted file mode 100644 index ba511e5ec1..0000000000 --- a/tests/benchmark/fixtures/LocallyConnectedLayerFixture.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_LOCALLYCONNECTEDLAYERFIXTURE -#define ARM_COMPUTE_TEST_LOCALLYCONNECTEDLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class LocallyConnectedLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, PadStrideInfo info, Size2D dilation, DataType data_type, int batches) - { - ARM_COMPUTE_UNUSED(dilation); - - // Set batched in source and destination shapes - src_shape.set(src_shape.num_dimensions() /* batch */, batches); - dst_shape.set(dst_shape.num_dimensions() /* batch */, batches); - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type); - weights = create_tensor<TensorType>(weights_shape, data_type); - biases = create_tensor<TensorType>(biases_shape, data_type); - dst = create_tensor<TensorType>(dst_shape, data_type); - - // Create and configure function - lc_layer.configure(&src, &weights, &biases, &dst, info); - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - lc_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function lc_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_LOCALLYCONNECTEDLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/MagnitudeFixture.h b/tests/benchmark/fixtures/MagnitudeFixture.h deleted file mode 100644 index a1b8054529..0000000000 --- a/tests/benchmark/fixtures/MagnitudeFixture.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_MAGNITUDE_FIXTURE -#define ARM_COMPUTE_TEST_MAGNITUDE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class MagnitudeFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, Format format, MagnitudeType magnitude_type) - { - // Create tensors - src1 = create_tensor<TensorType>(shape, format); - src2 = create_tensor<TensorType>(shape, format); - dst = create_tensor<TensorType>(shape, format); - - // Create and configure function - magnitude_func.configure(&src1, &src2, &dst, magnitude_type); - - // Allocate tensors - src1.allocator()->allocate(); - src2.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - magnitude_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src1.allocator()->free(); - src2.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src1{}; - TensorType src2{}; - TensorType dst{}; - Function magnitude_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MAGNITUDE_FIXTURE */ diff --git a/tests/benchmark/fixtures/MeanStdDevFixture.h b/tests/benchmark/fixtures/MeanStdDevFixture.h deleted file mode 100644 index 95ff17d2fb..0000000000 --- a/tests/benchmark/fixtures/MeanStdDevFixture.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_MEAN_STD_DEV_FIXTURE -#define ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class MeanStdDevFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, Format format) - { - // Create tensors - src = create_tensor<TensorType>(shape, format); - - // Create and configure function - mean_std_dev_func.configure(&src, &mean, &std_dev); - - // Allocate tensors - src.allocator()->allocate(); - } - - void run() - { - mean_std_dev_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - - void teardown() - { - src.allocator()->free(); - } - -private: - TensorType src{}; - Function mean_std_dev_func{}; - float mean{ 0.0f }; - float std_dev{ 0.0f }; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MEAN_STD_DEV_FIXTURE */ diff --git a/tests/benchmark/fixtures/Median3x3Fixture.h b/tests/benchmark/fixtures/Median3x3Fixture.h deleted file mode 100644 index 5d89b221a9..0000000000 --- a/tests/benchmark/fixtures/Median3x3Fixture.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_MEDIAN3x3_FIXTURE -#define ARM_COMPUTE_TEST_MEDIAN3x3_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class Median3x3Fixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution<uint8_t> distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - // Create tensors - src = create_tensor<TensorType>(shape, DataType::U8); - dst = create_tensor<TensorType>(shape, DataType::U8); - - // Create and configure function - median3x3_func.configure(&src, &dst, border_mode, constant_border_value); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - median3x3_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function median3x3_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MEDIAN3x3_FIXTURE */ diff --git a/tests/benchmark/fixtures/MinMaxLocationFixture.h b/tests/benchmark/fixtures/MinMaxLocationFixture.h deleted file mode 100644 index 384dce5a3f..0000000000 --- a/tests/benchmark/fixtures/MinMaxLocationFixture.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_MIN_MAX_LOCATION_FIXTURE -#define ARM_COMPUTE_TEST_MIN_MAX_LOCATION_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Types.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor, typename ArrayType> -class MinMaxLocationFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type) - { - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - - // Create and configure function - min_max_location_func.configure(&src, &min, &max, &min_loc, &max_loc); - - // Allocate tensors - src.allocator()->allocate(); - } - - void run() - { - min_max_location_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - - void teardown() - { - src.allocator()->free(); - } - -private: - TensorType src{}; - int32_t min{ 0 }; - int32_t max{ 0 }; - ArrayType min_loc{ 20000 }; - ArrayType max_loc{ 20000 }; - Function min_max_location_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_MIN_MAX_LOCATION_FIXTURE */ diff --git a/tests/benchmark/fixtures/NormalizationLayerFixture.h b/tests/benchmark/fixtures/NormalizationLayerFixture.h deleted file mode 100644 index 4331506250..0000000000 --- a/tests/benchmark/fixtures/NormalizationLayerFixture.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_NORMALIZATIONLAYERFIXTURE -#define ARM_COMPUTE_TEST_NORMALIZATIONLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class NormalizationLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, NormalizationLayerInfo info, DataType data_type, int batches) - { - // Set batched in source and destination shapes - - shape.set(shape.num_dimensions(), batches); - - // Create tensors - src = create_tensor<TensorType>(shape, data_type, 1); - dst = create_tensor<TensorType>(shape, data_type, 1); - - // Create and configure function - norm_layer.configure(&src, &dst, info); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - norm_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function norm_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_NORMALIZATIONLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/NormalizePlanarYUVLayerFixture.h b/tests/benchmark/fixtures/NormalizePlanarYUVLayerFixture.h deleted file mode 100644 index af42ba7f9a..0000000000 --- a/tests/benchmark/fixtures/NormalizePlanarYUVLayerFixture.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_NORMALIZEPLANARYUVLAYERFIXTURE -#define ARM_COMPUTE_TEST_NORMALIZEPLANARYUVLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class NormalizePlanarYUVLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape tensor_shape, TensorShape param_shape, DataType data_type, int batches) - { - // Set batched in source and destination shapes - tensor_shape.set(tensor_shape.num_dimensions(), batches); - - // Create tensors - src = create_tensor<TensorType>(tensor_shape, data_type, 1); - dst = create_tensor<TensorType>(tensor_shape, data_type, 1); - mean = create_tensor<TensorType>(param_shape, data_type, 1); - sd = create_tensor<TensorType>(param_shape, data_type, 1); - - // Create and configure function - normalize_planar_yuv_layer.configure(&src, &dst, &mean, &sd); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - mean.allocator()->allocate(); - sd.allocator()->allocate(); - } - - void run() - { - normalize_planar_yuv_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - mean.allocator()->free(); - sd.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - TensorType mean{}; - TensorType sd{}; - Function normalize_planar_yuv_layer{}; -}; -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_NORMALIZEPLANARYUVLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/OpticalFlowFixture.h b/tests/benchmark/fixtures/OpticalFlowFixture.h deleted file mode 100644 index f78187570a..0000000000 --- a/tests/benchmark/fixtures/OpticalFlowFixture.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_OPTICAL_FLOW_FIXTURE -#define ARM_COMPUTE_TEST_OPTICAL_FLOW_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Types.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, - typename Function, - typename Accessor, - typename ArrayType, - typename ArrayAccessor, - typename PyramidType, - typename PyramidFunctionType> -class OpticalFlowFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(std::string old_image_name, std::string new_image_name, OpticalFlowParameters params, - size_t num_levels, size_t num_keypoints, Format format, BorderMode border_mode) - { - const uint8_t constant_border_value = 0; - const std::random_device::result_type seed = 0; - - // Create keypoints - old_keypoints = generate_random_keypoints(library->get_image_shape(old_image_name), num_keypoints, seed, num_levels); - new_keypoints_estimates = old_keypoints; - - // Create tensors - old_image = create_tensor<TensorType>(library->get_image_shape(old_image_name), format); - new_image = create_tensor<TensorType>(library->get_image_shape(new_image_name), format); - - // Load keypoints - fill_array(ArrayAccessor(old_points), old_keypoints); - fill_array(ArrayAccessor(new_points_estimates), new_keypoints_estimates); - - // Create pyramid images - PyramidInfo pyramid_info(num_levels, SCALE_PYRAMID_HALF, old_image.info()->tensor_shape(), format); - old_pyramid = create_pyramid<PyramidType>(pyramid_info); - new_pyramid = create_pyramid<PyramidType>(pyramid_info); - - // Create and configure pyramid functions - old_gaussian_pyramid_func.configure(&old_image, &old_pyramid, border_mode, constant_border_value); - new_gaussian_pyramid_func.configure(&new_image, &new_pyramid, border_mode, constant_border_value); - - optical_flow_func.configure(&old_pyramid, - &new_pyramid, - &old_points, - &new_points_estimates, - &new_points, - params.termination, - params.epsilon, - params.num_iterations, - params.window_dimension, - params.use_initial_estimate, - border_mode, - constant_border_value); - - // Allocate input tensors - old_image.allocator()->allocate(); - new_image.allocator()->allocate(); - - // Allocate pyramids - old_pyramid.allocate(); - new_pyramid.allocate(); - - // Copy image data to tensors - library->fill(Accessor(old_image), old_image_name, format); - library->fill(Accessor(new_image), new_image_name, format); - - // Compute gaussian pyramids - old_gaussian_pyramid_func.run(); - new_gaussian_pyramid_func.run(); - } - - void run() - { - optical_flow_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - } - - void teardown() - { - old_image.allocator()->free(); - new_image.allocator()->free(); - } - -private: - static const size_t max_keypoints = 10000; - - std::vector<KeyPoint> old_keypoints{}; - std::vector<KeyPoint> new_keypoints_estimates{}; - - TensorType old_image{}; - TensorType new_image{}; - - ArrayType old_points{ max_keypoints }; - ArrayType new_points{ max_keypoints }; - ArrayType new_points_estimates{ max_keypoints }; - - PyramidType old_pyramid{}; - PyramidType new_pyramid{}; - - PyramidFunctionType old_gaussian_pyramid_func{}; - PyramidFunctionType new_gaussian_pyramid_func{}; - - Function optical_flow_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_OPTICAL_FLOW_FIXTURE */ diff --git a/tests/benchmark/fixtures/PadLayerFixture.h b/tests/benchmark/fixtures/PadLayerFixture.h deleted file mode 100644 index 2f482a0abf..0000000000 --- a/tests/benchmark/fixtures/PadLayerFixture.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2019 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_TEST_PADLAYERFIXTURE -#define ARM_COMPUTE_TEST_PADLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ - -template <typename TensorType, typename Accessor, typename Function, typename T> -class PaddingFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type, const PaddingList &paddings, const PaddingMode mode) - { - PaddingList clamped_padding = paddings; - if(mode != PaddingMode::CONSTANT) - { - // Clamp padding to prevent applying more than is possible. - for(uint32_t i = 0; i < paddings.size(); ++i) - { - if(mode == PaddingMode::REFLECT) - { - clamped_padding[i].first = std::min(static_cast<uint64_t>(paddings[i].first), static_cast<uint64_t>(shape[i] - 1)); - clamped_padding[i].second = std::min(static_cast<uint64_t>(paddings[i].second), static_cast<uint64_t>(shape[i] - 1)); - } - else - { - clamped_padding[i].first = std::min(static_cast<uint64_t>(paddings[i].first), static_cast<uint64_t>(shape[i])); - clamped_padding[i].second = std::min(static_cast<uint64_t>(paddings[i].second), static_cast<uint64_t>(shape[i])); - } - } - } - - const PixelValue const_value = PixelValue(static_cast<T>(0)); - - TensorShape output_shape = arm_compute::misc::shape_calculator::compute_padded_shape(shape, paddings); - - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(output_shape, data_type); - - // Create and configure function - pad_layer.configure(&src, &dst, paddings, const_value, mode); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - pad_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function pad_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_PADLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/PhaseFixture.h b/tests/benchmark/fixtures/PhaseFixture.h deleted file mode 100644 index be0bd8d6e5..0000000000 --- a/tests/benchmark/fixtures/PhaseFixture.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_PHASE_FIXTURE -#define ARM_COMPUTE_TEST_PHASE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class PhaseFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, Format format, PhaseType phase_type) - { - // Create tensors - src1 = create_tensor<TensorType>(shape, format); - src2 = create_tensor<TensorType>(shape, format); - dst = create_tensor<TensorType>(shape, DataType::U8); - - // Create and configure function - phase_func.configure(&src1, &src2, &dst, phase_type); - - // Allocate tensors - src1.allocator()->allocate(); - src2.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - phase_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src1.allocator()->free(); - src2.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src1{}; - TensorType src2{}; - TensorType dst{}; - Function phase_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_PHASE_FIXTURE */ diff --git a/tests/benchmark/fixtures/PoolingLayerFixture.h b/tests/benchmark/fixtures/PoolingLayerFixture.h deleted file mode 100644 index cbcfe2e869..0000000000 --- a/tests/benchmark/fixtures/PoolingLayerFixture.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_POOLINGLAYERFIXTURE -#define ARM_COMPUTE_TEST_POOLINGLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "arm_compute/core/utils/misc/ShapeCalculator.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -using namespace arm_compute::misc::shape_calculator; - -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class PoolingLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, PoolingLayerInfo info, DataType data_type, DataLayout data_layout, int batches) - { - // Set batched in source and destination shapes - - // Permute shape if NHWC format - if(data_layout == DataLayout::NHWC) - { - permute(src_shape, PermutationVector(2U, 0U, 1U)); - } - - TensorInfo src_info(src_shape, 1, data_type); - src_info.set_data_layout(data_layout); - - TensorShape dst_shape = compute_pool_shape(src_info, info); - - src_shape.set(src_shape.num_dimensions(), batches); - dst_shape.set(dst_shape.num_dimensions(), batches); - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1, QuantizationInfo(), data_layout); - dst = create_tensor<TensorType>(dst_shape, data_type, 1, QuantizationInfo(), data_layout); - - // Create and configure function - pool_layer.configure(&src, &dst, info); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - pool_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function pool_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_POOLINGLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/QuantizationLayerFixture.h b/tests/benchmark/fixtures/QuantizationLayerFixture.h deleted file mode 100644 index f2e8889423..0000000000 --- a/tests/benchmark/fixtures/QuantizationLayerFixture.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2017-2019 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_TEST_QUANTIZATION_LAYER_FIXTURE -#define ARM_COMPUTE_TEST_QUANTIZATION_LAYER_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class QuantizationLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - const QuantizationInfo q_info(0.5f, -10); - - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(shape, DataType::QASYMM8, 1, q_info); - - // Create and configure function - quantization_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - quantization_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function quantization_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_QUANTIZATION_LAYER_FIXTURE */ diff --git a/tests/benchmark/fixtures/ROIPoolingLayerFixture.h b/tests/benchmark/fixtures/ROIPoolingLayerFixture.h deleted file mode 100644 index 2c828272de..0000000000 --- a/tests/benchmark/fixtures/ROIPoolingLayerFixture.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2017-2019 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_TEST_ROIPOOLINGLAYERFIXTURE -#define ARM_COMPUTE_TEST_ROIPOOLINGLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -#include <vector> - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename AccessorType, typename T> -class ROIPoolingLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape input_shape, const ROIPoolingLayerInfo pool_info, TensorShape rois_shape, DataType data_type, int batches) - { - // Set batched in source and destination shapes - - TensorShape shape_dst; - rois_tensor = create_tensor<TensorType>(rois_shape, DataType::U16); - - input_shape.set(input_shape.num_dimensions(), batches); - shape_dst.set(0, pool_info.pooled_width()); - shape_dst.set(1, pool_info.pooled_height()); - shape_dst.set(2, input_shape.z()); - shape_dst.set(3, rois_shape[1]); - - // Create tensors - src = create_tensor<TensorType>(input_shape, data_type, 1); - dst = create_tensor<TensorType>(shape_dst, data_type, 1); - - // Create and configure function - roi_pool.configure(&src, &rois_tensor, &dst, pool_info); - - // Allocate tensors - rois_tensor.allocator()->allocate(); - src.allocator()->allocate(); - dst.allocator()->allocate(); - - // Create random ROIs - generate_rois(AccessorType(rois_tensor), input_shape, pool_info, rois_shape); - } - - void run() - { - roi_pool.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -protected: - template <typename U> - void generate_rois(U &&rois, const TensorShape &shape, const ROIPoolingLayerInfo &pool_info, TensorShape rois_shape) - { - const size_t values_per_roi = rois_shape.x(); - const size_t num_rois = rois_shape.y(); - - std::mt19937 gen(library->seed()); - uint16_t *rois_ptr = static_cast<uint16_t *>(rois.data()); - - const float pool_width = pool_info.pooled_width(); - const float pool_height = pool_info.pooled_height(); - const float roi_scale = pool_info.spatial_scale(); - - // Calculate distribution bounds - const auto scaled_width = static_cast<uint16_t>((shape.x() / roi_scale) / pool_width); - const auto scaled_height = static_cast<uint16_t>((shape.y() / roi_scale) / pool_height); - const auto min_width = static_cast<uint16_t>(pool_width / roi_scale); - const auto min_height = static_cast<uint16_t>(pool_height / roi_scale); - - // Create distributions - std::uniform_int_distribution<int> dist_batch(0, shape[3] - 1); - std::uniform_int_distribution<uint16_t> dist_x1(0, scaled_width); - std::uniform_int_distribution<uint16_t> dist_y1(0, scaled_height); - std::uniform_int_distribution<uint16_t> dist_w(min_width, std::max(float(min_width), (pool_width - 2) * scaled_width)); - std::uniform_int_distribution<uint16_t> dist_h(min_height, std::max(float(min_height), (pool_height - 2) * scaled_height)); - - for(unsigned int pw = 0; pw < num_rois; ++pw) - { - const auto batch_idx = dist_batch(gen); - const auto x1 = dist_x1(gen); - const auto y1 = dist_y1(gen); - const auto x2 = x1 + dist_w(gen); - const auto y2 = y1 + dist_h(gen); - - rois_ptr[values_per_roi * pw] = batch_idx; - rois_ptr[values_per_roi * pw + 1] = x1; - rois_ptr[values_per_roi * pw + 2] = y1; - rois_ptr[values_per_roi * pw + 3] = x2; - rois_ptr[values_per_roi * pw + 4] = y2; - } - } - -private: - TensorType src{}; - TensorType dst{}; - TensorType rois_tensor{}; - Function roi_pool{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_ROIPOOLINGLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/RemapFixture.h b/tests/benchmark/fixtures/RemapFixture.h deleted file mode 100644 index c0b0c13754..0000000000 --- a/tests/benchmark/fixtures/RemapFixture.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_REMAP_FIXTURE -#define ARM_COMPUTE_TEST_REMAP_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class RemapFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &input_shape, InterpolationPolicy policy, DataType data_type, BorderMode border_mode) - { - std::mt19937 gen(library->seed()); - std::uniform_int_distribution<uint8_t> distribution(0, 255); - const uint8_t constant_border_value = distribution(gen); - - // Create tensors - src = create_tensor<TensorType>(input_shape, data_type); - map_x = create_tensor<TensorType>(input_shape, DataType::F32); - map_y = create_tensor<TensorType>(input_shape, DataType::F32); - dst = create_tensor<TensorType>(input_shape, data_type); - - // Create and configure function - remap_func.configure(&src, &map_x, &map_y, &dst, policy, border_mode, constant_border_value); - - // Allocate tensors - src.allocator()->allocate(); - map_x.allocator()->allocate(); - map_y.allocator()->allocate(); - dst.allocator()->allocate(); - - // Fill tensors - fill(Accessor(src), 0, 0, 255); - fill(Accessor(map_x), 1, -5, input_shape.x() + 5); - fill(Accessor(map_y), 2, -5, input_shape.y() + 5); - } - - void run() - { - remap_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - map_x.allocator()->free(); - map_y.allocator()->free(); - dst.allocator()->free(); - } - -protected: - template <typename U> - void fill(U &&tensor, int i, float min, float max) - { - std::uniform_int_distribution<> distribution((int)min, (int)max); - library->fill(tensor, distribution, i); - } - -private: - TensorType src{}; - TensorType map_x{}; - TensorType map_y{}; - TensorType dst{}; - Function remap_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_REMAP_FIXTURE */ diff --git a/tests/benchmark/fixtures/ReshapeLayerFixture.h b/tests/benchmark/fixtures/ReshapeLayerFixture.h deleted file mode 100644 index 85a5b80a64..0000000000 --- a/tests/benchmark/fixtures/ReshapeLayerFixture.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_RESHAPEFIXTURE -#define ARM_COMPUTE_TEST_RESHAPEFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class ReshapeLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(shape, data_type); - - // Create and configure function - reshape_func.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - reshape_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function reshape_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_RESHAPEFIXTURE */ diff --git a/tests/benchmark/fixtures/SobelFixture.h b/tests/benchmark/fixtures/SobelFixture.h deleted file mode 100644 index 2717e8146b..0000000000 --- a/tests/benchmark/fixtures/SobelFixture.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_SOBEL_FIXTURE -#define ARM_COMPUTE_TEST_SOBEL_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Types.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -class CLSobel3x3; -class CLSobel5x5; -class CLSobel7x7; -class NESobel3x3; -class NESobel5x5; -class NESobel7x7; - -namespace test -{ -namespace benchmark -{ -namespace -{ -template <typename Function> -struct info; - -template <> -struct info<NESobel3x3> -{ - static const Format dst_format = Format::S16; -}; - -template <> -struct info<CLSobel3x3> -{ - static const Format dst_format = Format::S16; -}; - -template <> -struct info<NESobel5x5> -{ - static const Format dst_format = Format::S16; -}; - -template <> -struct info<CLSobel5x5> -{ - static const Format dst_format = Format::S16; -}; - -template <> -struct info<NESobel7x7> -{ - static const Format dst_format = Format::S32; -}; - -template <> -struct info<CLSobel7x7> -{ - static const Format dst_format = Format::S32; -}; -} // namespace - -template <typename TensorType, typename Function, typename Accessor> -class SobelFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &input_shape, BorderMode border_mode, GradientDimension gradient_dimension, Format input_format) - { - // Generate a random constant value - std::mt19937 gen(library->seed()); - std::uniform_int_distribution<uint8_t> int_dist(0, 255); - const uint8_t constant_border_value = int_dist(gen); - - // Create source tensor - src = create_tensor<TensorType>(input_shape, input_format); - - // Create destination tensors and configure function - switch(gradient_dimension) - { - case GradientDimension::GRAD_X: - dst_x = create_tensor<TensorType>(input_shape, info<Function>::dst_format); - sobel_func.configure(&src, &dst_x, nullptr, border_mode, constant_border_value); - break; - case GradientDimension::GRAD_Y: - dst_y = create_tensor<TensorType>(input_shape, info<Function>::dst_format); - sobel_func.configure(&src, nullptr, &dst_y, border_mode, constant_border_value); - break; - case GradientDimension::GRAD_XY: - dst_x = create_tensor<TensorType>(input_shape, info<Function>::dst_format); - dst_y = create_tensor<TensorType>(input_shape, info<Function>::dst_format); - sobel_func.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value); - break; - default: - ARM_COMPUTE_ERROR("Gradient dimension not supported"); - } - - // Allocate tensors - src.allocator()->allocate(); - dst_x.allocator()->allocate(); - dst_y.allocator()->allocate(); - } - - void run() - { - sobel_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst_x); - sync_tensor_if_necessary<TensorType>(dst_y); - } - - void teardown() - { - src.allocator()->free(); - dst_x.allocator()->free(); - dst_y.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst_x{}; - TensorType dst_y{}; - Function sobel_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_SOBEL_FIXTURE */ diff --git a/tests/benchmark/fixtures/SoftmaxLayerFixture.h b/tests/benchmark/fixtures/SoftmaxLayerFixture.h deleted file mode 100644 index 4d092f7567..0000000000 --- a/tests/benchmark/fixtures/SoftmaxLayerFixture.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_SOFTMAXLAYERFIXTURE -#define ARM_COMPUTE_TEST_SOFTMAXLAYERFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Asserts.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON, CL and OpenGL ES */ -template <typename TensorType, typename Function, typename Accessor> -class SoftmaxLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - // Create tensors - src = create_tensor<TensorType>(shape, data_type, 1, QuantizationInfo(1.f / 256, 10)); - dst = create_tensor<TensorType>(shape, data_type, 1, QuantizationInfo(1.f / 256, 0)); - - ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); - ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); - - // Create and configure function - smx_layer.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - smx_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function smx_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_SOFTMAXLAYERFIXTURE */ diff --git a/tests/benchmark/fixtures/TransposeFixture.h b/tests/benchmark/fixtures/TransposeFixture.h deleted file mode 100644 index 60643aa5e2..0000000000 --- a/tests/benchmark/fixtures/TransposeFixture.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017-2018 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_TEST_TRANSPOSEFIXTURE -#define ARM_COMPUTE_TEST_TRANSPOSEFIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NE/CL/GC */ -template <typename TensorType, typename Function, typename Accessor> -class TransposeFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape shape, DataType data_type) - { - // Make rows the columns of the original shape - TensorShape output_shape{ shape[1], shape[0] }; - - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(output_shape, data_type); - - // Create and configure function - transpose.configure(&src, &dst); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - transpose.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType dst{}; - Function transpose{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_TRANSPOSEFIXTURE */ diff --git a/tests/benchmark/fixtures/WarpAffineFixture.h b/tests/benchmark/fixtures/WarpAffineFixture.h deleted file mode 100644 index e1d6855c83..0000000000 --- a/tests/benchmark/fixtures/WarpAffineFixture.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_WARP_AFFINE_FIXTURE -#define ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" -#include "tests/validation/reference/Utils.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -template <typename TensorType, typename Function, typename Accessor> -class WarpAffineFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(const TensorShape &shape, DataType data_type, InterpolationPolicy policy, BorderMode border_mode) - { - // Generate a random constant value if border_mode is constant - std::mt19937 gen(library->seed()); - std::uniform_int_distribution<uint8_t> distribution_u8(0, 255); - uint8_t constant_border_value = distribution_u8(gen); - - // Create tensors - src = create_tensor<TensorType>(shape, data_type); - dst = create_tensor<TensorType>(shape, data_type); - - // Create and configure function - warp_affine_func.configure(&src, &dst, matrix, policy, border_mode, constant_border_value); - - // Allocate tensors - src.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - warp_affine_func.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - dst.allocator()->free(); - } - -private: - const std::array<float, 9> matrix{ { -0.9f, -0.6f, -0.3f, 0.3f, 0.6f, 0.9f, /* ignored*/ 1.f, 1.f, 1.f } }; - TensorType src{}; - TensorType dst{}; - Function warp_affine_func{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_WARP_AFFINE_FIXTURE */ diff --git a/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h b/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h deleted file mode 100644 index 86ea9c4dc1..0000000000 --- a/tests/benchmark/fixtures/WinogradConvolutionLayerFixture.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2018 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_TEST_WINOGRAD_CONVOLUTION_LAYER_FIXTURE -#define ARM_COMPUTE_TEST_WINOGRAD_CONVOLUTION_LAYER_FIXTURE - -#include "arm_compute/core/TensorShape.h" -#include "arm_compute/core/Types.h" -#include "tests/Globals.h" -#include "tests/Utils.h" -#include "tests/framework/Fixture.h" - -namespace arm_compute -{ -namespace test -{ -namespace benchmark -{ -/** Fixture that can be used for NEON and CL */ -template <typename TensorType, typename Function, typename Accessor> -class WinogradConvolutionLayerFixture : public framework::Fixture -{ -public: - template <typename...> - void setup(TensorShape src_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape dst_shape, PadStrideInfo info, Size2D dilation, ActivationLayerInfo act_info, DataType data_type, - int batches) - { - ARM_COMPUTE_UNUSED(dilation); - - // Set batched in source and destination shapes - - src_shape.set(3 /* batch */, batches); - dst_shape.set(3 /* batch */, batches); - DataType bias_data_type = is_data_type_quantized_asymmetric(data_type) ? DataType::S32 : data_type; - - // Create tensors - src = create_tensor<TensorType>(src_shape, data_type, 1); - weights = create_tensor<TensorType>(weights_shape, data_type, 1); - biases = create_tensor<TensorType>(biases_shape, bias_data_type, 1); - dst = create_tensor<TensorType>(dst_shape, data_type, 1); - - // Create and configure function - if(data_type == DataType::F16){ - conv_layer.configure(&src, &weights, &biases, &dst, info, act_info, true); - }else{ - conv_layer.configure(&src, &weights, &biases, &dst, info, act_info); - } - - // Allocate tensors - src.allocator()->allocate(); - weights.allocator()->allocate(); - biases.allocator()->allocate(); - dst.allocator()->allocate(); - } - - void run() - { - conv_layer.run(); - } - - void sync() - { - sync_if_necessary<TensorType>(); - sync_tensor_if_necessary<TensorType>(dst); - } - - void teardown() - { - src.allocator()->free(); - weights.allocator()->free(); - biases.allocator()->free(); - dst.allocator()->free(); - } - -private: - TensorType src{}; - TensorType weights{}; - TensorType biases{}; - TensorType dst{}; - Function conv_layer{}; -}; -} // namespace benchmark -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_WINOGRAD_CONVOLUTION_LAYER_FIXTURE */ |