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

Method adjust_num_of_windows

src/runtime/IScheduler.cpp:198–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198std::size_t IScheduler::adjust_num_of_windows(const Window &window,
199 std::size_t split_dimension,
200 std::size_t init_num_windows,
201 const ICPPKernel &kernel,
202 const CPUInfo &cpu_info)
203{
204 // Mitigation of the narrow split issue, which occurs when the split dimension is too small to split (hence "narrow").
205 if (window.num_iterations(split_dimension) < init_num_windows)
206 {
207 auto recommended_split_dim = Window::DimX;
208 for (std::size_t dims = Window::DimY; dims <= Window::DimW; ++dims)
209 {
210 if (window.num_iterations(recommended_split_dim) < window.num_iterations(dims))
211 {
212 recommended_split_dim = dims;
213 }
214 }
215 ARM_COMPUTE_LOG_INFO_MSG_WITH_FORMAT_CORE(
216 "%zu dimension is not a suitable dimension to split the workload. Recommended: %zu recommended_split_dim",
217 split_dimension, recommended_split_dim);
218 }
219
220 for (auto t = init_num_windows; t > 0; --t) // Trying the highest number of windows ,init_num_windows, first
221 {
222 // Try splitting the workload into t, subject to each subworkload size <= mws.
223 if ((window.num_iterations(split_dimension) / kernel.get_mws(cpu_info, t)) >= t)
224 {
225 if (t != init_num_windows)
226 {
227 ARM_COMPUTE_LOG_INFO_MSG_CORE(
228 "The scheduler is using a different thread count than the one assigned by the user.");
229 }
230 return t;
231 }
232 }
233 ARM_COMPUTE_LOG_INFO_MSG_CORE(
234 "The scheduler is using single thread instead of the thread count assigned by the user.");
235 return 1; // If the workload is so small that it can't be split, we should run a single thread
236}
237
238} // namespace arm_compute

Callers

nothing calls this directly

Calls 2

num_iterationsMethod · 0.80
get_mwsMethod · 0.45

Tested by

no test coverage detected