22.05
|
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... | |
void | tune_kernel_dynamic (ICLKernel &kernel, ITensorPack &tensors, const experimental::dynamic_fusion::ClExecutionDescriptor &exec_desc) override |
Tune OpenCL kernel dynamically for dynamic fusion interface. More... | |
bool | kernel_event_is_set () const |
Is the kernel_event set ? More... | |
![]() | |
virtual | ~ICLTuner ()=default |
Virtual destructor. More... | |
Data Fields | |
std::function< decltype(clEnqueueNDRangeKernel)> | real_clEnqueueNDRangeKernel |
clEnqueueNDRangeKernel symbol More... | |
Basic implementation of the OpenCL tuner interface.
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 41 of file CLTuner.cpp.
References ITensorPack::empty(), ICLKernel::run(), ICLKernel::run_composite_op(), ICLKernel::run_op(), and IKernel::window().
|
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 177 of file CLTuner.cpp.
References CLSymbols::clEnqueueNDRangeKernel_ptr, clRetainEvent(), arm_compute::mlgo::parser::end(), CLKernelLibrary::get(), CLScheduler::get(), CLSymbols::get(), CLTuningParams::get_lws(), arm_compute::cl_tuner::get_tuning_parameters_list(), CLTuningParams::get_wbsm(), ICLKernel::gws_from_window(), CLKernelLibrary::is_wbsm_supported(), CLTuner::kernel_event_is_set(), CLScheduler::queue(), CLTuner::real_clEnqueueNDRangeKernel, CLTuner::set_cl_kernel_event(), CLTuningParams::set_lws(), and CLTuningParams::set_wbsm().
Referenced by CLTuner::load_from_file(), and CLTuner::tune_kernel_dynamic().
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 304 of file CLTuner.cpp.
References CLTuner::tuning_params_table().
bool kernel_event_is_set | ( | ) | const |
Is the kernel_event set ?
Definition at line 88 of file CLTuner.cpp.
Referenced by CLTuner::add_tuning_params().
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 310 of file CLTuner.cpp.
References CLTuner::add_tuning_params(), ARM_COMPUTE_ERROR_VAR, and CLTuningParams::from_string().
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 362 of file CLTuner.cpp.
References CLTuningParams::to_string().
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 92 of file CLTuner.cpp.
Referenced by CLTuner::add_tuning_params().
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 97 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 106 of file CLTuner.cpp.
References clang_tidy_rules::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 116 of file CLTuner.cpp.
References CLTuner::add_tuning_params(), ICLKernel::config_id(), CLKernelLibrary::get(), CLTuningParams::get_lws(), CLKernelLibrary::get_num_compute_units(), ICLKernel::get_target(), CLTuningParams::get_wbsm(), arm_compute::test::validation::pack, ICLKernel::set_lws_hint(), ICLKernel::set_wbsm_hint(), arm_compute::string_from_target(), and arm_compute::support::cpp11::to_string().
|
overridevirtual |
Tune OpenCL kernel dynamically.
[in] | kernel | Kernel to tune |
[in,out] | tensors | Tensors for the kernel to use |
Implements ICLTuner.
Definition at line 161 of file CLTuner.cpp.
|
overridevirtual |
Tune OpenCL kernel dynamically for dynamic fusion interface.
[in] | kernel | Kernel to tune |
[in,out] | tensors | Tensors for the kernel to use |
[in] | exec_desc | Execution descriptor |
Implements ICLTuner.
Definition at line 169 of file CLTuner.cpp.
|
overridevirtual |
Tune OpenCL kernel statically.
[in] | kernel | Kernel to tune |
Implements ICLTuner.
Definition at line 111 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 101 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 299 of file CLTuner.cpp.
Referenced by CLTuner::import_tuning_params().
std::function<decltype(clEnqueueNDRangeKernel)> real_clEnqueueNDRangeKernel |
clEnqueueNDRangeKernel symbol
Definition at line 106 of file CLTuner.h.
Referenced by CLTuner::add_tuning_params().