55 return _num_threads_hint;
62 const Window &max_window = window;
73 unsigned m_threads, n_threads;
76 std::vector<IScheduler::Workload> workloads;
77 for(
unsigned int ni = 0; ni != n_threads; ++ni)
79 for(
unsigned int mi = 0; mi != m_threads; ++mi)
82 [ni, mi, m_threads, n_threads, &max_window, &kernel](
const ThreadInfo &
info)
96 kernel->
run_nd(win, info, thread_locator);
100 run_workloads(workloads);
107 if(num_iterations == 0)
118 kernel->
run(max_window, info);
122 kernel->
run_op(tensors, max_window, info);
127 unsigned int num_windows = 0;
135 const unsigned int granule_threshold = (hints.
threshold() <= 0) ? num_threads : static_cast<unsigned int>(hints.
threshold());
137 num_windows = num_iterations > granule_threshold ? granule_threshold : num_iterations;
143 std::vector<IScheduler::Workload> workloads(num_windows);
144 for(
unsigned int t = 0;
t < num_windows; ++
t)
147 workloads[
t] = [
t, &hints, &max_window, &num_windows, &kernel, &tensors](
const ThreadInfo &
info)
154 kernel->run(win,
info);
158 kernel->run_op(tensors, win,
info);
162 run_workloads(workloads);
173 run_workloads(workloads);
std::pair< unsigned, unsigned > split_2d(unsigned max_threads, std::size_t m, std::size_t n)
Given two dimensions and a maximum number of threads to utilise, calculate the best combination of th...
IScheduler()
Default constructor.
bool empty() const
Checks if pack is empty.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Common interface for all kernels implemented in C++.
Split the workload evenly among the threads.
static constexpr unsigned int split_dimensions_all
When arm_compute::ISchedular::Hints::_split_dimension is initialized with this value then the schedul...
Window split_window(size_t dimension, size_t id, size_t total) const
Split a window into a set of sub windows along a given dimension.
Describe one of the image's dimensions with a start, end and step.
virtual void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info)
Execute the kernel on the passed window.
CPUInfo & cpu_info()
Get CPU info.
virtual void run_tagged_workloads(std::vector< Workload > &workloads, const char *tag)
Execute all the passed workloads.
void validate() const
Will validate all the window's dimensions' values when asserts are enabled.
constexpr size_t num_iterations(size_t dimension) const
Return the number of iterations needed to iterate through a given dimension.
int threshold() const
Return the granule capping threshold to be used by dynamic scheduling.
Copyright (c) 2017-2021 Arm Limited.
Split the workload dynamically using a bucket system.
std::function< int(int, int)> BindFunc
Function to be used and map a given thread id to a logical core id.
virtual void run_nd(const Window &window, const ThreadInfo &info, const Window &thread_locator)
legacy compatibility layer for implemantions which do not support thread_locator In these cases we si...
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
virtual void run(const Window &window, const ThreadInfo &info)
Execute the kernel on the passed window.
StrategyHint strategy() const
Return the prefered strategy to use to split workload.
virtual bool is_parallelisable() const
Indicates whether or not the kernel is parallelisable.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
void set(size_t dimension, const Dimension &dim)
Set the values of a given dimension.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
Information about executing thread and CPU.
unsigned int num_threads_hint() const
Get a hint for the best possible number of execution threads.
unsigned int split_dimension() const
Return the prefered split dimension.
void get_cpu_configuration(CPUInfo &cpuinfo)
This function will try to detect the CPU configuration on the system and will fill the cpuinfo object...
unsigned int get_threads_hint()
Some systems have both big and small cores, this fuction computes the minimum number of cores that ar...
virtual unsigned int num_threads() const =0
Returns the number of threads that the SingleThreadScheduler has in his pool.
virtual void set_num_threads_with_affinity(unsigned int num_threads, BindFunc func)
Sets the number of threads the scheduler will use to run the kernels but also using a binding functio...
Describe a multidimensional execution window.