| 293 | } |
| 294 | |
| 295 | void ClIndirectConv2dKernel::run_op(ITensorPack &tensors, const Window &window, cl::CommandQueue &queue) |
| 296 | { |
| 297 | ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |
| 298 | ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window); |
| 299 | |
| 300 | // Get initial windows |
| 301 | Window slice = window.first_slice_window_3D(); |
| 302 | |
| 303 | const auto src = |
| 304 | utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_0)); |
| 305 | const auto weights = |
| 306 | utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_1)); |
| 307 | const auto biases = |
| 308 | utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_2)); |
| 309 | const auto indirect_buffer = |
| 310 | utils::cast::polymorphic_downcast<const ICLTensor *>(tensors.get_const_tensor(TensorType::ACL_SRC_3)); |
| 311 | auto dst = utils::cast::polymorphic_downcast<ICLTensor *>(tensors.get_tensor(TensorType::ACL_DST)); |
| 312 | |
| 313 | cl::Image2D weights_cl_image; |
| 314 | |
| 315 | if (_export_to_cl_image) |
| 316 | { |
| 317 | const size_t image_w = weights->info()->dimension(0) / 4; |
| 318 | const size_t image_h = |
| 319 | weights->info()->dimension(1) * weights->info()->dimension(2) * weights->info()->dimension(3); |
| 320 | const TensorShape shape2d(image_w, image_h); |
| 321 | const size_t image_row_pitch = weights->info()->strides_in_bytes()[1]; |
| 322 | |
| 323 | // Export cl_buffer to cl_image |
| 324 | weights_cl_image = |
| 325 | create_image2d_from_buffer(CLKernelLibrary::get().context(), weights->cl_buffer(), shape2d, |
| 326 | weights->info()->data_type(), image_row_pitch, CLImage2DType::ReadOnly); |
| 327 | } |
| 328 | |
| 329 | unsigned int idx = 0; |
| 330 | add_4d_tensor_nhwc_argument(idx, src); |
| 331 | add_4d_tensor_nhwc_argument(idx, indirect_buffer); |
| 332 | add_4d_tensor_nhwc_argument(idx, dst); |
| 333 | if (_export_to_cl_image) |
| 334 | { |
| 335 | _kernel.setArg(idx++, weights_cl_image); |
| 336 | } |
| 337 | add_4d_tensor_nhwc_argument(idx, weights); |
| 338 | if (biases != nullptr) |
| 339 | { |
| 340 | add_1D_tensor_argument(idx, biases, slice); |
| 341 | } |
| 342 | enqueue(queue, *this, slice, lws_hint()); |
| 343 | } |
| 344 | } // namespace kernels |
| 345 | } // namespace opencl |
| 346 | } // namespace arm_compute |
nothing calls this directly
no test coverage detected