aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManuel Bottini <manuel.bottini@arm.com>2020-07-02 11:27:27 +0100
committerManuel Bottini <manuel.bottini@arm.com>2020-07-09 15:03:17 +0000
commitc8e6e2c48e558da0c0698428fe496491e18c022a (patch)
tree3b55d0c9a24d587d9a2970e720170ec2959fb404 /src
parentd9eaf614975afad18fd13b9e8c7a7dd21ff6a1dd (diff)
downloadComputeLibrary-c8e6e2c48e558da0c0698428fe496491e18c022a.tar.gz
COMPMID-3325: Add support in gemm_tuner for cl_image
Change-Id: I78f815005516ca0e83366bab017884530c1d2e86 Signed-off-by: Manuel Bottini <manuel.bottini@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3518 Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/CL/gemm/CLGEMMHelpers.cpp17
-rw-r--r--src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp11
2 files changed, 18 insertions, 10 deletions
diff --git a/src/core/CL/gemm/CLGEMMHelpers.cpp b/src/core/CL/gemm/CLGEMMHelpers.cpp
index 8f54d3f670..1165e70273 100644
--- a/src/core/CL/gemm/CLGEMMHelpers.cpp
+++ b/src/core/CL/gemm/CLGEMMHelpers.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 Arm Limited.
+ * Copyright (c) 2019-2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,6 +23,8 @@
*/
#include "arm_compute/core/CL/gemm/CLGEMMHelpers.h"
+#include "arm_compute/core/CL/CLKernelLibrary.h"
+
#include <utility>
namespace arm_compute
@@ -51,5 +53,18 @@ std::pair<GEMMLHSMatrixInfo, GEMMRHSMatrixInfo> configure_lhs_rhs_info(unsigned
return std::make_pair(lhs_info, rhs_info);
}
+
+void update_padding_for_cl_image(ITensorInfo *tensor)
+{
+ constexpr unsigned int num_floats_per_pixel = 4;
+
+ const unsigned int stride_y_in_elements = tensor->strides_in_bytes()[1] / tensor->element_size();
+ const unsigned int pixel_aligment = get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device());
+ const unsigned int row_pitch_alignment = pixel_aligment * num_floats_per_pixel;
+ const unsigned int round_up_width = ((stride_y_in_elements + row_pitch_alignment - 1) / row_pitch_alignment) * row_pitch_alignment;
+ const unsigned int padding = round_up_width - stride_y_in_elements;
+
+ tensor->extend_padding(PaddingSize(0, padding, 0, 0));
+}
} // namespace cl_gemm
} // namespace arm_compute \ No newline at end of file
diff --git a/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp b/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp
index 5e09899ec8..c57066ae03 100644
--- a/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp
+++ b/src/core/CL/kernels/CLGEMMReshapeRHSMatrixKernel.cpp
@@ -29,6 +29,7 @@
#include "arm_compute/core/CL/CLValidate.h"
#include "arm_compute/core/CL/ICLTensor.h"
#include "arm_compute/core/CL/OpenCL.h"
+#include "arm_compute/core/CL/gemm/CLGEMMHelpers.h"
#include "arm_compute/core/Error.h"
#include "arm_compute/core/Helpers.h"
#include "arm_compute/core/TensorInfo.h"
@@ -107,15 +108,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
if(rhs_info.export_to_cl_image)
{
- constexpr unsigned int num_floats_per_pixel = 4;
-
- const unsigned int stride_y_in_elements = output->strides_in_bytes()[1] / output->element_size();
- const unsigned int pixel_aligment = get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device());
- const unsigned int row_pitch_alignment = pixel_aligment * num_floats_per_pixel;
- const unsigned int round_up_width = ((stride_y_in_elements + row_pitch_alignment - 1) / row_pitch_alignment) * row_pitch_alignment;
- const unsigned int padding = round_up_width - stride_y_in_elements;
-
- output->extend_padding(PaddingSize(0, padding, 0, 0));
+ arm_compute::cl_gemm::update_padding_for_cl_image(output);
}
// Collapse along the Z direction