OpenASIP  2.0
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MinimalOpSet Class Reference
Inheritance diagram for MinimalOpSet:
Inheritance graph
Collaboration diagram for MinimalOpSet:
Collaboration graph

Private Member Functions

 PLUGIN_DESCRIPTION ("Minimal opset checker and fixer plugin.")
 
 MinimalOpSet ()
 
virtual bool requiresStartingPointArchitecture () const
 
virtual bool producesArchitecture () const
 
virtual bool requiresHDB () const
 
virtual bool requiresSimulationData () const
 
virtual bool requiresApplication () const
 
virtual std::vector< RowIDexplore (const RowID &configurationID, const unsigned int &)
 
void readParameters ()
 
bool createConfig (const std::string &adf, const std::string &idf, DSDBManager &dsdb, DSDBManager::MachineConfiguration &conf)
 

Private Attributes

std::string adf_
 name of the adf file to evaluate More...
 
std::string idf_
 name of the idf file to evaluate More...
 
bool printMissingOps_
 print missing ops More...
 

Static Private Attributes

static const std::string adfPN_
 
static const std::string idfPN_
 
static const std::string printMissingOpsPN_
 

Additional Inherited Members

- Public Types inherited from DesignSpaceExplorerPlugin
typedef std::pair< std::string, ExplorerPluginParameterParameter
 
typedef std::map< std::string, ExplorerPluginParameterParameterMap
 
typedef std::map< std::string, ExplorerPluginParameter >::iterator PMIt
 
typedef std::map< std::string, ExplorerPluginParameter >::const_iterator PMCIt
 
- Public Member Functions inherited from DesignSpaceExplorerPlugin
virtual std::string description () const
 
void addParameter (TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
 
template<typename T >
void readCompulsoryParameter (const std::string paramName, T &param) const
 
template<typename T >
void readOptionalParameter (const std::string paramName, T &param) const
 
template<typename RT >
RT parameterValue (const std::string &paramName) const
 
virtual ~DesignSpaceExplorerPlugin ()
 
virtual void giveParameter (const std::string &name, const std::string &value)
 
virtual std::string name () const
 
virtual void setPluginName (const std::string &pluginName)
 
virtual bool hasParameter (const std::string &paramName) const
 
ParameterMap parameters () const
 
virtual bool booleanValue (const std::string &parameter) const
 
- Public Member Functions inherited from DesignSpaceExplorer
 DesignSpaceExplorer ()
 
virtual ~DesignSpaceExplorer ()
 
virtual void setDSDB (DSDBManager &dsdb)
 
virtual bool evaluate (const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
 
virtual DSDBManagerdb ()
 
std::vector< DesignSpaceExplorerPlugin * > getPlugins ()
 
RowID createImplementationAndStore (const DSDBManager::MachineConfiguration &conf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
 
bool createImplementation (const DSDBManager::MachineConfiguration &conf, DSDBManager::MachineConfiguration &newConf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
 
IDF::MachineImplementationselectComponents (const TTAMachine::Machine &mach, const double &frequency=0.0, const double &maxArea=0.0, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb") const
 
void createEstimateData (const TTAMachine::Machine &mach, const IDF::MachineImplementation &idf, CostEstimator::AreaInGates &area, CostEstimator::DelayInNanoSeconds &longestPathDelay)
 
RowID addConfToDSDB (const DSDBManager::MachineConfiguration &conf)
 
- Static Public Member Functions inherited from DesignSpaceExplorer
static DesignSpaceExplorerPluginloadExplorerPlugin (const std::string &pluginName, DSDBManager *dsdb=NULL)
 
- Protected Member Functions inherited from DesignSpaceExplorerPlugin
 DesignSpaceExplorerPlugin ()
 
void checkParameters () const
 
- Protected Member Functions inherited from DesignSpaceExplorer
TTAProgram::Programschedule (const std::string applicationFile, TTAMachine::Machine &machine, TCEString paramOptions="-O3")
 
const ExecutionTracesimulate (const TTAProgram::Program &program, const TTAMachine::Machine &machine, const TestApplication &testApplication, const ClockCycleCount &maxCycles, ClockCycleCount &runnedCycles, const bool tracing, const bool useCompiledSimulation=false, std::vector< ClockCycleCount > *executionCounts=NULL)
 
- Protected Attributes inherited from DesignSpaceExplorerPlugin
std::string pluginName_
 the name of the explorer plugin More...
 
ParameterMap parameters_
 Parameters for the plugin. More...
 

Detailed Description

Explorer plugin that checks that given config or adf meets minimal opset requirements stated by minimal machine adf or user given reference adf.

Supported parameters:

Definition at line 58 of file MinimalOpSet.cc.

Constructor & Destructor Documentation

◆ MinimalOpSet()

MinimalOpSet::MinimalOpSet ( )
inlineprivate

Definition at line 61 of file MinimalOpSet.cc.

62  adf_(""),
63  idf_(""),
64  printMissingOps_(false) {
65 
66  // compulsory parameters
67  // no compulsory parameters
68 
69  // parameters that have a default value
70  addParameter(adfPN_, STRING, false, adf_);
71  addParameter(idfPN_, STRING, false, idf_);
74  }

References BOOL, STRING, and Conversion::toString().

Here is the call graph for this function:

Member Function Documentation

◆ createConfig()

bool MinimalOpSet::createConfig ( const std::string &  adf,
const std::string &  idf,
DSDBManager dsdb,
DSDBManager::MachineConfiguration conf 
)
inlineprivate

Load adf and idf from files and store to given dsdb and config.

Parameters
adfPath of architecture definition file.
idfPath of implementation definition file.
dsdbDatabase where to store adf and idf.
confConfiguration for adf/idf ids.
Returns
True if creating config succeeded, else false.

Definition at line 219 of file MinimalOpSet.cc.

223  {
224 
225  assert(adf != "");
226 
227  IDF::MachineImplementation* idfo = NULL;
228  TTAMachine::Machine* mach = NULL;
229  try {
230  if (adf != "") {
232  conf.architectureID = dsdb.addArchitecture(*mach);
233  } else {
234  return false;
235  }
236  if (idf != "") {
238  conf.implementationID =
239  dsdb.addImplementation(*idfo, 0,0);
240  conf.hasImplementation = true;
241  } else {
242  conf.hasImplementation = false;
243  }
244  } catch (const Exception& e) {
245  std::ostringstream msg(std::ostringstream::out);
246  msg << "Error loading the adf/idf." << std::endl;
247  verboseLog(msg.str());
248  return false;
249  }
250  return true;
251  }

References DSDBManager::addArchitecture(), DSDBManager::addImplementation(), DSDBManager::MachineConfiguration::architectureID, assert, DSDBManager::MachineConfiguration::hasImplementation, DSDBManager::MachineConfiguration::implementationID, TTAMachine::Machine::loadFromADF(), IDF::MachineImplementation::loadFromIDF(), and verboseLog.

Here is the call graph for this function:

◆ explore()

virtual std::vector<RowID> MinimalOpSet::explore ( const RowID configurationID,
const unsigned int &   
)
inlineprivatevirtual

Explorer plugin that checks that given config or adf meets minimal opset requirements stated by minimal machine adf or user given reference adf.

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 87 of file MinimalOpSet.cc.

87  {
89  std::vector<RowID> result;
90  MinimalOpSetCheck minimalOpSetCheck = MinimalOpSetCheck();
91 
92  // make params for adf and idf, so no configuration needed
93  if (configurationID == 0 && adf_ == "") {
94  std::ostringstream msg(std::ostringstream::out);
95  msg << "No configuration nor adf defined. Use -s <confID> to "
96  << "define the configuration to be optimized or give adf "
97  << "as plugin parameter." << std::endl;
98  verboseLog(msg.str());
99  return result;
100  }
101 
102  DSDBManager& dsdb = db();
104  conf.architectureID = -1;
105  conf.hasImplementation = false;
106 
107  // load adf/idf from file if no configuration was given
108  if (configurationID == 0) {
109  if (!createConfig(adf_, idf_, dsdb, conf)) {
110  return result;
111  }
112  } else {
113  // if starting configuration given load it
114  conf = dsdb.configuration(configurationID);
115  }
116 
117  // load machine from configuration
118  // TODO: load machine from file is adf_ is specified.
119  Machine* mach = NULL;
120  try {
121  mach = dsdb.architecture(conf.architectureID);
122  } catch (const Exception& e) {
123  std::ostringstream msg(std::ostringstream::out);
124  msg << e.errorMessage() << std::endl;
125  verboseLog(msg.str());
126  return result;
127  }
128 
129  // check minimal opset and print missing ops
130  if (printMissingOps_) {
131  std::vector<std::string> missingOps;
132  minimalOpSetCheck.missingOperations(*mach, missingOps);
133  if (missingOps.empty()) {
134  std::cout << "MinimalOpSet: Configuration/machine has all"
135  << " the operations in the minimal opset already."
136  << std::endl;
137  return result;
138  }
139  for (unsigned int i = 0; i < missingOps.size(); ++i) {
140  std::cout << missingOps.at(i) + " : operation is missing."
141  << std::endl;
142  }
143  }
144 
145  // add FUs to the machine, so that it has all the operations in the
146  // minimal opset
147  try {
148  minimalOpSetCheck.fix(*mach);
149  } catch (const InvalidData& e) {
150  verboseLog("MinimalOpSet: Configuration/machine has all the"
151  "operations in the minimal opset already.")
152  return result;
153  }
154 
155  // create the result config
156  DSDBManager::MachineConfiguration newConf;
157  newConf.architectureID = dsdb.addArchitecture(*mach);
158  newConf.hasImplementation = false;
159 
160  // if old config had implementation create a new one for new config
161  if (conf.hasImplementation) {
162  createImplementation(newConf, newConf);
163  }
164 
165  CostEstimates estimates;
166  bool estimate = (newConf.hasImplementation ? true : false);
167  try {
168  if (!evaluate(newConf, estimates, estimate)) {
169  debugLog(std::string("Evaluate failed."));
170  return result;
171  }
172  } catch (const Exception& e) {
173  debugLog(std::string("Error in Evaluate plugin: ")
174  + e.errorMessage() + std::string(" ")
175  + e.errorMessageStack());
176  return result;
177  }
178 
179  RowID newConfID = addConfToDSDB(newConf);
180  if (newConfID != 0) {
181  result.push_back(newConfID);
182  }
183  return result;
184  }

References DSDBManager::addArchitecture(), DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, DSDBManager::configuration(), debugLog, Exception::errorMessage(), Exception::errorMessageStack(), MinimalOpSetCheck::fix(), DSDBManager::MachineConfiguration::hasImplementation, MinimalOpSetCheck::missingOperations(), and verboseLog.

Here is the call graph for this function:

◆ PLUGIN_DESCRIPTION()

MinimalOpSet::PLUGIN_DESCRIPTION ( "Minimal opset checker and fixer plugin."  )
private

◆ producesArchitecture()

virtual bool MinimalOpSet::producesArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 77 of file MinimalOpSet.cc.

77 { return false; }

◆ readParameters()

void MinimalOpSet::readParameters ( )
inlineprivate

Reads the parameters given to the plugin.

Definition at line 203 of file MinimalOpSet.cc.

◆ requiresApplication()

virtual bool MinimalOpSet::requiresApplication ( ) const
inlineprivatevirtual

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 80 of file MinimalOpSet.cc.

80 { return false; }

◆ requiresHDB()

virtual bool MinimalOpSet::requiresHDB ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 78 of file MinimalOpSet.cc.

78 { return false; }

◆ requiresSimulationData()

virtual bool MinimalOpSet::requiresSimulationData ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 79 of file MinimalOpSet.cc.

79 { return false; }

◆ requiresStartingPointArchitecture()

virtual bool MinimalOpSet::requiresStartingPointArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 76 of file MinimalOpSet.cc.

76 { return false; }

Member Data Documentation

◆ adf_

std::string MinimalOpSet::adf_
private

name of the adf file to evaluate

Definition at line 194 of file MinimalOpSet.cc.

◆ adfPN_

const std::string MinimalOpSet::adfPN_
staticprivate

Definition at line 188 of file MinimalOpSet.cc.

◆ idf_

std::string MinimalOpSet::idf_
private

name of the idf file to evaluate

Definition at line 196 of file MinimalOpSet.cc.

◆ idfPN_

const std::string MinimalOpSet::idfPN_
staticprivate

Definition at line 189 of file MinimalOpSet.cc.

◆ printMissingOps_

bool MinimalOpSet::printMissingOps_
private

print missing ops

Definition at line 198 of file MinimalOpSet.cc.

◆ printMissingOpsPN_

const std::string MinimalOpSet::printMissingOpsPN_
staticprivate

Definition at line 190 of file MinimalOpSet.cc.


The documentation for this class was generated from the following file:
MinimalOpSet::createConfig
bool createConfig(const std::string &adf, const std::string &idf, DSDBManager &dsdb, DSDBManager::MachineConfiguration &conf)
Definition: MinimalOpSet.cc:219
DesignSpaceExplorer::evaluate
virtual bool evaluate(const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
Definition: DesignSpaceExplorer.cc:133
DesignSpaceExplorerPlugin::readCompulsoryParameter
void readCompulsoryParameter(const std::string paramName, T &param) const
MinimalOpSet::adfPN_
static const std::string adfPN_
Definition: MinimalOpSet.cc:188
MinimalOpSetCheck
Definition: MinimalOpSetCheck.hh:53
MinimalOpSet::adf_
std::string adf_
name of the adf file to evaluate
Definition: MinimalOpSet.cc:194
DesignSpaceExplorer::db
virtual DSDBManager & db()
Definition: DesignSpaceExplorer.cc:300
CostEstimates
Definition: CostEstimates.hh:57
MinimalOpSetCheck::fix
virtual std::string fix(TTAMachine::Machine &machine) const
Definition: MinimalOpSetCheck.cc:298
DSDBManager::architecture
TTAMachine::Machine * architecture(RowID id) const
Definition: DSDBManager.cc:807
DSDBManager::MachineConfiguration::hasImplementation
bool hasImplementation
Definition: DSDBManager.hh:80
DesignSpaceExplorer::addConfToDSDB
RowID addConfToDSDB(const DSDBManager::MachineConfiguration &conf)
Definition: DesignSpaceExplorer.cc:755
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
DesignSpaceExplorerPlugin::DesignSpaceExplorerPlugin
DesignSpaceExplorerPlugin()
Definition: DesignSpaceExplorerPlugin.cc:48
MinimalOpSet::idf_
std::string idf_
name of the idf file to evaluate
Definition: MinimalOpSet.cc:196
Conversion::toString
static std::string toString(const T &source)
verboseLog
#define verboseLog(text)
Definition: Application.hh:115
BOOL
@ BOOL
Definition: ExplorerPluginParameter.hh:40
assert
#define assert(condition)
Definition: Application.hh:86
DSDBManager::MachineConfiguration::implementationID
RowID implementationID
Definition: DSDBManager.hh:81
MinimalOpSet::idfPN_
static const std::string idfPN_
Definition: MinimalOpSet.cc:189
DSDBManager::MachineConfiguration
Definition: DSDBManager.hh:78
InvalidData
Definition: Exception.hh:149
STRING
@ STRING
Definition: ExplorerPluginParameter.hh:40
Exception::errorMessageStack
std::string errorMessageStack(bool messagesOnly=false) const
Definition: Exception.cc:138
MinimalOpSet::printMissingOps_
bool printMissingOps_
print missing ops
Definition: MinimalOpSet.cc:198
Exception
Definition: Exception.hh:54
DSDBManager
Definition: DSDBManager.hh:76
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
MinimalOpSet::readParameters
void readParameters()
Definition: MinimalOpSet.cc:203
DSDBManager::addArchitecture
RowID addArchitecture(const TTAMachine::Machine &mom)
Definition: DSDBManager.cc:191
DSDBManager::configuration
MachineConfiguration configuration(RowID id) const
Definition: DSDBManager.cc:361
DesignSpaceExplorer::createImplementation
bool createImplementation(const DSDBManager::MachineConfiguration &conf, DSDBManager::MachineConfiguration &newConf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
Definition: DesignSpaceExplorer.cc:650
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
MinimalOpSetCheck::missingOperations
void missingOperations(const TTAMachine::Machine &machine, std::vector< std::string > &missingOps) const
Definition: MinimalOpSetCheck.cc:213
debugLog
#define debugLog(text)
Definition: Application.hh:95
DSDBManager::MachineConfiguration::architectureID
RowID architectureID
Definition: DSDBManager.hh:79
MinimalOpSet::printMissingOpsPN_
static const std::string printMissingOpsPN_
Definition: MinimalOpSet.cc:190
DesignSpaceExplorerPlugin::addParameter
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
DSDBManager::addImplementation
RowID addImplementation(const IDF::MachineImplementation &impl, double longestPathDelay, CostEstimator::AreaInGates area)
Definition: DSDBManager.cc:252
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
IDF::MachineImplementation::loadFromIDF
static MachineImplementation * loadFromIDF(const std::string &idfFileName)
Definition: MachineImplementation.cc:1524
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::Machine::loadFromADF
static Machine * loadFromADF(const std::string &adfFileName)
Definition: Machine.cc:905