aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/runtime/CPP/CPPScheduler.h35
-rw-r--r--arm_compute/runtime/IScheduler.h14
2 files changed, 19 insertions, 30 deletions
diff --git a/arm_compute/runtime/CPP/CPPScheduler.h b/arm_compute/runtime/CPP/CPPScheduler.h
index 855535ebce..9d55ed448e 100644
--- a/arm_compute/runtime/CPP/CPPScheduler.h
+++ b/arm_compute/runtime/CPP/CPPScheduler.h
@@ -39,16 +39,6 @@ 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
*
@@ -56,27 +46,12 @@ public:
* @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.
- */
+
+ // 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;
- /** 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.
- * @param[in] inputs Vector that contains the input tensors.
- * @param[in] outputs Vector that contains the output tensors.
- */
void schedule_op(ICPPKernel *kernel, const Hints &hints, const InputTensorMap &inputs, const OutputTensorMap &outputs) override;
protected:
diff --git a/arm_compute/runtime/IScheduler.h b/arm_compute/runtime/IScheduler.h
index 9382c20b29..fff77274bd 100644
--- a/arm_compute/runtime/IScheduler.h
+++ b/arm_compute/runtime/IScheduler.h
@@ -47,6 +47,13 @@ public:
DYNAMIC, /**< Split the workload dynamically using a bucket system */
};
+ /** Function to be used and map a given thread id to a logical core id
+ *
+ * Mapping function expects the thread index and total number of cores as input,
+ * and returns the logical core index to bind against
+ */
+ using BindFunc = std::function<int(int, int)>;
+
/** When arm_compute::ISchedular::Hints::_split_dimension is initialized with this value
* then the schedular is free to break down the problem space over as many dimensions
* as it wishes
@@ -137,6 +144,13 @@ public:
*/
virtual void set_num_threads(unsigned int num_threads) = 0;
+ /** Sets the number of threads the scheduler will use to run the kernels but also using a binding function to pin the threads to given logical cores
+ *
+ * @param[in] num_threads If set to 0, then one thread per CPU core available on the system will be used, otherwise the number of threads specified.
+ * @param[in] func Binding function to use.
+ */
+ virtual void set_num_threads_with_affinity(unsigned int num_threads, BindFunc func);
+
/** Returns the number of threads that the SingleThreadScheduler has in his pool.
*
* @return Number of threads available in SingleThreadScheduler.