diff options
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/runtime/CPP/CPPScheduler.h | 11 | ||||
-rw-r--r-- | arm_compute/runtime/IScheduler.h | 12 | ||||
-rw-r--r-- | arm_compute/runtime/SingleThreadScheduler.h | 8 |
3 files changed, 27 insertions, 4 deletions
diff --git a/arm_compute/runtime/CPP/CPPScheduler.h b/arm_compute/runtime/CPP/CPPScheduler.h index 17da7aeb78..6462ac6f2c 100644 --- a/arm_compute/runtime/CPP/CPPScheduler.h +++ b/arm_compute/runtime/CPP/CPPScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -30,8 +30,6 @@ namespace arm_compute { -class Thread; - /** C++11 implementation of a pool of threads to automatically split a kernel's execution among several threads. */ class CPPScheduler : public IScheduler { @@ -63,7 +61,14 @@ public: */ void schedule(ICPPKernel *kernel, unsigned int split_dimension) override; + /** Will run the workloads in parallel using num_threads + * + * @param[in] workloads Workloads to run + */ + void run_workloads(std::vector<Workload> &workloads) override; + private: + class Thread; /** Constructor: create a pool of threads. */ CPPScheduler(); diff --git a/arm_compute/runtime/IScheduler.h b/arm_compute/runtime/IScheduler.h index a0bcada722..76ff5a3de0 100644 --- a/arm_compute/runtime/IScheduler.h +++ b/arm_compute/runtime/IScheduler.h @@ -26,6 +26,8 @@ #include "arm_compute/core/CPP/CPPTypes.h" +#include <functional> + namespace arm_compute { class ICPPKernel; @@ -34,6 +36,8 @@ class ICPPKernel; class IScheduler { public: + /** Signature for the workloads to execute */ + using Workload = std::function<void(const ThreadInfo &)>; /** Default constructor. */ IScheduler(); @@ -59,6 +63,14 @@ public: */ virtual void schedule(ICPPKernel *kernel, unsigned int split_dimension) = 0; + /** Execute all the passed workloads + * + * @note there is no guarantee regarding the order in which the workloads will be executed or whether or not they will be executed in parallel. + * + * @param[in] workloads Array of workloads to run + */ + virtual void run_workloads(std::vector<Workload> &workloads) = 0; + /** Get CPU info. * * @return CPU info. diff --git a/arm_compute/runtime/SingleThreadScheduler.h b/arm_compute/runtime/SingleThreadScheduler.h index a6e1defe7c..5672b622f2 100644 --- a/arm_compute/runtime/SingleThreadScheduler.h +++ b/arm_compute/runtime/SingleThreadScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -54,6 +54,12 @@ public: */ void schedule(ICPPKernel *kernel, unsigned int split_dimension) override; + /** Will run the workloads sequentially and in order. + * + * @param[in] workloads Workloads to run + */ + void run_workloads(std::vector<Workload> &workloads) override; + private: /** Constructor. */ SingleThreadScheduler() = default; |