AMF-Placer  2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
CLBLegalizer Class Reference

CLBLegalizer maps CLBs (each of which consists of one site) to legal location. e.g. LUTRAM, except those CLBs in CARRY8_Chain. More...

#include <CLBLegalizer.h>

Collaboration diagram for CLBLegalizer:

Public Member Functions

 CLBLegalizer (std::string legalizerName, PlacementInfo *placementInfo, DeviceInfo *deviceInfo, std::vector< std::string > &siteTypesToLegalize, std::map< std::string, std::string > &JSONCfg)
 Construct a new CLBLegalizer object. More...
 
 ~CLBLegalizer ()
 
void legalize (bool exactLegalization=false)
 conduct legalization and map the PlacementUnit of one of the given types to sites More...
 
float getAverageDisplacementOfExactLegalization ()
 Get the average displacement of exact legalization for the involved PlacementUnit. More...
 
float getAverageDisplacementOfRoughLegalization ()
 Get the average displacement of rough legalization for the involved PlacementUnit. More...
 
void setIntitialParameters (float displacementThr, int candidateNum, int _candidateFactor=-1)
 Set the intitial parameters of the legalizer. More...
 
void resetSitesMapped ()
 reset the mapped flag of the involved sites. More...
 
void dumpMatching (bool fixedColumn=false, bool enforce=false)
 
bool hasNoTarget ()
 

Private Member Functions

void getPUsToLegalize ()
 get the PlacementUnits which SHOULD be legalized More...
 
void findSiteType2AvailableSites ()
 find available sites for each specific type required by the constructor More...
 
void resolveOverflowColumns ()
 resolve the overflow columns during fixed column legalization by spreading "outliers" to neighbor columns More...
 
void findPossibleLegalLocation (bool fixedColumn=false)
 find potential sites for each PlacementUnit More...
 
void mapPUsToColumns ()
 map PlacementUnit to the columns according to the locations of the cells in it More...
 
void createBipartiteGraph ()
 Create a bipartite graph between PlacementUnit and potential DeviceSites. More...
 
void roughlyLegalize ()
 conduct rough legalization. More...
 
void fixedColumnLegalize ()
 conduct fixed-column legalization as a step in exact legalization. During fixed-column legalization, cells in PlacementUnit (macro) can be only mapped to the same column. More...
 
void updatePUMatchingLocation (bool isRoughLegalization=true, bool updateDisplacement=true)
 update the locations of the legalization anchors for the PlacementUnits. More...
 
void finalLegalizeBasedOnDP ()
 finally dynamic programming to legalize the PlacementUnits which have been mapped to the columns. More...
 
float DPForMinHPWL (int colNum, std::vector< std::vector< DeviceInfo::DeviceSite * >> &Column2Sites, std::vector< std::deque< PlacementInfo::PlacementUnit * >> &Column2PUs)
 DP function for the legalization of a specific type of PlacementUnits in the same column. More...
 
void updateMatchingAndUnmatchedPUs ()
 record the matching in private list and update the list of PlacementUnits which are not matched by the bi-partite matching More...
 
void spreadPUs (int columnNum, std::vector< int > &columnUntilization, std::vector< std::vector< DeviceInfo::DeviceSite * >> &column2Sites, std::vector< std::deque< PlacementInfo::PlacementUnit * >> &column2PUs, std::map< PlacementInfo::PlacementUnit *, int > &cell2Column)
 spread PlacementUnits accross columns to resolve resource overflow More...
 
int findIdMaxWithRecurence (int minId, int maxId, std::vector< int > &ids)
 find the column which contains the most of cells in a macro in a specific range of columns More...
 
void setSitesMapped ()
 Set the sites which are binded as mapped so they will not be mapped to other elements in the netlist. More...
 
void resetSettings ()
 clear the mapping information and reset the mapping parameters More...
 
void findPU2SitesInDistance ()
 find candidate sites for the PlacementUnits left to be matched More...
 
void resetPU2SitesInDistance ()
 clear the information of candidate sites for the PlacementUnits left to be matched More...
 
int getPUSiteNum (PlacementInfo::PlacementUnit *tmpPUUnit)
 check how many sites are required by the given PlacementUnit More...
 
void swapPU (PlacementInfo::PlacementUnit **A, PlacementInfo::PlacementUnit **B)
 
void sortPUsByPU2Y (std::deque< PlacementInfo::PlacementUnit * > &PUs)
 
void sortSitesBySiteY (std::vector< DeviceInfo::DeviceSite * > &sites)
 
float getDisplacement (PlacementInfo::Location &PULoc, DeviceInfo::DeviceSite *curSite)
 
float getDisplacement (PlacementInfo::PlacementUnit *curPU, DeviceInfo::DeviceSite *curSite)
 
float getHPWLChange (PlacementInfo::PlacementUnit *curPU, DeviceInfo::DeviceSite *curSite)
 get the HPWL change when the given PlacementUnit moves to the given DeviceSite More...
 
float getHPWLChange (PlacementInfo::PlacementUnit *tmpPU, float PUX, float PUY)
 get the HPWL change when the given PlacementUnit moves to the given location More...
 
void swapSitePtr (DeviceInfo::DeviceSite **siteA, DeviceInfo::DeviceSite **siteB)
 
int sortPartition (PlacementInfo::PlacementUnit *curPU, std::vector< DeviceInfo::DeviceSite * > &sites, int low, int high)
 
int RandomPivotPartition (PlacementInfo::PlacementUnit *curPU, std::vector< DeviceInfo::DeviceSite * > &sites, int low, int high)
 
void quick_sort_WLChange (PlacementInfo::PlacementUnit *curPU, std::vector< DeviceInfo::DeviceSite * > &sites, int p, int q)
 
void swapPUs (PlacementInfo::PlacementUnit **siteA, PlacementInfo::PlacementUnit **siteB)
 
int sortPartition (std::vector< PlacementInfo::PlacementUnit * > &PUs, int low, int high)
 
int RandomPivotPartition (std::vector< PlacementInfo::PlacementUnit * > &PUs, int low, int high)
 
void quick_sort_locX (std::vector< PlacementInfo::PlacementUnit * > &PUs, int p, int q)
 

Private Attributes

std::string legalizerName
 
PlacementInfoplacementInfo
 
DeviceInfodeviceInfo
 
PlacementInfo::CompatiblePlacementTablecompatiblePlacementTable
 compatiblePlacementTable describes the type mapping from design to device, where a cell can be placed (which BEL in which site) More...
 
std::vector< std::string > siteTypesToLegalize
 a vector of Cell Type string indicating the target types handled by this CLBLegalizer More...
 
std::vector< PlacementInfo::Location > & cellLoc
 a reference of the locations of cells (in cellId order) More...
 
std::map< std::string, std::string > & JSONCfg
 
MinCostBipartiteMatcherminCostBipartiteMatcher = nullptr
 min-cost bipartite matching solver for the legalization More...
 
std::vector< PlacementInfo::PlacementUnit * > PUsToLegalize
 a vector storing the PlacementUnits which have NOT been legalized More...
 
std::vector< PlacementInfo::PlacementUnit * > initialPUsToLegalize
 a vector storing the PlacementUnits which SHOULD be legalized More...
 
std::set< PlacementInfo::PlacementUnit * > PUsToLegalizeSet
 a set storing the PlacementUnits which have NOT been legalized More...
 
std::map< std::string, std::vector< DeviceInfo::DeviceSite * > > siteType2Sites
 a map record the potential sites of different site types More...
 
std::map< PlacementInfo::PlacementUnit *, std::vector< DeviceInfo::DeviceSite * > > PU2Sites
 record the mapping from PlacementUnits to the candidate sites which are NOT binded to PUs More...
 
std::map< DeviceInfo::DeviceSite *, int > rightSiteIds
 map sites to temperary indexes for bipartite matching More...
 
std::vector< DeviceInfo::DeviceSite * > siteList
 a vector for the candidate sites for bipartite matching More...
 
std::vector< std::vector< std::pair< int, float > > > adjList
 the adjacent list of the bipartite graph More...
 
std::map< PlacementInfo::PlacementUnit *, std::map< DeviceInfo::DeviceSite *, float > > PU2Site2HPWLIncrease
 a map of map recording the HPWL overhead when binding a PlacementUnit to a specific site More...
 
std::set< PlacementInfo::PlacementUnit * > matchedPUs
 a set of PlacementUnits binded to corresponding DeviceSites More...
 
std::set< DeviceInfo::DeviceSite * > matchedSites
 a set of DeviceSites binded to corresponding PlacementUnits More...
 
std::vector< std::pair< PlacementInfo::PlacementUnit *, DeviceInfo::DeviceSite * > > PULevelMatching
 record the binding between PlacementUnits and DeviceSites as a vector of pairs More...
 
int DumpCLBLegalizationCnt = 0
 
float displacementThreshold = 20
 displacement threshold to detect potential legal sites More...
 
int maxNumCandidate = 20
 the maximum number of final candidate sites More...
 
int candidateFactor = 5
 we are allowed to detect a excessive number (>candidateNum) of initial candidates. candidateFactor is to control the excessive ratio. More...
 
int nJobs = 1
 the number of the parallel multi-threading workers to handle the legalization problems More...
 
int MCLBColumnNum = -1
 the number of SLICEM columns on the target device More...
 
int LCLBColumnNum = -1
 the number of SLICEL columns on the target device More...
 
int MCLBRowNum = -1
 the number of SLICEM rows ocolumnsn the target device More...
 
int LCLBRowNum = -1
 the number of SLICEL rows on the target device More...
 
std::vector< float > MCLBColumnXs
 the floating-point X location of the SLICEM columns on the device More...
 
std::vector< float > LCLBColumnXs
 the floating-point X location of the SLICEL columns on the device More...
 
std::vector< std::vector< DeviceInfo::DeviceSite * > > MCLBColumn2Sites
 record the sites in each column of SLICEM More...
 
std::vector< std::vector< DeviceInfo::DeviceSite * > > LCLBColumn2Sites
 record the sites in each column of SLICEL More...
 
std::vector< std::deque< PlacementInfo::PlacementUnit * > > MCLBColumn2PUs
 record the PlacementUnits in each column of SLICEM More...
 
std::vector< std::deque< PlacementInfo::PlacementUnit * > > LCLBColumn2PUs
 record the PlacementUnits in each column of SLICEL More...
 
std::vector< int > MCLBColumnUntilization
 record the number of cells (Macro contains multiple cells) in each column of SLICEM More...
 
std::vector< int > LCLBColumnUntilization
 record the number of cells (Macro contains multiple cells) in each column of SLICEL More...
 
std::map< PlacementInfo::PlacementUnit *, int > MCLB2Column
 record the mapping from SLICEM CLB PlacementUnits to corresponding columns More...
 
std::map< PlacementInfo::PlacementUnit *, int > LCLB2Column
 record the mapping from SLICEL CLB PlacementUnits to corresponding columns More...
 
std::map< PlacementInfo::PlacementUnit *, std::vector< DeviceInfo::DeviceSite * > > PU2LegalSites
 record the mapping from PlacementUnits to exact DeviceSites More...
 
std::map< PlacementInfo::PlacementUnit *, float > PU2X
 record the mapping from PlacementUnits to exact DeviceSite location X More...
 
std::map< PlacementInfo::PlacementUnit *, float > PU2Y
 record the mapping from PlacementUnits to exact DeviceSite location Y More...
 
std::map< PlacementInfo::PlacementUnit *, int > PU2SiteX
 record the exact site X (column id) of involved PlacementUnits More...
 
std::map< PlacementInfo::PlacementUnit *, std::vector< int > > PU2Columns
 record the column id for the binded cells in involved PlacementUnits More...
 
std::set< PlacementInfo::PlacementUnit * > MCLBPUs
 the PlacementUnits which shoudl be mapped to SLICEM More...
 
std::set< PlacementInfo::PlacementUnit * > LCLBPUs
 the PlacementUnits which shoudl be mapped to SLICEL More...
 
std::map< PlacementInfo::PlacementUnit *, std::vector< DeviceInfo::DeviceSite * > * > PU2SitesInDisplacementThreshold
 a cache record the candidate sites within a given displacement threshold for each PlacementUnit More...
 
bool enableMCLBLegalization = false
 
bool enableLCLBLegalization = false
 
bool verbose = false
 
float y2xRatio = 1.0
 
float finalAverageDisplacement = 10000.0
 the average displacement of exact legalization for the involved PlacementUnit More...
 
float fixedColumnAverageDisplacement = 10000.0
 the average displacement of fixed column (but not exactly consective) legalization for the involved PlacementUnit More...
 
float roughAverageDisplacement = 10000.0
 the average displacement of rough legalization for the involved PlacementUnit More...
 
bool noTarget = false
 
float initialDisplacementThreshold = 20
 displacement threshold to detect potential legal sites More...
 
int initialMaxNumCandidate = 20
 the maximum number of final candidate sites More...
 

Detailed Description

CLBLegalizer maps CLBs (each of which consists of one site) to legal location. e.g. LUTRAM, except those CLBs in CARRY8_Chain.

It should be aware that on FPGA, there are 2 types of CLBs, SLICEM and SLICEL. SLICEM CLBs can be instantiated as LUTRAM and Shifters while SLICEL can be only instantiated as general logic and carry chains. CLBLegalizer is used to handle 1-to-1 PlacementUnit-DeviceSite legalization.

The legalization procedure will only conduct rough legalization in the early iterations of global placement, and it will conduct exact legalization following rough legalization when the macros are close enough to their potential legal positions.

Definition at line 61 of file CLBLegalizer.h.

Constructor & Destructor Documentation

◆ CLBLegalizer()

CLBLegalizer::CLBLegalizer ( std::string  legalizerName,
PlacementInfo placementInfo,
DeviceInfo deviceInfo,
std::vector< std::string > &  siteTypesToLegalize,
std::map< std::string, std::string > &  JSONCfg 
)

Construct a new CLBLegalizer object.

Parameters
legalizerNamethe name string of legalizer for log dumping
placementInfothe PlacementInfo for this placer to handle
deviceInfodevice information
siteTypesToLegalizea vector of Cell Type string indicating the target types handled by this CLBLegalizer
JSONCfgthe user-defined placement configuration

Definition at line 33 of file CLBLegalizer.cc.

◆ ~CLBLegalizer()

CLBLegalizer::~CLBLegalizer ( )
inline

Definition at line 75 of file CLBLegalizer.h.

Member Function Documentation

◆ createBipartiteGraph()

void CLBLegalizer::createBipartiteGraph ( )
private

Create a bipartite graph between PlacementUnit and potential DeviceSites.

Definition at line 556 of file CLBLegalizer.cc.

Referenced by fixedColumnLegalize(), and roughlyLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DPForMinHPWL()

float CLBLegalizer::DPForMinHPWL ( int  colNum,
std::vector< std::vector< DeviceInfo::DeviceSite * >> &  Column2Sites,
std::vector< std::deque< PlacementInfo::PlacementUnit * >> &  Column2PUs 
)
private

DP function for the legalization of a specific type of PlacementUnits in the same column.

Parameters
colNumtotal number of the column of the target type of PlacementUnit
Column2Sitesa vector record the sites in the columns
Column2PUsa vector record the PlacementUnits in the columns
Returns
float

Definition at line 187 of file CLBLegalizer.cc.

Referenced by finalLegalizeBasedOnDP().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpMatching()

void CLBLegalizer::dumpMatching ( bool  fixedColumn = false,
bool  enforce = false 
)

Definition at line 628 of file CLBLegalizer.cc.

Referenced by GlobalPlacer::GlobalPlacement_CLBElements(), and legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalLegalizeBasedOnDP()

void CLBLegalizer::finalLegalizeBasedOnDP ( )
private

finally dynamic programming to legalize the PlacementUnits which have been mapped to the columns.

This function will call DP function for each specific type of PlacementUnits

Definition at line 168 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findIdMaxWithRecurence()

int CLBLegalizer::findIdMaxWithRecurence ( int  minId,
int  maxId,
std::vector< int > &  ids 
)
private

find the column which contains the most of cells in a macro in a specific range of columns

Parameters
minIdthe begin column
maxIdthe end column
idsthe column ids of the cells in the macro
Returns
int

Definition at line 916 of file CLBLegalizer.cc.

Referenced by mapPUsToColumns().

Here is the caller graph for this function:

◆ findPossibleLegalLocation()

void CLBLegalizer::findPossibleLegalLocation ( bool  fixedColumn = false)
private

find potential sites for each PlacementUnit

Parameters
fixedColumntrue if we want to find potential sites for PlacementUnit in a given column

Definition at line 472 of file CLBLegalizer.cc.

Referenced by fixedColumnLegalize(), and roughlyLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findPU2SitesInDistance()

void CLBLegalizer::findPU2SitesInDistance ( )
inlineprivate

find candidate sites for the PlacementUnits left to be matched

Definition at line 600 of file CLBLegalizer.h.

Referenced by fixedColumnLegalize(), and roughlyLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSiteType2AvailableSites()

void CLBLegalizer::findSiteType2AvailableSites ( )
private

find available sites for each specific type required by the constructor

Definition at line 374 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fixedColumnLegalize()

void CLBLegalizer::fixedColumnLegalize ( )
private

conduct fixed-column legalization as a step in exact legalization. During fixed-column legalization, cells in PlacementUnit (macro) can be only mapped to the same column.

Definition at line 139 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAverageDisplacementOfExactLegalization()

float CLBLegalizer::getAverageDisplacementOfExactLegalization ( )
inline

Get the average displacement of exact legalization for the involved PlacementUnit.

Exact legalization ensures elements in a macro are placed consecutively.

Returns
float

Definition at line 95 of file CLBLegalizer.h.

Referenced by GlobalPlacer::macroLegalize().

Here is the caller graph for this function:

◆ getAverageDisplacementOfRoughLegalization()

float CLBLegalizer::getAverageDisplacementOfRoughLegalization ( )
inline

Get the average displacement of rough legalization for the involved PlacementUnit.

Rough legalization does not guarantee that elements in a macro are placed consecutively.

Returns
float

Definition at line 117 of file CLBLegalizer.h.

Referenced by GlobalPlacer::macroLegalize().

Here is the caller graph for this function:

◆ getDisplacement() [1/2]

float CLBLegalizer::getDisplacement ( PlacementInfo::Location PULoc,
DeviceInfo::DeviceSite curSite 
)
inlineprivate

Definition at line 665 of file CLBLegalizer.h.

Referenced by dumpMatching(), and findPossibleLegalLocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDisplacement() [2/2]

float CLBLegalizer::getDisplacement ( PlacementInfo::PlacementUnit curPU,
DeviceInfo::DeviceSite curSite 
)
inlineprivate

Definition at line 670 of file CLBLegalizer.h.

Here is the call graph for this function:

◆ getHPWLChange() [1/2]

float CLBLegalizer::getHPWLChange ( PlacementInfo::PlacementUnit curPU,
DeviceInfo::DeviceSite curSite 
)
inlineprivate

get the HPWL change when the given PlacementUnit moves to the given DeviceSite

Parameters
curPUthe given PlacementUnit
curSitethe given DeviceSite
Returns
float

Definition at line 682 of file CLBLegalizer.h.

Referenced by createBipartiteGraph(), DPForMinHPWL(), dumpMatching(), and sortPartition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getHPWLChange() [2/2]

float CLBLegalizer::getHPWLChange ( PlacementInfo::PlacementUnit tmpPU,
float  PUX,
float  PUY 
)
inlineprivate

get the HPWL change when the given PlacementUnit moves to the given location

Parameters
tmpPUthe given PlacementUnit
PUXgiven location X
PUYgiven location Y
Returns
float

Definition at line 715 of file CLBLegalizer.h.

Here is the call graph for this function:

◆ getPUSiteNum()

int CLBLegalizer::getPUSiteNum ( PlacementInfo::PlacementUnit tmpPUUnit)
private

check how many sites are required by the given PlacementUnit

Parameters
tmpPUUnitthe given PlacementUnit
Returns
int

Definition at line 685 of file CLBLegalizer.cc.

Referenced by DPForMinHPWL(), dumpMatching(), mapPUsToColumns(), spreadPUs(), and updatePUMatchingLocation().

Here is the caller graph for this function:

◆ getPUsToLegalize()

void CLBLegalizer::getPUsToLegalize ( )
private

get the PlacementUnits which SHOULD be legalized

Definition at line 336 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasNoTarget()

bool CLBLegalizer::hasNoTarget ( )
inline

Definition at line 148 of file CLBLegalizer.h.

Referenced by GlobalPlacer::GlobalPlacement_CLBElements(), and GlobalPlacer::macroLegalize().

Here is the caller graph for this function:

◆ legalize()

void CLBLegalizer::legalize ( bool  exactLegalization = false)

conduct legalization and map the PlacementUnit of one of the given types to sites

Parameters
exactLegalizationtrue to ensure elements in a macro are placed consecutively.

Definition at line 78 of file CLBLegalizer.cc.

Referenced by GlobalPlacer::macroLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mapPUsToColumns()

void CLBLegalizer::mapPUsToColumns ( )
private

map PlacementUnit to the columns according to the locations of the cells in it

Definition at line 939 of file CLBLegalizer.cc.

Referenced by fixedColumnLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ quick_sort_locX()

void CLBLegalizer::quick_sort_locX ( std::vector< PlacementInfo::PlacementUnit * > &  PUs,
int  p,
int  q 
)
inlineprivate

Definition at line 818 of file CLBLegalizer.h.

Here is the call graph for this function:

◆ quick_sort_WLChange()

void CLBLegalizer::quick_sort_WLChange ( PlacementInfo::PlacementUnit curPU,
std::vector< DeviceInfo::DeviceSite * > &  sites,
int  p,
int  q 
)
inlineprivate

Definition at line 769 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RandomPivotPartition() [1/2]

int CLBLegalizer::RandomPivotPartition ( PlacementInfo::PlacementUnit curPU,
std::vector< DeviceInfo::DeviceSite * > &  sites,
int  low,
int  high 
)
inlineprivate

Definition at line 760 of file CLBLegalizer.h.

Referenced by quick_sort_locX(), and quick_sort_WLChange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RandomPivotPartition() [2/2]

int CLBLegalizer::RandomPivotPartition ( std::vector< PlacementInfo::PlacementUnit * > &  PUs,
int  low,
int  high 
)
inlineprivate

Definition at line 809 of file CLBLegalizer.h.

Here is the call graph for this function:

◆ resetPU2SitesInDistance()

void CLBLegalizer::resetPU2SitesInDistance ( )
inlineprivate

clear the information of candidate sites for the PlacementUnits left to be matched

Definition at line 636 of file CLBLegalizer.h.

Referenced by fixedColumnLegalize(), and roughlyLegalize().

Here is the caller graph for this function:

◆ resetSettings()

void CLBLegalizer::resetSettings ( )
inlineprivate

clear the mapping information and reset the mapping parameters

Definition at line 587 of file CLBLegalizer.h.

Referenced by finalLegalizeBasedOnDP(), and legalize().

Here is the caller graph for this function:

◆ resetSitesMapped()

void CLBLegalizer::resetSitesMapped ( )

reset the mapped flag of the involved sites.

A mapped site will not be binded to another PlacementUnit.

Definition at line 1002 of file CLBLegalizer.cc.

Referenced by GlobalPlacer::macroLegalize().

Here is the caller graph for this function:

◆ resolveOverflowColumns()

void CLBLegalizer::resolveOverflowColumns ( )
private

resolve the overflow columns during fixed column legalization by spreading "outliers" to neighbor columns

Definition at line 904 of file CLBLegalizer.cc.

Referenced by fixedColumnLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ roughlyLegalize()

void CLBLegalizer::roughlyLegalize ( )
private

conduct rough legalization.

Rough legalization does not guarantee that elements in a macro are placed consecutively. During rough legalization, each cell in a macro will be "legalized" individually as a general standard cell withouth the shape constraints.

Definition at line 114 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIntitialParameters()

void CLBLegalizer::setIntitialParameters ( float  displacementThr,
int  candidateNum,
int  _candidateFactor = -1 
)
inline

Set the intitial parameters of the legalizer.

Parameters
displacementThrdisplacement threshold to detect potential legal sites
candidateNumthe maximum number of final candidate sites
_candidateFactorwe are allowed to detect a excessive number (>candidateNum) of initial candidates

Definition at line 129 of file CLBLegalizer.h.

Referenced by GlobalPlacer::macroLegalize().

Here is the caller graph for this function:

◆ setSitesMapped()

void CLBLegalizer::setSitesMapped ( )
private

Set the sites which are binded as mapped so they will not be mapped to other elements in the netlist.

Definition at line 989 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the caller graph for this function:

◆ sortPartition() [1/2]

int CLBLegalizer::sortPartition ( PlacementInfo::PlacementUnit curPU,
std::vector< DeviceInfo::DeviceSite * > &  sites,
int  low,
int  high 
)
inlineprivate

Definition at line 740 of file CLBLegalizer.h.

Referenced by RandomPivotPartition().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortPartition() [2/2]

int CLBLegalizer::sortPartition ( std::vector< PlacementInfo::PlacementUnit * > &  PUs,
int  low,
int  high 
)
inlineprivate

Definition at line 790 of file CLBLegalizer.h.

Here is the call graph for this function:

◆ sortPUsByPU2Y()

void CLBLegalizer::sortPUsByPU2Y ( std::deque< PlacementInfo::PlacementUnit * > &  PUs)
private

Definition at line 690 of file CLBLegalizer.cc.

Referenced by updatePUMatchingLocation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortSitesBySiteY()

void CLBLegalizer::sortSitesBySiteY ( std::vector< DeviceInfo::DeviceSite * > &  sites)
private

Definition at line 699 of file CLBLegalizer.cc.

Referenced by DPForMinHPWL().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spreadPUs()

void CLBLegalizer::spreadPUs ( int  columnNum,
std::vector< int > &  columnUntilization,
std::vector< std::vector< DeviceInfo::DeviceSite * >> &  column2Sites,
std::vector< std::deque< PlacementInfo::PlacementUnit * >> &  column2PUs,
std::map< PlacementInfo::PlacementUnit *, int > &  cell2Column 
)
private

spread PlacementUnits accross columns to resolve resource overflow

Parameters
columnNumthe number of columns
columnUntilizationa vector reording the utilization usage of each column
column2Sitesa vector reording device sites in each column
column2PUsa vector reording PlacementUnits in each column
cell2Columna map recording the column id for each PlacementUnit

Definition at line 810 of file CLBLegalizer.cc.

Referenced by resolveOverflowColumns().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ swapPU()

void CLBLegalizer::swapPU ( PlacementInfo::PlacementUnit **  A,
PlacementInfo::PlacementUnit **  B 
)
inlineprivate

Definition at line 654 of file CLBLegalizer.h.

Referenced by sortPUsByPU2Y().

Here is the caller graph for this function:

◆ swapPUs()

void CLBLegalizer::swapPUs ( PlacementInfo::PlacementUnit **  siteA,
PlacementInfo::PlacementUnit **  siteB 
)
inlineprivate

Definition at line 783 of file CLBLegalizer.h.

Referenced by RandomPivotPartition(), and sortPartition().

Here is the caller graph for this function:

◆ swapSitePtr()

void CLBLegalizer::swapSitePtr ( DeviceInfo::DeviceSite **  siteA,
DeviceInfo::DeviceSite **  siteB 
)
inlineprivate

Definition at line 733 of file CLBLegalizer.h.

Referenced by RandomPivotPartition(), sortPartition(), and sortSitesBySiteY().

Here is the caller graph for this function:

◆ updateMatchingAndUnmatchedPUs()

void CLBLegalizer::updateMatchingAndUnmatchedPUs ( )
private

record the matching in private list and update the list of PlacementUnits which are not matched by the bi-partite matching

Definition at line 600 of file CLBLegalizer.cc.

Referenced by fixedColumnLegalize(), and roughlyLegalize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePUMatchingLocation()

void CLBLegalizer::updatePUMatchingLocation ( bool  isRoughLegalization = true,
bool  updateDisplacement = true 
)
private

update the locations of the legalization anchors for the PlacementUnits.

This function might be called more than one time during implementation so we have to specify the type of legalization and whether we want to update the displacement value for the control of some optimizations.

Parameters
isRoughLegalizationspecify the type of legalization
updateDisplacementwhether we want to update the displacement value for the control of some optimizations

Definition at line 719 of file CLBLegalizer.cc.

Referenced by legalize().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ adjList

std::vector<std::vector<std::pair<int, float> > > CLBLegalizer::adjList
private

the adjacent list of the bipartite graph

Definition at line 233 of file CLBLegalizer.h.

Referenced by createBipartiteGraph(), fixedColumnLegalize(), and roughlyLegalize().

◆ candidateFactor

int CLBLegalizer::candidateFactor = 5
private

we are allowed to detect a excessive number (>candidateNum) of initial candidates. candidateFactor is to control the excessive ratio.

Definition at line 278 of file CLBLegalizer.h.

Referenced by findPU2SitesInDistance(), and setIntitialParameters().

◆ cellLoc

std::vector<PlacementInfo::Location>& CLBLegalizer::cellLoc
private

a reference of the locations of cells (in cellId order)

Definition at line 175 of file CLBLegalizer.h.

Referenced by findPU2SitesInDistance().

◆ compatiblePlacementTable

PlacementInfo::CompatiblePlacementTable* CLBLegalizer::compatiblePlacementTable
private

compatiblePlacementTable describes the type mapping from design to device, where a cell can be placed (which BEL in which site)

Definition at line 163 of file CLBLegalizer.h.

◆ deviceInfo

DeviceInfo* CLBLegalizer::deviceInfo
private

Definition at line 156 of file CLBLegalizer.h.

Referenced by findSiteType2AvailableSites().

◆ displacementThreshold

float CLBLegalizer::displacementThreshold = 20
private

displacement threshold to detect potential legal sites

Definition at line 265 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), findPU2SitesInDistance(), fixedColumnLegalize(), resetSettings(), and roughlyLegalize().

◆ DumpCLBLegalizationCnt

int CLBLegalizer::DumpCLBLegalizationCnt = 0
private

Definition at line 259 of file CLBLegalizer.h.

Referenced by dumpMatching().

◆ enableLCLBLegalization

bool CLBLegalizer::enableLCLBLegalization = false
private

◆ enableMCLBLegalization

bool CLBLegalizer::enableMCLBLegalization = false
private

◆ finalAverageDisplacement

float CLBLegalizer::finalAverageDisplacement = 10000.0
private

the average displacement of exact legalization for the involved PlacementUnit

Definition at line 431 of file CLBLegalizer.h.

Referenced by finalLegalizeBasedOnDP(), and getAverageDisplacementOfExactLegalization().

◆ fixedColumnAverageDisplacement

float CLBLegalizer::fixedColumnAverageDisplacement = 10000.0
private

the average displacement of fixed column (but not exactly consective) legalization for the involved PlacementUnit

During the fixed column legalization, cells in a macro will be constrainted on one column.

Definition at line 440 of file CLBLegalizer.h.

Referenced by updatePUMatchingLocation().

◆ initialDisplacementThreshold

float CLBLegalizer::initialDisplacementThreshold = 20
private

displacement threshold to detect potential legal sites

Definition at line 454 of file CLBLegalizer.h.

Referenced by resetSettings(), and setIntitialParameters().

◆ initialMaxNumCandidate

int CLBLegalizer::initialMaxNumCandidate = 20
private

the maximum number of final candidate sites

Definition at line 460 of file CLBLegalizer.h.

Referenced by resetSettings(), and setIntitialParameters().

◆ initialPUsToLegalize

std::vector<PlacementInfo::PlacementUnit *> CLBLegalizer::initialPUsToLegalize
private

a vector storing the PlacementUnits which SHOULD be legalized

Definition at line 195 of file CLBLegalizer.h.

Referenced by fixedColumnLegalize(), getPUsToLegalize(), and legalize().

◆ JSONCfg

std::map<std::string, std::string>& CLBLegalizer::JSONCfg
private

Definition at line 177 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), and dumpMatching().

◆ LCLB2Column

std::map<PlacementInfo::PlacementUnit *, int> CLBLegalizer::LCLB2Column
private

record the mapping from SLICEL CLB PlacementUnits to corresponding columns

Definition at line 368 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), and resolveOverflowColumns().

◆ LCLBColumn2PUs

std::vector<std::deque<PlacementInfo::PlacementUnit *> > CLBLegalizer::LCLBColumn2PUs
private

record the PlacementUnits in each column of SLICEL

Definition at line 344 of file CLBLegalizer.h.

Referenced by dumpMatching(), finalLegalizeBasedOnDP(), mapPUsToColumns(), resolveOverflowColumns(), and updatePUMatchingLocation().

◆ LCLBColumn2Sites

std::vector<std::vector<DeviceInfo::DeviceSite *> > CLBLegalizer::LCLBColumn2Sites
private

record the sites in each column of SLICEL

Definition at line 332 of file CLBLegalizer.h.

Referenced by finalLegalizeBasedOnDP(), findPossibleLegalLocation(), findSiteType2AvailableSites(), and resolveOverflowColumns().

◆ LCLBColumnNum

int CLBLegalizer::LCLBColumnNum = -1
private

the number of SLICEL columns on the target device

Definition at line 296 of file CLBLegalizer.h.

Referenced by dumpMatching(), finalLegalizeBasedOnDP(), findSiteType2AvailableSites(), mapPUsToColumns(), resolveOverflowColumns(), and updatePUMatchingLocation().

◆ LCLBColumnUntilization

std::vector<int> CLBLegalizer::LCLBColumnUntilization
private

record the number of cells (Macro contains multiple cells) in each column of SLICEL

Definition at line 356 of file CLBLegalizer.h.

Referenced by mapPUsToColumns(), and resolveOverflowColumns().

◆ LCLBColumnXs

std::vector<float> CLBLegalizer::LCLBColumnXs
private

the floating-point X location of the SLICEL columns on the device

Definition at line 320 of file CLBLegalizer.h.

Referenced by findSiteType2AvailableSites().

◆ LCLBPUs

std::set<PlacementInfo::PlacementUnit *> CLBLegalizer::LCLBPUs
private

the PlacementUnits which shoudl be mapped to SLICEL

Definition at line 414 of file CLBLegalizer.h.

Referenced by getPUsToLegalize(), and mapPUsToColumns().

◆ LCLBRowNum

int CLBLegalizer::LCLBRowNum = -1
private

the number of SLICEL rows on the target device

Definition at line 308 of file CLBLegalizer.h.

Referenced by findSiteType2AvailableSites().

◆ legalizerName

std::string CLBLegalizer::legalizerName
private

Definition at line 154 of file CLBLegalizer.h.

◆ matchedPUs

std::set<PlacementInfo::PlacementUnit *> CLBLegalizer::matchedPUs
private

a set of PlacementUnits binded to corresponding DeviceSites

Definition at line 245 of file CLBLegalizer.h.

Referenced by resetSettings(), and updateMatchingAndUnmatchedPUs().

◆ matchedSites

std::set<DeviceInfo::DeviceSite *> CLBLegalizer::matchedSites
private

a set of DeviceSites binded to corresponding PlacementUnits

Definition at line 251 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), resetSettings(), and updateMatchingAndUnmatchedPUs().

◆ maxNumCandidate

int CLBLegalizer::maxNumCandidate = 20
private

the maximum number of final candidate sites

Definition at line 271 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), findPU2SitesInDistance(), fixedColumnLegalize(), resetSettings(), and roughlyLegalize().

◆ MCLB2Column

std::map<PlacementInfo::PlacementUnit *, int> CLBLegalizer::MCLB2Column
private

record the mapping from SLICEM CLB PlacementUnits to corresponding columns

Definition at line 362 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), and resolveOverflowColumns().

◆ MCLBColumn2PUs

std::vector<std::deque<PlacementInfo::PlacementUnit *> > CLBLegalizer::MCLBColumn2PUs
private

record the PlacementUnits in each column of SLICEM

Definition at line 338 of file CLBLegalizer.h.

Referenced by dumpMatching(), finalLegalizeBasedOnDP(), mapPUsToColumns(), resolveOverflowColumns(), and updatePUMatchingLocation().

◆ MCLBColumn2Sites

std::vector<std::vector<DeviceInfo::DeviceSite *> > CLBLegalizer::MCLBColumn2Sites
private

record the sites in each column of SLICEM

Definition at line 326 of file CLBLegalizer.h.

Referenced by finalLegalizeBasedOnDP(), findPossibleLegalLocation(), findSiteType2AvailableSites(), and resolveOverflowColumns().

◆ MCLBColumnNum

int CLBLegalizer::MCLBColumnNum = -1
private

the number of SLICEM columns on the target device

Definition at line 290 of file CLBLegalizer.h.

Referenced by dumpMatching(), finalLegalizeBasedOnDP(), findSiteType2AvailableSites(), mapPUsToColumns(), resolveOverflowColumns(), and updatePUMatchingLocation().

◆ MCLBColumnUntilization

std::vector<int> CLBLegalizer::MCLBColumnUntilization
private

record the number of cells (Macro contains multiple cells) in each column of SLICEM

Definition at line 350 of file CLBLegalizer.h.

Referenced by mapPUsToColumns(), and resolveOverflowColumns().

◆ MCLBColumnXs

std::vector<float> CLBLegalizer::MCLBColumnXs
private

the floating-point X location of the SLICEM columns on the device

Definition at line 314 of file CLBLegalizer.h.

Referenced by findSiteType2AvailableSites().

◆ MCLBPUs

std::set<PlacementInfo::PlacementUnit *> CLBLegalizer::MCLBPUs
private

the PlacementUnits which shoudl be mapped to SLICEM

Definition at line 408 of file CLBLegalizer.h.

Referenced by getPUsToLegalize(), and mapPUsToColumns().

◆ MCLBRowNum

int CLBLegalizer::MCLBRowNum = -1
private

the number of SLICEM rows ocolumnsn the target device

Definition at line 302 of file CLBLegalizer.h.

Referenced by findSiteType2AvailableSites().

◆ minCostBipartiteMatcher

MinCostBipartiteMatcher* CLBLegalizer::minCostBipartiteMatcher = nullptr
private

min-cost bipartite matching solver for the legalization

Definition at line 183 of file CLBLegalizer.h.

Referenced by fixedColumnLegalize(), roughlyLegalize(), updateMatchingAndUnmatchedPUs(), and ~CLBLegalizer().

◆ nJobs

int CLBLegalizer::nJobs = 1
private

the number of the parallel multi-threading workers to handle the legalization problems

Definition at line 284 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), fixedColumnLegalize(), and roughlyLegalize().

◆ noTarget

bool CLBLegalizer::noTarget = false
private

Definition at line 448 of file CLBLegalizer.h.

Referenced by hasNoTarget(), and legalize().

◆ placementInfo

◆ PU2Columns

std::map<PlacementInfo::PlacementUnit *, std::vector<int> > CLBLegalizer::PU2Columns
private

record the column id for the binded cells in involved PlacementUnits

i.e., if a PlacementUnit is PlacementMacro, the cells in it might be allowed to bind to different columns during rough legalization.

Definition at line 402 of file CLBLegalizer.h.

Referenced by mapPUsToColumns(), and updatePUMatchingLocation().

◆ PU2LegalSites

std::map<PlacementInfo::PlacementUnit *, std::vector<DeviceInfo::DeviceSite *> > CLBLegalizer::PU2LegalSites
private

record the mapping from PlacementUnits to exact DeviceSites

Definition at line 374 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), DPForMinHPWL(), finalLegalizeBasedOnDP(), resetSitesMapped(), setSitesMapped(), and updatePUMatchingLocation().

◆ PU2Site2HPWLIncrease

std::map<PlacementInfo::PlacementUnit *, std::map<DeviceInfo::DeviceSite *, float> > CLBLegalizer::PU2Site2HPWLIncrease
private

a map of map recording the HPWL overhead when binding a PlacementUnit to a specific site

Definition at line 239 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), getHPWLChange(), getPUsToLegalize(), and legalize().

◆ PU2Sites

std::map<PlacementInfo::PlacementUnit *, std::vector<DeviceInfo::DeviceSite *> > CLBLegalizer::PU2Sites
private

record the mapping from PlacementUnits to the candidate sites which are NOT binded to PUs

Please be aware that a PlacementUnit (i.e., PlacementMacro) might be binded of multiple sites.

Definition at line 215 of file CLBLegalizer.h.

Referenced by createBipartiteGraph(), DPForMinHPWL(), findPossibleLegalLocation(), fixedColumnLegalize(), and roughlyLegalize().

◆ PU2SitesInDisplacementThreshold

std::map<PlacementInfo::PlacementUnit *, std::vector<DeviceInfo::DeviceSite *> *> CLBLegalizer::PU2SitesInDisplacementThreshold
private

a cache record the candidate sites within a given displacement threshold for each PlacementUnit

Definition at line 420 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), findPU2SitesInDistance(), and resetPU2SitesInDistance().

◆ PU2SiteX

std::map<PlacementInfo::PlacementUnit *, int> CLBLegalizer::PU2SiteX
private

record the exact site X (column id) of involved PlacementUnits

unused currently and just for debugging

Definition at line 393 of file CLBLegalizer.h.

Referenced by updatePUMatchingLocation().

◆ PU2X

std::map<PlacementInfo::PlacementUnit *, float> CLBLegalizer::PU2X
private

record the mapping from PlacementUnits to exact DeviceSite location X

Definition at line 380 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), DPForMinHPWL(), finalLegalizeBasedOnDP(), and updatePUMatchingLocation().

◆ PU2Y

std::map<PlacementInfo::PlacementUnit *, float> CLBLegalizer::PU2Y
private

record the mapping from PlacementUnits to exact DeviceSite location Y

Definition at line 385 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), DPForMinHPWL(), dumpMatching(), finalLegalizeBasedOnDP(), sortPUsByPU2Y(), and updatePUMatchingLocation().

◆ PULevelMatching

std::vector<std::pair<PlacementInfo::PlacementUnit *, DeviceInfo::DeviceSite *> > CLBLegalizer::PULevelMatching
private

record the binding between PlacementUnits and DeviceSites as a vector of pairs

Definition at line 257 of file CLBLegalizer.h.

Referenced by DPForMinHPWL(), dumpMatching(), getAverageDisplacementOfExactLegalization(), resetSettings(), resetSitesMapped(), setSitesMapped(), updateMatchingAndUnmatchedPUs(), and updatePUMatchingLocation().

◆ PUsToLegalize

std::vector<PlacementInfo::PlacementUnit *> CLBLegalizer::PUsToLegalize
private

◆ PUsToLegalizeSet

std::set<PlacementInfo::PlacementUnit *> CLBLegalizer::PUsToLegalizeSet
private

a set storing the PlacementUnits which have NOT been legalized

Definition at line 201 of file CLBLegalizer.h.

Referenced by getPUsToLegalize().

◆ rightSiteIds

std::map<DeviceInfo::DeviceSite *, int> CLBLegalizer::rightSiteIds
private

map sites to temperary indexes for bipartite matching

Definition at line 221 of file CLBLegalizer.h.

Referenced by createBipartiteGraph(), fixedColumnLegalize(), and roughlyLegalize().

◆ roughAverageDisplacement

float CLBLegalizer::roughAverageDisplacement = 10000.0
private

the average displacement of rough legalization for the involved PlacementUnit

Definition at line 446 of file CLBLegalizer.h.

Referenced by getAverageDisplacementOfRoughLegalization(), and updatePUMatchingLocation().

◆ siteList

std::vector<DeviceInfo::DeviceSite *> CLBLegalizer::siteList
private

a vector for the candidate sites for bipartite matching

Definition at line 227 of file CLBLegalizer.h.

Referenced by createBipartiteGraph(), and updateMatchingAndUnmatchedPUs().

◆ siteType2Sites

std::map<std::string, std::vector<DeviceInfo::DeviceSite *> > CLBLegalizer::siteType2Sites
private

a map record the potential sites of different site types

Definition at line 207 of file CLBLegalizer.h.

Referenced by findPossibleLegalLocation(), and findSiteType2AvailableSites().

◆ siteTypesToLegalize

std::vector<std::string> CLBLegalizer::siteTypesToLegalize
private

a vector of Cell Type string indicating the target types handled by this CLBLegalizer

Definition at line 169 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), and findSiteType2AvailableSites().

◆ verbose

bool CLBLegalizer::verbose = false
private

◆ y2xRatio

float CLBLegalizer::y2xRatio = 1.0
private

Definition at line 425 of file CLBLegalizer.h.

Referenced by CLBLegalizer(), getDisplacement(), and getHPWLChange().


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