OpenASIP 2.2
Loading...
Searching...
No Matches
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ConnectionSweeper Class Reference
Inheritance diagram for ConnectionSweeper:
Inheritance graph
Collaboration diagram for ConnectionSweeper:
Collaboration graph

Private Member Functions

 PLUGIN_DESCRIPTION ("Optimizes the IC of the given configuration by removing bus " "connections with least effect to the cycle count first.")
 
 ConnectionSweeper ()
 
virtual bool requiresStartingPointArchitecture () const
 
virtual bool producesArchitecture () const
 
virtual bool requiresHDB () const
 
virtual bool requiresSimulationData () const
 
virtual std::vector< RowIDexplore (const RowID &startPointConfigurationID, const unsigned int &)
 
std::list< RowIDsweepRFs (RowID startPointConfigurationID)
 
std::list< RowIDsweepBypasses (RowID startPointConfigurationID)
 
void readParameters ()
 
float averageWorsening (RowID confId)
 
std::list< RowIDremoveAllConnections (std::vector< const TTAMachine::Connection * > connections, const DSDBManager::MachineConfiguration &startConf)
 
std::list< RowIDremoveLeastNecessaryConnections (std::vector< const TTAMachine::Connection * > connections, const DSDBManager::MachineConfiguration &startConf)
 
void removeConnection (TTAMachine::Machine &mach, const TTAMachine::Connection &connection)
 

Private Attributes

std::map< RowID, ClockCycleCountorigCycles_
 
unsigned int maxCcWorseningThreshold_
 
unsigned int ccWorseningThreshold_
 
bool allOrNothing_
 

Static Private Attributes

static const std::string ccWorseningThresholdPN_
 
static const std::string allOrNothingPN_
 

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 bool requiresApplication () const
 
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 optimizes the interconnection network by removing connections with least effect to the cycle count first.

1) Sweeps through the buses in order. 2) For each bus, tries to remove each connection one-by-one, and evaluates the effect to the cycle count. The one with the least effect is removed first. The process is repeated until the minimum cycle count increase crosses an user-defined threshold, or the program becomes unschedulable. Emphasize RF port connections as they tend to get to the longest path due to the register selection logic being in the same path. 3) After that, the next bus is tried similarly, until either all the buses have been optimized this way. 4) The DSDB can be queried with the connection count as the first measure, the cycle count the second with both as small as possible.

Definition at line 95 of file ConnectionSweeper.cc.

Constructor & Destructor Documentation

◆ ConnectionSweeper()

ConnectionSweeper::ConnectionSweeper ( )
inlineprivate

Definition at line 100 of file ConnectionSweeper.cc.

101
103 "Limit the reduction when the cycle count "
104 "drops more than this limit (%).");
105 addParameter(allOrNothingPN_, BOOL, false, "true",
106 "Do not consider single connections. Just try to remove "
107 "all of the bypass or RF connections at once. If fails, "
108 "leave them all. Leads quicker to symmetric reduced "
109 "connectivity machines.");
110 }
#define UINT(OPERAND)
Definition OSAL.hh:313
#define BOOL()
static const std::string ccWorseningThresholdPN_
static const std::string allOrNothingPN_
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")

References DesignSpaceExplorerPlugin::addParameter(), allOrNothingPN_, BOOL, ccWorseningThresholdPN_, and UINT.

Here is the call graph for this function:

Member Function Documentation

◆ averageWorsening()

float ConnectionSweeper::averageWorsening ( RowID  confId)
inlineprivate

Computes the average cycle count worsening for the given processor configuration across all the explored applications.

Definition at line 386 of file ConnectionSweeper.cc.

386 {
387 float worsenings = 0.0f;
388 std::set<RowID> appIds = db().applicationIDs();
389 for (std::set<RowID>::const_iterator appI = appIds.begin();
390 appI != appIds.end(); ++appI) {
391 RowID appID = *appI;
393 db().configuration(confId);
394 if (!db().hasCycleCount(appID, conf.architectureID)) {
395 continue; /* the evaluation had failed */
396 }
397 int origCycles = origCycles_[appID];
398 int newCycles =
399 db().cycleCount(appID, conf.architectureID);
400 worsenings += 100.0*(newCycles - origCycles) / origCycles;
401 }
402 float avgWorsening = worsenings / appIds.size();
403 return avgWorsening;
404 }
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
std::map< RowID, ClockCycleCount > origCycles_
ClockCycleCount cycleCount(RowID application, RowID architecture) const
std::set< RowID > applicationIDs() const
MachineConfiguration configuration(RowID id) const
virtual DSDBManager & db()

References DSDBManager::applicationIDs(), DSDBManager::MachineConfiguration::architectureID, DSDBManager::configuration(), DSDBManager::cycleCount(), DesignSpaceExplorer::db(), and origCycles_.

Referenced by removeAllConnections(), and removeLeastNecessaryConnections().

Here is the call graph for this function:

◆ explore()

virtual std::vector< RowID > ConnectionSweeper::explore ( const RowID startPointConfigurationID,
const unsigned int &  maxIter 
)
inlineprivatevirtual

Explores the design space from the starting point machine and returns best exploring results as configuration IDs.

Exploring creates new machine configurations (architecture, implementation) that are ordered so that the best results are first in the result vector.

Parameters
startPointStarting point machine configuration for the plugin.
maxIterMaximum number of design space points the plugin is allowed to explore. Default value for maxIter is zero when the iteration number is not taken into account. In that case the exploration runs indefinetly or stops at a point defined by the algorithm.
Returns
Ordered vector of IDs of the best machine configurations where the target programs can be successfully run. The IDs of the best machine configurations are first in the result vector. Returns an empty vector if does not find any possible machine configurations.

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 118 of file ConnectionSweeper.cc.

118 {
119
120
122
123 DSDBManager& dsdb = db();
125 dsdb.configuration(startPointConfigurationID);
126
127 // loads starting configuration
128 Machine* origMach = NULL;
129 origMach = dsdb.architecture(startConf.architectureID);
130 // get cycle counts for the original architecture for each app
131 std::set<RowID> appIds = dsdb.applicationIDs();
132 for (std::set<RowID>::const_iterator appI = appIds.begin();
133 appI != appIds.end(); ++appI) {
134 RowID appID = *appI;
135 if (!dsdb.hasCycleCount(appID, startConf.architectureID)) {
136 CostEstimates estimates;
137 bool success = evaluate(startConf, estimates, false);
138 if (!success) {
139 throw Exception(
140 __FILE__, __LINE__, __func__,
141 "Could not evaluate the starting point arch.");
142 }
143 }
144 assert(dsdb.hasCycleCount(appID, startConf.architectureID));
145 origCycles_[appID] =
146 dsdb.cycleCount(appID, startConf.architectureID);
147 TCEString s;
148 s << "app: " << appID << " original cycles: ";
149 s << origCycles_[appID] << " total connections: "
151 verboseLog(s);
152 }
153
154 std::vector<RowID> result;
155
156 // sweep through the buses, the register file connections first
157 // start from the biggest allowed worsening threshold to find
158 // the machines with minimal connections first
159 const int thresholdStep =
160 std::max(maxCcWorseningThreshold_ / 4, (unsigned)1);
164 std::max(0, (int)ccWorseningThreshold_ - thresholdStep)) {
165 TCEString s;
166 s << "### Testing max worsening threshold "
167 << ccWorseningThreshold_ << "% of "
168 << maxCcWorseningThreshold_ << "%";
169 verboseLog(s);
170
171 s = "### Reducing register file and immediate unit connections.";
172 verboseLog(s);
173 std::list<RowID> rfSweepResults =
174 sweepRFs(startPointConfigurationID);
175
176 if (rfSweepResults.size() == 0) break;
177
178 RowID bestFromRFSweep = rfSweepResults.front();
179 result.insert(result.begin(), bestFromRFSweep);
180
181 s = "### Reducing bypass connections.";
182 verboseLog(s);
183
184 std::list<RowID> bypassSweepResults =
185 sweepBypasses(bestFromRFSweep);
186 if (bypassSweepResults.size() == 0) break;
187
188 RowID bestFromBPSweep = rfSweepResults.front();
189 result.insert(result.begin(), bestFromBPSweep);
190 }
191 return result;
192 }
#define verboseLog(text)
#define __func__
#define assert(condition)
std::list< RowID > sweepBypasses(RowID startPointConfigurationID)
unsigned int ccWorseningThreshold_
std::list< RowID > sweepRFs(RowID startPointConfigurationID)
unsigned int maxCcWorseningThreshold_
TTAMachine::Machine * architecture(RowID id) const
bool hasCycleCount(RowID application, RowID architecture) const
virtual bool evaluate(const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
static int totalConnectionCount(const TTAMachine::Machine &mach)

References __func__, DSDBManager::applicationIDs(), DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, assert, ccWorseningThreshold_, DSDBManager::configuration(), DSDBManager::cycleCount(), DesignSpaceExplorer::db(), DesignSpaceExplorer::evaluate(), DSDBManager::hasCycleCount(), maxCcWorseningThreshold_, origCycles_, readParameters(), sweepBypasses(), sweepRFs(), MachineConnectivityCheck::totalConnectionCount(), and verboseLog.

Here is the call graph for this function:

◆ PLUGIN_DESCRIPTION()

ConnectionSweeper::PLUGIN_DESCRIPTION ( "Optimizes the IC of the given configuration by removing bus " "connections with least effect to the cycle count first."  )
private

◆ producesArchitecture()

virtual bool ConnectionSweeper::producesArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 113 of file ConnectionSweeper.cc.

113{ return true; }

◆ readParameters()

void ConnectionSweeper::readParameters ( )
inlineprivate

Reads the parameters given to the plugin.

Definition at line 374 of file ConnectionSweeper.cc.

References allOrNothing_, allOrNothingPN_, ccWorseningThresholdPN_, maxCcWorseningThreshold_, and DesignSpaceExplorerPlugin::readOptionalParameter().

Referenced by explore().

Here is the call graph for this function:

◆ removeAllConnections()

std::list< RowID > ConnectionSweeper::removeAllConnections ( std::vector< const TTAMachine::Connection * >  connections,
const DSDBManager::MachineConfiguration startConf 
)
inlineprivate

Definition at line 408 of file ConnectionSweeper.cc.

410 {
411
412 std::list<RowID> results;
413
414#if (!defined(HAVE_CXX11) && !defined(HAVE_CXX0X))
415 std::auto_ptr<TTAMachine::Machine> currentMachine(
416 db().architecture(startConf.architectureID));
417#else
418 std::unique_ptr<TTAMachine::Machine> currentMachine(
419 db().architecture(startConf.architectureID));
420#endif
421
422 for (std::vector<const TTAMachine::Connection*>::iterator
423 connI = connections.begin(); connI != connections.end();
424 ++connI) {
425 const TTAMachine::Connection* conn = *connI;
426 removeConnection(*currentMachine, *conn);
427 }
428
430 conf.architectureID = db().addArchitecture(*currentMachine);
431 RowID confId = db().addConfiguration(conf);
432 conf = db().configuration(confId);
433 CostEstimates estimates;
434 bool success = evaluate(conf, estimates, false);
435 float worsening = averageWorsening(confId);
436 if (success) {
437#if (!defined(HAVE_CXX11) && !defined(HAVE_CXX0X))
438 std::auto_ptr<TTAMachine::Machine> arch
439 (db().architecture(
440 db().configuration(confId).architectureID));
441#else
442 std::unique_ptr<TTAMachine::Machine> arch
443 (db().architecture(
444 db().configuration(confId).architectureID));
445#endif
446
447
448 if (worsening <= ccWorseningThreshold_) {
449 results.push_back(confId);
450 TCEString s;
451 s << "removing all connections was within threshold: #"
452 << confId << " avg worsening: ";
453 s << (int)worsening << "% " << " total connections: "
455 verboseLog(s);
456 } else {
457 TCEString s;
458 s << "removing all connections was not within the "
459 << "threshold: #"
460 << confId << " avg worsening: ";
461 s << (int)worsening << "% " << " total connections: "
463 s << "\n";
464 verboseLog(s);
465 }
466 } else {
467 TCEString s;
468 s << "removing all connections led to unschedulable program\n";
469 verboseLog(s);
470 }
471 return results;
472 }
void removeConnection(TTAMachine::Machine &mach, const TTAMachine::Connection &connection)
float averageWorsening(RowID confId)
RowID addArchitecture(const TTAMachine::Machine &mom)
RowID addConfiguration(const MachineConfiguration &conf)

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::MachineConfiguration::architectureID, averageWorsening(), ccWorseningThreshold_, DSDBManager::configuration(), DesignSpaceExplorer::db(), DesignSpaceExplorer::evaluate(), removeConnection(), MachineConnectivityCheck::totalConnectionCount(), and verboseLog.

Referenced by sweepBypasses(), and sweepRFs().

Here is the call graph for this function:

◆ removeConnection()

void ConnectionSweeper::removeConnection ( TTAMachine::Machine mach,
const TTAMachine::Connection connection 
)
inlineprivate

Definition at line 563 of file ConnectionSweeper.cc.

564 {
565 TTAMachine::Segment& segment =
566 *mach.busNavigator().item(connection.bus()->parentBus()->name())->
567 segment(0);
568
569 TTAMachine::Socket& socket =
570 *mach.socketNavigator().item(connection.socket()->name());
571
572 segment.detachSocket(socket);
573 }
virtual TCEString name() const
Socket * socket() const
Segment * bus() const
ComponentType * item(int index) const
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
void detachSocket(Socket &socket)
Definition Segment.cc:210
Bus * parentBus() const

References TTAMachine::Connection::bus(), TTAMachine::Machine::busNavigator(), TTAMachine::Segment::detachSocket(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), TTAMachine::Segment::parentBus(), TTAMachine::Connection::socket(), and TTAMachine::Machine::socketNavigator().

Referenced by removeAllConnections(), and removeLeastNecessaryConnections().

Here is the call graph for this function:

◆ removeLeastNecessaryConnections()

std::list< RowID > ConnectionSweeper::removeLeastNecessaryConnections ( std::vector< const TTAMachine::Connection * >  connections,
const DSDBManager::MachineConfiguration startConf 
)
inlineprivate

Removes the connections in the given set that affect the cycle count the least until the worsening threshold is reached or in case the program becomes uncompilable.

Parameters
tryAllFirstTries to remove all connections first and if it the results fits in the cc threshold, does not try configuration with the listed connections.

Definition at line 484 of file ConnectionSweeper.cc.

486 {
487
488 std::list<RowID> results;
489 DSDBManager::MachineConfiguration bestConf = startConf;
490
491 bool couldRemove = true;
492 while (couldRemove) {
493 couldRemove = false;
494 const TTAMachine::Connection* mostUnneededConn = NULL;
495 float bestAvgccWorsening = 100.0;
496 TTAMachine::Machine* currentMachine =
497 db().architecture(bestConf.architectureID);
498 RowID bestConfInThisIteration = -1;
499 std::vector<const TTAMachine::Connection*>::iterator unneededPos =
500 connections.end();
501 // find the least affecting connection removal for this stage
502 for (std::vector<const TTAMachine::Connection*>::iterator
503 connI = connections.begin(); connI != connections.end();
504 ++connI) {
505 const TTAMachine::Connection* conn = *connI;
506
507 // compute the avgccWorsening
508 // check if it's the best found and if it's above the
509 // threshold
510 TTAMachine::Machine mach = *currentMachine;
511 removeConnection(mach, *conn);
512
514 conf.architectureID = db().addArchitecture(mach);
515 RowID confId = db().addConfiguration(conf);
516 bool success = evaluate(db().configuration(confId));
517
518 if (success) {
519 unsigned int avgWorsening =
520 (unsigned)averageWorsening(confId);
521 if (avgWorsening <= ccWorseningThreshold_ &&
522 avgWorsening < bestAvgccWorsening) {
523 mostUnneededConn = conn;
524 bestConfInThisIteration = confId;
525 unneededPos = connI;
526 bestAvgccWorsening = avgWorsening;
527 TCEString s;
528 s << "new config: #" << bestConfInThisIteration
529 << " avg worsening: ";
530 s << (int)bestAvgccWorsening << "% "
531 << " total connections: "
533 *db().architecture(
534 db().configuration(confId).architectureID));
535 verboseLog(s);
536 }
537 } else {
538 TCEString s;
539 s << "new config: #" << confId << " is unschedulable";
540 verboseLog(s);
541 }
542 }
543 if (mostUnneededConn != NULL) {
544 // more connections we remove while staying in the threshold,
545 // better the processor gets
546 bestConf = db().configuration(bestConfInThisIteration);
547 couldRemove = true;
548 connections.erase(unneededPos);
549 results.push_front(bestConfInThisIteration);
550 TCEString s;
551 s << "best config from this bus sweep: #"
552 << bestConfInThisIteration << " avg worsening: ";
553 s << (int)bestAvgccWorsening << "% " << " total connections: "
555 *db().architecture(bestConf.architectureID));
556 verboseLog(s);
557 }
558 }
559 return results;
560 }

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, averageWorsening(), ccWorseningThreshold_, DSDBManager::configuration(), DesignSpaceExplorer::db(), DesignSpaceExplorer::evaluate(), removeConnection(), MachineConnectivityCheck::totalConnectionCount(), and verboseLog.

Referenced by sweepBypasses(), and sweepRFs().

Here is the call graph for this function:

◆ requiresHDB()

virtual bool ConnectionSweeper::requiresHDB ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 114 of file ConnectionSweeper.cc.

114{ return false; }

◆ requiresSimulationData()

virtual bool ConnectionSweeper::requiresSimulationData ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 115 of file ConnectionSweeper.cc.

115{ return true; }

◆ requiresStartingPointArchitecture()

virtual bool ConnectionSweeper::requiresStartingPointArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 112 of file ConnectionSweeper.cc.

112{ return true; }

◆ sweepBypasses()

std::list< RowID > ConnectionSweeper::sweepBypasses ( RowID  startPointConfigurationID)
inlineprivate

Sweeps the bypass connections, that is, everything else but the register file and immediate unit connections.

Definition at line 277 of file ConnectionSweeper.cc.

277 {
278
280 db().configuration(startPointConfigurationID);
281
282 // loads starting configuration
283 Machine* mach = db().architecture(startConf.architectureID);
284 DSDBManager::MachineConfiguration bestConf = startConf;
285
286 std::list<RowID> result;
287 for (int busI = 0; busI < mach->busNavigator().count();
288 ++busI) {
289 const TTAMachine::Bus& bus = *mach->busNavigator().item(busI);
290
291 verboseLog(TCEString("considering bus ") + bus.name());
292
293 std::vector<const TTAMachine::Connection*> connections;
294 const TTAMachine::Segment& seg = *bus.segment(0);
295 for (int connI = 0; connI < seg.connectionCount();
296 ++connI) {
297 const TTAMachine::Connection& conn =
298 seg.connection(*seg.connection(connI));
299 // check if the connection is to an IU or RF
300 bool rfConnection = false;
301 for (int rfI = 0; rfI < mach->registerFileNavigator().count();
302 ++rfI) {
303 const TTAMachine::RegisterFile& rf =
304 *mach->registerFileNavigator().item(rfI);
305 for (int portI = 0; portI < conn.socket()->portCount();
306 ++portI) {
307 const TTAMachine::Port& port =
308 *conn.socket()->port(portI);
309 if (port.parentUnit() == &rf) {
310 rfConnection = true;
311 break;
312 }
313 }
314
315 }
316 for (int iuI = 0;
317 !rfConnection &&
318 iuI < mach->immediateUnitNavigator().count();
319 ++iuI) {
320 const TTAMachine::ImmediateUnit& iu =
321 *mach->immediateUnitNavigator().item(iuI);
322 for (int portI = 0; portI < conn.socket()->portCount();
323 ++portI) {
324 const TTAMachine::Port& port =
325 *conn.socket()->port(portI);
326 if (port.parentUnit() == &iu) {
327 rfConnection = true;
328 break;
329 }
330 }
331 }
332 if (!rfConnection) connections.push_back(&conn);
333 }
334
335
336 std::list<RowID> newConfs = removeAllConnections(connections, bestConf);
337
338 if (!allOrNothing_ && newConfs.size() == 0) {
339 verboseLog("trying the connections one-by-one\n");
340 removeLeastNecessaryConnections(connections, bestConf);
341 }
342
343 if (newConfs.size() > 0) {
344 bestConf = db().configuration(newConfs.front());
345 for (std::list<RowID>::reverse_iterator i = newConfs.rbegin();
346 i != newConfs.rend(); ++i) {
347 result.insert(result.begin(), *i);
348 }
349 }
350 }
351 return result;
352 }
std::list< RowID > removeLeastNecessaryConnections(std::vector< const TTAMachine::Connection * > connections, const DSDBManager::MachineConfiguration &startConf)
std::list< RowID > removeAllConnections(std::vector< const TTAMachine::Connection * > connections, const DSDBManager::MachineConfiguration &startConf)
virtual Segment * segment(int index) const
Definition Bus.cc:329
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416
Unit * parentUnit() const
const Connection & connection(const Socket &socket) const
Definition Segment.cc:250
int connectionCount() const
Port * port(int index) const
Definition Socket.cc:266

References allOrNothing_, DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, TTAMachine::Machine::busNavigator(), DSDBManager::configuration(), TTAMachine::Segment::connection(), TTAMachine::Segment::connectionCount(), DesignSpaceExplorer::db(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), TTAMachine::Port::parentUnit(), TTAMachine::Socket::port(), TTAMachine::Machine::registerFileNavigator(), removeAllConnections(), removeLeastNecessaryConnections(), TTAMachine::Bus::segment(), TTAMachine::Connection::socket(), and verboseLog.

Referenced by explore().

Here is the call graph for this function:

◆ sweepRFs()

std::list< RowID > ConnectionSweeper::sweepRFs ( RowID  startPointConfigurationID)
inlineprivate

Sweeps the register file and immediate unit connections.

Definition at line 198 of file ConnectionSweeper.cc.

198 {
199
201 db().configuration(startPointConfigurationID);
202
203 // loads starting configuration
204 Machine* mach = db().architecture(startConf.architectureID);
205 DSDBManager::MachineConfiguration bestConf = startConf;
206
207
208 std::list<RowID> result;
209 for (int busI = 0; busI < mach->busNavigator().count();
210 ++busI) {
211 const TTAMachine::Bus& bus = *mach->busNavigator().item(busI);
212
213 verboseLog(TCEString("considering bus ") + bus.name());
214
215 std::vector<const TTAMachine::Connection*> connections;
216 const TTAMachine::Segment& seg = *bus.segment(0);
217 for (int rfI = 0; rfI < mach->registerFileNavigator().count();
218 ++rfI) {
219 const TTAMachine::RegisterFile& rf =
220 *mach->registerFileNavigator().item(rfI);
221 for (int connI = 0; connI < seg.connectionCount();
222 ++connI) {
223 const TTAMachine::Connection& conn =
224 seg.connection(*seg.connection(connI));
225 for (int portI = 0; portI < conn.socket()->portCount();
226 ++portI) {
227 const TTAMachine::Port& port =
228 *conn.socket()->port(portI);
229 if (port.parentUnit() == &rf) {
230 connections.push_back(&conn);
231 }
232 }
233 }
234 }
235 for (int iuI = 0; iuI < mach->immediateUnitNavigator().count();
236 ++iuI) {
237 const TTAMachine::ImmediateUnit& iu =
238 *mach->immediateUnitNavigator().item(iuI);
239 for (int connI = 0; connI < seg.connectionCount();
240 ++connI) {
241 const TTAMachine::Connection& conn =
242 seg.connection(*seg.connection(connI));
243 for (int portI = 0; portI < conn.socket()->portCount();
244 ++portI) {
245 const TTAMachine::Port& port =
246 *conn.socket()->port(portI);
247 if (port.parentUnit() == &iu) {
248 connections.push_back(&conn);
249 }
250 }
251 }
252 }
253
254 std::list<RowID> newConfs = removeAllConnections(connections, bestConf);
255
256 if (!allOrNothing_ && newConfs.size() == 0) {
257 verboseLog("trying the connections one-by-one\n");
258 removeLeastNecessaryConnections(connections, bestConf);
259 }
260
261 if (newConfs.size() > 0) {
262 bestConf = db().configuration(newConfs.front());
263 for (std::list<RowID>::reverse_iterator i = newConfs.rbegin();
264 i != newConfs.rend(); ++i) {
265 result.insert(result.begin(), *i);
266 }
267 }
268 }
269 return result;
270 }

References allOrNothing_, DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, TTAMachine::Machine::busNavigator(), DSDBManager::configuration(), TTAMachine::Segment::connection(), TTAMachine::Segment::connectionCount(), DesignSpaceExplorer::db(), TTAMachine::Machine::immediateUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), TTAMachine::Port::parentUnit(), TTAMachine::Socket::port(), TTAMachine::Machine::registerFileNavigator(), removeAllConnections(), removeLeastNecessaryConnections(), TTAMachine::Bus::segment(), TTAMachine::Connection::socket(), and verboseLog.

Referenced by explore().

Here is the call graph for this function:

Member Data Documentation

◆ allOrNothing_

bool ConnectionSweeper::allOrNothing_
private

Definition at line 370 of file ConnectionSweeper.cc.

Referenced by readParameters(), sweepBypasses(), and sweepRFs().

◆ allOrNothingPN_

const std::string ConnectionSweeper::allOrNothingPN_
staticprivate

Definition at line 361 of file ConnectionSweeper.cc.

Referenced by ConnectionSweeper(), and readParameters().

◆ ccWorseningThreshold_

unsigned int ConnectionSweeper::ccWorseningThreshold_
private

◆ ccWorseningThresholdPN_

const std::string ConnectionSweeper::ccWorseningThresholdPN_
staticprivate

Definition at line 360 of file ConnectionSweeper.cc.

Referenced by ConnectionSweeper(), and readParameters().

◆ maxCcWorseningThreshold_

unsigned int ConnectionSweeper::maxCcWorseningThreshold_
private

Definition at line 364 of file ConnectionSweeper.cc.

Referenced by explore(), and readParameters().

◆ origCycles_

std::map<RowID, ClockCycleCount> ConnectionSweeper::origCycles_
private

Definition at line 358 of file ConnectionSweeper.cc.

Referenced by averageWorsening(), and explore().


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