From 1f9ca1d7737846c74053d68ee0844b448bae298b Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Thu, 1 Mar 2018 11:13:45 +0000 Subject: COMPMID-935 Implementing Convolution with Winograd on OpenCL (part 3) Change-Id: I51f92f30602fb0a02314f344fa67061f448694bf Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/122793 Tested-by: Jenkins Reviewed-by: Giorgio Arena Reviewed-by: Gian Marco Iodice --- src/core/CL/CLKernelLibrary.cpp | 6 + src/core/CL/cl_kernels/winograd.cl | 208 +++++++++++++++++++++ .../CL/kernels/CLWinogradInputTransformKernel.cpp | 180 ++++++++++++++++++ 3 files changed, 394 insertions(+) create mode 100644 src/core/CL/cl_kernels/winograd.cl create mode 100644 src/core/CL/kernels/CLWinogradInputTransformKernel.cpp (limited to 'src/core') diff --git a/src/core/CL/CLKernelLibrary.cpp b/src/core/CL/CLKernelLibrary.cpp index aba20448e7..40aceb702a 100644 --- a/src/core/CL/CLKernelLibrary.cpp +++ b/src/core/CL/CLKernelLibrary.cpp @@ -351,6 +351,8 @@ const std::map CLKernelLibrary::_kernel_program_map = { "warp_affine_bilinear", "warp_affine.cl" }, { "warp_perspective_nearest_neighbour", "warp_perspective.cl" }, { "warp_perspective_bilinear", "warp_perspective.cl" }, + { "winograd_input_transform_2x2_3x3_stepz1_nchw", "winograd.cl" }, + { "winograd_input_transform_2x2_3x3_stepz2_nchw", "winograd.cl" }, { "YUYV422_to_IYUV_bt709", "color_convert.cl" }, { "YUYV422_to_NV12_bt709", "color_convert.cl" }, { "YUYV422_to_RGB888_bt709", "color_convert.cl" }, @@ -676,6 +678,10 @@ const std::map CLKernelLibrary::_program_source_map = "warp_perspective.cl", #include "./cl_kernels/warp_perspective.clembed" }, + { + "winograd.cl", +#include "./cl_kernels/winograd.clembed" + }, #endif /* EMBEDDED_KERNELS */ }; diff --git a/src/core/CL/cl_kernels/winograd.cl b/src/core/CL/cl_kernels/winograd.cl new file mode 100644 index 0000000000..fa06601c50 --- /dev/null +++ b/src/core/CL/cl_kernels/winograd.cl @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2018 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "helpers.h" + +#if defined(NUM_TILES_X) + +/** This OpenCL kernel computes the input transform when the kernel size is 3x3 and the output tile is 2x2 + * + * @note The number of tiles in the x axis must be passed at compile time using -DNUM_TILES_X (i.e.-DNUM_TILES_X=5). + * @note The pad left and pad top must be passed at compile time using -DPAD_LEFT and -DPAD_TOP (i.e.-DPAD_LEFT=1 and -DPAD_TOP=0). + * + * @param[in] src_ptr Pointer to the source image. Supported data types: F32 + * @param[in] src_stride_x Stride of the source image in X dimension (in bytes) + * @param[in] src_step_x src_stride_x * number of elements along X processed per workitem(in bytes) + * @param[in] src_stride_y Stride of the source image in Y dimension (in bytes) + * @param[in] src_step_y src_stride_y * number of elements along Y processed per workitem(in bytes) + * @param[in] src_offset_first_element_in_bytes The offset of the first element in the source image + * @param[in] src_stride_z Stride of the source tensor in Z dimension (in bytes) + * @param[in] src_step_z src_stride_z * number of elements along Y processed per workitem(in bytes) + * @param[in] dst_ptr Pointer to the destination tensor. Supported data types: as @p src_ptr + * @param[in] dst_stride_x Stride of the destination tensor in X dimension (in bytes) + * @param[in] dst_step_x dst_stride_x * number of elements along X processed per workitem(in bytes) + * @param[in] dst_stride_y Stride of the destination tensor in Y dimension (in bytes) + * @param[in] dst_step_y dst_stride_y * number of elements along Y processed per workitem(in bytes) + * @param[in] dst_stride_z Stride of the destination tensor in Z dimension (in bytes) + * @param[in] dst_step_z dst_stride_z * number of elements along Y processed per workitem(in bytes) + * @param[in] dst_offset_first_element_in_bytes The offset of the first element in the destination tensor + */ +__kernel void winograd_input_transform_2x2_3x3_stepz1_nchw( + TENSOR3D_DECLARATION(src), + TENSOR3D_DECLARATION(dst)) +{ + int x = get_global_id(0); + int y = get_global_id(1); + int z = get_global_id(2); + + // Compute input address + __global uchar *src_addr = src_ptr + src_offset_first_element_in_bytes + x * 2 * src_stride_x + y * 2 * src_stride_y + z * src_stride_z; + + src_addr = src_addr - ((int)PAD_LEFT * src_stride_x) - ((int)PAD_TOP * src_stride_y); + + float4 in_row0 = vload4(0, (__global float *)(src_addr + 0 * src_stride_y)); + float4 in_row1 = vload4(0, (__global float *)(src_addr + 1 * src_stride_y)); + float4 in_row2 = vload4(0, (__global float *)(src_addr + 2 * src_stride_y)); + float4 in_row3 = vload4(0, (__global float *)(src_addr + 3 * src_stride_y)); + + float4 tmp0 = in_row0 - in_row2; + float4 tmp1 = in_row1 + in_row2; + float4 tmp2 = in_row2 - in_row1; + float4 tmp3 = in_row1 - in_row3; + + float out00 = tmp0.s0 - tmp0.s2; + float out01 = tmp0.s1 + tmp0.s2; + float out02 = tmp0.s2 - tmp0.s1; + float out03 = tmp0.s1 - tmp0.s3; + + float out10 = tmp1.s0 - tmp1.s2; + float out11 = tmp1.s1 + tmp1.s2; + float out12 = tmp1.s2 - tmp1.s1; + float out13 = tmp1.s1 - tmp1.s3; + + float out20 = tmp2.s0 - tmp2.s2; + float out21 = tmp2.s1 + tmp2.s2; + float out22 = tmp2.s2 - tmp2.s1; + float out23 = tmp2.s1 - tmp2.s3; + + float out30 = tmp3.s0 - tmp3.s2; + float out31 = tmp3.s1 + tmp3.s2; + float out32 = tmp3.s2 - tmp3.s1; + float out33 = tmp3.s1 - tmp3.s3; + + __global uchar *dst_addr = dst_ptr + dst_offset_first_element_in_bytes + z * dst_stride_x + (x + y * (int)NUM_TILES_X) * dst_stride_y; + + *((__global float *)(dst_addr + 0 * dst_stride_z)) = out00; + *((__global float *)(dst_addr + 1 * dst_stride_z)) = out01; + *((__global float *)(dst_addr + 2 * dst_stride_z)) = out02; + *((__global float *)(dst_addr + 3 * dst_stride_z)) = out03; + *((__global float *)(dst_addr + 4 * dst_stride_z)) = out10; + *((__global float *)(dst_addr + 5 * dst_stride_z)) = out11; + *((__global float *)(dst_addr + 6 * dst_stride_z)) = out12; + *((__global float *)(dst_addr + 7 * dst_stride_z)) = out13; + *((__global float *)(dst_addr + 8 * dst_stride_z)) = out20; + *((__global float *)(dst_addr + 9 * dst_stride_z)) = out21; + *((__global float *)(dst_addr + 10 * dst_stride_z)) = out22; + *((__global float *)(dst_addr + 11 * dst_stride_z)) = out23; + *((__global float *)(dst_addr + 12 * dst_stride_z)) = out30; + *((__global float *)(dst_addr + 13 * dst_stride_z)) = out31; + *((__global float *)(dst_addr + 14 * dst_stride_z)) = out32; + *((__global float *)(dst_addr + 15 * dst_stride_z)) = out33; +} + +/** This OpenCL kernel computes the input transform when the kernel size is 3x3, the output tile is 2x2 and the number of channels is multiple of 2 + * + * @note The number of tiles in the x axis must be passed at compile time using -DNUM_TILES_X (i.e.-DNUM_TILES_X=5). + * @note The pad left and pad top must be passed at compile time using -DPAD_LEFT and -DPAD_TOP (i.e.-DPAD_LEFT=1 and -DPAD_TOP=0). + * + * @param[in] src_ptr Pointer to the source image. Supported data types: F32 + * @param[in] src_stride_x Stride of the source image in X dimension (in bytes) + * @param[in] src_step_x src_stride_x * number of elements along X processed per workitem(in bytes) + * @param[in] src_stride_y Stride of the source image in Y dimension (in bytes) + * @param[in] src_step_y src_stride_y * number of elements along Y processed per workitem(in bytes) + * @param[in] src_offset_first_element_in_bytes The offset of the first element in the source image + * @param[in] src_stride_z Stride of the source tensor in Z dimension (in bytes) + * @param[in] src_step_z src_stride_z * number of elements along Y processed per workitem(in bytes) + * @param[in] dst_ptr Pointer to the destination tensor. Supported data types: as @p src_ptr + * @param[in] dst_stride_x Stride of the destination tensor in X dimension (in bytes) + * @param[in] dst_step_x dst_stride_x * number of elements along X processed per workitem(in bytes) + * @param[in] dst_stride_y Stride of the destination tensor in Y dimension (in bytes) + * @param[in] dst_step_y dst_stride_y * number of elements along Y processed per workitem(in bytes) + * @param[in] dst_stride_z Stride of the destination tensor in Z dimension (in bytes) + * @param[in] dst_step_z dst_stride_z * number of elements along Y processed per workitem(in bytes) + * @param[in] dst_offset_first_element_in_bytes The offset of the first element in the destination tensor + */ +__kernel void winograd_input_transform_2x2_3x3_stepz2_nchw( + TENSOR3D_DECLARATION(src), + TENSOR3D_DECLARATION(dst)) +{ + int x = get_global_id(0); + int y = get_global_id(1); + int z = get_global_id(2) * 2; + + // Compute input address + __global uchar *src_addr = src_ptr + src_offset_first_element_in_bytes + x * 2 * src_stride_x + y * 2 * src_stride_y + z * src_stride_z; + + src_addr = src_addr - ((int)PAD_LEFT * src_stride_x) - ((int)PAD_TOP * src_stride_y); + + float4 in_row0 = vload4(0, (__global float *)(src_addr + 0 * src_stride_y)); + float4 in_row1 = vload4(0, (__global float *)(src_addr + 1 * src_stride_y)); + float4 in_row2 = vload4(0, (__global float *)(src_addr + 2 * src_stride_y)); + float4 in_row3 = vload4(0, (__global float *)(src_addr + 3 * src_stride_y)); + + src_addr += src_stride_z; + float4 in_row4 = vload4(0, (__global float *)(src_addr + 0 * src_stride_y)); + float4 in_row5 = vload4(0, (__global float *)(src_addr + 1 * src_stride_y)); + float4 in_row6 = vload4(0, (__global float *)(src_addr + 2 * src_stride_y)); + float4 in_row7 = vload4(0, (__global float *)(src_addr + 3 * src_stride_y)); + + float4 tmp0 = in_row0 - in_row2; + float4 tmp1 = in_row1 + in_row2; + float4 tmp2 = in_row2 - in_row1; + float4 tmp3 = in_row1 - in_row3; + + float4 tmp4 = in_row4 - in_row6; + float4 tmp5 = in_row5 + in_row6; + float4 tmp6 = in_row6 - in_row5; + float4 tmp7 = in_row5 - in_row7; + + float2 out00 = (float2)(tmp0.s0 - tmp0.s2, tmp4.s0 - tmp4.s2); + float2 out01 = (float2)(tmp0.s1 + tmp0.s2, tmp4.s1 + tmp4.s2); + float2 out02 = (float2)(tmp0.s2 - tmp0.s1, tmp4.s2 - tmp4.s1); + float2 out03 = (float2)(tmp0.s1 - tmp0.s3, tmp4.s1 - tmp4.s3); + + float2 out10 = (float2)(tmp1.s0 - tmp1.s2, tmp5.s0 - tmp5.s2); + float2 out11 = (float2)(tmp1.s1 + tmp1.s2, tmp5.s1 + tmp5.s2); + float2 out12 = (float2)(tmp1.s2 - tmp1.s1, tmp5.s2 - tmp5.s1); + float2 out13 = (float2)(tmp1.s1 - tmp1.s3, tmp5.s1 - tmp5.s3); + + float2 out20 = (float2)(tmp2.s0 - tmp2.s2, tmp6.s0 - tmp6.s2); + float2 out21 = (float2)(tmp2.s1 + tmp2.s2, tmp6.s1 + tmp6.s2); + float2 out22 = (float2)(tmp2.s2 - tmp2.s1, tmp6.s2 - tmp6.s1); + float2 out23 = (float2)(tmp2.s1 - tmp2.s3, tmp6.s1 - tmp6.s3); + + float2 out30 = (float2)(tmp3.s0 - tmp3.s2, tmp7.s0 - tmp7.s2); + float2 out31 = (float2)(tmp3.s1 + tmp3.s2, tmp7.s1 + tmp7.s2); + float2 out32 = (float2)(tmp3.s2 - tmp3.s1, tmp7.s2 - tmp7.s1); + float2 out33 = (float2)(tmp3.s1 - tmp3.s3, tmp7.s1 - tmp7.s3); + + __global uchar *dst_addr = dst_ptr + dst_offset_first_element_in_bytes + z * dst_stride_x + (x + y * (int)NUM_TILES_X) * dst_stride_y; + + vstore2(out00, 0, (__global float *)(dst_addr + 0 * dst_stride_z)); + vstore2(out01, 0, (__global float *)(dst_addr + 1 * dst_stride_z)); + vstore2(out02, 0, (__global float *)(dst_addr + 2 * dst_stride_z)); + vstore2(out03, 0, (__global float *)(dst_addr + 3 * dst_stride_z)); + vstore2(out10, 0, (__global float *)(dst_addr + 4 * dst_stride_z)); + vstore2(out11, 0, (__global float *)(dst_addr + 5 * dst_stride_z)); + vstore2(out12, 0, (__global float *)(dst_addr + 6 * dst_stride_z)); + vstore2(out13, 0, (__global float *)(dst_addr + 7 * dst_stride_z)); + vstore2(out20, 0, (__global float *)(dst_addr + 8 * dst_stride_z)); + vstore2(out21, 0, (__global float *)(dst_addr + 9 * dst_stride_z)); + vstore2(out22, 0, (__global float *)(dst_addr + 10 * dst_stride_z)); + vstore2(out23, 0, (__global float *)(dst_addr + 11 * dst_stride_z)); + vstore2(out30, 0, (__global float *)(dst_addr + 12 * dst_stride_z)); + vstore2(out31, 0, (__global float *)(dst_addr + 13 * dst_stride_z)); + vstore2(out32, 0, (__global float *)(dst_addr + 14 * dst_stride_z)); + vstore2(out33, 0, (__global float *)(dst_addr + 15 * dst_stride_z)); +} +#endif //defined(NUM_TILES_X) \ No newline at end of file diff --git a/src/core/CL/kernels/CLWinogradInputTransformKernel.cpp b/src/core/CL/kernels/CLWinogradInputTransformKernel.cpp new file mode 100644 index 0000000000..72adb5f358 --- /dev/null +++ b/src/core/CL/kernels/CLWinogradInputTransformKernel.cpp @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2018 ARM Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#include "arm_compute/core/CL/kernels/CLWinogradInputTransformKernel.h" + +#include "arm_compute/core/CL/CLHelpers.h" +#include "arm_compute/core/CL/CLKernelLibrary.h" +#include "arm_compute/core/CL/ICLTensor.h" +#include "arm_compute/core/CL/OpenCL.h" +#include "arm_compute/core/Error.h" +#include "arm_compute/core/Helpers.h" +#include "arm_compute/core/Types.h" +#include "arm_compute/core/utils/misc/ShapeCalculator.h" +#include "support/ToolchainSupport.h" + +using namespace arm_compute; + +namespace +{ +Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &conv_info, const Size2D &kernel_dims) +{ + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F32); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(conv_info.stride().first != 1 || conv_info.stride().second != 1, "Winograd input transform only supports unit strides"); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(kernel_dims.width != 3 || kernel_dims.height != 3, "Winograd input transform only supports 3x3 kernels"); + ARM_COMPUTE_UNUSED(kernel_dims); + + const TensorShape output_shape = misc::shape_calculator::compute_winograd_input_transform_shape(*input, conv_info, Size2D(3U, 3U)); + + // Validate configured output + if(output->total_size() != 0) + { + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DIMENSIONS(output->tensor_shape(), output_shape); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); + } + + return Status{}; +} + +std::pair validate_and_configure_window(ITensorInfo *input, ITensorInfo *output, const PadStrideInfo &conv_info, const Size2D &kernel_dims) +{ + ARM_COMPUTE_UNUSED(output); + ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_ERROR_ON(kernel_dims.width != 3 || kernel_dims.height != 3); + ARM_COMPUTE_UNUSED(kernel_dims); + + constexpr unsigned int num_elems_read_per_iteration_x = 4u; + constexpr unsigned int num_elems_read_per_iteration_y = 4u; + + Window win = calculate_max_window(*input, Steps(1, 1)); + + AccessWindowRectangle input_access(input, -conv_info.pad_left(), -conv_info.pad_top(), num_elems_read_per_iteration_x, num_elems_read_per_iteration_y); + + 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); +} +} // namespace + +CLWinogradInputTransformKernel::CLWinogradInputTransformKernel() + : _border_size(0), _input(nullptr), _output(nullptr), _num_tiles_x(0), _num_tiles_y(0), _step_z(1) +{ +} + +BorderSize CLWinogradInputTransformKernel::border_size() const +{ + return _border_size; +} + +void CLWinogradInputTransformKernel::configure(const ICLTensor *input, ICLTensor *output, const PadStrideInfo &conv_info, const Size2D &kernel_dims) +{ + ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), conv_info, kernel_dims)); + + // Compute number of elements to process in the X and Y direction + const int num_elements_x = input->info()->dimension(0) - 2 + conv_info.pad_left() + conv_info.pad_right(); + const int num_elements_y = input->info()->dimension(1) - 2 + conv_info.pad_top() + conv_info.pad_bottom(); + + // Check if we need to extend the right or bottom border + const unsigned int extra_border_right = (num_elements_x % 2 == 0) ? 0u : 1u; + const unsigned int extra_border_bottom = (num_elements_y % 2 == 0) ? 0u : 1u; + + _input = input; + _output = output; + _border_size = BorderSize(conv_info.pad_top(), conv_info.pad_right() + extra_border_right, conv_info.pad_bottom() + extra_border_bottom, conv_info.pad_left()); + _num_tiles_x = std::ceil(num_elements_x / 2.0f); + _num_tiles_y = std::ceil(num_elements_y / 2.0f); + + const TensorShape output_shape = misc::shape_calculator::compute_winograd_input_transform_shape(*input->info(), conv_info, Size2D(3U, 3U)); + + // Output auto inizialitation if not yet initialized + auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(output_shape)); + + ARM_COMPUTE_ERROR_ON(_num_tiles_x * _num_tiles_y != static_cast(output->info()->dimension(1))); + + CLBuildOptions build_opts; + build_opts.add_option("-DNUM_TILES_X=" + support::cpp11::to_string(_num_tiles_x)); + build_opts.add_option("-DPAD_LEFT=" + support::cpp11::to_string(conv_info.pad_left())); + build_opts.add_option("-DPAD_TOP=" + support::cpp11::to_string(conv_info.pad_top())); + + // Create kernel + if((_input->info()->dimension(2) % 2) != 0) + { + _step_z = 1; + _kernel = static_cast(CLKernelLibrary::get().create_kernel("winograd_input_transform_2x2_3x3_stepz1_nchw", build_opts.options())); + } + else + { + _step_z = 2; + _kernel = static_cast(CLKernelLibrary::get().create_kernel("winograd_input_transform_2x2_3x3_stepz2_nchw", build_opts.options())); + _lws_hint = cl::NDRange(1, 1, 8); + } + + // Create window and update padding + auto win_config = validate_and_configure_window(input->info(), output->info(), conv_info, kernel_dims); + ARM_COMPUTE_ERROR_THROW_ON(win_config.first); + ICLKernel::configure(win_config.second); + + _config_id = "winograd_transform_input_2x2_3x3_"; + _config_id += support::cpp11::to_string(input->info()->dimension(0)); + _config_id += "_"; + _config_id += support::cpp11::to_string(input->info()->dimension(1)); + _config_id += "_"; + _config_id += support::cpp11::to_string(input->info()->dimension(2)); + _config_id += "_"; + _config_id += support::cpp11::to_string(conv_info.pad_left()); + _config_id += "_"; + _config_id += support::cpp11::to_string(conv_info.pad_top()); +} + +Status CLWinogradInputTransformKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const PadStrideInfo &conv_info, const Size2D &kernel_dims) +{ + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ERROR_ON(validate_arguments(input, output, conv_info, kernel_dims)); + + return Status{}; +} + +void CLWinogradInputTransformKernel::run(const Window &window, cl::CommandQueue &queue) +{ + ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); + ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window); + + Window slice = window.first_slice_window_3D(); + slice.set(Window::DimX, Window::Dimension(0, _num_tiles_x, 1)); + slice.set(Window::DimY, Window::Dimension(0, _num_tiles_y, 1)); + + ARM_COMPUTE_ERROR_ON(((slice.z().end() - slice.z().start()) % _step_z) != 0); + slice.set(Window::DimZ, Window::Dimension(slice.z().start(), slice.z().end(), _step_z)); + + do + { + unsigned int idx = 0; + add_3D_tensor_argument(idx, _input, slice); + add_3D_tensor_argument(idx, _output, slice); + + enqueue(queue, *this, slice, _lws_hint); + } + while(window.slide_window_slice_3D(slice)); +} -- cgit v1.2.1