aboutsummaryrefslogtreecommitdiff
path: root/tests/framework
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-09-14 12:33:34 +0100
committerFreddie Liardet <frederick.liardet@arm.com>2021-10-07 10:59:05 +0000
commitb6af482bc5d8e4f03f876e17909c561de198c4d3 (patch)
treef32c3a796cad01ffc27a4da2e8141cdf451ca453 /tests/framework
parent58e9e06102da7042bed34482ae89b3a6f8c77dca (diff)
downloadComputeLibrary-b6af482bc5d8e4f03f876e17909c561de198c4d3.tar.gz
Per-operator build dependencies
Creates a list of operators their respective dependencies. Alters the build system to walk-through them resolve the dependencies and build Compute Library. Removes the following unused kernels/functions: -[NE|CL]MinMaxLayerKernel -CLFillBorder Resolves: COMPMID-4695,COMPMID-4696 Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I35ebeef38dac25ec5459cfe9c5f7c9a708621124 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/357914 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Michele DiGiorgio <michele.digiorgio@arm.com> Comments-Addressed: bsgcomp <bsgcomp@arm.com> Signed-off-by: Freddie Liardet <frederick.liardet@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6295 Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/framework')
-rw-r--r--tests/framework/instruments/OpenCLTimer.cpp45
-rw-r--r--tests/framework/instruments/OpenCLTimer.h10
-rw-r--r--tests/framework/instruments/SchedulerTimer.cpp34
-rw-r--r--tests/framework/instruments/SchedulerTimer.h16
4 files changed, 66 insertions, 39 deletions
diff --git a/tests/framework/instruments/OpenCLTimer.cpp b/tests/framework/instruments/OpenCLTimer.cpp
index 45eb4c5c60..e9f945bd95 100644
--- a/tests/framework/instruments/OpenCLTimer.cpp
+++ b/tests/framework/instruments/OpenCLTimer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Arm Limited.
+ * Copyright (c) 2017-2019, 2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -54,7 +54,13 @@ std::string OpenCLClock<output_timestamps>::id() const
template <bool output_timestamps>
OpenCLClock<output_timestamps>::OpenCLClock(ScaleFactor scale_factor)
- : _kernels(), _real_function(nullptr), _real_graph_function(nullptr), _prefix(), _timer_enabled(false)
+ : _kernels(),
+ _real_function(nullptr),
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
+ _real_graph_function(nullptr),
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
+ _prefix(),
+ _timer_enabled(false)
{
auto q = CLScheduler::get().queue();
cl_command_queue_properties props = q.getInfo<CL_QUEUE_PROPERTIES>();
@@ -91,19 +97,17 @@ void OpenCLClock<output_timestamps>::test_start()
{
// Start intercepting enqueues:
ARM_COMPUTE_ERROR_ON(_real_function != nullptr);
- ARM_COMPUTE_ERROR_ON(_real_graph_function != nullptr);
- _real_function = CLSymbols::get().clEnqueueNDRangeKernel_ptr;
- _real_graph_function = graph::TaskExecutor::get().execute_function;
- auto interceptor = [this](
- cl_command_queue command_queue,
- cl_kernel kernel,
- cl_uint work_dim,
- const size_t *gwo,
- const size_t *gws,
- const size_t *lws,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
+ _real_function = CLSymbols::get().clEnqueueNDRangeKernel_ptr;
+ auto interceptor = [this](
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t *gwo,
+ const size_t *gws,
+ const size_t *lws,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event)
{
if(this->_timer_enabled)
{
@@ -138,7 +142,11 @@ void OpenCLClock<output_timestamps>::test_start()
return this->_real_function(command_queue, kernel, work_dim, gwo, gws, lws, num_events_in_wait_list, event_wait_list, event);
}
};
+ CLSymbols::get().clEnqueueNDRangeKernel_ptr = interceptor;
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
+ ARM_COMPUTE_ERROR_ON(_real_graph_function != nullptr);
+ _real_graph_function = graph::TaskExecutor::get().execute_function;
// Start intercepting tasks:
auto task_interceptor = [this](graph::ExecutionTask & task)
{
@@ -153,9 +161,8 @@ void OpenCLClock<output_timestamps>::test_start()
this->_real_graph_function(task);
this->_prefix = "";
};
-
- CLSymbols::get().clEnqueueNDRangeKernel_ptr = interceptor;
graph::TaskExecutor::get().execute_function = task_interceptor;
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
}
template <bool output_timestamps>
@@ -175,9 +182,11 @@ void OpenCLClock<output_timestamps>::test_stop()
{
// Restore real function
CLSymbols::get().clEnqueueNDRangeKernel_ptr = _real_function;
+ _real_function = nullptr;
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
graph::TaskExecutor::get().execute_function = _real_graph_function;
_real_graph_function = nullptr;
- _real_function = nullptr;
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
}
template <bool output_timestamps>
diff --git a/tests/framework/instruments/OpenCLTimer.h b/tests/framework/instruments/OpenCLTimer.h
index 9904035c20..1812272435 100644
--- a/tests/framework/instruments/OpenCLTimer.h
+++ b/tests/framework/instruments/OpenCLTimer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 Arm Limited.
+ * Copyright (c) 2017-2018, 2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -67,9 +67,11 @@ private:
};
std::list<kernel_info> _kernels;
std::function<decltype(clEnqueueNDRangeKernel)> _real_function;
- std::function<decltype(graph::execute_task)> _real_graph_function;
- std::string _prefix;
- bool _timer_enabled;
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
+ std::function<decltype(graph::execute_task)> _real_graph_function;
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
+ std::string _prefix;
+ bool _timer_enabled;
#endif /* ARM_COMPUTE_CL */
private:
diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp
index 35f960d368..b753485351 100644
--- a/tests/framework/instruments/SchedulerTimer.cpp
+++ b/tests/framework/instruments/SchedulerTimer.cpp
@@ -129,16 +129,24 @@ protected:
private:
std::list<struct SchedulerClock<output_timestamps>::kernel_info> &_kernels;
- std::map<std::string, SchedulerTimer::LayerData> &_layer_data_map;
- IScheduler &_real_scheduler;
- WallClock<output_timestamps> _timer;
- std::string _prefix;
+ std::map<std::string, SchedulerTimer::LayerData> &_layer_data_map;
+ IScheduler &_real_scheduler;
+ WallClock<output_timestamps> _timer;
+ std::string _prefix;
};
template <bool output_timestamps>
SchedulerClock<output_timestamps>::SchedulerClock(ScaleFactor scale_factor)
- : _kernels(), _layer_data_map(), _real_scheduler(nullptr), _real_scheduler_type(), _real_graph_function(nullptr),
- _scale_factor(scale_factor), _interceptor(nullptr), _scheduler_users()
+ : _kernels(),
+ _layer_data_map(),
+ _real_scheduler(nullptr),
+ _real_scheduler_type(),
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
+ _real_graph_function(nullptr),
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
+ _scale_factor(scale_factor),
+ _interceptor(nullptr),
+ _scheduler_users()
{
if(instruments_info != nullptr)
{
@@ -149,6 +157,7 @@ SchedulerClock<output_timestamps>::SchedulerClock(ScaleFactor scale_factor)
template <bool output_timestamps>
void SchedulerClock<output_timestamps>::test_start()
{
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
// Start intercepting tasks:
ARM_COMPUTE_ERROR_ON(_real_graph_function != nullptr);
_real_graph_function = graph::TaskExecutor::get().execute_function;
@@ -182,6 +191,7 @@ void SchedulerClock<output_timestamps>::test_start()
scheduler->set_prefix("");
}
};
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
ARM_COMPUTE_ERROR_ON(_real_scheduler != nullptr);
_real_scheduler_type = Scheduler::get_type();
@@ -191,7 +201,9 @@ void SchedulerClock<output_timestamps>::test_start()
_real_scheduler = &Scheduler::get();
_interceptor = std::make_shared<Interceptor<output_timestamps>>(_kernels, _layer_data_map, *_real_scheduler, _scale_factor);
Scheduler::set(std::static_pointer_cast<IScheduler>(_interceptor));
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
graph::TaskExecutor::get().execute_function = task_interceptor;
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
// Create an interceptor for each scheduler
// TODO(COMPID-2638) : Allow multiple schedulers, now it assumes the same scheduler is used.
@@ -217,10 +229,12 @@ void SchedulerClock<output_timestamps>::test_stop()
{
// Restore real scheduler
Scheduler::set(_real_scheduler_type);
- _real_scheduler = nullptr;
- _interceptor = nullptr;
+ _real_scheduler = nullptr;
+ _interceptor = nullptr;
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
graph::TaskExecutor::get().execute_function = _real_graph_function;
_real_graph_function = nullptr;
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
// Restore schedulers
std::for_each(std::begin(_scheduler_users), std::end(_scheduler_users),
@@ -270,9 +284,9 @@ Instrument::MeasurementsMap SchedulerClock<output_timestamps>::measurements() co
}
template <bool output_timestamps>
-std::string SchedulerClock<output_timestamps>::instrument_header() const
+std::string SchedulerClock<output_timestamps>::instrument_header() const
{
- std::string output{""};
+ std::string output{ "" };
output += R"("layer_data" : {)";
for(auto i_it = _layer_data_map.cbegin(), i_end = _layer_data_map.cend(); i_it != i_end; ++i_it)
{
diff --git a/tests/framework/instruments/SchedulerTimer.h b/tests/framework/instruments/SchedulerTimer.h
index 9cc0381a9a..c437f2717c 100644
--- a/tests/framework/instruments/SchedulerTimer.h
+++ b/tests/framework/instruments/SchedulerTimer.h
@@ -97,14 +97,16 @@ public:
};
private:
- std::list<kernel_info> _kernels;
- std::map<std::string, LayerData> _layer_data_map;
- IScheduler *_real_scheduler;
- Scheduler::Type _real_scheduler_type;
+ std::list<kernel_info> _kernels;
+ std::map<std::string, LayerData> _layer_data_map;
+ IScheduler *_real_scheduler;
+ Scheduler::Type _real_scheduler_type;
+#ifdef ARM_COMPUTE_GRAPH_ENABLED
std::function<decltype(graph::execute_task)> _real_graph_function;
- ScaleFactor _scale_factor;
- std::shared_ptr<IScheduler> _interceptor;
- std::vector<ISchedulerUser *> _scheduler_users;
+#endif /* ARM_COMPUTE_GRAPH_ENABLED */
+ ScaleFactor _scale_factor;
+ std::shared_ptr<IScheduler> _interceptor;
+ std::vector<ISchedulerUser *> _scheduler_users;
};
using SchedulerTimer = SchedulerClock<false>;