| 50 | } |
| 51 | |
| 52 | void ClFillKernel::configure(const CLCompileContext &compile_context, |
| 53 | ITensorInfo *tensor, |
| 54 | const PixelValue &constant_value, |
| 55 | Window *window) |
| 56 | { |
| 57 | ARM_COMPUTE_ERROR_ON_NULLPTR(tensor); |
| 58 | ARM_COMPUTE_ERROR_THROW_ON(validate(tensor, constant_value, window)); |
| 59 | |
| 60 | const DataType data_type = tensor->data_type(); |
| 61 | const int vec_size_x = 16 / tensor->element_size(); |
| 62 | |
| 63 | // Create and update the window (if needed) |
| 64 | _full_window = calculate_max_window(*tensor); |
| 65 | Window win = _full_window; |
| 66 | if (window != nullptr) |
| 67 | { |
| 68 | ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(win, *window); |
| 69 | win = *window; |
| 70 | } |
| 71 | |
| 72 | const int output_width_x = win.num_iterations(0); |
| 73 | const bool multi_access_x = output_width_x >= vec_size_x; |
| 74 | const bool remainder_x = output_width_x % vec_size_x > 0; |
| 75 | |
| 76 | if (multi_access_x) |
| 77 | { |
| 78 | win.set(Window::DimX, |
| 79 | Window::Dimension(win.x().start(), ceil_to_multiple(win.x().end(), vec_size_x), vec_size_x)); |
| 80 | } |
| 81 | ICLKernel::configure_internal(win); |
| 82 | |
| 83 | // Create kernel |
| 84 | CLBuildOptions build_opts; |
| 85 | build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(data_type)); |
| 86 | build_opts.add_option("-DCONSTANT_VALUE=" + string_from_pixel_value(constant_value, data_type)); |
| 87 | build_opts.add_option_if(multi_access_x, "-DVEC_SIZE=" + support::cpp11::to_string(vec_size_x)); |
| 88 | build_opts.add_option_if(multi_access_x && remainder_x, |
| 89 | "-DLAST_ACCESSED_X=" + |
| 90 | support::cpp11::to_string(std::max<int>(output_width_x - vec_size_x, 0))); |
| 91 | _kernel = create_kernel(compile_context, "memset", build_opts.options()); |
| 92 | } |
| 93 | |
| 94 | Status ClFillKernel::validate(const ITensorInfo *tensor, const PixelValue &constant_value, Window *window) |
| 95 | { |
nothing calls this directly
no test coverage detected