diff options
Diffstat (limited to 'arm_compute/runtime/CPP/CPPScheduler.h')
-rw-r--r-- | arm_compute/runtime/CPP/CPPScheduler.h | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/arm_compute/runtime/CPP/CPPScheduler.h b/arm_compute/runtime/CPP/CPPScheduler.h index c8de41bf20..7f70b5fa1f 100644 --- a/arm_compute/runtime/CPP/CPPScheduler.h +++ b/arm_compute/runtime/CPP/CPPScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 ARM Limited. + * Copyright (c) 2016-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,13 +24,21 @@ #ifndef ARM_COMPUTE_CPPSCHEDULER_H #define ARM_COMPUTE_CPPSCHEDULER_H +#include "arm_compute/core/experimental/Types.h" #include "arm_compute/runtime/IScheduler.h" #include <memory> namespace arm_compute { -/** C++11 implementation of a pool of threads to automatically split a kernel's execution among several threads. */ +/** C++11 implementation of a pool of threads to automatically split a kernel's execution among several threads. + * + * It has 2 scheduling modes: Linear or Fanout (please refer to the implementation for details) + * The mode is selected automatically based on the runtime environment. However it can be forced via an environment + * variable ARM_COMPUTE_CPP_SCHEDULER_MODE. e.g.: + * ARM_COMPUTE_CPP_SCHEDULER_MODE=linear # Force select the linear scheduling mode + * ARM_COMPUTE_CPP_SCHEDULER_MODE=fanout # Force select the fanout scheduling mode +*/ class CPPScheduler final : public IScheduler { public: @@ -38,33 +46,20 @@ public: CPPScheduler(); /** Default destructor */ ~CPPScheduler(); - /** Sets the number of threads the scheduler will use to run the kernels. - * - * @param[in] num_threads If set to 0, then the maximum number of threads supported by C++11 will be used, otherwise the number of threads specified. - */ - void set_num_threads(unsigned int num_threads) override; - /** Returns the number of threads that the CPPScheduler has in his pool. - * - * @return Number of threads available in CPPScheduler. - */ - unsigned int num_threads() const override; /** Access the scheduler singleton * - * @note this method has been deprecated and will be remover in the upcoming releases + * @note this method has been deprecated and will be remover in future releases * @return The scheduler */ static CPPScheduler &get(); - /** Multithread the execution of the passed kernel if possible. - * - * The kernel will run on a single thread if any of these conditions is true: - * - ICPPKernel::is_parallelisable() returns false - * - The scheduler has been initialized with only one thread. - * - * @param[in] kernel Kernel to execute. - * @param[in] hints Hints for the scheduler. - */ - void schedule(ICPPKernel *kernel, const Hints &hints) override; + + // Inherited functions overridden + void set_num_threads(unsigned int num_threads) override; + void set_num_threads_with_affinity(unsigned int num_threads, BindFunc func) override; + unsigned int num_threads() const override; + void schedule(ICPPKernel *kernel, const Hints &hints) override; + void schedule_op(ICPPKernel *kernel, const Hints &hints, const Window &window, ITensorPack &tensors) override; protected: /** Will run the workloads in parallel using num_threads |