24.02.1
|
Basic implementation of the OpenCL tuner interface. More...
#include <CLTuner.h>
Public Member Functions | |
CLTuner (bool tune_new_kernels=true, CLTuningInfo tuning_info=CLTuningInfo()) | |
Constructor. More... | |
~CLTuner ()=default | |
Destructor. More... | |
void | set_tune_new_kernels (bool tune_new_kernels) |
Setter for tune_new_kernels option. More... | |
bool | tune_new_kernels () const |
Tune kernels that are not in the tuning parameters table. More... | |
void | set_tuning_parameters (CLTuningInfo tuning_info) |
Setter for tune parameters option. More... | |
void | set_tuner_mode (CLTunerMode mode) |
Set OpenCL tuner mode. More... | |
void | add_tuning_params (const std::string &kernel_id, CLTuningParams optimal_tuning_params) |
Manually add tuning parameters for a kernel. More... | |
void | import_tuning_params (const std::unordered_map< std::string, CLTuningParams > &tuning_params_table) |
Import tuning parameters table. More... | |
const std::unordered_map< std::string, CLTuningParams > & | tuning_params_table () const |
Give read access to the tuning params table. More... | |
void | set_cl_kernel_event (cl_event kernel_event) |
Set the OpenCL kernel event. More... | |
void | load_from_file (const std::string &filename) |
Load the tuning parameters table from file. More... | |
bool | save_to_file (const std::string &filename) const |
Save the content of the tuning parameters table to file. More... | |
void | tune_kernel_static (ICLKernel &kernel) override |
Tune OpenCL kernel statically. More... | |
void | tune_kernel_dynamic (ICLKernel &kernel) override |
Tune OpenCL kernel dynamically. More... | |
void | tune_kernel_dynamic (ICLKernel &kernel, ITensorPack &tensors) override |
Tune OpenCL kernel dynamically. More... | |
bool | kernel_event_is_set () const |
Is the kernel_event set ? More... | |
Public Member Functions inherited from ICLTuner | |
virtual | ~ICLTuner ()=default |
Virtual destructor. More... | |
Data Fields | |
std::function< decltype(clEnqueueNDRangeKernel)> | real_clEnqueueNDRangeKernel |
clEnqueueNDRangeKernel symbol More... | |
CLTuner | ( | bool | tune_new_kernels = true , |
CLTuningInfo | tuning_info = CLTuningInfo() |
||
) |
Constructor.
[in] | tune_new_kernels | Find the optimal local workgroup size for kernels which are not present in the table ? |
[in] | tuning_info | (Optional) opencl parameters to tune |
Definition at line 40 of file CLTuner.cpp.
|
default |
Destructor.
void add_tuning_params | ( | const std::string & | kernel_id, |
CLTuningParams | optimal_tuning_params | ||
) |
Manually add tuning parameters for a kernel.
[in] | kernel_id | Unique identifiant of the kernel |
[in] | optimal_tuning_params | Optimal tuning parameters to use for the given kernel |
Definition at line 152 of file CLTuner.cpp.
Referenced by CLTuner::load_from_file().
void import_tuning_params | ( | const std::unordered_map< std::string, CLTuningParams > & | tuning_params_table | ) |
Import tuning parameters table.
[in] | tuning_params_table | The unordered_map container to import |
Definition at line 292 of file CLTuner.cpp.
References CLTuner::tuning_params_table().
bool kernel_event_is_set | ( | ) | const |
Is the kernel_event set ?
Definition at line 71 of file CLTuner.cpp.
void load_from_file | ( | const std::string & | filename | ) |
Load the tuning parameters table from file.
It also sets up the tuning read from the file
[in] | filename | Load the tuning parameters table from this file.(Must exist) |
Definition at line 298 of file CLTuner.cpp.
References CLTuner::add_tuning_params(), ARM_COMPUTE_ERROR_VAR, CLTuningParams::from_string(), and CLTuningInfo::tune_wbsm.
Referenced by main(), and CLDeviceBackend::setup_backend_context().
bool save_to_file | ( | const std::string & | filename | ) | const |
Save the content of the tuning parameters table to file.
[in] | filename | Save the tuning parameters table to this file. (Content will be overwritten) |
Definition at line 350 of file CLTuner.cpp.
References CLTuningParams::to_string(), and CLTuningInfo::tune_wbsm.
Referenced by main(), and CLDeviceBackend::~CLDeviceBackend().
void set_cl_kernel_event | ( | cl_event | kernel_event | ) |
Set the OpenCL kernel event.
[in] | kernel_event | The OpenCL kernel event |
Definition at line 75 of file CLTuner.cpp.
void set_tune_new_kernels | ( | bool | tune_new_kernels | ) |
Setter for tune_new_kernels option.
[in] | tune_new_kernels | Find the optimal local workgroup size for kernels which are not present in the table ? |
Definition at line 80 of file CLTuner.cpp.
References CLTuner::tune_new_kernels().
Referenced by main(), and CLDeviceBackend::set_kernel_tuning().
void set_tuner_mode | ( | CLTunerMode | mode | ) |
Set OpenCL tuner mode.
[in] | mode | Indicates how exhaustive the search for the optimal tuning parameters should be while tuning. Default is Exhaustive mode |
Definition at line 89 of file CLTuner.cpp.
References clang_tidy_rules::mode, and CLTuningInfo::tuner_mode.
Referenced by main(), and CLDeviceBackend::set_kernel_tuning_mode().
void set_tuning_parameters | ( | CLTuningInfo | tuning_info | ) |
Setter for tune parameters option.
[in] | tuning_info | opencl parameters to tune |
|
overridevirtual |
Tune OpenCL kernel dynamically.
[in] | kernel | Kernel to tune |
Implements ICLTuner.
Definition at line 99 of file CLTuner.cpp.
References arm_compute::test::validation::pack.
|
overridevirtual |
Tune OpenCL kernel dynamically.
[in] | kernel | Kernel to tune |
[in,out] | tensors | Tensors for the kernel to use |
Implements ICLTuner.
Definition at line 145 of file CLTuner.cpp.
|
overridevirtual |
Tune OpenCL kernel statically.
[in] | kernel | Kernel to tune |
Implements ICLTuner.
Definition at line 94 of file CLTuner.cpp.
References ARM_COMPUTE_UNUSED.
bool tune_new_kernels | ( | ) | const |
Tune kernels that are not in the tuning parameters table.
Definition at line 84 of file CLTuner.cpp.
Referenced by CLTuner::set_tune_new_kernels().
const std::unordered_map< std::string, CLTuningParams > & tuning_params_table | ( | ) | const |
Give read access to the tuning params table.
Definition at line 287 of file CLTuner.cpp.
Referenced by CLTuner::import_tuning_params().
std::function<decltype(clEnqueueNDRangeKernel)> real_clEnqueueNDRangeKernel |