From d556d7bafe6ad943f4aca0f5285ada7b8ce497f7 Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Tue, 27 Oct 2020 10:56:31 +0000 Subject: Integrate improved pooling layer on NEON Resolves COMPMID-4035 Change-Id: I559f8c4208fba9193dfe5012f03ddaf26c746215 Signed-off-by: Michele Di Giorgio Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4855 Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas Comments-Addressed: Arm Jenkins --- src/core/NEON/kernels/assembly/pool_common.hpp | 123 +++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/core/NEON/kernels/assembly/pool_common.hpp (limited to 'src/core/NEON/kernels/assembly/pool_common.hpp') diff --git a/src/core/NEON/kernels/assembly/pool_common.hpp b/src/core/NEON/kernels/assembly/pool_common.hpp new file mode 100644 index 0000000000..fdc18aef39 --- /dev/null +++ b/src/core/NEON/kernels/assembly/pool_common.hpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2021 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#pragma once + +#ifdef CYCLE_PROFILING +#include "profiler.hpp" +#endif // CYCLE_PROFILING + +namespace arm_conv +{ +namespace pooling +{ +enum class PoolingType +{ + AVERAGE, + MAX, +}; + +enum class PoolingMethod +{ + DEFAULT, + DEPTHFIRST, + PLANAR, +}; + +struct PoolingWindow +{ + unsigned int rows, cols; +}; + +struct PoolingStride +{ + unsigned int rows, cols; +}; + +struct PaddingValues +{ + unsigned int left, top, right, bottom; +}; + +class IPoolingCommon +{ +public: + virtual ~IPoolingCommon() = default; + + // Determine the amount of working space required. + virtual size_t get_working_size(unsigned int num_threads) const = 0; + + // Execute pooling over the specified area of memory. + virtual void execute( + const void *const input, + void *const output, + void *working_space, + unsigned int thread_id, + unsigned int num_threads) const = 0; + + virtual void execute( + const void *const input, + size_t ld_input_col, + size_t ld_input_row, + size_t ld_input_batch, + void *const output, + size_t ld_output_col, + size_t ld_output_row, + size_t ld_output_batch, + void *working_space, + unsigned int thread_id, + unsigned int num_threads) const = 0; + + virtual void execute( + unsigned int batches, + unsigned int height, + unsigned int width, + unsigned int channels, + const void *const input, + size_t ld_input_col, + size_t ld_input_row, + size_t ld_input_batch, + const PaddingValues &, + unsigned int output_height, + unsigned int output_width, + void *const output, + size_t ld_output_col, + size_t ld_output_row, + size_t ld_output_batch, + void *working_space, + unsigned int thread_id, + unsigned int num_threads) const = 0; +}; + +struct Nothing +{ +}; + +template +class PoolingCommon : public IPoolingCommon +{ +}; + +} // namespace pooling +} // namespace arm_conv -- cgit v1.2.1