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

Method configure

src/gpu/cl/kernels/ClCropKernel.cpp:50–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void ClCropKernel::configure(const CLCompileContext &compile_context,
51 const ITensorInfo *src,
52 ITensorInfo *dst,
53 Coordinates2D start,
54 Coordinates2D end,
55 uint32_t batch_index,
56 float extrapolation_value,
57 Window *dst_window)
58{
59 ARM_COMPUTE_ERROR_ON_NULLPTR(src, dst);
60 ARM_COMPUTE_ERROR_THROW_ON(validate(src, dst, start, end, batch_index, extrapolation_value, dst_window));
61
62 _start = start;
63 _batch_index = batch_index;
64 _extrapolation_value = extrapolation_value;
65
66 const uint32_t vec_size_x = 4;
67 // Create and update the window (if needed)
68 Window win = calculate_max_window(*dst);
69
70 if (dst_window != nullptr)
71 {
72 ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(win, *dst_window);
73 win = *dst_window;
74 }
75
76 const uint32_t dst_width_x = win.num_iterations(0);
77 const bool multi_access_x = dst_width_x >= vec_size_x;
78 const bool remainder_x = dst_width_x % vec_size_x > 0;
79
80 if (multi_access_x)
81 {
82 win.set(Window::DimX,
83 Window::Dimension(win.x().start(), ceil_to_multiple(win.x().end(), vec_size_x), vec_size_x));
84 }
85 ICLKernel::configure_internal(win);
86
87 // Create kernel
88 CLBuildOptions build_opts;
89 build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(src->data_type()));
90 build_opts.add_option_if(multi_access_x, "-DVEC_SIZE=" + support::cpp11::to_string(vec_size_x));
91 build_opts.add_option_if(multi_access_x && remainder_x,
92 "-DLAST_ACCESSED_X=" +
93 support::cpp11::to_string(std::max<int>(dst_width_x - vec_size_x, 0)));
94 build_opts.add_option_if(start.x > end.x, "-DWIDTH_FLIPPED=");
95 build_opts.add_option_if(start.y > end.y, "-DHEIGHT_FLIPPED=");
96 _kernel = create_kernel(compile_context, "crop_tensor", build_opts.options());
97}
98
99Status ClCropKernel::validate(const ITensorInfo *src,
100 const ITensorInfo *dst,

Callers

nothing calls this directly

Calls 15

ceil_to_multipleFunction · 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
setMethod · 0.45
startMethod · 0.45
xMethod · 0.45

Tested by

no test coverage detected