| 272 | } |
| 273 | |
| 274 | void ClWinogradInputTransformKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) |
| 275 | { |
| 276 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 277 | ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window); |
| 278 | |
| 279 | auto src = utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC)); |
| 280 | auto dst = utils::cast::polymorphic_downcast<ICLTensor *>(tensors.get_tensor(TensorType::ACL_DST)); |
| 281 | |
| 282 | const size_t idx_w = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::WIDTH); |
| 283 | const size_t idx_h = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::HEIGHT); |
| 284 | const size_t idx_c = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::CHANNEL); |
| 285 | const size_t total_batches = window.shape().total_size_upper(3); |
| 286 | |
| 287 | // Collapse window |
| 288 | Window window_collapsed = window.collapse_if_possible(IClKernel::window(), Window::DimZ); |
| 289 | |
| 290 | if (_data_layout == DataLayout::NHWC) |
| 291 | { |
| 292 | Window slice = window_collapsed.first_slice_window_3D(); |
| 293 | slice.set(1, Window::Dimension(0, _num_tiles_x * _num_tiles_y, 1)); |
| 294 | slice.set(2, Window::Dimension(0, total_batches, 1)); |
| 295 | |
| 296 | unsigned int idx = 0; |
| 297 | add_4D_tensor_argument(idx, src, slice); |
| 298 | add_4D_tensor_argument(idx, dst, slice); |
| 299 | _kernel.setArg<cl_uint>(idx++, _src_width); |
| 300 | _kernel.setArg<cl_uint>(idx++, _src_height); |
| 301 | _kernel.setArg<cl_uint>(idx++, _num_tiles_x); |
| 302 | _kernel.setArg<cl_uint>(idx++, _num_tiles_y); |
| 303 | enqueue(queue, *this, slice, lws_hint()); |
| 304 | } |
| 305 | else |
| 306 | { |
| 307 | Window slice = window_collapsed.first_slice_window_3D(); |
| 308 | slice.set(idx_w, Window::Dimension(0, _num_tiles_x, 1)); |
| 309 | slice.set(idx_h, Window::Dimension(0, _num_tiles_y, 1)); |
| 310 | |
| 311 | ARM_COMPUTE_ERROR_ON(((slice[idx_c].end() - slice[idx_c].start()) % _step_z) != 0); |
| 312 | slice.set(idx_c, Window::Dimension(slice[idx_c].start(), slice[idx_c].end(), _step_z)); |
| 313 | |
| 314 | unsigned int idx = 2 * num_arguments_per_3D_tensor(); |
| 315 | _kernel.setArg<cl_uint>(idx++, static_cast<unsigned int>(src->info()->strides_in_bytes()[3])); |
| 316 | _kernel.setArg<cl_uint>(idx++, static_cast<unsigned int>(dst->info()->strides_in_bytes()[3])); |
| 317 | |
| 318 | do |
| 319 | { |
| 320 | unsigned int idx = 0; |
| 321 | add_3D_tensor_argument(idx, src, slice); |
| 322 | add_3D_tensor_argument(idx, dst, slice); |
| 323 | |
| 324 | enqueue(queue, *this, slice, lws_hint()); |
| 325 | } while (window_collapsed.slide_window_slice_3D(slice)); |
| 326 | } |
| 327 | } |
| 328 | } // namespace kernels |
| 329 | } // namespace opencl |
| 330 | } // namespace arm_compute |
nothing calls this directly
no test coverage detected