Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 1 | /* |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 2 | * Copyright (c) 2017-2018 ARM Limited. |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 24 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 25 | #include "arm_compute/core/GLES_COMPUTE/kernels/GCIm2ColKernel.h" |
| 26 | |
| 27 | #include "arm_compute/core/AccessWindowStatic.h" |
| 28 | #include "arm_compute/core/Error.h" |
| 29 | #include "arm_compute/core/GLES_COMPUTE/GCHelpers.h" |
| 30 | #include "arm_compute/core/GLES_COMPUTE/GCKernelLibrary.h" |
| 31 | #include "arm_compute/core/GLES_COMPUTE/IGCTensor.h" |
| 32 | #include "arm_compute/core/GLES_COMPUTE/OpenGLES.h" |
| 33 | #include "arm_compute/core/Helpers.h" |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 34 | #include "arm_compute/core/Size2D.h" |
Isabella Gottardi | d56e770 | 2018-02-28 14:29:36 +0000 | [diff] [blame] | 35 | #include "arm_compute/core/TensorInfo.h" |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 36 | #include "arm_compute/core/Types.h" |
| 37 | #include "arm_compute/core/Validate.h" |
| 38 | #include "support/ToolchainSupport.h" |
| 39 | |
| 40 | #include <cmath> |
| 41 | #include <tuple> |
| 42 | |
| 43 | using namespace arm_compute; |
| 44 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 45 | namespace |
| 46 | { |
| 47 | Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output) |
| 48 | { |
| 49 | ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::F16, DataType::F32); |
| 50 | ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(output); |
| 51 | |
| 52 | // Checks performed when output is configured |
| 53 | if(output->total_size() != 0) |
| 54 | { |
| 55 | ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | return Status{}; |
| 59 | } |
| 60 | } // namespace |
| 61 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 62 | GCIm2ColKernel::GCIm2ColKernel() |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 63 | : _input(nullptr), _output(nullptr), _convolved_dims(), _kernel_dims(), _num_elems_processed_per_iteration(1), _run_func(nullptr) |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 64 | { |
| 65 | } |
| 66 | |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 67 | void GCIm2ColKernel::configure(const IGCTensor *input, IGCTensor *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation) |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 68 | { |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 69 | ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); |
| 70 | |
| 71 | // Perform validation step |
| 72 | ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info())); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 73 | |
| 74 | _input = input; |
| 75 | _output = output; |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 76 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 77 | // Create kernel |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 78 | std::set<std::string> build_opts; |
| 79 | std::string dt_name = (input->info()->data_type() == DataType::F32) ? "DATA_TYPE_FP32" : "DATA_TYPE_FP16"; |
| 80 | build_opts.emplace("#define LOCAL_SIZE_X " + support::cpp11::to_string(1)); |
| 81 | build_opts.emplace("#define LOCAL_SIZE_Y " + support::cpp11::to_string(1)); |
| 82 | build_opts.emplace("#define LOCAL_SIZE_Z " + support::cpp11::to_string(1)); |
| 83 | build_opts.insert("#define " + dt_name); |
| 84 | |
| 85 | if(has_bias) |
| 86 | { |
| 87 | build_opts.emplace("#define HAS_BIAS"); |
| 88 | } |
| 89 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 90 | int stride_x = 0; |
| 91 | int stride_y = 0; |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 92 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 93 | std::tie(stride_x, stride_y) = conv_info.stride(); |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 94 | _kernel_dims = std::make_pair(kernel_dims.width, kernel_dims.height); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 95 | |
| 96 | const bool run_img2col_reduced = (output->info()->dimension(0) == (input->info()->dimension(0) * input->info()->dimension(1) * input->info()->dimension(2))) && (TensorShape::num_max_dimensions >= 4) |
| 97 | && (std::equal(input->info()->tensor_shape().cbegin() + 3, |
| 98 | input->info()->tensor_shape().cend(), |
| 99 | output->info()->tensor_shape().cbegin() + 1)) |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 100 | && ((stride_x == 1) && (stride_y == 1) && !conv_info.has_padding()) |
| 101 | && (dilation == Size2D(1U, 1U)); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 102 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 103 | std::string kernel_name = "im2col_generic"; |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 104 | if(!run_img2col_reduced) |
| 105 | { |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 106 | if(input->info()->data_type() == DataType::F16 && _kernel_dims == std::pair<unsigned int, unsigned int>(1, 1)) |
| 107 | { |
| 108 | build_opts.emplace("#define KERNEL_1x1"); |
| 109 | } |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 110 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 111 | build_opts.emplace("#define IM2COL_GENERIC"); |
| 112 | _convolved_dims = scaled_dimensions(input->info()->dimension(0), input->info()->dimension(1), |
| 113 | kernel_dims.width, kernel_dims.height, |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 114 | conv_info, dilation); |
Michele Di Giorgio | fc1d1e2 | 2018-04-10 14:24:35 +0100 | [diff] [blame] | 115 | _num_elems_processed_per_iteration = (input->info()->data_type() == DataType::F32) ? 1 : 2; |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 116 | |
| 117 | build_opts.emplace("#define KERNEL_WIDTH " + support::cpp11::to_string(kernel_dims.width)); |
| 118 | build_opts.emplace("#define KERNEL_HEIGHT " + support::cpp11::to_string(kernel_dims.height)); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 119 | build_opts.emplace("#define KERNEL_DEPTH " + support::cpp11::to_string(input->info()->dimension(2))); |
| 120 | build_opts.emplace("#define CONVOLVED_WIDTH " + support::cpp11::to_string(_convolved_dims.first)); |
| 121 | build_opts.emplace("#define CONVOLVED_HEIGHT " + support::cpp11::to_string(_convolved_dims.second)); |
| 122 | build_opts.emplace("#define STRIDE_X " + support::cpp11::to_string(conv_info.stride().first)); |
| 123 | build_opts.emplace("#define STRIDE_Y " + support::cpp11::to_string(conv_info.stride().second)); |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 124 | build_opts.emplace("#define PAD_LEFT " + support::cpp11::to_string(conv_info.pad_left())); |
| 125 | build_opts.emplace("#define PAD_TOP " + support::cpp11::to_string(conv_info.pad_top())); |
| 126 | build_opts.emplace("#define PAD_RIGHT " + support::cpp11::to_string(conv_info.pad_right())); |
| 127 | build_opts.emplace("#define PAD_BOTTOM " + support::cpp11::to_string(conv_info.pad_bottom())); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 128 | build_opts.emplace("#define SRC_WIDTH " + support::cpp11::to_string(input->info()->dimension(0))); |
| 129 | build_opts.emplace("#define SRC_HEIGHT " + support::cpp11::to_string(input->info()->dimension(1))); |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 130 | build_opts.emplace("#define DILATION_X " + support::cpp11::to_string(dilation.x())); |
| 131 | build_opts.emplace("#define DILATION_Y " + support::cpp11::to_string(dilation.y())); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 132 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 133 | _run_func = &GCIm2ColKernel::run_generic; |
| 134 | } |
| 135 | else |
| 136 | { |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 137 | build_opts.emplace("#define IM2COL_REDUCED"); |
| 138 | kernel_name = "im2col_reduced"; |
Frank Lei | b9d38ee | 2017-12-05 10:43:33 +0800 | [diff] [blame] | 139 | |
| 140 | if(input->info()->data_type() == DataType::F32) |
| 141 | { |
| 142 | _num_elems_processed_per_iteration = 4 / input->info()->element_size(); |
| 143 | } |
| 144 | else if(input->info()->data_type() == DataType::F16) |
| 145 | { |
| 146 | int input_width = input->info()->dimension(0); |
| 147 | int input_height = input->info()->dimension(1); |
| 148 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 149 | build_opts.emplace("#define IMAGE_SIZE " + support::cpp11::to_string(input_width * input_height)); |
Frank Lei | b9d38ee | 2017-12-05 10:43:33 +0800 | [diff] [blame] | 150 | if(input_width % 8 == 0) |
| 151 | { |
| 152 | _num_elems_processed_per_iteration = 8; |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 153 | build_opts.emplace("#define IM2COL_REDUCED_8X"); |
Frank Lei | b9d38ee | 2017-12-05 10:43:33 +0800 | [diff] [blame] | 154 | } |
| 155 | else if(input_width % 4 == 0) |
| 156 | { |
| 157 | _num_elems_processed_per_iteration = 4; |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 158 | build_opts.emplace("#define IM2COL_REDUCED_4X"); |
Frank Lei | b9d38ee | 2017-12-05 10:43:33 +0800 | [diff] [blame] | 159 | } |
| 160 | else if(input_width % 2 == 0) |
| 161 | { |
| 162 | _num_elems_processed_per_iteration = 2; |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 163 | build_opts.emplace("#define IM2COL_REDUCED_2X"); |
Frank Lei | b9d38ee | 2017-12-05 10:43:33 +0800 | [diff] [blame] | 164 | } |
| 165 | else |
| 166 | { |
| 167 | _num_elems_processed_per_iteration = 2; |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 168 | build_opts.emplace("#define IM2COL_REDUCED_GENERIC"); |
Frank Lei | b9d38ee | 2017-12-05 10:43:33 +0800 | [diff] [blame] | 169 | } |
| 170 | } |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 171 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 172 | _run_func = &GCIm2ColKernel::run_reduced; |
| 173 | } |
| 174 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 175 | // Create kernel |
| 176 | _kernel = static_cast<GCKernel>(GCKernelLibrary::get().create_kernel(kernel_name, build_opts)); |
| 177 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 178 | // Configure kernel window |
| 179 | Window win = calculate_max_window(*input->info(), Steps(_num_elems_processed_per_iteration)); |
| 180 | |
| 181 | if(input->info()->data_type() == DataType::F16) |
| 182 | { |
| 183 | // Calculate input right and bottom border |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 184 | const int input_width = input->info()->dimension(0); |
| 185 | const int input_height = input->info()->dimension(1); |
| 186 | int input_total_width = input->info()->padding().left + input_width + input->info()->padding().right; |
| 187 | int input_padding_right = ceil_to_multiple(input_total_width, _num_elems_processed_per_iteration) - input_total_width; |
| 188 | input_total_width = input_width + input_padding_right + input->info()->padding().right; |
| 189 | AccessWindowStatic input_access(input->info(), 0, 0, input_total_width, input_height); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 190 | |
| 191 | // Calculate output right and bottom border |
| 192 | const int output_width = output->info()->dimension(0); |
| 193 | const int output_height = output->info()->dimension(1); |
| 194 | const int output_padding_right = ceil_to_multiple(output_width, _num_elems_processed_per_iteration) - output_width; |
| 195 | AccessWindowStatic output_access(output->info(), 0, 0, output_width + output_padding_right, output_height); |
| 196 | |
| 197 | update_window_and_padding(win, input_access, output_access); |
| 198 | } |
| 199 | |
| 200 | output->info()->set_valid_region(ValidRegion(Coordinates(), output->info()->tensor_shape())); |
| 201 | |
| 202 | if(!run_img2col_reduced) |
| 203 | { |
| 204 | // set the Z dimension's step same size as the whole dimension so that one can't split across the Z dimension |
| 205 | win.set_dimension_step(Window::DimZ, win[Window::DimZ].end() - win[Window::DimZ].start()); |
| 206 | } |
| 207 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 208 | IGCKernel::configure(win); |
| 209 | } |
| 210 | |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 211 | Status GCIm2ColKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation) |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 212 | { |
| 213 | ARM_COMPUTE_UNUSED(kernel_dims); |
| 214 | ARM_COMPUTE_UNUSED(conv_info); |
| 215 | ARM_COMPUTE_UNUSED(has_bias); |
Alex Gilday | 7da29b6 | 2018-03-23 14:16:00 +0000 | [diff] [blame] | 216 | ARM_COMPUTE_UNUSED(dilation); |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 217 | ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output)); |
| 218 | return Status{}; |
| 219 | } |
| 220 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 221 | void GCIm2ColKernel::run(const Window &window) |
| 222 | { |
| 223 | ARM_COMPUTE_ERROR_ON(_run_func == nullptr); |
| 224 | (this->*_run_func)(window); |
| 225 | } |
| 226 | |
| 227 | void GCIm2ColKernel::run_generic(const Window &window) |
| 228 | { |
| 229 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 230 | ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(IGCKernel::window(), window); |
| 231 | |
| 232 | // Get initial windows |
| 233 | Window window_collapsed = window.collapse_if_possible(IGCKernel::window(), Window::DimZ); |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 234 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 235 | // Change the Z dimension's step back to 1 |
| 236 | window_collapsed.set_dimension_step(Window::DimZ, 1); |
| 237 | |
| 238 | Window slice = window_collapsed.first_slice_window_3D(); |
| 239 | Window slice_in = window_collapsed.first_slice_window_3D(); |
| 240 | Window slice_out = window_collapsed.first_slice_window_3D(); |
| 241 | |
| 242 | // Setup slice |
| 243 | slice.set(Window::DimX, Window::Dimension(0, static_cast<int>(_convolved_dims.first), 1)); |
| 244 | slice.set(Window::DimY, Window::Dimension(0, static_cast<int>(_convolved_dims.second), 1)); |
| 245 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 246 | // Setup output slice |
| 247 | slice_out.set(Window::DimX, Window::Dimension(0, _output->info()->dimension(0), _num_elems_processed_per_iteration)); |
| 248 | slice_out.set(Window::DimY, Window::Dimension(0, _output->info()->dimension(1), 1)); |
| 249 | slice_out.set(Window::DimZ, Window::Dimension(0, 1, 1)); |
| 250 | |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 251 | // we need top/left pad to be included in valid region |
| 252 | if(_input->info()->data_type() == DataType::F16) |
| 253 | { |
| 254 | (dynamic_cast<TensorInfo *>(_input->info()))->init(_input->info()->tensor_shape(), _input->info()->num_channels(), _input->info()->data_type(), _input->info()->strides_in_bytes(), 0, |
Vidhya Sudhan Loganathan | 7485d5a | 2018-07-04 09:34:00 +0100 | [diff] [blame] | 255 | _input->info()->total_size()); |
Stephen Li | e855c23 | 2018-01-04 14:13:22 +0800 | [diff] [blame] | 256 | } |
| 257 | |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 258 | _kernel.use(); |
| 259 | |
| 260 | do |
| 261 | { |
| 262 | unsigned int idx = 0; |
| 263 | add_3D_tensor_argument(idx, _input, 1, slice_in); |
| 264 | add_2D_tensor_argument(idx, _output, 2, slice_out); |
Joel Liang | f1f3ebd | 2017-11-10 09:59:19 +0800 | [diff] [blame] | 265 | _kernel.set_argument(idx++, static_cast<unsigned int>(_input->info()->strides_in_bytes()[3])); |
| 266 | _kernel.set_argument(idx++, static_cast<unsigned int>(_output->info()->strides_in_bytes()[3])); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 267 | _kernel.update_shader_params(); |
| 268 | |
| 269 | enqueue(*this, slice); |
| 270 | } |
| 271 | while(window_collapsed.slide_window_slice_3D(slice) && window_collapsed.slide_window_slice_3D(slice_out) && window_collapsed.slide_window_slice_3D(slice_in)); |
| 272 | } |
| 273 | |
| 274 | void GCIm2ColKernel::run_reduced(const Window &window) |
| 275 | { |
| 276 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 277 | ARM_COMPUTE_ERROR_ON_MISMATCHING_WINDOWS(IGCKernel::window(), window); |
| 278 | |
| 279 | Window out_window; |
| 280 | out_window.use_tensor_dimensions(_output->info()->tensor_shape()); |
| 281 | |
| 282 | Window out_slice = out_window.first_slice_window_1D(); |
| 283 | Window in_slice = window.first_slice_window_3D(); |
| 284 | |
| 285 | _kernel.use(); |
| 286 | |
| 287 | // Run kernel |
| 288 | do |
| 289 | { |
| 290 | // Set arguments |
| 291 | unsigned int idx = 0; |
| 292 | |
| 293 | add_3D_tensor_argument(idx, _input, 1, in_slice); |
| 294 | add_1D_tensor_argument(idx, _output, 2, out_slice); |
Joel Liang | f1f3ebd | 2017-11-10 09:59:19 +0800 | [diff] [blame] | 295 | _kernel.set_argument(idx++, _input->info()->dimension(0)); |
| 296 | _kernel.set_argument(idx++, _input->info()->dimension(1)); |
Anthony Barbier | 7068f99 | 2017-10-26 15:23:08 +0100 | [diff] [blame] | 297 | _kernel.update_shader_params(); |
| 298 | |
| 299 | enqueue(*this, in_slice); |
| 300 | } |
| 301 | while(window.slide_window_slice_3D(in_slice) && out_window.slide_window_slice_1D(out_slice)); |
| 302 | } |