From 972787c81ee0f58f9e1ce0f7b977fe5dc3e1c5c1 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Tue, 11 May 2021 14:00:04 +0200 Subject: [PATCH] Fix memory corruption in Etesian::Area, separate it's creation. * In Etesian::Slice::createDiodeUnder(), delete the Instance *after* removing the tile referring it. This was working, unless we active the debug mode which tries to print the Tile's instance. * In EtesianEngine::place(), no longer call toHurricane() at the end of the placement. Must now be done as a separate step. Exported to Python interface. This fix is related to the spare buffer removal memory corruption --- etesian/src/EtesianEngine.cpp | 4 +--- etesian/src/GraphicEtesianEngine.cpp | 1 + etesian/src/Placement.cpp | 9 ++++++++- etesian/src/PyEtesianEngine.cpp | 3 +++ etesian/src/etesian/Placement.h | 24 +++++++++++++++++++++++- 5 files changed, 36 insertions(+), 5 deletions(-) diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index d598b65c..b600916b 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -1418,9 +1418,7 @@ namespace Etesian { cmess1 << " o Detailed Placement." << endl; detailedPlace(detailedIterations, detailedEffort, detailedOptions); - Breakpoint::stop( 100, "Before adding feeds." ); - cmess2 << " o Adding feed cells." << endl; - toHurricane(); + //toHurricane(); //addFeeds(); cmess1 << " o Placement finished." << endl; diff --git a/etesian/src/GraphicEtesianEngine.cpp b/etesian/src/GraphicEtesianEngine.cpp index e5e11994..f53c3cba 100644 --- a/etesian/src/GraphicEtesianEngine.cpp +++ b/etesian/src/GraphicEtesianEngine.cpp @@ -101,6 +101,7 @@ namespace Etesian { EtesianEngine* etesian = getForFramework( CreateEngine ); etesian->resetPlacement(); etesian->place(); + etesian->toHurricane(); } diff --git a/etesian/src/Placement.cpp b/etesian/src/Placement.cpp index 575d14d8..e123ef6d 100644 --- a/etesian/src/Placement.cpp +++ b/etesian/src/Placement.cpp @@ -17,6 +17,7 @@ #include "hurricane/Error.h" #include "hurricane/Warning.h" #include "hurricane/DataBase.h" +#include "hurricane/DebugSession.h" #include "hurricane/UpdateSession.h" #include "hurricane/DeepNet.h" #include "hurricane/Plug.h" @@ -43,6 +44,7 @@ namespace Etesian { using Hurricane::DeepNet; using Hurricane::Plug; using Hurricane::RoutingPad; + using Hurricane::DebugSession; using Hurricane::UpdateSession; using CRL::AllianceFramework; using CRL::CatalogExtension; @@ -327,8 +329,8 @@ namespace Etesian { DbU::Unit width = (*iCandidate).getWidth(); diodeInst = (*iCandidate).getInstance(); Transformation transf = diodeInst->getTransformation(); - diodeInst->destroy(); _tiles.erase( iCandidate ); + diodeInst->destroy(); Occurrence rpOccurrence = rp->getPlugOccurrence(); Path instancePath = rpOccurrence.getPath(); @@ -683,6 +685,10 @@ namespace Etesian { return; } + //Breakpoint::stop( 100, "Before adding feeds." ); + cmess2 << " o Adding feed cells." << endl; + + //DebugSession::open( 145, 150 ); UpdateSession::open(); if (_area) delete _area; @@ -759,6 +765,7 @@ namespace Etesian { _area->addFeeds(); UpdateSession::close(); + //DebugSession::close(); if (_viewer) _viewer->getCellWidget()->refresh(); } diff --git a/etesian/src/PyEtesianEngine.cpp b/etesian/src/PyEtesianEngine.cpp index 8ad38c2e..7d64d34c 100644 --- a/etesian/src/PyEtesianEngine.cpp +++ b/etesian/src/PyEtesianEngine.cpp @@ -76,6 +76,7 @@ extern "C" { DirectVoidMethod(EtesianEngine,etesian,resetPlacement) DirectVoidMethod(EtesianEngine,etesian,clearColoquinte) DirectVoidMethod(EtesianEngine,etesian,flattenPower) + DirectVoidMethod(EtesianEngine,etesian,toHurricane) DirectGetUIntAttribute (PyEtesianEngine_doHFNS ,doHFNS ,PyEtesianEngine,EtesianEngine) DirectSetLongAttribute (PyEtesianEngine_setFixedAbHeight,setFixedAbHeight,PyEtesianEngine,EtesianEngine) DirectSetLongAttribute (PyEtesianEngine_setFixedAbWidth ,setFixedAbWidth ,PyEtesianEngine,EtesianEngine) @@ -267,6 +268,8 @@ extern "C" { , "Build abstract interface in top cell for supply & blockages." } , { "doHFNS" , (PyCFunction)PyEtesianEngine_doHFNS , METH_NOARGS , "Perform the high fanout net synthesis." } + , { "toHurricane" , (PyCFunction)PyEtesianEngine_toHurricane , METH_NOARGS + , "Build the Hurricane post-placement manipulation structure." } , { "destroy" , (PyCFunction)PyEtesianEngine_destroy , METH_NOARGS , "Destroy the associated hurricane object. The python object remains." } , {NULL, NULL, 0, NULL} /* sentinel */ diff --git a/etesian/src/etesian/Placement.h b/etesian/src/etesian/Placement.h index 338ae8a6..0f4bc8ce 100644 --- a/etesian/src/etesian/Placement.h +++ b/etesian/src/etesian/Placement.h @@ -132,6 +132,8 @@ namespace Etesian { class Tile { public: inline Tile ( DbU::Unit xMin, DbU::Unit width, const Occurrence& ); + inline Tile ( const Tile& ); + inline ~Tile (); inline bool isFixed () const; inline DbU::Unit getXMin () const; inline DbU::Unit getXMax () const; @@ -140,6 +142,7 @@ namespace Etesian { inline Instance* getInstance () const; inline const Occurrence& getOccurrence () const; inline void translate ( DbU::Unit ); + inline Tile& operator= ( const Tile& ); inline std::string _getString () const; Record* _getRecord () const; private: @@ -149,7 +152,26 @@ namespace Etesian { }; inline Tile::Tile ( DbU::Unit xMin, DbU::Unit width, const Occurrence& occurrence ) - : _xMin(xMin), _width(width), _occurrence(occurrence) + : _xMin(xMin) + , _width(width) + , _occurrence(occurrence) + { } + + inline Tile::Tile ( const Tile& other ) + : _xMin(other._xMin) + , _width(other._width) + , _occurrence(other._occurrence) + { } + + inline Tile& Tile::operator= ( const Tile& other ) + { + _xMin = other._xMin; + _width = other._width; + _occurrence = other._occurrence; + return *this; + } + + inline Tile::~Tile () { } inline DbU::Unit Tile::getXMin () const { return _xMin; }