Skip to content

Commit 0005493

Browse files
authored
Merge pull request #9137 from AcKoucher/mpl-remove-ignore-std-cell-area
mpl: remove ignore-std-cell-area mechanism
2 parents d8e07f5 + b8c51b6 commit 0005493

File tree

2 files changed

+49
-87
lines changed

2 files changed

+49
-87
lines changed

src/mpl/src/hier_rtlmp.cpp

Lines changed: 48 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,48 +1317,27 @@ void HierRTLMP::adjustMacroBlockageWeight()
13171317
}
13181318
}
13191319

1320-
void HierRTLMP::placeChildren(Cluster* parent, bool ignore_std_cell_area)
1320+
void HierRTLMP::placeChildren(Cluster* parent)
13211321
{
1322-
if (!ignore_std_cell_area) {
1323-
if (parent->getClusterType() == HardMacroCluster) {
1324-
placeMacros(parent);
1325-
return;
1326-
}
1327-
1328-
// Cover IO Clusters, Leaf Std Cells and Fixed Macros.
1329-
if (parent->isLeaf()) {
1330-
return;
1331-
}
1332-
1333-
debugPrint(logger_,
1334-
MPL,
1335-
"hierarchical_macro_placement",
1336-
1,
1337-
"Placing children of cluster {}",
1338-
parent->getName());
1322+
if (parent->getClusterType() == HardMacroCluster) {
1323+
placeMacros(parent);
1324+
return;
1325+
}
13391326

1340-
for (auto& cluster : parent->getChildren()) {
1341-
clustering_engine_->updateInstancesAssociation(cluster.get());
1342-
}
1343-
} else {
1344-
if (parent->getClusterType() != MixedCluster) {
1345-
return;
1346-
}
1327+
// Cover IO Clusters, Leaf Std Cells and Fixed Macros.
1328+
if (parent->isLeaf()) {
1329+
return;
1330+
}
13471331

1348-
// We only run this enhanced cluster placement version if there are no
1349-
// further levels ahead in the current branch of the physical hierarchy.
1350-
for (auto& cluster : parent->getChildren()) {
1351-
if (cluster->getClusterType() == MixedCluster) {
1352-
return;
1353-
}
1354-
}
1332+
debugPrint(logger_,
1333+
MPL,
1334+
"hierarchical_macro_placement",
1335+
1,
1336+
"Placing children of cluster {}",
1337+
parent->getName());
13551338

1356-
debugPrint(logger_,
1357-
MPL,
1358-
"hierarchical_macro_placement",
1359-
1,
1360-
"Conventional cluster placement failed. Attempting with minimum "
1361-
"target utilization.");
1339+
for (auto& cluster : parent->getChildren()) {
1340+
clustering_engine_->updateInstancesAssociation(cluster.get());
13621341
}
13631342

13641343
if (graphics_) {
@@ -1476,40 +1455,30 @@ void HierRTLMP::placeChildren(Cluster* parent, bool ignore_std_cell_area)
14761455
writeNetFile(file_name_prefix, macros, nets);
14771456
}
14781457

1479-
// Call Simulated Annealing Engine to place children
1480-
// set the action probabilities
1481-
// the summation of probabilities should be one.
1458+
// The sum of probabilities should be equal to 1.0.
14821459
const float action_sum = pos_swap_prob_ + neg_swap_prob_ + double_swap_prob_
14831460
+ exchange_swap_prob_ + resize_prob_;
1461+
14841462
// In our implementation, target_util and target_dead_space are different
14851463
// target_util is used to determine the utilization for MixedCluster
14861464
// target_dead_space is used to determine the utilization for
14871465
// StandardCellCluster We vary the target utilization to generate different
14881466
// tilings
1489-
std::vector<float> target_utils;
1490-
std::vector<float> target_dead_spaces;
14911467

1492-
if (!ignore_std_cell_area) {
1493-
// In our implementation, the utilization can be larger than 1.
1494-
for (int i = 0; i < num_target_util_; i++) {
1495-
target_utils.push_back(target_util_ + i * target_util_step_);
1496-
}
1497-
// In our implementation, the target_dead_space should be less than 1.0.
1498-
// The larger the target dead space, the higher the utilization.
1499-
for (int i = 0; i < num_target_dead_space_; i++) {
1500-
if (target_dead_space_ + i * target_dead_space_step_ < 1.0) {
1501-
target_dead_spaces.push_back(target_dead_space_
1502-
+ i * target_dead_space_step_);
1503-
}
1504-
}
1505-
} else {
1506-
// A high target util minimizes the std cells area inside mixed clusters
1507-
const float target_util = 1e6;
1508-
// A dead space closer to 1 minizes the std cell cluster area
1509-
const float target_dead_space = 0.99999;
1468+
// In our implementation, the utilization can be larger than 1.
1469+
std::vector<float> target_utils(num_target_util_);
1470+
for (int i = 0; i < num_target_util_; i++) {
1471+
target_utils[i] = target_util_ + (i * target_util_step_);
1472+
}
15101473

1511-
target_utils.push_back(target_util);
1512-
target_dead_spaces.push_back(target_dead_space);
1474+
// In our implementation, the target_dead_space should be less than 1.0.
1475+
// The larger the target dead space, the higher the utilization.
1476+
std::vector<float> target_dead_spaces;
1477+
for (int i = 0; i < num_target_dead_space_; i++) {
1478+
if (target_dead_space_ + i * target_dead_space_step_ < 1.0) {
1479+
target_dead_spaces.push_back(target_dead_space_
1480+
+ (i * target_dead_space_step_));
1481+
}
15131482
}
15141483

15151484
// Since target_util and target_dead_space are independent variables
@@ -1632,7 +1601,6 @@ void HierRTLMP::placeChildren(Cluster* parent, bool ignore_std_cell_area)
16321601

16331602
remaining_runs -= run_thread;
16341603

1635-
// add macro tilings
16361604
for (auto& sa : sa_batch) {
16371605
sa_containers.push_back(std::move(sa));
16381606
}
@@ -1657,36 +1625,30 @@ void HierRTLMP::placeChildren(Cluster* parent, bool ignore_std_cell_area)
16571625
}
16581626
}
16591627

1660-
if (best_sa == nullptr) {
1661-
if (!ignore_std_cell_area) {
1662-
placeChildren(parent, true);
1663-
} else {
1664-
logger_->error(MPL, 40, "Failed on cluster {}", parent->getName());
1665-
}
1666-
} else {
1667-
best_sa->fillDeadSpace();
1628+
if (!best_sa) {
1629+
logger_->error(MPL, 40, "Failed on cluster {}", parent->getName());
1630+
}
16681631

1669-
std::vector<SoftMacro> shaped_macros = best_sa->getMacros();
1632+
best_sa->fillDeadSpace();
16701633

1671-
if (logger_->debugCheck(MPL, "hierarchical_macro_placement", 1)) {
1672-
logger_->report("Cluster Placement Summary");
1673-
printPlacementResult(parent, outline, best_sa);
1634+
std::vector<SoftMacro> shaped_macros = best_sa->getMacros();
16741635

1675-
writeFloorplanFile(file_name_prefix, shaped_macros);
1676-
writeCostFile(file_name_prefix, best_sa);
1677-
}
1636+
if (logger_->debugCheck(MPL, "hierarchical_macro_placement", 1)) {
1637+
logger_->report("Cluster Placement Summary");
1638+
printPlacementResult(parent, outline, best_sa);
16781639

1679-
updateChildrenShapesAndLocations(parent, shaped_macros, soft_macro_id_map);
1680-
updateChildrenRealLocation(parent, outline.xMin(), outline.yMin());
1640+
writeFloorplanFile(file_name_prefix, shaped_macros);
1641+
writeCostFile(file_name_prefix, best_sa);
16811642
}
16821643

1683-
if (!ignore_std_cell_area) {
1684-
for (auto& cluster : parent->getChildren()) {
1685-
placeChildren(cluster.get());
1686-
}
1644+
updateChildrenShapesAndLocations(parent, shaped_macros, soft_macro_id_map);
1645+
updateChildrenRealLocation(parent, outline.xMin(), outline.yMin());
16871646

1688-
clustering_engine_->updateInstancesAssociation(parent);
1647+
for (auto& cluster : parent->getChildren()) {
1648+
placeChildren(cluster.get());
16891649
}
1650+
1651+
clustering_engine_->updateInstancesAssociation(parent);
16901652
}
16911653

16921654
// Find the area of blockages that are inside the outline.

src/mpl/src/hier_rtlmp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class HierRTLMP
173173

174174
// Hierarchical Macro Placement 1st stage: Cluster Placement
175175
void adjustMacroBlockageWeight();
176-
void placeChildren(Cluster* parent, bool ignore_std_cell_area = false);
176+
void placeChildren(Cluster* parent);
177177

178178
std::vector<odb::Rect> findBlockagesWithinOutline(
179179
const odb::Rect& outline) const;

0 commit comments

Comments
 (0)