Anabatic transient commit 16. First implementation of edge's historical cost.
This commit is contained in:
parent
4aec49e08a
commit
d29cbe976a
|
@ -18,6 +18,7 @@
|
|||
#include <iostream>
|
||||
#include "hurricane/Bug.h"
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/Breakpoint.h"
|
||||
#include "hurricane/RegularLayer.h"
|
||||
#include "hurricane/Horizontal.h"
|
||||
#include "hurricane/RoutingPad.h"
|
||||
|
@ -38,6 +39,7 @@ namespace Anabatic {
|
|||
using std::ostringstream;
|
||||
using Hurricane::Bug;
|
||||
using Hurricane::Error;
|
||||
using Hurricane::Breakpoint;
|
||||
using Hurricane::RegularLayer;
|
||||
using Hurricane::Component;
|
||||
using Hurricane::Horizontal;
|
||||
|
@ -554,6 +556,7 @@ namespace Anabatic {
|
|||
|
||||
void AnabaticEngine::ripup ( Segment* seed, Flags flags )
|
||||
{
|
||||
|
||||
Net* net = seed->getNet();
|
||||
|
||||
DebugSession::open( net, 112, 120 );
|
||||
|
@ -614,6 +617,8 @@ namespace Anabatic {
|
|||
|
||||
Contact* source = dynamic_cast<Contact*>( segment->getSource() );
|
||||
Contact* target = dynamic_cast<Contact*>( segment->getTarget() );
|
||||
segment->getSourceHook()->detach();
|
||||
segment->getTargetHook()->detach();
|
||||
segment->destroy();
|
||||
bool deletedSource = gcells->gcellAt( 0 )->unrefContact( source );
|
||||
bool deletedTarget = gcells->gcellAt( gcells->size()-1 )->unrefContact( target );
|
||||
|
@ -635,7 +640,7 @@ namespace Anabatic {
|
|||
|
||||
getNetData( net )->setGlobalRouted( false );
|
||||
|
||||
cdebug_tabw(111,-1);
|
||||
cdebug_tabw(112,-1);
|
||||
DebugSession::close();
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace Anabatic {
|
|||
, _edgeWidth (DbU::fromLambda(Cfg::getParamInt("anabatic.edgeWidth" , 4)->asInt()))
|
||||
, _edgeCostH (Cfg::getParamDouble("anabatic.edgeCostH", 9.0)->asDouble())
|
||||
, _edgeCostK (Cfg::getParamDouble("anabatic.edgeCostK",-10.0)->asDouble())
|
||||
, _edgeHInc (Cfg::getParamDouble("anabatic.edgeHInc" , 1.5)->asDouble())
|
||||
, _hEdgeLocal (Cfg::getParamInt("kite.hTracksReservedLocal",0)->asInt())
|
||||
, _vEdgeLocal (Cfg::getParamInt("kite.vTracksReservedLocal",0)->asInt())
|
||||
{
|
||||
|
@ -131,6 +132,7 @@ namespace Anabatic {
|
|||
, _allowedDepth (other._allowedDepth)
|
||||
, _edgeCostH (other._edgeCostH)
|
||||
, _edgeCostK (other._edgeCostK)
|
||||
, _edgeHInc (other._edgeHInc)
|
||||
{
|
||||
if (other._cg) _cg = other._cg->getClone();
|
||||
if (other._rg) _rg = other._rg->getClone();
|
||||
|
@ -335,6 +337,9 @@ namespace Anabatic {
|
|||
{ return _edgeCostK; }
|
||||
|
||||
|
||||
float ConfigurationConcrete::getEdgeHInc () const
|
||||
{ return _edgeHInc; }
|
||||
|
||||
|
||||
void ConfigurationConcrete::print ( Cell* cell ) const
|
||||
{
|
||||
|
|
|
@ -172,17 +172,18 @@ namespace Anabatic {
|
|||
|
||||
|
||||
Dijkstra::Dijkstra ( AnabaticEngine* anabatic )
|
||||
: _anabatic (anabatic)
|
||||
, _vertexes ()
|
||||
, _distanceCb (_distance)
|
||||
, _mode (Mode::Standart)
|
||||
, _net (NULL)
|
||||
, _stamp (-1)
|
||||
, _sources ()
|
||||
, _targets ()
|
||||
, _searchArea ()
|
||||
, _connectedsId(-1)
|
||||
, _queue ()
|
||||
: _anabatic (anabatic)
|
||||
, _vertexes ()
|
||||
, _distanceCb (_distance)
|
||||
, _mode (Mode::Standart)
|
||||
, _net (NULL)
|
||||
, _stamp (-1)
|
||||
, _sources ()
|
||||
, _targets ()
|
||||
, _searchArea ()
|
||||
, _searchAreaHalo(0)
|
||||
, _connectedsId (-1)
|
||||
, _queue ()
|
||||
{
|
||||
const vector<GCell*>& gcells = _anabatic->getGCells();
|
||||
for ( GCell* gcell : gcells ) {
|
||||
|
@ -216,6 +217,8 @@ namespace Anabatic {
|
|||
for ( auto rp : rps ) {
|
||||
Point center = rp->getBoundingBox().getCenter();
|
||||
GCell* gcell = _anabatic->getGCellUnder( center );
|
||||
|
||||
cdebug_log(112,0) << "| " << rp << endl;
|
||||
|
||||
if (not gcell) {
|
||||
cerr << Error( "Dijkstra::load(): %s of %s is not under any GCell.\n"
|
||||
|
@ -244,7 +247,7 @@ namespace Anabatic {
|
|||
vertex->setFrom ( NULL );
|
||||
vertex->clearRestriction();
|
||||
_targets.insert( vertex );
|
||||
cdebug_log(112,0) << "Add Vertex: " << vertex << endl;
|
||||
cdebug_log(112,0) << "| Add: " << vertex << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +257,7 @@ namespace Anabatic {
|
|||
rp->getBodyHook()->attach( vcontact->getBodyHook() );
|
||||
}
|
||||
|
||||
_searchArea.inflate( _searchAreaHalo );
|
||||
cdebug_log(112,0) << "Search area: " << _searchArea << endl;
|
||||
cdebug_tabw(112,-1);
|
||||
DebugSession::close();
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace Anabatic {
|
|||
, _capacity (0)
|
||||
, _realOccupancy (0)
|
||||
, _estimateOccupancy(0.0)
|
||||
, _historicCost (0.0)
|
||||
, _source (source)
|
||||
, _target (target)
|
||||
, _axis (0)
|
||||
|
@ -299,6 +300,7 @@ namespace Anabatic {
|
|||
s.insert( s.size()-1, " "+DbU::getValueString(_axis) );
|
||||
s.insert( s.size()-1, " "+getString(_realOccupancy) );
|
||||
s.insert( s.size()-1, "/"+getString(_capacity) );
|
||||
s.insert( s.size()-1, " h:"+getString(_historicCost) );
|
||||
s.insert( s.size()-1, " "+getString(_flags) );
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -594,7 +594,7 @@ namespace Anabatic {
|
|||
|
||||
GCell* GCell::vcut ( DbU::Unit x )
|
||||
{
|
||||
cdebug_log(119,1) << "GCell::vcut() @x:" << DbU::getValueString(x) << " " << this << endl;
|
||||
cdebug_log(110,1) << "GCell::vcut() @x:" << DbU::getValueString(x) << " " << this << endl;
|
||||
|
||||
if ( (x < getXMin()) or (x > getXMax()) )
|
||||
throw Error( "GCell::vcut(): Vertical cut axis at %s is outside GCell box,\n"
|
||||
|
@ -604,7 +604,7 @@ namespace Anabatic {
|
|||
);
|
||||
|
||||
GCell* chunk = _create( x, getYMin() );
|
||||
cdebug_log(119,0) << "New chunk:" << chunk << endl;
|
||||
cdebug_log(110,0) << "New chunk:" << chunk << endl;
|
||||
|
||||
_moveEdges( chunk, 0, Flags::EastSide );
|
||||
Edge::create( this, chunk, Flags::Horizontal );
|
||||
|
@ -646,7 +646,7 @@ namespace Anabatic {
|
|||
_revalidate();
|
||||
chunk->_revalidate();
|
||||
|
||||
cdebug_tabw(119,-1);
|
||||
cdebug_tabw(110,-1);
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ namespace Anabatic {
|
|||
|
||||
GCell* GCell::hcut ( DbU::Unit y )
|
||||
{
|
||||
cdebug_log(119,1) << "GCell::hcut() @y:" << DbU::getValueString(y) << " " << this << endl;
|
||||
cdebug_log(110,1) << "GCell::hcut() @y:" << DbU::getValueString(y) << " " << this << endl;
|
||||
|
||||
if ( (y < getYMin()) or (y > getYMax()) )
|
||||
throw Error( "GCell::hcut(): Horizontal cut axis at %s is outside GCell box,\n"
|
||||
|
@ -664,7 +664,7 @@ namespace Anabatic {
|
|||
);
|
||||
|
||||
GCell* chunk = _create( getXMin(), y );
|
||||
cdebug_log(119,0) << "New chunk:" << chunk << endl;
|
||||
cdebug_log(110,0) << "New chunk:" << chunk << endl;
|
||||
|
||||
_moveEdges( chunk, 0, Flags::NorthSide );
|
||||
Edge::create( this, chunk, Flags::Vertical );
|
||||
|
@ -698,7 +698,7 @@ namespace Anabatic {
|
|||
_revalidate();
|
||||
chunk->_revalidate();
|
||||
|
||||
cdebug_tabw(119,-1);
|
||||
cdebug_tabw(110,-1);
|
||||
|
||||
return chunk;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,9 @@ namespace {
|
|||
float congestion = (float)edge->getRealOccupancy() / (float)edge->getCapacity();
|
||||
float congestionCost = 1.0 + _h / (1.0 + std::exp(_k * (congestion - 1.0)));
|
||||
|
||||
float distance = (float)source->getDistance() + congestionCost * (float)edge->getDistance();
|
||||
float distance = (float)source->getDistance()
|
||||
+ congestionCost * (float)edge->getDistance();
|
||||
+ edge->getHistoricCost();
|
||||
|
||||
// Edge* sourceFrom = source->getFrom();
|
||||
// if (sourceFrom) {
|
||||
|
@ -77,6 +79,19 @@ namespace {
|
|||
}
|
||||
|
||||
|
||||
void computeNextHCost ( Edge* edge, float edgeHInc )
|
||||
{
|
||||
float congestion = (float)edge->getRealOccupancy() / (float)edge->getCapacity();
|
||||
float hCost = edge->getHistoricCost();
|
||||
|
||||
float alpha = (congestion < 1.0) ? congestion : std::exp( std::log(8)*( congestion - 1 ) );
|
||||
|
||||
edge->setHistoricCost( alpha * (hCost + ((congestion < 1.0) ? 0.0 : edgeHInc) ));
|
||||
|
||||
cdebug_log(113,0) << edge << endl;
|
||||
}
|
||||
|
||||
|
||||
} // Anonymous namespace.
|
||||
|
||||
|
||||
|
@ -119,6 +134,7 @@ namespace Anabatic {
|
|||
//DebugSession::addToTrace( cell->getNet("a_from_pads(0)") );
|
||||
//DebugSession::addToTrace( cell->getNet("ialu.not_aux104") );
|
||||
//DebugSession::addToTrace( cell->getNet("mips_r3000_1m_dp_shift32_rshift_se_muxoutput(159)") );
|
||||
//DebugSession::addToTrace( cell->getNet("mips_r3000_1m_dp_shift32_rshift_se_c1(3)") );
|
||||
|
||||
startMeasures();
|
||||
|
||||
|
@ -145,7 +161,9 @@ namespace Anabatic {
|
|||
|
||||
cmess1 << " o Running global routing..." << endl;
|
||||
|
||||
UpdateSession::open();
|
||||
float edgeHInc = getConfiguration()->getEdgeHInc();
|
||||
|
||||
Session::open( this );
|
||||
Dijkstra* dijkstra = new Dijkstra ( this );
|
||||
dijkstra->setDistance( DigitalDistance( getConfiguration()->getEdgeCostH()
|
||||
, getConfiguration()->getEdgeCostK() ) );
|
||||
|
@ -165,9 +183,13 @@ namespace Anabatic {
|
|||
}
|
||||
cmess2 << left << setw(6) << netCount << right;
|
||||
|
||||
//Session::revalidate();
|
||||
|
||||
const vector<Edge*>& ovEdges = getOvEdges();
|
||||
cmess2 << " ovEdges:" << ovEdges.size();
|
||||
|
||||
for ( Edge* edge : ovEdges ) computeNextHCost( edge, edgeHInc );
|
||||
|
||||
netCount = 0;
|
||||
while ( not ovEdges.empty() ) {
|
||||
Edge* ovEdge = ovEdges[0];
|
||||
|
@ -181,8 +203,9 @@ namespace Anabatic {
|
|||
}
|
||||
}
|
||||
|
||||
cmess2 << " ripup:" << netCount;
|
||||
dijkstra->setSearchAreaHalo( Session::getSliceHeight()*3 );
|
||||
|
||||
cmess2 << " ripup:" << netCount;
|
||||
stopMeasures();
|
||||
cmess2 << " " << setw(10) << Timer::getStringTime (_timer.getCombTime())
|
||||
<< " " << setw( 6) << Timer::getStringMemory(_timer.getIncrease()) << endl;
|
||||
|
@ -218,7 +241,7 @@ namespace Anabatic {
|
|||
printMeasures( "Dijkstra" );
|
||||
|
||||
delete dijkstra;
|
||||
UpdateSession::close();
|
||||
Session::close();
|
||||
|
||||
_state = EngineGlobalLoaded;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ namespace Anabatic {
|
|||
virtual DbU::Unit getEdgeWidth () const = 0;
|
||||
virtual float getEdgeCostH () const = 0;
|
||||
virtual float getEdgeCostK () const = 0;
|
||||
virtual float getEdgeHInc () const = 0;
|
||||
virtual size_t getHEdgeLocal () const = 0;
|
||||
virtual size_t getVEdgeLocal () const = 0;
|
||||
virtual void print ( Cell* ) const = 0;
|
||||
|
@ -157,6 +158,7 @@ namespace Anabatic {
|
|||
virtual DbU::Unit getEdgeWidth () const;
|
||||
virtual float getEdgeCostH () const;
|
||||
virtual float getEdgeCostK () const;
|
||||
virtual float getEdgeHInc () const;
|
||||
virtual size_t getHEdgeLocal () const;
|
||||
virtual size_t getVEdgeLocal () const;
|
||||
virtual void print ( Cell* ) const;
|
||||
|
@ -179,6 +181,7 @@ namespace Anabatic {
|
|||
DbU::Unit _edgeWidth;
|
||||
float _edgeCostH;
|
||||
float _edgeCostK;
|
||||
float _edgeHInc;
|
||||
size_t _hEdgeLocal;
|
||||
size_t _vEdgeLocal;
|
||||
private:
|
||||
|
|
|
@ -293,7 +293,9 @@ namespace Anabatic {
|
|||
inline bool isBipoint () const;
|
||||
inline bool isSourceVertex ( Vertex* ) const;
|
||||
inline bool isTargetVertex ( Vertex* ) const;
|
||||
inline DbU::Unit getSearchAreaHalo () const;
|
||||
inline void setDistance ( distance_t );
|
||||
inline void setSearchAreaHalo ( DbU::Unit );
|
||||
void load ( Net* );
|
||||
void run ( Mode mode=Mode::Standart );
|
||||
private:
|
||||
|
@ -319,6 +321,7 @@ namespace Anabatic {
|
|||
VertexSet _sources;
|
||||
VertexSet _targets;
|
||||
Box _searchArea;
|
||||
DbU::Unit _searchAreaHalo;
|
||||
int _connectedsId;
|
||||
PriorityQueue _queue;
|
||||
};
|
||||
|
@ -327,10 +330,12 @@ namespace Anabatic {
|
|||
inline Dijkstra::Mode::Mode ( unsigned int flags ) : BaseFlags(flags) { }
|
||||
inline Dijkstra::Mode::Mode ( BaseFlags base ) : BaseFlags(base) { }
|
||||
|
||||
inline bool Dijkstra::isBipoint () const { return _net and (_targets.size()+_sources.size() == 2); }
|
||||
inline bool Dijkstra::isSourceVertex ( Vertex* v ) const { return (_sources.find(v) != _sources.end()); }
|
||||
inline bool Dijkstra::isTargetVertex ( Vertex* v ) const { return (_targets.find(v) != _targets.end()); }
|
||||
inline void Dijkstra::setDistance ( distance_t cb ) { _distanceCb = cb; }
|
||||
inline bool Dijkstra::isBipoint () const { return _net and (_targets.size()+_sources.size() == 2); }
|
||||
inline bool Dijkstra::isSourceVertex ( Vertex* v ) const { return (_sources.find(v) != _sources.end()); }
|
||||
inline bool Dijkstra::isTargetVertex ( Vertex* v ) const { return (_targets.find(v) != _targets.end()); }
|
||||
inline DbU::Unit Dijkstra::getSearchAreaHalo () const { return _searchAreaHalo; }
|
||||
inline void Dijkstra::setDistance ( distance_t cb ) { _distanceCb = cb; }
|
||||
inline void Dijkstra::setSearchAreaHalo ( DbU::Unit halo ) { _searchAreaHalo = halo; }
|
||||
|
||||
|
||||
} // Anabatic namespace.
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace Anabatic {
|
|||
inline unsigned int getCapacity () const;
|
||||
inline unsigned int getRealOccupancy () const;
|
||||
inline unsigned int getEstimateOccupancy () const;
|
||||
inline float getHistoricCost () const;
|
||||
DbU::Unit getDistance () const;
|
||||
inline GCell* getSource () const;
|
||||
inline GCell* getTarget () const;
|
||||
|
@ -74,6 +75,7 @@ namespace Anabatic {
|
|||
inline const vector<Segment*>& getSegments () const;
|
||||
inline void incCapacity ( int );
|
||||
void incRealOccupancy ( int );
|
||||
inline void setHistoricCost ( float );
|
||||
void add ( Segment* );
|
||||
void remove ( Segment* );
|
||||
void replace ( Segment* orig, Segment* repl );
|
||||
|
@ -110,6 +112,7 @@ namespace Anabatic {
|
|||
unsigned int _capacity;
|
||||
unsigned int _realOccupancy;
|
||||
float _estimateOccupancy;
|
||||
float _historicCost;
|
||||
GCell* _source;
|
||||
GCell* _target;
|
||||
DbU::Unit _axis;
|
||||
|
@ -124,11 +127,13 @@ namespace Anabatic {
|
|||
inline unsigned int Edge::getCapacity () const { return _capacity; }
|
||||
inline unsigned int Edge::getRealOccupancy () const { return _realOccupancy; }
|
||||
inline unsigned int Edge::getEstimateOccupancy () const { return _estimateOccupancy; }
|
||||
inline float Edge::getHistoricCost () const { return _historicCost; }
|
||||
inline GCell* Edge::getSource () const { return _source; }
|
||||
inline GCell* Edge::getTarget () const { return _target; }
|
||||
inline DbU::Unit Edge::getAxis () const { return _axis; }
|
||||
inline const vector<Segment*>& Edge::getSegments () const { return _segments; }
|
||||
inline void Edge::incCapacity ( int delta ) { _capacity = ((int)_capacity+delta > 0) ? _capacity+delta : 0; }
|
||||
inline void Edge::setHistoricCost ( float hcost ) { _historicCost = hcost; }
|
||||
inline const Flags& Edge::flags () const { return _flags; }
|
||||
inline Flags& Edge::flags () { return _flags; }
|
||||
inline void Edge::revalidate () const { /*if (_flags&Flags::Invalidated)*/ const_cast<Edge*>(this)->_revalidate(); }
|
||||
|
|
Loading…
Reference in New Issue