From 8b81195919eaab90a803fabae57ca05136e9430e Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Wed, 28 Feb 2018 13:47:58 +0000 Subject: 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 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/runtime/CL/CLTuner.h | 53 +++++++++++++++------------------------- 1 file changed, 20 insertions(+), 33 deletions(-) (limited to 'arm_compute/runtime/CL/CLTuner.h') diff --git a/arm_compute/runtime/CL/CLTuner.h b/arm_compute/runtime/CL/CLTuner.h index 251848814d..a321241fee 100644 --- a/arm_compute/runtime/CL/CLTuner.h +++ b/arm_compute/runtime/CL/CLTuner.h @@ -47,11 +47,16 @@ public: /** Destructor */ ~CLTuner() = default; - /* Setter for tune_new_kernels option + /** Setter for tune_new_kernels option * * @param[in] tune_new_kernels Find the optimal local workgroup size for kernels which are not present in the table ? */ void set_tune_new_kernels(bool tune_new_kernels); + /** Tune kernels that are not in the LWS table + * + * @return True if tuning of new kernels is enabled. + */ + bool tune_new_kernels() const; /** Manually add a LWS for a kernel * * @param[in] kernel_id Unique identifiant of the kernel @@ -64,11 +69,11 @@ public: */ void import_lws_table(const std::unordered_map &lws_table); - /** Export LWS table + /** Give read access to the LWS table * * return The lws table as unordered_map container */ - const std::unordered_map &export_lws_table() const; + const std::unordered_map &lws_table() const; /** Set the OpenCL kernel event * @@ -80,6 +85,18 @@ public: std::function real_clEnqueueNDRangeKernel; + /** Load the LWS table from file + * + * @param[in] filename Load the LWS table from this file.(Must exist) + */ + void load_from_file(const std::string &filename); + + /** Save the content of the LWS table to file + * + * @param[in] filename Save the LWS table to this file. (Content will be overwritten) + */ + void save_to_file(const std::string &filename) const; + // Inherited methods overridden: void tune_kernel(ICLKernel &kernel) override; @@ -98,35 +115,5 @@ private: cl::Event _kernel_event; bool _tune_new_kernels; }; - -class CLFileTuner : public CLTuner -{ -public: - /** Constructor - * - * @param[in] file_path File to load/store the tuning information from - * @param[in] update_file If true, save the new LWS table to the file on exit. - * @param[in] tune_new_kernels Find the optimal local workgroup size for kernels which are not present in the table ? - */ - CLFileTuner(std::string file_path = "acl_tuner.csv", bool update_file = false, bool tune_new_kernels = false); - - /** Save the content of the LWS table to file - */ - void save_to_file() const; - /* Setter for update_file option - * - * @param[in] update_file If true, save the new LWS table to the file on exit. - */ - void set_update_file(bool update_file); - /** Destructor - * - * Will save the LWS table to the file if the CLFileTuner was created with update_file enabled. - */ - ~CLFileTuner(); - const std::string filename; - -private: - bool _update_file; -}; } #endif /*__ARM_COMPUTE_CLTUNER_H__ */ -- cgit v1.2.1