diff options
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/runtime/CPP/CPPScheduler.h | 1 | ||||
-rw-r--r-- | arm_compute/runtime/IScheduler.h | 2 | ||||
-rw-r--r-- | arm_compute/runtime/SchedulerUtils.h | 39 |
3 files changed, 41 insertions, 1 deletions
diff --git a/arm_compute/runtime/CPP/CPPScheduler.h b/arm_compute/runtime/CPP/CPPScheduler.h index e8ad427eba..764af818d9 100644 --- a/arm_compute/runtime/CPP/CPPScheduler.h +++ b/arm_compute/runtime/CPP/CPPScheduler.h @@ -62,7 +62,6 @@ protected: void run_workloads(std::vector<Workload> &workloads) override; private: - void schedule_common(ICPPKernel *kernel, const Hints &hints, ITensorPack &tensors); struct Impl; std::unique_ptr<Impl> _impl; }; diff --git a/arm_compute/runtime/IScheduler.h b/arm_compute/runtime/IScheduler.h index 98627538e8..309aee3bb5 100644 --- a/arm_compute/runtime/IScheduler.h +++ b/arm_compute/runtime/IScheduler.h @@ -205,6 +205,8 @@ protected: virtual void run_workloads(std::vector<Workload> &workloads) = 0; CPUInfo _cpu_info; + void schedule_common(ICPPKernel *kernel, const Hints &hints, ITensorPack &tensors); + private: unsigned int _num_threads_hint = {}; }; diff --git a/arm_compute/runtime/SchedulerUtils.h b/arm_compute/runtime/SchedulerUtils.h new file mode 100644 index 0000000000..5a88e039cc --- /dev/null +++ b/arm_compute/runtime/SchedulerUtils.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2020 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +#ifndef ARM_COMPUTE_SCHEDULER_UTILS_H +#define ARM_COMPUTE_SCHEDULER_UTILS_H + +namespace arm_compute +{ +/** Given two dimensions and a maxium number of threads to utilise, calculate the best + * combination of threads that fit in (mutliplied together) max_threads. + * + * This algorithm assumes that work in either of the dimensions is equally difficult + * to compute + * + * @returns [m_nthreads, n_nthreads] A pair of the threads that should be used in each dimension + */ +std::pair<unsigned, unsigned> split_2d(unsigned max_threads, std::size_t m, std::size_t n); +} // namespace arm_compute +#endif /* ARM_COMPUTE_SCHEDULER_UTILS_H */ |