aboutsummaryrefslogtreecommitdiff
path: root/src/core/NEON/kernels
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2019-06-19 12:28:47 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2019-07-03 09:36:46 +0000
commit4646d2e026a0fa92085fcba2f4aec5ec148956aa (patch)
tree0847684b138f9b4631cf56e20d0e75ef313607d0 /src/core/NEON/kernels
parentcbe39055f61bc7a3f6aef4588de47d48b77cf354 (diff)
downloadComputeLibrary-4646d2e026a0fa92085fcba2f4aec5ec148956aa.tar.gz
COMPMID-2072: Use a constexpr for num_elems_processed_per_iteration where possible
Change-Id: I26cb699ae3a77003ef7d05ac30d3ed518214e25f Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/1375 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Manuel Bottini <manuel.bottini@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
Diffstat (limited to 'src/core/NEON/kernels')
-rw-r--r--src/core/NEON/kernels/NEGEMMMatrixAdditionKernel.cpp4
-rw-r--r--src/core/NEON/kernels/NEHistogramKernel.cpp14
-rw-r--r--src/core/NEON/kernels/NELocallyConnectedMatrixMultiplyKernel.cpp8
-rw-r--r--src/core/NEON/kernels/NEStridedSliceKernel.cpp4
-rw-r--r--src/core/NEON/kernels/NEThresholdKernel.cpp6
5 files changed, 12 insertions, 24 deletions
diff --git a/src/core/NEON/kernels/NEGEMMMatrixAdditionKernel.cpp b/src/core/NEON/kernels/NEGEMMMatrixAdditionKernel.cpp
index 86bea849e4..8ee46eae42 100644
--- a/src/core/NEON/kernels/NEGEMMMatrixAdditionKernel.cpp
+++ b/src/core/NEON/kernels/NEGEMMMatrixAdditionKernel.cpp
@@ -36,6 +36,8 @@ namespace arm_compute
{
namespace
{
+constexpr unsigned int num_elems_processed_per_iteration = 16;
+
Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, float beta)
{
ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output);
@@ -134,7 +136,6 @@ void NEGEMMMatrixAdditionKernel::configure(const ITensor *input, ITensor *output
}
// Configure kernel window
- constexpr unsigned int num_elems_processed_per_iteration = 16;
INESimpleKernel::configure(input, output, num_elems_processed_per_iteration);
_beta = beta;
@@ -142,7 +143,6 @@ void NEGEMMMatrixAdditionKernel::configure(const ITensor *input, ITensor *output
Status NEGEMMMatrixAdditionKernel::validate(const ITensorInfo *input, const ITensorInfo *output, float beta)
{
- constexpr unsigned int num_elems_processed_per_iteration = 16;
ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, beta));
ARM_COMPUTE_RETURN_ON_ERROR(INESimpleKernel::validate(input->clone().get(), output->clone().get(), num_elems_processed_per_iteration));
return Status{};
diff --git a/src/core/NEON/kernels/NEHistogramKernel.cpp b/src/core/NEON/kernels/NEHistogramKernel.cpp
index 02de566f6a..b088a232a8 100644
--- a/src/core/NEON/kernels/NEHistogramKernel.cpp
+++ b/src/core/NEON/kernels/NEHistogramKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017 ARM Limited.
+ * Copyright (c) 2016-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -35,12 +35,9 @@
#include <arm_neon.h>
#include <array>
-using namespace arm_compute;
-
namespace arm_compute
{
class Coordinates;
-} // namespace arm_compute
inline void NEHistogramKernel::merge_histogram(uint32_t *global_hist, const uint32_t *local_hist, size_t bins)
{
@@ -217,9 +214,7 @@ void NEHistogramKernel::configure(const IImage *input, IDistribution1D *output,
// Set appropriate function
_func = &NEHistogramKernel::histogram_U8;
- constexpr unsigned int num_elems_processed_per_iteration = 1;
-
- Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
+ Window win = calculate_max_window(*input->info(), Steps());
INEKernel::configure(win);
}
@@ -236,9 +231,7 @@ void NEHistogramKernel::configure(const IImage *input, IDistribution1D *output)
// Set appropriate function
_func = &NEHistogramKernel::histogram_fixed_U8;
- constexpr unsigned int num_elems_processed_per_iteration = 1;
-
- Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
+ Window win = calculate_max_window(*input->info(), Steps());
INEKernel::configure(win);
}
@@ -251,3 +244,4 @@ void NEHistogramKernel::run(const Window &window, const ThreadInfo &info)
(this->*_func)(window, info);
}
+} // namespace arm_compute
diff --git a/src/core/NEON/kernels/NELocallyConnectedMatrixMultiplyKernel.cpp b/src/core/NEON/kernels/NELocallyConnectedMatrixMultiplyKernel.cpp
index 46b7913223..467546a5d3 100644
--- a/src/core/NEON/kernels/NELocallyConnectedMatrixMultiplyKernel.cpp
+++ b/src/core/NEON/kernels/NELocallyConnectedMatrixMultiplyKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -40,12 +40,9 @@
#include <cstdint>
#include <tuple>
-using namespace arm_compute;
-
namespace arm_compute
{
class Coordinates;
-} // namespace arm_compute
namespace
{
@@ -317,7 +314,7 @@ Status validate_arguments(const ITensorInfo *input0, const ITensorInfo *input1,
std::tuple<Status, Window> validate_and_configure_window(ITensorInfo *input0, ITensorInfo *input1, ITensorInfo *output)
{
- const unsigned int num_elems_processed_per_iteration_x = 16;
+ constexpr unsigned int num_elems_processed_per_iteration_x = 16;
Window win = calculate_max_window(*output, Steps(num_elems_processed_per_iteration_x));
@@ -389,3 +386,4 @@ void NELocallyConnectedMatrixMultiplyKernel::run(const Window &window, const Thr
}
}
}
+} // namespace arm_compute
diff --git a/src/core/NEON/kernels/NEStridedSliceKernel.cpp b/src/core/NEON/kernels/NEStridedSliceKernel.cpp
index 2ae029b64c..ece291e0a3 100644
--- a/src/core/NEON/kernels/NEStridedSliceKernel.cpp
+++ b/src/core/NEON/kernels/NEStridedSliceKernel.cpp
@@ -86,9 +86,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
auto_init_if_empty(*output, input->clone()->set_tensor_shape(output_shape));
// Create window
- const unsigned int num_elems_processed_per_iteration = 1;
-
- Window win = calculate_max_window(*output, Steps(num_elems_processed_per_iteration));
+ Window win = calculate_max_window(*output, Steps());
output->set_valid_region(ValidRegion(Coordinates(), output->tensor_shape()));
return std::make_pair(Status{}, win);
diff --git a/src/core/NEON/kernels/NEThresholdKernel.cpp b/src/core/NEON/kernels/NEThresholdKernel.cpp
index ae9c62bc92..5c3b2a7540 100644
--- a/src/core/NEON/kernels/NEThresholdKernel.cpp
+++ b/src/core/NEON/kernels/NEThresholdKernel.cpp
@@ -30,12 +30,9 @@
#include <arm_neon.h>
-using namespace arm_compute;
-
namespace arm_compute
{
class Coordinates;
-} // namespace arm_compute
NEThresholdKernel::NEThresholdKernel()
: _func(nullptr), _input(nullptr), _output(nullptr), _threshold(0), _false_value(0), _true_value(0), _upper(0)
@@ -67,7 +64,7 @@ void NEThresholdKernel::configure(const ITensor *input, ITensor *output, uint8_t
break;
}
- const unsigned int num_elems_processed_per_iteration = 16;
+ constexpr unsigned int num_elems_processed_per_iteration = 16;
Window win = calculate_max_window(*input->info(), Steps(num_elems_processed_per_iteration));
AccessWindowHorizontal output_access(output->info(), 0, num_elems_processed_per_iteration);
@@ -128,3 +125,4 @@ void NEThresholdKernel::run(const Window &window, const ThreadInfo &info)
(this->*_func)(window);
}
+} // namespace arm_compute