aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2018-03-15 17:58:20 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:16 +0000
commit2d9de0a3fa6ad858e70040124f362799a962bb6a (patch)
tree0a055c5100438a929b3b04945821665d2fef8751 /arm_compute
parented99f411d52949720a4d64d91664cd71e46b79d5 (diff)
downloadComputeLibrary-2d9de0a3fa6ad858e70040124f362799a962bb6a.tar.gz
COMPMID-1009 Support 4x4 output tile for Winograd Filter Transform on OpenCL.
Change-Id: I68c6453e0f192de659582404f109a89616b9fbb9 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/124811 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h18
-rw-r--r--arm_compute/core/Size2D.h16
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h16
3 files changed, 31 insertions, 19 deletions
diff --git a/arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h b/arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h
index ec5e51482a..c4ae5745b8 100644
--- a/arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h
+++ b/arm_compute/core/CL/kernels/CLWinogradFilterTransformKernel.h
@@ -48,20 +48,22 @@ public:
~CLWinogradFilterTransformKernel() = default;
/** Set the input and output tensor.
*
- * @param[in] input Source tensor. The input is a 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] (NCHW data layout).
- * kernel_x must be 3 and equal to kernel_y. Data types supported: F32.
- * @param[out] output Destination tensor. The output is a 3D tensor with dimensions [OFM, IFM, 16]. Data type supported: same as @p input
+ * @param[in] input Source tensor. The input is a 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] (NCHW data layout).
+ * kernel_x must be 3 and equal to kernel_y. Data types supported: F32.
+ * @param[out] output Destination tensor. The output is a 3D tensor with dimensions [OFM, IFM, 16]. Data type supported: same as @p input
+ * @param[in] output_tile Output tile. Currently only 2x2 and 4x4 tiles are supported.
*/
- void configure(const ICLTensor *input, ICLTensor *output);
+ void configure(const ICLTensor *input, ICLTensor *output, const Size2D &output_tile);
/** Static function to check if given info will lead to a valid configuration of @ref CLWinogradFilterTransformKernel
*
- * @param[in] input Source tensor info. The input is a 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] (NCHW data layout).
- * kernel_x must be 3 and equal to kernel_y. Data types supported: F32.
- * @param[in] output Destination tensor info. The output is a 3D tensor with dimensions [OFM, IFM, 16]. Data type supported: same as @p input
+ * @param[in] input Source tensor info. The input is a 4D tensor with dimensions [kernel_x, kernel_y, IFM, OFM] (NCHW data layout).
+ * kernel_x must be 3 and equal to kernel_y. Data types supported: F32.
+ * @param[in] output Destination tensor info. The output is a 3D tensor with dimensions [OFM, IFM, 16]. Data type supported: same as @p input
+ * @param[in] output_tile Output tile. Currently only 2x2 and 4x4 tiles are supported.
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &output_tile);
// Inherited methods overridden:
void run(const Window &window, cl::CommandQueue &queue) override;
diff --git a/arm_compute/core/Size2D.h b/arm_compute/core/Size2D.h
index 3840771cd1..37c4ebd041 100644
--- a/arm_compute/core/Size2D.h
+++ b/arm_compute/core/Size2D.h
@@ -24,6 +24,7 @@
#ifndef __ARM_COMPUTE_SIZE2D_H__
#define __ARM_COMPUTE_SIZE2D_H__
+#include "support/ToolchainSupport.h"
#include <cstddef>
#include <utility>
@@ -54,6 +55,21 @@ public:
return (width * height);
}
+ bool operator==(const Size2D &other) const
+ {
+ return (width == other.width) && (height == other.height);
+ }
+
+ bool operator!=(const Size2D &other) const
+ {
+ return !(*this == other);
+ }
+
+ std::string to_string() const
+ {
+ return support::cpp11::to_string(width) + std::string("x") + support::cpp11::to_string(height);
+ }
+
public:
size_t width = {}; /**< Width of the image region or rectangle */
size_t height = {}; /**< Height of the image region or rectangle */
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index 5344ce7e74..383fc6cda6 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -196,23 +196,17 @@ inline TensorShape compute_fully_connected_reshaped_weights_shape(const ITensorI
return output_shape;
}
-inline TensorShape compute_winograd_filter_transform_shape(const ITensorInfo &input)
+inline TensorShape compute_winograd_filter_transform_shape(const ITensorInfo &input, const Size2D &output_tile)
{
- // COMPMID-984 (giaiod01)
TensorShape tensor_shape{ input.tensor_shape() };
+ tensor_shape.remove_dimension(get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH));
+ tensor_shape.set(Window::DimY, input.dimension(2));
+ tensor_shape.set(Window::DimZ, (output_tile.width == 2) ? 16 : 36);
+
if(input.data_layout() == DataLayout::NCHW)
{
- tensor_shape.remove_dimension(0);
tensor_shape.set(Window::DimX, input.dimension(3));
- tensor_shape.set(Window::DimY, input.dimension(2));
- tensor_shape.set(Window::DimZ, 16);
- }
- else
- {
- tensor_shape.remove_dimension(1);
- tensor_shape.set(Window::DimY, input.dimension(2));
- tensor_shape.set(Window::DimZ, 16);
}
return tensor_shape;