aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime
diff options
context:
space:
mode:
authormorgolock <pablo.tello@arm.com>2020-08-20 14:51:39 +0100
committerPablo Marquez <pablo.tello@arm.com>2020-08-25 13:17:09 +0000
commit5111264954e2d1a4d3e91d23a0869a0d7105be4c (patch)
tree57c8db6a8911378129364bc6d826a3c0ef7f9283 /arm_compute/runtime
parent96a14008af85725d067cdd8247023474581102ea (diff)
downloadComputeLibrary-5111264954e2d1a4d3e91d23a0869a0d7105be4c.tar.gz
COMPMID-3661: Added multidimension support to OMP scheduler.
Change-Id: Iedacf7094896f08d7c2847c8fb99bd7153deba2c Signed-off-by: morgolock <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3809 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Sang-Hoon Park <sang-hoon.park@arm.com>
Diffstat (limited to 'arm_compute/runtime')
-rw-r--r--arm_compute/runtime/CPP/CPPScheduler.h1
-rw-r--r--arm_compute/runtime/IScheduler.h2
-rw-r--r--arm_compute/runtime/SchedulerUtils.h39
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 */