aboutsummaryrefslogtreecommitdiff
path: root/src/graph
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2018-02-28 13:47:58 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:48:33 +0000
commit8b81195919eaab90a803fabae57ca05136e9430e (patch)
tree325798fd319f8091b18458127d3843b88c4d40af /src/graph
parentfadfc6d6737716891f543f61a529e984da9b0a8b (diff)
downloadComputeLibrary-8b81195919eaab90a803fabae57ca05136e9430e.tar.gz
COMPMID-978 Load/Store tuning data from file (Part2)
Change-Id: I1819f42c0e456673543b267d51f730b6e80a0ad9 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/122629 Reviewed-by: Robert Hughes <robert.hughes@arm.com> Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/graph')
-rw-r--r--src/graph/Graph.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/graph/Graph.cpp b/src/graph/Graph.cpp
index b1698e4672..2fe3a90aef 100644
--- a/src/graph/Graph.cpp
+++ b/src/graph/Graph.cpp
@@ -33,8 +33,19 @@
#include "arm_compute/runtime/Tensor.h"
#include "support/ToolchainSupport.h"
+#include <sys/stat.h>
+
using namespace arm_compute::graph;
+namespace
+{
+bool file_exists(const std::string &filename)
+{
+ std::ifstream file(filename);
+ return file.good();
+}
+
+} // namespace
struct Stage
{
ITensorObject *_input;
@@ -62,16 +73,20 @@ public:
std::unique_ptr<INode> _current_node{ nullptr };
ITensorObject *_current_output{ nullptr };
bool _info_enabled{ false };
- CLFileTuner _tuner{};
+ CLTuner _tuner{};
private:
ITensorObject *_current_input{ nullptr };
GraphHints _previous_hints{};
};
+static const std::string tuner_data_filename = "acl_tuner.csv";
Graph::~Graph() //NOLINT
{
- //Can't use =default because the destructor must be defined after Graph::Private's definition
+ if(_pimpl->_tuner.tune_new_kernels() && !_pimpl->_tuner.lws_table().empty())
+ {
+ _pimpl->_tuner.save_to_file(tuner_data_filename);
+ }
}
Graph::Graph()
@@ -85,12 +100,14 @@ void Graph::graph_init(const bool use_cl_tuner)
// Check if OpenCL is available and initialize the scheduler
if(opencl_is_available())
{
+ if(_pimpl->_tuner.lws_table().empty() && file_exists(tuner_data_filename))
+ {
+ _pimpl->_tuner.load_from_file(tuner_data_filename);
+ }
_pimpl->_tuner.set_tune_new_kernels(use_cl_tuner);
- _pimpl->_tuner.set_update_file(use_cl_tuner);
arm_compute::CLScheduler::get().default_init(&_pimpl->_tuner);
}
}
-
void Graph::run()
{
while(true)