Kite is now deterministic, given a global routing.

* Bug: In Kite, in TrackCost, the boolean attribute "_forGlobal" was not
    initialized in the constructor causing the non-deterministic behavior.
    Arrrrgggghhhhhh.
* Bug: In Kite, in PyKiteEngine, forgot to perform the
    "balanceGlobalDensity()" in the layer assign Python wrapper, another
    cause for non-determinism.
* Change: In Kite, In KiteEngine, print the configuration at the same
    point as in the python script (to get identical output).
This commit is contained in:
Jean-Paul Chaput 2014-07-07 00:42:38 +02:00
parent e29221274e
commit 0cced62851
13 changed files with 34 additions and 14 deletions

View File

@ -387,7 +387,7 @@ namespace Katabatic {
<< (_timer.getMemorySize()>>10) << "Kb"; << (_timer.getMemorySize()>>10) << "Kb";
cmess2 << Dots::asString( " - Raw measurements", result.str() ) << endl; cmess2 << Dots::asString( " - Raw measurements", result.str() ) << endl;
if (not tag.empty()) { if (not tag.empty()) {
addMeasure<double>( getCell(), tag+"T", _timer.getCombTime () ); addMeasure<double>( getCell(), tag+"T", _timer.getCombTime () );
addMeasure<size_t>( getCell(), tag+"S", (_timer.getMemorySize() >> 20) ); addMeasure<size_t>( getCell(), tag+"S", (_timer.getMemorySize() >> 20) );
} }

View File

@ -81,6 +81,7 @@ namespace Kite {
{ {
DebugSession::open( _trackSegment->getNet(), 148 ); DebugSession::open( _trackSegment->getNet(), 148 );
//ltrace(500) << "Deter| DataNegociate::update() - " << _trackSegment << endl;
ltrace(148) << "DataNegociate::update() - " << _trackSegment << endl; ltrace(148) << "DataNegociate::update() - " << _trackSegment << endl;
ltracein(148); ltracein(148);
@ -97,6 +98,7 @@ namespace Kite {
); );
_terminals = AutoSegment::getTerminalCount( _trackSegment->base(), collapseds ); _terminals = AutoSegment::getTerminalCount( _trackSegment->base(), collapseds );
//ltrace(500) << "Deter| Terminals:" << _terminals << endl;
_attractors.clear(); _attractors.clear();
_perpandiculars.clear(); _perpandiculars.clear();
_perpandicularFree = Interval(false); _perpandicularFree = Interval(false);

View File

@ -124,6 +124,7 @@ namespace Kite {
kite = KiteEngine::create( cell ); kite = KiteEngine::create( cell );
kite->setPostEventCb( boost::bind(&GraphicKiteEngine::postEvent,this) ); kite->setPostEventCb( boost::bind(&GraphicKiteEngine::postEvent,this) );
kite->setViewer( _viewer ); kite->setViewer( _viewer );
if (cmess1.enabled()) kite->printConfiguration();
} else } else
cerr << Warning( "%s already has a Kite engine.", getString(cell).c_str() ) << endl; cerr << Warning( "%s already has a Kite engine.", getString(cell).c_str() ) << endl;
@ -174,7 +175,6 @@ namespace Kite {
void GraphicKiteEngine::_loadGlobalRouting () void GraphicKiteEngine::_loadGlobalRouting ()
{ {
KiteEngine* kite = getForFramework( NoFlags ); KiteEngine* kite = getForFramework( NoFlags );
if (cmess1.enabled()) kite->printConfiguration();
_viewer->clearToolInterrupt(); _viewer->clearToolInterrupt();
kite->loadGlobalRouting( Katabatic::EngineLoadGrByNet ); kite->loadGlobalRouting( Katabatic::EngineLoadGrByNet );

View File

@ -52,6 +52,7 @@ namespace {
void NegociateOverlapCost ( const TrackElement* segment, TrackCost& cost ) void NegociateOverlapCost ( const TrackElement* segment, TrackCost& cost )
{ {
ltrace(500) << "Deter| NegociateOverlapCost() " << segment << endl;
Interval intersect = segment->getCanonicalInterval(); Interval intersect = segment->getCanonicalInterval();
if (not intersect.intersect(cost.getInterval())) return; if (not intersect.intersect(cost.getInterval())) return;
@ -99,8 +100,12 @@ namespace {
cost.setOverlap(); cost.setOverlap();
if ( segment->isLocal() if ( segment->isLocal()
or (cost.isForGlobal() and (Session::getRoutingGauge()->getLayerDepth(segment->getLayer()) < 3)) ) or (cost.isForGlobal() and (Session::getRoutingGauge()->getLayerDepth(segment->getLayer()) < 3)) ) {
ltrace(500) << "Deter| incTerminals() " << boolalpha << cost.isForGlobal() << " " << (data->getTerminals()*100) << endl;
cost.incTerminals( data->getTerminals()*100 ); cost.incTerminals( data->getTerminals()*100 );
} else {
ltrace(500) << "Deter| isForGlobal() " << boolalpha << cost.isForGlobal() << endl;
}
ltrace(200) << "| Increment Delta: " << DbU::getValueString(intersect.getSize()) << endl; ltrace(200) << "| Increment Delta: " << DbU::getValueString(intersect.getSize()) << endl;
cost.incDelta( intersect.getSize() ); cost.incDelta( intersect.getSize() );
@ -383,6 +388,8 @@ namespace Kite {
_eventHistory.clear(); _eventHistory.clear();
_eventQueue.load( _segments ); _eventQueue.load( _segments );
if (inltrace(500)) _eventQueue.dump();
size_t count = 0; size_t count = 0;
RoutingEvent::setStage( RoutingEvent::Negociate ); RoutingEvent::setStage( RoutingEvent::Negociate );
while ( not _eventQueue.empty() and not isInterrupted() ) { while ( not _eventQueue.empty() and not isInterrupted() ) {

View File

@ -201,9 +201,11 @@ extern "C" {
if (PyArg_ParseTuple(args,"I:KiteEngine.layerAssign", &flags)) { if (PyArg_ParseTuple(args,"I:KiteEngine.layerAssign", &flags)) {
if (kite->getViewer()) { if (kite->getViewer()) {
ExceptionWidget::catchAllWrapper( std::bind(&KiteEngine::layerAssign,kite,flags) ); ExceptionWidget::catchAllWrapper( std::bind(&KiteEngine::balanceGlobalDensity,kite) );
ExceptionWidget::catchAllWrapper( std::bind(&KiteEngine::layerAssign ,kite,flags) );
} else { } else {
kite->layerAssign(flags); kite->balanceGlobalDensity();
kite->layerAssign (flags);
} }
} else { } else {
PyErr_SetString(ConstructorError, "KiteEngine.layerAssign(): Invalid number/bad type of parameter."); PyErr_SetString(ConstructorError, "KiteEngine.layerAssign(): Invalid number/bad type of parameter.");

View File

@ -475,9 +475,7 @@ namespace Kite {
_axisHistory = _segment->getAxis(); _axisHistory = _segment->getAxis();
_eventLevel = 0; _eventLevel = 0;
ltrace(500) << "Deter| addInsertEvent()" << endl; ltrace(500) << "Deter| addInsertEvent() @" << fsm.getCost(itrack).getTrack() << endl;
ltrace(500) << "Deter| | " << _segment << endl;
ltrace(500) << "Deter| | " << fsm.getCost(itrack).getTrack() << endl;
Session::addInsertEvent( _segment, fsm.getCost(itrack).getTrack() ); Session::addInsertEvent( _segment, fsm.getCost(itrack).getTrack() );
fsm.setState( SegmentFsm::SelfInserted ); fsm.setState( SegmentFsm::SelfInserted );
} else { } else {
@ -486,6 +484,11 @@ namespace Kite {
Manipulator(_segment,fsm).ripupPerpandiculars(); Manipulator(_segment,fsm).ripupPerpandiculars();
} else { } else {
if (Manipulator(_segment,fsm).canRipup(Manipulator::NotOnLastRipup)) { if (Manipulator(_segment,fsm).canRipup(Manipulator::NotOnLastRipup)) {
if (inltrace(500)) {
for ( itrack=0 ; itrack<fsm.getCosts().size() ; itrack++ ) {
ltrace(500) << "Deter| | Candidate Track: " << fsm.getCost(itrack) << endl;
}
}
for ( itrack=0 ; itrack<fsm.getCosts().size() ; itrack++ ) { for ( itrack=0 ; itrack<fsm.getCosts().size() ; itrack++ ) {
ltrace(200) << "Trying Track: " << itrack << endl; ltrace(200) << "Trying Track: " << itrack << endl;
if (fsm.getCost(itrack).isInfinite()) break; if (fsm.getCost(itrack).isInfinite()) break;

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2013, All Rights Reserved // Copyright (c) UPMC 2008-2014, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | C O R I O L I S | // | C O R I O L I S |
@ -218,7 +218,7 @@ namespace Kite {
{ {
multiset<RoutingEvent*,RoutingEvent::Compare>::const_iterator ievent = _events.begin (); multiset<RoutingEvent*,RoutingEvent::Compare>::const_iterator ievent = _events.begin ();
for ( ; ievent != _events.end(); ievent++ ) { for ( ; ievent != _events.end(); ievent++ ) {
cerr << "Order: Queue:" cerr << "Deter| Queue:"
<< (*ievent)->getEventLevel() << (*ievent)->getEventLevel()
<< "," << setw(6) << (*ievent)->getPriority() << "," << setw(6) << (*ievent)->getPriority()
<< " " << setw(6) << DbU::getValueString((*ievent)->getSegment()->getLength()) << " " << setw(6) << DbU::getValueString((*ievent)->getSegment()->getLength())

View File

@ -511,7 +511,10 @@ namespace Kite {
_costs.push_back ( itrack->getOverlapCost(segment,costflags) ); _costs.push_back ( itrack->getOverlapCost(segment,costflags) );
_costs.back().setAxisWeight ( _event->getAxisWeight(itrack->getAxis()) ); _costs.back().setAxisWeight ( _event->getAxisWeight(itrack->getAxis()) );
_costs.back().incDeltaPerpand ( _data->getWiringDelta(itrack->getAxis()) ); _costs.back().incDeltaPerpand ( _data->getWiringDelta(itrack->getAxis()) );
if (segment->isGlobal()) _costs.back().setForGlobal(); if (segment->isGlobal()) {
ltrace(500) << "Deter| setForGlobal() on " << *itrack << endl;
_costs.back().setForGlobal();
}
if ( inLocalDepth and (_costs.back().getDataState() == DataNegociate::MaximumSlack) ) if ( inLocalDepth and (_costs.back().getDataState() == DataNegociate::MaximumSlack) )
_costs.back().setInfinite (); _costs.back().setInfinite ();

View File

@ -452,6 +452,8 @@ namespace Kite {
void Track::insert ( TrackElement* segment ) void Track::insert ( TrackElement* segment )
{ {
// ltrace(500) << "Deter| Track::insert() " << getLayer()->getName()
// << " @" << DbU::getValueString(getAxis()) << " " << segment << endl;
ltrace(200) << "Track::insert() " << getLayer()->getName() ltrace(200) << "Track::insert() " << getLayer()->getName()
<< " @" << DbU::getValueString(getAxis()) << " " << segment << endl; << " @" << DbU::getValueString(getAxis()) << " " << segment << endl;

View File

@ -43,6 +43,7 @@ namespace Kite {
, _begin (begin) , _begin (begin)
, _end (end) , _end (end)
, _interval (interval) , _interval (interval)
, _forGlobal (false)
, _blockage (false) , _blockage (false)
, _fixed (false) , _fixed (false)
, _infinite (false) , _infinite (false)

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2013, All Rights Reserved // Copyright (c) UPMC 2008-2014, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | C O R I O L I S | // | C O R I O L I S |

View File

@ -2,7 +2,7 @@
// -*- C++ -*- // -*- C++ -*-
// //
// This file is part of the Coriolis Software. // This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2013, All Rights Reserved // Copyright (c) UPMC 2008-2014, All Rights Reserved
// //
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
// | C O R I O L I S | // | C O R I O L I S |

View File

@ -223,7 +223,7 @@ if __name__ == '__main__':
routingNets = [] routingNets = []
kite = Kite.KiteEngine.create(cell) kite = Kite.KiteEngine.create(cell)
if options.showConf: kite.printConfiguration() if options.showConf: kite.printConfiguration()
kite.runGlobalRouter(globalFlags) kite.runGlobalRouter(globalFlags)
if saveGlobal: kite.saveGlobalSolution() if saveGlobal: kite.saveGlobalSolution()