| 84 | } |
| 85 | |
| 86 | void ClCopyKernel::configure(const CLCompileContext &compile_context, |
| 87 | const ITensorInfo *src, |
| 88 | ITensorInfo *dst, |
| 89 | Window *dst_window) |
| 90 | { |
| 91 | ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst); |
| 92 | ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(src, dst, dst_window)); |
| 93 | |
| 94 | auto padding_info = get_padding_info({src, dst}); |
| 95 | |
| 96 | // Create kernel |
| 97 | CLBuildOptions build_opts; |
| 98 | build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(src->data_type())); |
| 99 | |
| 100 | // Output auto inizialitation if not yet initialized |
| 101 | auto_init_if_empty(*dst, *src); |
| 102 | |
| 103 | // Configure window |
| 104 | const unsigned int vec_size_x = adjust_vec_size(16 / src->element_size(), src->dimension(0)); |
| 105 | |
| 106 | const Window win_config = calculate_max_window(*src, Steps(vec_size_x)); |
| 107 | |
| 108 | if (dst_window != nullptr) |
| 109 | { |
| 110 | _has_dst_window = true; |
| 111 | _dst_window = Window(*dst_window); |
| 112 | const int width_x = dst_window->num_iterations(0); |
| 113 | const int vec_size_x_leftover = width_x % vec_size_x; |
| 114 | const bool multi_access_x = width_x >= static_cast<int32_t>(vec_size_x); |
| 115 | |
| 116 | if (multi_access_x) |
| 117 | { |
| 118 | _dst_window.set(Window::DimX, |
| 119 | Window::Dimension(dst_window->x().start(), |
| 120 | ceil_to_multiple(dst_window->x().end(), vec_size_x), vec_size_x)); |
| 121 | } |
| 122 | |
| 123 | build_opts.add_option("-DVEC_SIZE_LEFTOVER=" + support::cpp11::to_string(vec_size_x_leftover)); |
| 124 | } |
| 125 | else |
| 126 | { |
| 127 | const int width_x = src->tensor_shape().x(); |
| 128 | const int vec_size_x_leftover = width_x % vec_size_x; |
| 129 | |
| 130 | build_opts.add_option("-DVEC_SIZE_LEFTOVER=" + support::cpp11::to_string(vec_size_x_leftover)); |
| 131 | } |
| 132 | |
| 133 | build_opts.add_option("-DVEC_SIZE=" + support::cpp11::to_string(vec_size_x)); |
| 134 | |
| 135 | // Build kernel |
| 136 | _kernel = create_kernel(compile_context, "copy_tensor", build_opts.options()); |
| 137 | |
| 138 | // Validate and set the window |
| 139 | ICLKernel::configure_internal(win_config); |
| 140 | |
| 141 | ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); |
| 142 | } |
| 143 |
nothing calls this directly
no test coverage detected