aboutsummaryrefslogtreecommitdiff
path: root/src/core/CL/gemm/CLGEMMHelpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/CL/gemm/CLGEMMHelpers.cpp')
-rw-r--r--src/core/CL/gemm/CLGEMMHelpers.cpp17
1 files changed, 16 insertions, 1 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