From 7b607dc5058d2f6a398cfac4d2eab65d415c3733 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Fri, 13 Jul 2018 15:55:24 +0100 Subject: COMPMID-1400: Add command line option to specify the tuner's config file Change-Id: Ib597e0dff4c8c01f7e6bd46d03824beef4bc1e9a Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/139923 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- src/graph/backends/CL/CLDeviceBackend.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/graph/backends/CL/CLDeviceBackend.cpp') diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp index b235c3aa48..6717f9f8e3 100644 --- a/src/graph/backends/CL/CLDeviceBackend.cpp +++ b/src/graph/backends/CL/CLDeviceBackend.cpp @@ -62,20 +62,17 @@ bool file_exists(const std::string &filename) /** Register CL backend */ static detail::BackendRegistrar CLDeviceBackend_registrar(Target::CL); -/** Tuner export file */ -static const std::string tuner_data_filename = "acl_tuner.csv"; - CLDeviceBackend::CLDeviceBackend() - : _initialized(false), _tuner(), _allocator(nullptr) + : _initialized(false), _tuner(), _allocator(nullptr), _tuner_file() { } CLDeviceBackend::~CLDeviceBackend() { // TODO (geopin01) : Shouldn't call non exception safe stuff here - if(_tuner.tune_new_kernels() && !_tuner.lws_table().empty()) + if(_tuner.tune_new_kernels() && !_tuner.lws_table().empty() && !_tuner_file.empty()) { - _tuner.save_to_file(tuner_data_filename); + _tuner.save_to_file(_tuner_file); } } @@ -86,12 +83,6 @@ void CLDeviceBackend::set_kernel_tuning(bool enable_tuning) void CLDeviceBackend::initialize_backend() { - // Load tuner data if available - if(_tuner.lws_table().empty() && file_exists(tuner_data_filename)) - { - _tuner.load_from_file(tuner_data_filename); - } - // Setup Scheduler CLScheduler::get().default_init(&_tuner); @@ -109,6 +100,13 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx) } // Setup tuner + _tuner_file = ctx.config().tuner_file; + // Load tuner data if available + if(file_exists(_tuner_file)) + { + _tuner.load_from_file(_tuner_file); + } + set_kernel_tuning(ctx.config().use_tuner); // Setup a management backend @@ -193,4 +191,4 @@ std::shared_ptr CLDeviceBackend::create_memory_mana } } // namespace backends } // namespace graph -} // namespace arm_compute \ No newline at end of file +} // namespace arm_compute -- cgit v1.2.1