aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2019-08-13 14:23:21 +0100
committerMichele Di Giorgio <michele.digiorgio@arm.com>2019-08-13 15:41:26 +0000
commit9d3e7f9c2bcb56b9bfb867ac92db784484bbb816 (patch)
treef0fa15b520d8911acdbf46148fc3b9b05e90f102
parent3ae323f941f55cf282caa75dffa5150dd975b321 (diff)
downloadComputeLibrary-9d3e7f9c2bcb56b9bfb867ac92db784484bbb816.tar.gz
COMPMID-2569: Fix access window in NEGEMMTranspose1xWKernel and NEGEMMLowpMatrixMultiplyKernel
A lot of padding was unnecessarily added by NEGEMMLowpMatrixMultiplyKernel because the wrong number of elements accessed in the X direction was set to the access window of the second input. Change-Id: I1dac0a55dbf2183540d4fed31f097ef6d6243a5b Signed-off-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-on: https://review.mlplatform.org/c/1728 Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--src/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.cpp6
-rw-r--r--src/core/NEON/kernels/NEGEMMTranspose1xWKernel.cpp14
2 files changed, 8 insertions, 12 deletions
diff --git a/src/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.cpp b/src/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.cpp
index b561d1e3f4..6cec51d5a2 100644
--- a/src/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.cpp
+++ b/src/core/NEON/kernels/NEGEMMLowpMatrixMultiplyKernel.cpp
@@ -780,9 +780,9 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input0, ITe
unsigned int num_k_iterations = ceil_to_multiple(input1->dimension(0), num_elems_processed_per_iteration_x) / 16;
// For each iteration of "k" we increment the input pointer by 4, and we load 8 elements a the time:
- AccessWindowStatic in0_access(input0, 0, 0, (num_k_iterations - 1) * 4 + 8, input0->dimension(1));
- AccessWindowHorizontal in1_access(input1, 0, input1->dimension(0));
- AccessWindowRectangle output_access(output, 0, 0, num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y);
+ AccessWindowStatic in0_access(input0, 0, 0, (num_k_iterations - 1) * 4 + 8, input0->dimension(1));
+ AccessWindowStatic in1_access(input1, 0, 0, ceil_to_multiple(input1->dimension(0), num_elems_processed_per_iteration_x), input1->dimension(1));
+ AccessWindowRectangle output_access(output, 0, 0, num_elems_processed_per_iteration_x, num_elems_processed_per_iteration_y);
window_changed = update_window_and_padding(win, in0_access, in1_access, output_access);
diff --git a/src/core/NEON/kernels/NEGEMMTranspose1xWKernel.cpp b/src/core/NEON/kernels/NEGEMMTranspose1xWKernel.cpp
index 38503b7a03..0ca7fd3dc8 100644
--- a/src/core/NEON/kernels/NEGEMMTranspose1xWKernel.cpp
+++ b/src/core/NEON/kernels/NEGEMMTranspose1xWKernel.cpp
@@ -23,7 +23,7 @@
*/
#include "arm_compute/core/NEON/kernels/NEGEMMTranspose1xWKernel.h"
-#include "arm_compute/core/AccessWindowTranspose.h"
+#include "arm_compute/core/AccessWindowStatic.h"
#include "arm_compute/core/Coordinates.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
@@ -73,25 +73,21 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output)
std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITensorInfo *output)
{
const unsigned int num_elems_processed_per_iteration = 16 / input->element_size();
- const int scale_x = num_elems_processed_per_iteration;
- bool window_changed = false;
// Configure kernel window
Window win = calculate_max_window(*input, Steps(num_elems_processed_per_iteration));
- ARM_COMPUTE_ERROR_ON_MSG((win.x().end() / scale_x) == 0, "Transposed shape would be 0 in the second dimension");
-
AccessWindowHorizontal input_access(input, 0, num_elems_processed_per_iteration);
- window_changed = window_changed || update_window_and_padding(win, input_access);
// Configure window in case of configured output
if(output->total_size() != 0)
{
- AccessWindowTranspose output_access(output, 0, 0, num_elems_processed_per_iteration, 1, scale_x, 1.f / scale_x);
- window_changed = window_changed || update_window_and_padding(win, output_access);
- output_access.set_valid_region(win, ValidRegion(Coordinates(), input->tensor_shape()));
+ AccessWindowStatic output_access(output, 0, 0, output->dimension(0), output->dimension(1));
+ output_access.set_valid_region(win, ValidRegion(Coordinates(), output->tensor_shape()));
}
+ const bool window_changed = update_window_and_padding(win, input_access);
+
Status err = (window_changed) ? ARM_COMPUTE_CREATE_ERROR(ErrorCode::RUNTIME_ERROR, "Insufficient Padding!") : Status{};
return std::make_pair(err, win);
}