AMF-Placer
2.0
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
ParallelCLBPacker will finally pack LUT/FF/MUX/CARRY elements into legal CLB sites in a parallel approach. More...
#include <ParallelCLBPacker.h>
Classes | |
struct | _PUWithScore |
helper struct for candidate site sorting More... | |
struct | _siteWithScore |
helper struct for candidate site sorting More... | |
class | PackedControlSet |
PackedControlSet stores the data of a combination of FFs within one control set (clock enable/preset-reset/clock) that can be packed in a site. More... | |
class | PackingCLBSite |
PackingCLBSite is a container for the packing information (parameters, candidates and packing status) of a specific DeviceInfo::DeviceSite. More... | |
class | PULocation |
PULocation is a helper class to find the neighbor PlacementUnits with KD-Tree. More... | |
Public Types | |
typedef struct ParallelCLBPacker::_siteWithScore | siteWithScore |
helper struct for candidate site sorting More... | |
typedef struct ParallelCLBPacker::_PUWithScore | PUWithScore |
helper struct for candidate site sorting More... | |
Public Member Functions | |
ParallelCLBPacker (DesignInfo *designInfo, DeviceInfo *deviceInfo, PlacementInfo *placementInfo, std::map< std::string, std::string > &JSONCfg, int unchangedIterationThr, int numNeighbor, float deltaD, float curD, float maxD, int PQSize, float HPWLWeight, std::string packerName, PlacementTimingOptimizer *timingOptimizer, WirelengthOptimizer *WLOptimizer=nullptr) | |
Construct a new Parallel CLB Packer object. More... | |
~ParallelCLBPacker () | |
void | prePackLegalizedMacros (PlacementInfo::PlacementMacro *tmpMacro) |
Load the information of some packed macros like LUTRAM/Crossing-Clock-Domain FFs/Carry Chains have been legalized. More... | |
void | packCLBsIteration (bool initial, bool debug=false) |
update the packing cluster candidates for each CLB site and determine some mapping from elements to sites according to the "confidence". More... | |
void | packCLBs (int packIterNum, bool doExceptionHandling, bool debug=false) |
packing the PlacementUnits (which are compatible to CLB sites) into CLB sites More... | |
void | addNonCLBPackingSites () |
int | timingDrivenDetailedPlacement_shortestPath_intermediate () |
int | timingDrivenDetailedPlacement_shortestPath (int iterId, float displacementRatio) |
int | timingDrivenDetailedPlacement_swap (int iterId) |
int | timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping () |
void | exceptionHandling (bool verbose=false) |
handle the PlacementUnits that cannot be packed during the parallel procedure More... | |
std::vector< DeviceInfo::DeviceSite * > * | findNeiborSitesFromBinGrid (DesignInfo::DesignCellType curCellType, float targetX, float targetY, float displacementLowerbound, float displacementUpperbound, float y2xRatio, bool clockRegionAware) |
find the neighbors of specific cell type with given coordinate center More... | |
std::vector< DeviceInfo::DeviceSite * > * | findNeiborSitesFromBinGrid (DesignInfo::DesignCellType curCellType, float targetX, float targetY, float displacementLowerbound, float displacementUpperbound, float y2xRatio, bool clockRegionAware, float v1x, float v1y, float v2x, float v2y, int numLimit) |
bool | exceptionPULegalize (PlacementInfo::PlacementUnit *curPU, float displacementThreshold, bool verbose) |
try to find a legal location for the given PlacementUnit when most of PlacementUnits are packed into CLB site More... | |
bool | ripUpAndLegalizae (PackingCLBSite *curTargetPackingSite, PlacementInfo::PlacementUnit *curPU, float displacementThreshold, std::map< PackingCLBSite *, PackingCLBSite::PackingCLBCluster * > &packingSite2DeterminedCluster, bool verbose) |
try to rip up the packing for a given CLB site and pack the given PlacementUnit in the site. The evicted PlacementUnits which are originally packed in this site and cannot be packed now will try to find other CLB sites to pack More... | |
void | checkPackedPUsAndUnpackedPUs () |
check the packing status for all the PlacementUnits More... | |
void | setPULocationToPackedSite () |
update the location of PlacementUnits according to the packing result More... | |
void | updatePackedMacro (bool setPUPseudoNetToCLBSite=false, bool setCLBFixed=false) |
Update the macros in PlacementInfo by regarding those elements in one CLB site as a macro. More... | |
void | setPUsToBePacked () |
set the packed attribute for the packed PlacementUnits More... | |
void | dumpFinalPacking () |
void | dumpDSPBRAMPlacementTcl (std::ofstream &outfileTcl) |
void | dumpCLBPlacementTcl (std::ofstream &outfileTcl, bool packingRelatedToLUT6_2) |
void | dumpPlacementTcl (std::string dumpTclFile) |
void | dumpAllCellsCoordinate () |
ParallelCLBPacker will finally pack LUT/FF/MUX/CARRY elements into legal CLB sites in a parallel approach.
implemented based on the paper's Algorithm 1: W. Li and D. Z. Pan, "A New Paradigm for FPGA Placement Without Explicit Packing," in IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems, vol. 38, no. 11, pp. 2113-2126, Nov. 2019, doi: 10.1109/TCAD.2018.2877017.
We also provide many detailed optimization techniques according to our observation, macro constraints, timing demands, and the application characteristics to improve the packing efficiency and quality.
Definition at line 93 of file ParallelCLBPacker.h.
typedef struct ParallelCLBPacker::_PUWithScore ParallelCLBPacker::PUWithScore |
helper struct for candidate site sorting
helper struct for candidate site sorting
ParallelCLBPacker::ParallelCLBPacker | ( | DesignInfo * | designInfo, |
DeviceInfo * | deviceInfo, | ||
PlacementInfo * | placementInfo, | ||
std::map< std::string, std::string > & | JSONCfg, | ||
int | unchangedIterationThr, | ||
int | numNeighbor, | ||
float | deltaD, | ||
float | curD, | ||
float | maxD, | ||
int | PQSize, | ||
float | HPWLWeight, | ||
std::string | packerName, | ||
PlacementTimingOptimizer * | timingOptimizer, | ||
WirelengthOptimizer * | WLOptimizer = nullptr |
||
) |
Construct a new Parallel CLB Packer object.
designInfo | given design information |
deviceInfo | given device information |
placementInfo | the PlacementInfo for this placer to handle |
JSONCfg | the user-defined placement configuration |
unchangedIterationThr | specify how many iterations a PlacementUnit should stay at the top priority of a site before we finally map it to the site |
numNeighbor | the threshold number of cells for site |
deltaD | the increase step of the neighbor search diameter |
curD | current neighbor search diameter |
maxD | the maximum constraint of the neighbor search diameter |
PQSize | the size of priority queue (the low-priority candidates will be removed) |
HPWLWeight | the factor of HPWL overhead in packing evaluation for a cell |
packerName | the name of this packer |
timingOptimizer | timingOptimizer |
WLOptimizer | WLOptimizer |
Definition at line 57 of file ParallelCLBPacker.cc.
|
inline |
Definition at line 120 of file ParallelCLBPacker.h.
void ParallelCLBPacker::addNonCLBPackingSites | ( | ) |
Definition at line 2743 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
void ParallelCLBPacker::checkPackedPUsAndUnpackedPUs | ( | ) |
check the packing status for all the PlacementUnits
Definition at line 1722 of file ParallelCLBPacker.cc.
Referenced by exceptionHandling().
void ParallelCLBPacker::dumpAllCellsCoordinate | ( | ) |
Definition at line 3420 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
void ParallelCLBPacker::dumpCLBPlacementTcl | ( | std::ofstream & | outfileTcl, |
bool | packingRelatedToLUT6_2 | ||
) |
Definition at line 3003 of file ParallelCLBPacker.cc.
Referenced by dumpPlacementTcl().
void ParallelCLBPacker::dumpDSPBRAMPlacementTcl | ( | std::ofstream & | outfileTcl | ) |
Definition at line 2865 of file ParallelCLBPacker.cc.
Referenced by dumpPlacementTcl().
void ParallelCLBPacker::dumpFinalPacking | ( | ) |
Definition at line 3225 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
void ParallelCLBPacker::dumpPlacementTcl | ( | std::string | dumpTclFile | ) |
Definition at line 3184 of file ParallelCLBPacker.cc.
Referenced by dumpFinalPacking().
void ParallelCLBPacker::exceptionHandling | ( | bool | verbose = false | ) |
handle the PlacementUnits that cannot be packed during the parallel procedure
verbose | whether dumping information for debugging |
Definition at line 1766 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
bool ParallelCLBPacker::exceptionPULegalize | ( | PlacementInfo::PlacementUnit * | curPU, |
float | displacementThreshold, | ||
bool | verbose | ||
) |
try to find a legal location for the given PlacementUnit when most of PlacementUnits are packed into CLB site
curPU | a PlacementUnit which has NOT been legalized/packed |
displacementThreshold | the displacement threshold to find the neighbor site candidate |
verbose | whether print out debugging information |
Definition at line 1931 of file ParallelCLBPacker.cc.
Referenced by exceptionHandling().
std::vector< DeviceInfo::DeviceSite * > * ParallelCLBPacker::findNeiborSitesFromBinGrid | ( | DesignInfo::DesignCellType | curCellType, |
float | targetX, | ||
float | targetY, | ||
float | displacementLowerbound, | ||
float | displacementUpperbound, | ||
float | y2xRatio, | ||
bool | clockRegionAware | ||
) |
find the neighbors of specific cell type with given coordinate center
curCellType | the given cell type |
targetX | center X |
targetY | center Y |
displacementLowerbound | the lower bound threshold of neighbors' displacement from the center (the neighbors with low displacement might be tried by previous procedure) |
displacementUpperbound | the upper bound threshold of neighbors' displacement from the center |
y2xRatio | a factor to tune the weights of the net spanning in Y-coordinate relative to the net spanning in X-coordinate |
clockRegionAware | whether make clock region become constraints |
Definition at line 2432 of file ParallelCLBPacker.cc.
Referenced by exceptionPULegalize(), ripUpAndLegalizae(), timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping(), timingDrivenDetailedPlacement_shortestPath(), and timingDrivenDetailedPlacement_swap().
std::vector< DeviceInfo::DeviceSite * > * ParallelCLBPacker::findNeiborSitesFromBinGrid | ( | DesignInfo::DesignCellType | curCellType, |
float | targetX, | ||
float | targetY, | ||
float | displacementLowerbound, | ||
float | displacementUpperbound, | ||
float | y2xRatio, | ||
bool | clockRegionAware, | ||
float | v1x, | ||
float | v1y, | ||
float | v2x, | ||
float | v2y, | ||
int | numLimit | ||
) |
void ParallelCLBPacker::packCLBs | ( | int | packIterNum, |
bool | doExceptionHandling, | ||
bool | debug = false |
||
) |
packing the PlacementUnits (which are compatible to CLB sites) into CLB sites
packIterNum | the number of packing iteration |
doExceptionHandling | conduct exception handling if some PlacementUnits fail to be legalized during the parallel procedure |
debug | whether print out debugging information |
Definition at line 288 of file ParallelCLBPacker.cc.
Referenced by AMFPlacer::run().
void ParallelCLBPacker::packCLBsIteration | ( | bool | initial, |
bool | debug = false |
||
) |
update the packing cluster candidates for each CLB site and determine some mapping from elements to sites according to the "confidence".
initial | indicate whether it is the first round of the packing iteration |
debug | whether print out debugging information |
Definition at line 129 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
void ParallelCLBPacker::prePackLegalizedMacros | ( | PlacementInfo::PlacementMacro * | tmpMacro | ) |
Load the information of some packed macros like LUTRAM/Crossing-Clock-Domain FFs/Carry Chains have been legalized.
tmpMacro |
Definition at line 29 of file ParallelCLBPacker.cc.
Referenced by ParallelCLBPacker().
bool ParallelCLBPacker::ripUpAndLegalizae | ( | PackingCLBSite * | curTargetPackingSite, |
PlacementInfo::PlacementUnit * | curPU, | ||
float | displacementThreshold, | ||
std::map< PackingCLBSite *, PackingCLBSite::PackingCLBCluster * > & | packingSite2DeterminedCluster, | ||
bool | verbose | ||
) |
try to rip up the packing for a given CLB site and pack the given PlacementUnit in the site. The evicted PlacementUnits which are originally packed in this site and cannot be packed now will try to find other CLB sites to pack
curTargetPackingSite | a given CLB site |
curPU | a given PlacementUnit |
displacementThreshold | the displacement threshold for the evicted PlacementUnits to find the neighbor site candidates |
packingSite2DeterminedCluster | the mapping between PlacementUnit and CLB sites |
verbose | whether print out debugging information |
Definition at line 2050 of file ParallelCLBPacker.cc.
Referenced by exceptionPULegalize().
void ParallelCLBPacker::setPULocationToPackedSite | ( | ) |
update the location of PlacementUnits according to the packing result
Definition at line 2518 of file ParallelCLBPacker.cc.
Referenced by packCLBs(), and AMFPlacer::run().
void ParallelCLBPacker::setPUsToBePacked | ( | ) |
set the packed attribute for the packed PlacementUnits
Definition at line 2542 of file ParallelCLBPacker.cc.
int ParallelCLBPacker::timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping | ( | ) |
Definition at line 993 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
int ParallelCLBPacker::timingDrivenDetailedPlacement_shortestPath | ( | int | iterId, |
float | displacementRatio | ||
) |
Definition at line 539 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
int ParallelCLBPacker::timingDrivenDetailedPlacement_shortestPath_intermediate | ( | ) |
int ParallelCLBPacker::timingDrivenDetailedPlacement_swap | ( | int | iterId | ) |
Definition at line 1410 of file ParallelCLBPacker.cc.
Referenced by packCLBs().
void ParallelCLBPacker::updatePackedMacro | ( | bool | setPUPseudoNetToCLBSite = false , |
bool | setCLBFixed = false |
||
) |
Update the macros in PlacementInfo by regarding those elements in one CLB site as a macro.
setPUPseudoNetToCLBSite | whether set the legalization pseudo nets for those packed PlacementUnits after updateing |
setCLBFixed | whether fix the locations of the packed PlacementUnits after updateing |
Definition at line 2562 of file ParallelCLBPacker.cc.
Referenced by AMFPlacer::run().
|
private |
Definition at line 3021 of file ParallelCLBPacker.h.
Referenced by dumpAllCellsCoordinate().
|
private |
|
private |
Definition at line 3031 of file ParallelCLBPacker.h.
Referenced by updatePackedMacro().
|
private |
Definition at line 3030 of file ParallelCLBPacker.h.
Referenced by updatePackedMacro().
|
private |
Definition at line 3025 of file ParallelCLBPacker.h.
Referenced by packCLBsIteration(), and ParallelCLBPacker().
|
private |
whether make clock region become constraints
Definition at line 3047 of file ParallelCLBPacker.h.
Referenced by exceptionHandling(), exceptionPULegalize(), findNeiborSitesFromBinGrid(), and ripUpAndLegalizae().
|
private |
current neighbor search diameter
Definition at line 2996 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), ParallelCLBPacker(), and ParallelCLBPacker::PackingCLBSite::updateStep().
|
private |
the increase step of the neighbor search diameter
Definition at line 2990 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), ParallelCLBPacker(), and ParallelCLBPacker::PackingCLBSite::updateStep().
|
private |
Definition at line 2969 of file ParallelCLBPacker.h.
Referenced by timingDrivenDetailedPlacement_shortestPath(), timingDrivenDetailedPlacement_shortestPath_intermediate(), and timingDrivenDetailedPlacement_swap().
|
private |
Definition at line 2970 of file ParallelCLBPacker.h.
Referenced by ParallelCLBPacker().
|
private |
Definition at line 3033 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), exceptionPULegalize(), ParallelCLBPacker(), prePackLegalizedMacros(), ripUpAndLegalizae(), timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping(), timingDrivenDetailedPlacement_shortestPath(), and timingDrivenDetailedPlacement_swap().
|
private |
Definition at line 3020 of file ParallelCLBPacker.h.
Referenced by dumpFinalPacking().
|
private |
the factor of HPWL overhead in packing evaluation for a cell
Definition at line 3014 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), and ParallelCLBPacker().
|
private |
Definition at line 3037 of file ParallelCLBPacker.h.
|
private |
Definition at line 2972 of file ParallelCLBPacker.h.
Referenced by dumpAllCellsCoordinate(), dumpFinalPacking(), and ParallelCLBPacker().
|
private |
the maximum constraint of the neighbor search diameter
Definition at line 3002 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), exceptionHandling(), ParallelCLBPacker(), and ParallelCLBPacker::PackingCLBSite::updateStep().
|
private |
the threshold number of cells for site
Definition at line 2984 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), ParallelCLBPacker(), and ParallelCLBPacker::PackingCLBSite::updateStep().
|
private |
Definition at line 3034 of file ParallelCLBPacker.h.
Referenced by checkPackedPUsAndUnpackedPUs(), and updatePackedMacro().
|
private |
Definition at line 3015 of file ParallelCLBPacker.h.
Referenced by dumpFinalPacking().
|
private |
Definition at line 3024 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), checkPackedPUsAndUnpackedPUs(), dumpCLBPlacementTcl(), dumpFinalPacking(), packCLBs(), packCLBsIteration(), ParallelCLBPacker(), setPULocationToPackedSite(), setPUsToBePacked(), updatePackedMacro(), and ~ParallelCLBPacker().
|
private |
Definition at line 2971 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), checkPackedPUsAndUnpackedPUs(), dumpAllCellsCoordinate(), dumpCLBPlacementTcl(), dumpDSPBRAMPlacementTcl(), dumpFinalPacking(), exceptionHandling(), ParallelCLBPacker::PackingCLBSite::finalMapToSlotsForCarrySite(), ParallelCLBPacker::PackingCLBSite::finalMapToSlotsForCommonLUTFFInSite(), ParallelCLBPacker::PackingCLBSite::findNeiborPUsFromBinGrid(), findNeiborSitesFromBinGrid(), ParallelCLBPacker::PackingCLBSite::greedyMapMuxForCommonLUTFFInSite(), ParallelCLBPacker::PackingCLBSite::mapCarryRelatedCellsToSlots(), packCLBs(), packCLBsIteration(), ParallelCLBPacker(), prePackLegalizedMacros(), setPULocationToPackedSite(), timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping(), timingDrivenDetailedPlacement_shortestPath(), timingDrivenDetailedPlacement_shortestPath_intermediate(), timingDrivenDetailedPlacement_swap(), ParallelCLBPacker::PackingCLBSite::updateConsistentPUsInTop(), and updatePackedMacro().
|
private |
Definition at line 3029 of file ParallelCLBPacker.h.
Referenced by ParallelCLBPacker(), and updatePackedMacro().
|
private |
Definition at line 3027 of file ParallelCLBPacker.h.
Referenced by exceptionHandling(), and updatePackedMacro().
|
private |
Definition at line 3028 of file ParallelCLBPacker.h.
Referenced by updatePackedMacro().
|
private |
the size of priority queue (the low-priority candidates will be removed)
Definition at line 3008 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), ParallelCLBPacker(), and ParallelCLBPacker::PackingCLBSite::updateStep().
|
private |
Definition at line 3023 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), dumpFinalPacking(), ParallelCLBPacker::PackingCLBSite::findNeiborPUsFromBinGrid(), packCLBs(), packCLBsIteration(), ParallelCLBPacker(), ParallelCLBPacker::PackingCLBSite::removeInvalidClustersFromPQ(), ParallelCLBPacker::PackingCLBSite::removeInvalidPUsFromNeighborPUs(), timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping(), timingDrivenDetailedPlacement_shortestPath(), timingDrivenDetailedPlacement_swap(), ParallelCLBPacker::PackingCLBSite::updateConsistentPUsInTop(), and ParallelCLBPacker::PackingCLBSite::updateStep().
|
private |
Definition at line 3026 of file ParallelCLBPacker.h.
Referenced by packCLBsIteration().
|
private |
Definition at line 3038 of file ParallelCLBPacker.h.
Referenced by exceptionHandling().
|
private |
Definition at line 3017 of file ParallelCLBPacker.h.
Referenced by exceptionHandling(), packCLBs(), ripUpAndLegalizae(), timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping(), timingDrivenDetailedPlacement_shortestPath(), timingDrivenDetailedPlacement_shortestPath_intermediate(), and timingDrivenDetailedPlacement_swap().
|
private |
specify how many iterations a PlacementUnit should stay at the top priority of a site before we finally map it to the site
Definition at line 2978 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), ParallelCLBPacker(), and ParallelCLBPacker::PackingCLBSite::updateConsistentPUsInTop().
|
private |
Definition at line 3035 of file ParallelCLBPacker.h.
Referenced by checkPackedPUsAndUnpackedPUs().
|
private |
Definition at line 3036 of file ParallelCLBPacker.h.
Referenced by checkPackedPUsAndUnpackedPUs(), and exceptionHandling().
|
private |
Definition at line 3018 of file ParallelCLBPacker.h.
Referenced by packCLBs().
|
private |
Definition at line 3041 of file ParallelCLBPacker.h.
Referenced by addNonCLBPackingSites(), dumpFinalPacking(), exceptionHandling(), exceptionPULegalize(), ParallelCLBPacker::PackingCLBSite::findNeiborPUsFromBinGrid(), findNeiborSitesFromBinGrid(), ParallelCLBPacker(), ripUpAndLegalizae(), timingDrivenDetailedPlacement_LUTFFPairReloacationAfterSlotMapping(), timingDrivenDetailedPlacement_shortestPath(), timingDrivenDetailedPlacement_swap(), and ParallelCLBPacker::PackingCLBSite::updateStep().