Initial draft for routing-driven placement

* Uses density restrictions rather than cell inflation
* Will fail brutally if the congestion is too high; does not attempt to balance the densities
This commit is contained in:
Gabriel Gouvine 2015-04-19 20:11:43 +02:00
parent 6f0bc2ecb0
commit ef671cb944
8 changed files with 94 additions and 30 deletions

View File

@ -14,10 +14,10 @@ projects = [
#, "nimbus"
#, "metis"
#, "mauka"
, "katabatic"
, "coloquinte"
, "etesian"
, "knik"
, "katabatic"
, "kite"
, "equinox"
, "solstice"

View File

@ -18,6 +18,13 @@
*/
namespace coloquinte{
struct density_limit{
box<int_t> box_;
float_t density_; // from 0.0 for a macro to 1.0 if it does nothing
};
typedef std::vector<density_limit> density_restrictions;
namespace gp{
class region_distribution{
@ -38,11 +45,6 @@ class region_distribution{
// Specifies a maximum density of movable cells per usable area
// Representing either a macroblock or a routing congestion
struct density_limit{
box<int_t> box_;
float_t density_; // from 0.0 for a macro to 1.0 if it does nothing
};
private:
struct region;

View File

@ -117,6 +117,7 @@ std::vector<region_distribution::region> region_distribution::prepare_regions(in
// The regions' capacities
std::vector<capacity_t> region_caps(x_cnt * y_cnt, 0);
// Find the limits of the regions
std::vector<int_t> x_reg_lims(x_cnt+1), y_reg_lims(y_cnt+1);
for(index_t i=0; i<=x_cnt; ++i){
x_reg_lims[i] = placement_area_.x_min_ + ( ((std::int64_t) (placement_area_.x_max_ - placement_area_.x_min_)) * i ) / x_cnt;

View File

@ -22,6 +22,7 @@
find_package(VLSISAPD REQUIRED)
find_package(LEFDEF REQUIRED)
find_package(HURRICANE REQUIRED)
find_package(KATABATIC REQUIRED)
find_package(CORIOLIS REQUIRED)
find_package(COLOQUINTE REQUIRED)
find_package(Libexecinfo REQUIRED)

View File

@ -39,6 +39,8 @@
#include "hurricane/RoutingPad.h"
#include "hurricane/UpdateSession.h"
#include "hurricane/viewer/CellWidget.h"
#include "katabatic/GCellGrid.h"
#include "katabatic/KatabaticEngine.h"
#include "crlcore/Utilities.h"
#include "crlcore/Measures.h"
#include "crlcore/AllianceFramework.h"
@ -601,6 +603,46 @@ namespace Etesian {
_progressReport2(" [--]" );
}
void EtesianEngine::feedRoutingBack(){
using namespace Katabatic;
/*
* If routing information is present, use it to
* * artificially expand the areas given to coloquinte
* * add placement dentity constraints
*/
DbU::Unit pitch = getPitch();
const float densityThreshold = 0.9;
KatabaticEngine* routingEngine = KatabaticEngine::get( getCell() );
if(routingEngine == NULL)
throw Error("No routing information was found when performing routing-driven placement\n");
GCellGrid * grid = routingEngine->getGCellGrid();
// Get information about the GCells
// Create different densities
_densityLimits.clear();
forEach(GCell*, gc, grid->getGCells()){
float density = (*gc)->getMaxHVDensity();
if(density >= densityThreshold){
coloquinte::density_limit cur;
cur.box_ = coloquinte::box<int_t>(
(*gc)->getX() / pitch,
(*gc)->getXMax() / pitch,
(*gc)->getY() / pitch,
(*gc)->getYMax() / pitch
);
cur.density_ = densityThreshold/density;
_densityLimits.push_back(cur);
}
}
// TODO: Careful to keep the densities high enough
// Will just fail later if the densities are too high
// Expand areas: TODO
}
void EtesianEngine::globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options ){
using namespace coloquinte::gp;
@ -616,8 +658,8 @@ namespace Etesian {
do{
// Create a legalizer and bipartition it until we have sufficient precision
auto legalizer = (options & ForceUniformDensity) != 0 ?
region_distribution::uniform_density_distribution(_surface, _circuit, _placementLB)
: region_distribution::full_density_distribution(_surface, _circuit, _placementLB);
region_distribution::uniform_density_distribution (_surface, _circuit, _placementLB, _densityLimits)
: region_distribution::full_density_distribution (_surface, _circuit, _placementLB, _densityLimits);
// Until there is about 10 standard cells per region
for ( int quad_part=0 ; _circuit.cell_cnt() > (index_t)(10 * (1 << (quad_part*2))) ; ++quad_part ) {
legalizer.x_bipartition();

View File

@ -69,16 +69,24 @@ namespace Etesian {
inline double getAspectRatio () const;
inline const FeedCells& getFeedCells () const;
inline void setCellWidget ( Hurricane::CellWidget* );
void startMeasures ();
void stopMeasures ();
void printMeasures ( std::string ) const;
void setDefaultAb ();
void resetPlacement ();
void toColoquinte ();
void preplace ();
void roughLegalize ( float minDisruption );
void completeLegalize ();
void globalPlace ( float initPenalty, float minDisruption, float targetImprovement, float minInc, float maxInc, unsigned options=0 );
void detailedPlace ( int iterations, int effort, unsigned options=0 );
void feedRoutingBack ();
void place ();
inline void useFeed ( Cell* );
size_t findYSpin ();
void addFeeds ();
@ -99,6 +107,7 @@ namespace Etesian {
coloquinte::netlist _circuit;
coloquinte::placement_t _placementLB;
coloquinte::placement_t _placementUB;
coloquinte::density_restrictions _densityLimits;
std::unordered_map<string,unsigned int> _cellsToIds;
std::vector<Instance*> _idsToInsts;
Hurricane::CellWidget* _cellWidget;

View File

@ -543,6 +543,33 @@ namespace Katabatic {
return (float)( _box.getWidth () / Session::getPitch(2) + 1 );
}
float GCell::getAverageHVDensity () const
{
// Average density of all layers mixeds together.
float density = 0.0;
for ( size_t i=0 ; i<_depth ; i++ )
density += _densities[i];
return density / ((float)(_depth-_pinDepth));
}
float GCell::getMaxHVDensity () const
{
// Maximum density between all horizontal vs. all vertical layers.
size_t hplanes = 0;
size_t vplanes = 0;
float hdensity = 0.0;
float vdensity = 0.0;
for ( size_t i=_pinDepth ; i<_depth ; i++ ) {
if ( i%2 ) { hdensity += _densities[i]; ++hplanes; }
else { vdensity += _densities[i]; ++vplanes; }
}
if (hplanes) hdensity /= hplanes;
if (vplanes) vdensity /= vplanes;
return std::max(hdensity, vdensity);
}
float GCell::getDensity ( unsigned int flags ) const
{
@ -551,29 +578,9 @@ namespace Katabatic {
float density = 0.0;
if (getGCellGrid()->getDensityMode() == GCellGrid::AverageHVDensity) {
// Average density of all layers mixeds together.
for ( size_t i=0 ; i<_depth ; i++ )
density += _densities[i];
//density = roundfp ( density/((float)(_depth-_pinDepth)) );
density = density/((float)(_depth-_pinDepth));
density = getAverageHVDensity();
} else if (getGCellGrid()->getDensityMode() == GCellGrid::MaxHVDensity) {
// Maximum density between all horizontal vs. all vertical layers.
size_t hplanes = 0;
size_t vplanes = 0;
float hdensity = 0.0;
float vdensity = 0.0;
for ( size_t i=_pinDepth ; i<_depth ; i++ ) {
if ( i%2 ) { hdensity += _densities[i]; ++hplanes; }
else { vdensity += _densities[i]; ++vplanes; }
}
if (hplanes) hdensity /= hplanes;
if (vplanes) vdensity /= vplanes;
//density = roundfp ( (hdensity > vdensity) ? hdensity : vdensity );
density = (hdensity > vdensity) ? hdensity : vdensity;
density = getMaxHVDensity();
} else if (getGCellGrid()->getDensityMode() == GCellGrid::AverageHDensity) {
// Average density between all horizontal layers.
size_t hplanes = 0;

View File

@ -140,6 +140,8 @@ namespace Katabatic {
float getHCapacity () const;
float getVCapacity () const;
float getDensity ( unsigned int flags=0 ) const;
float getAverageHVDensity () const;
float getMaxHVDensity () const;
inline float getCDensity ( unsigned int flags=0 ) const;
inline float getWDensity ( unsigned int depth, unsigned int flags=0 ) const;
inline DbU::Unit getBlockage ( unsigned int depth ) const;