OpenASIP 2.2
Loading...
Searching...
No Matches
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
 
std::string idf_
 name of the idf file to evaluate
 
bool printMissingOps_
 print missing ops
 

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
 
ParameterMap parameters_
 Parameters for the plugin.
 

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
74 }
#define BOOL()
static std::string toString(const T &source)
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
std::string idf_
name of the idf file to evaluate
static const std::string printMissingOpsPN_
static const std::string adfPN_
std::string adf_
name of the adf file to evaluate
static const std::string idfPN_
bool printMissingOps_
print missing ops

References DesignSpaceExplorerPlugin::addParameter(), adf_, adfPN_, BOOL, idf_, idfPN_, printMissingOps_, printMissingOpsPN_, 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 }
#define verboseLog(text)
#define assert(condition)
RowID addArchitecture(const TTAMachine::Machine &mom)
RowID addImplementation(const IDF::MachineImplementation &impl, double longestPathDelay, CostEstimator::AreaInGates area)
static MachineImplementation * loadFromIDF(const std::string &idfFileName)
static Machine * loadFromADF(const std::string &adfFileName)
Definition Machine.cc:899

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

Referenced by explore().

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 }
#define debugLog(text)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
find Finds info of the inner loops in the false
TTAMachine::Machine * architecture(RowID id) const
MachineConfiguration configuration(RowID id) const
RowID addConfToDSDB(const DSDBManager::MachineConfiguration &conf)
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")
virtual DSDBManager & db()
virtual bool evaluate(const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
std::string errorMessageStack(bool messagesOnly=false) const
Definition Exception.cc:138
std::string errorMessage() const
Definition Exception.cc:123
virtual std::string fix(TTAMachine::Machine &machine) const
void missingOperations(const TTAMachine::Machine &machine, std::vector< std::string > &missingOps) const
bool createConfig(const std::string &adf, const std::string &idf, DSDBManager &dsdb, DSDBManager::MachineConfiguration &conf)
void readParameters()

References DSDBManager::addArchitecture(), DesignSpaceExplorer::addConfToDSDB(), adf_, DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, DSDBManager::configuration(), createConfig(), DesignSpaceExplorer::createImplementation(), DesignSpaceExplorer::db(), debugLog, Exception::errorMessage(), Exception::errorMessageStack(), DesignSpaceExplorer::evaluate(), MinimalOpSetCheck::fix(), DSDBManager::MachineConfiguration::hasImplementation, idf_, MinimalOpSetCheck::missingOperations(), printMissingOps_, readParameters(), 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.

203 {
207 }
void readCompulsoryParameter(const std::string paramName, T &param) const

References adf_, adfPN_, idf_, idfPN_, printMissingOps_, printMissingOpsPN_, and DesignSpaceExplorerPlugin::readCompulsoryParameter().

Referenced by explore().

Here is the call graph for this function:

◆ 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.

Referenced by explore(), MinimalOpSet(), and readParameters().

◆ adfPN_

const std::string MinimalOpSet::adfPN_
staticprivate

Definition at line 188 of file MinimalOpSet.cc.

Referenced by MinimalOpSet(), and readParameters().

◆ idf_

std::string MinimalOpSet::idf_
private

name of the idf file to evaluate

Definition at line 196 of file MinimalOpSet.cc.

Referenced by explore(), MinimalOpSet(), and readParameters().

◆ idfPN_

const std::string MinimalOpSet::idfPN_
staticprivate

Definition at line 189 of file MinimalOpSet.cc.

Referenced by MinimalOpSet(), and readParameters().

◆ printMissingOps_

bool MinimalOpSet::printMissingOps_
private

print missing ops

Definition at line 198 of file MinimalOpSet.cc.

Referenced by explore(), MinimalOpSet(), and readParameters().

◆ printMissingOpsPN_

const std::string MinimalOpSet::printMissingOpsPN_
staticprivate

Definition at line 190 of file MinimalOpSet.cc.

Referenced by MinimalOpSet(), and readParameters().


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