From 148b07500ad883ff2d31a4087ba2538103005979 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Tue, 11 Sep 2018 14:19:39 +0100 Subject: COMPMID-1563: Added a tag to ISCheduler::run_workloads to identify workloads Change-Id: Ieac59e3ccf47feab8f88c65200eb8a81b2eb4196 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/147728 Tested-by: bsgcomp Reviewed-by: Georgios Pinitas --- arm_compute/runtime/CPP/CPPScheduler.h | 1 + arm_compute/runtime/IScheduler.h | 10 +++++++++- arm_compute/runtime/OMP/OMPScheduler.h | 2 ++ arm_compute/runtime/SingleThreadScheduler.h | 1 + src/runtime/IScheduler.cpp | 7 +++++++ .../NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp | 2 +- tests/framework/instruments/SchedulerTimer.cpp | 13 ++++++++++--- 7 files changed, 31 insertions(+), 5 deletions(-) diff --git a/arm_compute/runtime/CPP/CPPScheduler.h b/arm_compute/runtime/CPP/CPPScheduler.h index 30bc4c8b70..17ed8310a4 100644 --- a/arm_compute/runtime/CPP/CPPScheduler.h +++ b/arm_compute/runtime/CPP/CPPScheduler.h @@ -61,6 +61,7 @@ public: */ void schedule(ICPPKernel *kernel, const Hints &hints) override; +protected: /** Will run the workloads in parallel using num_threads * * @param[in] workloads Workloads to run diff --git a/arm_compute/runtime/IScheduler.h b/arm_compute/runtime/IScheduler.h index 1f90f4ef9c..14acf04439 100644 --- a/arm_compute/runtime/IScheduler.h +++ b/arm_compute/runtime/IScheduler.h @@ -134,8 +134,9 @@ public: * @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 + * @param[in] tag String that can be used by profiling tools to identify the workloads run by the scheduler (Can be null). */ - virtual void run_workloads(std::vector &workloads) = 0; + virtual void run_tagged_workloads(std::vector &workloads, const char *tag); /** Get CPU info. * @@ -152,6 +153,13 @@ public: unsigned int num_threads_hint() const; protected: + /** 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 &workloads) = 0; CPUInfo _cpu_info; private: diff --git a/arm_compute/runtime/OMP/OMPScheduler.h b/arm_compute/runtime/OMP/OMPScheduler.h index 4ff787630f..ff9bf052fd 100644 --- a/arm_compute/runtime/OMP/OMPScheduler.h +++ b/arm_compute/runtime/OMP/OMPScheduler.h @@ -57,6 +57,8 @@ public: * @param[in] hints Hints for the scheduler. */ void schedule(ICPPKernel *kernel, const Hints &hints) override; + +protected: /** 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. diff --git a/arm_compute/runtime/SingleThreadScheduler.h b/arm_compute/runtime/SingleThreadScheduler.h index 6924601903..7c084efeaf 100644 --- a/arm_compute/runtime/SingleThreadScheduler.h +++ b/arm_compute/runtime/SingleThreadScheduler.h @@ -54,6 +54,7 @@ public: */ void schedule(ICPPKernel *kernel, const Hints &hints) override; +protected: /** Will run the workloads sequentially and in order. * * @param[in] workloads Workloads to run diff --git a/src/runtime/IScheduler.cpp b/src/runtime/IScheduler.cpp index 54a2bd2182..5188dce4eb 100644 --- a/src/runtime/IScheduler.cpp +++ b/src/runtime/IScheduler.cpp @@ -23,6 +23,7 @@ */ #include "arm_compute/runtime/IScheduler.h" +#include "arm_compute/core/Error.h" #include "arm_compute/runtime/CPUUtils.h" namespace arm_compute @@ -43,4 +44,10 @@ unsigned int IScheduler::num_threads_hint() const { return _num_threads_hint; } +void IScheduler::run_tagged_workloads(std::vector &workloads, const char *tag) +{ + ARM_COMPUTE_UNUSED(tag); + run_workloads(workloads); +} + } // namespace arm_compute diff --git a/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp b/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp index b52ce663f1..69d59283ae 100644 --- a/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp +++ b/src/runtime/NEON/functions/assembly/NEGEMMInterleavedWrapper.cpp @@ -42,7 +42,7 @@ void NEGEMMInterleavedWrapper::run() prepare(); _memory_group.acquire(); - NEScheduler::get().run_workloads(_workloads); + NEScheduler::get().run_tagged_workloads(_workloads, "NEGEMMInterleavedWrapper"); _memory_group.release(); } diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp index 50d77dd5b9..76f1a58e9c 100644 --- a/tests/framework/instruments/SchedulerTimer.cpp +++ b/tests/framework/instruments/SchedulerTimer.cpp @@ -76,19 +76,26 @@ public: _kernels.push_back(std::move(info)); } - void run_workloads(std::vector &workloads) override + void run_tagged_workloads(std::vector &workloads, const char *tag) override { _timer.start(); - _real_scheduler.run_workloads(workloads); + _real_scheduler.run_tagged_workloads(workloads, tag); _timer.stop(); SchedulerTimer::kernel_info info; - info.name = "Unknown"; + info.name = tag != nullptr ? tag : "Unknown"; info.prefix = _prefix; info.measurements = _timer.measurements(); _kernels.push_back(std::move(info)); } +protected: + void run_workloads(std::vector &workloads) override + { + ARM_COMPUTE_UNUSED(workloads); + ARM_COMPUTE_ERROR("Can't be reached"); + } + private: std::list &_kernels; IScheduler &_real_scheduler; -- cgit v1.2.1