MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / configure

Method configure

src/gpu/cl/kernels/ClFillKernel.cpp:52–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52void 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
94Status ClFillKernel::validate(const ITensorInfo *tensor, const PixelValue &constant_value, Window *window)
95{

Callers

nothing calls this directly

Calls 15

ceil_to_multipleFunction · 0.85
string_from_pixel_valueFunction · 0.85
create_kernelFunction · 0.85
num_iterationsMethod · 0.80
add_option_ifMethod · 0.80
validateFunction · 0.50
calculate_max_windowFunction · 0.50
DimensionClass · 0.50
to_stringFunction · 0.50
data_typeMethod · 0.45
element_sizeMethod · 0.45

Tested by

no test coverage detected