Compute Library
 22.05
CLTuningParams Class Reference

< OpenCL tuner parameters More...

#include <CLTuningParams.h>

Public Member Functions

 CLTuningParams (const CLTuningParams &)=default
 
 CLTuningParams (unsigned int lws_x=0, unsigned int lws_y=0, unsigned int lws_z=0, int wbsm=0)
 
 CLTuningParams (cl::NDRange lws, cl_int wbsm=0)
 
 CLTuningParams (cl_int wbsm)
 
void set_lws (cl::NDRange lws)
 
cl::NDRange get_lws () const
 
void set_wbsm (cl_int wbsm)
 
cl_int get_wbsm () const
 
std::string to_string (CLTuningInfo tuning_info)
 
bool from_string (CLTuningInfo tuning_info, std::string tuning_params_string)
 

Detailed Description

< OpenCL tuner parameters

Definition at line 36 of file CLTuningParams.h.

Constructor & Destructor Documentation

◆ CLTuningParams() [1/4]

CLTuningParams ( const CLTuningParams )
default

◆ CLTuningParams() [2/4]

CLTuningParams ( unsigned int  lws_x = 0,
unsigned int  lws_y = 0,
unsigned int  lws_z = 0,
int  wbsm = 0 
)
inline

Definition at line 41 of file CLTuningParams.h.

42  : _lws(lws_x, lws_y, lws_z), _wbsm(wbsm)
43  {
44  }

◆ CLTuningParams() [3/4]

CLTuningParams ( cl::NDRange  lws,
cl_int  wbsm = 0 
)
inline

Definition at line 45 of file CLTuningParams.h.

46  : _lws(lws), _wbsm(wbsm)
47  {
48  }

◆ CLTuningParams() [4/4]

CLTuningParams ( cl_int  wbsm)
inline

Definition at line 50 of file CLTuningParams.h.

51  : CLTuningParams(cl::NullRange, wbsm)
52  {
53  }
CLTuningParams(const CLTuningParams &)=default

Member Function Documentation

◆ from_string()

bool from_string ( CLTuningInfo  tuning_info,
std::string  tuning_params_string 
)
inline

Definition at line 86 of file CLTuningParams.h.

References arm_compute::test::validation::ss(), arm_compute::support::cpp11::stoi(), and CLTuningInfo::tune_wbsm.

Referenced by CLTuner::load_from_file().

87  {
88  std::replace(tuning_params_string.begin(), tuning_params_string.end(), ';', ' ');
89  std::vector<std::string> array;
90  std::stringstream ss(tuning_params_string);
91  std::string temp;
92  while(ss >> temp)
93  {
94  array.push_back(temp);
95  }
96  // Read 3 values for lws
97  if(array.size() < 3)
98  {
99  return false;
100  }
101  const unsigned int lws_0 = support::cpp11::stoi(array[0]);
102  const unsigned int lws_1 = support::cpp11::stoi(array[1]);
103  const unsigned int lws_2 = support::cpp11::stoi(array[2]);
104  if(lws_0 == 0 && lws_1 == 0 && lws_2 == 0)
105  {
106  // If lws values are 0, cl::NullRange has to be used
107  // otherwise the lws object will be badly created
108  _lws = cl::NullRange;
109  }
110  else
111  {
112  _lws = cl::NDRange(lws_0, lws_1, lws_2);
113  }
114  array.erase(array.begin(), array.begin() + 3);
115  if(tuning_info.tune_wbsm)
116  {
117  if(array.size() < 1)
118  {
119  return false;
120  }
121  _wbsm = support::cpp11::stoi(array[0]);
122  array.erase(array.begin());
123  }
124  return true;
125  }
std::stringstream ss(mlgo_str)
int stoi(const std::string &str, std::size_t *pos=0, NumericBase base=NumericBase::BASE_10)
Convert string values to integer.
Definition: StringSupport.h:55

◆ get_lws()

cl::NDRange get_lws ( ) const
inline

Definition at line 60 of file CLTuningParams.h.

Referenced by CLTuner::add_tuning_params(), and CLTuner::tune_kernel_dynamic().

61  {
62  return _lws;
63  }

◆ get_wbsm()

cl_int get_wbsm ( ) const
inline

Definition at line 70 of file CLTuningParams.h.

Referenced by CLTuner::add_tuning_params(), and CLTuner::tune_kernel_dynamic().

71  {
72  return _wbsm;
73  }

◆ set_lws()

void set_lws ( cl::NDRange  lws)
inline

Definition at line 55 of file CLTuningParams.h.

Referenced by CLTuner::add_tuning_params().

56  {
57  _lws = lws;
58  }

◆ set_wbsm()

void set_wbsm ( cl_int  wbsm)
inline

Definition at line 65 of file CLTuningParams.h.

Referenced by CLTuner::add_tuning_params().

66  {
67  _wbsm = wbsm;
68  }

◆ to_string()

std::string to_string ( CLTuningInfo  tuning_info)
inline

Definition at line 75 of file CLTuningParams.h.

References arm_compute::support::cpp11::to_string(), and CLTuningInfo::tune_wbsm.

Referenced by CLTuner::save_to_file().

76  {
77  std::string tuning_params_string = "";
78  tuning_params_string += ";" + support::cpp11::to_string(_lws[0]) + ";" + support::cpp11::to_string(_lws[1]) + ";" + support::cpp11::to_string(_lws[2]);
79  if(tuning_info.tune_wbsm)
80  {
81  tuning_params_string += ";" + support::cpp11::to_string(_wbsm);
82  }
83  return tuning_params_string;
84  }
std::string to_string(T &&value)
Convert integer and float values to string.

The documentation for this class was generated from the following file: