Compute Library
 22.11
CLTuningParams Class Reference

< OpenCL tuner parameters More...

#include <CLTuningParams.h>

Public Member Functions

 CLTuningParams (const CLTuningParams &tuning_params)
 
 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)
 
CLTuningParamsoperator= (const CLTuningParams &other)
 
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 tuning_params)
inline

Definition at line 39 of file CLTuningParams.h.

40  : _lws(tuning_params._lws), _wbsm(tuning_params._wbsm)
41  {
42  }

◆ 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 44 of file CLTuningParams.h.

45  : _lws(lws_x, lws_y, lws_z), _wbsm(wbsm)
46  {
47  }

◆ CLTuningParams() [3/4]

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

Definition at line 48 of file CLTuningParams.h.

49  : _lws(lws), _wbsm(wbsm)
50  {
51  }

◆ CLTuningParams() [4/4]

CLTuningParams ( cl_int  wbsm)
inline

Definition at line 53 of file CLTuningParams.h.

54  : CLTuningParams(cl::NullRange, wbsm)
55  {
56  }
CLTuningParams(const CLTuningParams &tuning_params)

Member Function Documentation

◆ from_string()

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

Definition at line 95 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().

96  {
97  std::replace(tuning_params_string.begin(), tuning_params_string.end(), ';', ' ');
98  std::vector<std::string> array;
99  std::stringstream ss(tuning_params_string);
100  std::string temp;
101  while(ss >> temp)
102  {
103  array.push_back(temp);
104  }
105  // Read 3 values for lws
106  if(array.size() < 3)
107  {
108  return false;
109  }
110  const unsigned int lws_0 = support::cpp11::stoi(array[0]);
111  const unsigned int lws_1 = support::cpp11::stoi(array[1]);
112  const unsigned int lws_2 = support::cpp11::stoi(array[2]);
113  if(lws_0 == 0 && lws_1 == 0 && lws_2 == 0)
114  {
115  // If lws values are 0, cl::NullRange has to be used
116  // otherwise the lws object will be badly created
117  _lws = cl::NullRange;
118  }
119  else
120  {
121  _lws = cl::NDRange(lws_0, lws_1, lws_2);
122  }
123  array.erase(array.begin(), array.begin() + 3);
124  if(tuning_info.tune_wbsm)
125  {
126  if(array.size() < 1)
127  {
128  return false;
129  }
130  _wbsm = support::cpp11::stoi(array[0]);
131  array.erase(array.begin());
132  }
133  return true;
134  }
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 69 of file CLTuningParams.h.

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

70  {
71  return _lws;
72  }

◆ get_wbsm()

cl_int get_wbsm ( ) const
inline

Definition at line 79 of file CLTuningParams.h.

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

80  {
81  return _wbsm;
82  }

◆ operator=()

CLTuningParams& operator= ( const CLTuningParams other)
inline

Definition at line 57 of file CLTuningParams.h.

58  {
59  _lws = other._lws;
60  _wbsm = other._wbsm;
61  return *this;
62  }

◆ set_lws()

void set_lws ( cl::NDRange  lws)
inline

Definition at line 64 of file CLTuningParams.h.

Referenced by CLTuner::add_tuning_params().

65  {
66  _lws = lws;
67  }

◆ set_wbsm()

void set_wbsm ( cl_int  wbsm)
inline

Definition at line 74 of file CLTuningParams.h.

Referenced by CLTuner::add_tuning_params().

75  {
76  _wbsm = wbsm;
77  }

◆ to_string()

std::string to_string ( CLTuningInfo  tuning_info)
inline

Definition at line 84 of file CLTuningParams.h.

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

Referenced by CLTuner::save_to_file().

85  {
86  std::string tuning_params_string = "";
87  tuning_params_string += ";" + support::cpp11::to_string(_lws[0]) + ";" + support::cpp11::to_string(_lws[1]) + ";" + support::cpp11::to_string(_lws[2]);
88  if(tuning_info.tune_wbsm)
89  {
90  tuning_params_string += ";" + support::cpp11::to_string(_wbsm);
91  }
92  return tuning_params_string;
93  }
std::string to_string(T &&value)
Convert integer and float values to string.

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