Skip to content

Commit 9aaa999

Browse files
authored
Merge pull request #8087 from AcKoucher/mpl-refactor-clean-up
mpl: renaming and minor cleanup for fixed macros support
2 parents 199d0fa + 907de20 commit 9aaa999

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

src/mpl/src/SimulatedAnnealingCore.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ void SimulatedAnnealingCore<T>::initSequencePair()
100100
return;
101101
}
102102

103-
const int sequence_pair_size
104-
= macros_to_place_ != 0 ? macros_to_place_ : macros_.size();
103+
const int sequence_pair_size = number_of_sequence_pair_macros_ != 0
104+
? number_of_sequence_pair_macros_
105+
: macros_.size();
105106

106107
int macro_id = 0;
107108

src/mpl/src/SimulatedAnnealingCore.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class SimulatedAnnealingCore
5959

6060
virtual ~SimulatedAnnealingCore() = default;
6161

62-
void setNumberOfMacrosToPlace(int macros_to_place)
62+
void setNumberOfSequencePairMacros(int number_of_sequence_pair_macros)
6363
{
64-
macros_to_place_ = macros_to_place;
64+
number_of_sequence_pair_macros_ = number_of_sequence_pair_macros;
6565
};
6666
void setNets(const std::vector<BundledNet>& nets);
6767
void setFences(const std::map<int, Rect>& fences);
@@ -145,8 +145,7 @@ class SimulatedAnnealingCore
145145
BoundaryRegionList available_regions_for_unconstrained_pins_;
146146
ClusterToBoundaryRegionMap io_cluster_to_constraint_;
147147

148-
// Number of macros that will actually be part of the sequence pair
149-
int macros_to_place_ = 0;
148+
int number_of_sequence_pair_macros_ = 0;
150149

151150
std::vector<BundledNet> nets_;
152151
std::map<int, Rect> fences_; // Macro Id -> Fence

src/mpl/src/clusterEngine.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,7 @@ void ClusteringEngine::setFloorplanShape()
171171

172172
void ClusteringEngine::searchForFixedInstsInsideFloorplanShape()
173173
{
174-
odb::Rect floorplan_shape(
175-
block_->micronsToDbu(tree_->floorplan_shape.xMin()),
176-
block_->micronsToDbu(tree_->floorplan_shape.yMin()),
177-
block_->micronsToDbu(tree_->floorplan_shape.xMax()),
178-
block_->micronsToDbu(tree_->floorplan_shape.yMax()));
174+
odb::Rect floorplan_shape = micronsToDbu(block_, tree_->floorplan_shape);
179175

180176
for (odb::dbInst* inst : block_->getInsts()) {
181177
if (inst->isFixed()
@@ -2105,7 +2101,7 @@ void ClusteringEngine::getHardMacros(odb::dbModule* module,
21052101
}
21062102

21072103
void ClusteringEngine::createOneClusterForEachMacro(
2108-
Cluster* parent,
2104+
Cluster* mixed_leaf_parent,
21092105
const std::vector<HardMacro*>& hard_macros,
21102106
std::vector<Cluster*>& macro_clusters)
21112107
{
@@ -2116,7 +2112,7 @@ void ClusteringEngine::createOneClusterForEachMacro(
21162112
single_macro_cluster->addLeafMacro(hard_macro->getInst());
21172113
macro_clusters.push_back(single_macro_cluster.get());
21182114

2119-
incorporateNewCluster(std::move(single_macro_cluster), parent);
2115+
incorporateNewCluster(std::move(single_macro_cluster), mixed_leaf_parent);
21202116
}
21212117
}
21222118

src/mpl/src/clusterEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ class ClusteringEngine
219219
void mapMacroInCluster2HardMacro(Cluster* cluster);
220220
void getHardMacros(odb::dbModule* module,
221221
std::vector<HardMacro*>& hard_macros);
222-
void createOneClusterForEachMacro(Cluster* parent,
222+
void createOneClusterForEachMacro(Cluster* mixed_leaf_parent,
223223
const std::vector<HardMacro*>& hard_macros,
224224
std::vector<Cluster*>& macro_clusters);
225225
void classifyMacrosBySize(const std::vector<HardMacro*>& hard_macros,

src/mpl/src/hier_rtlmp.cpp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,13 +1383,14 @@ void HierRTLMP::placeChildren(Cluster* parent)
13831383
io_clusters.push_back(cluster.get());
13841384
continue;
13851385
}
1386-
// for other clusters
1386+
13871387
soft_macro_id_map[cluster->getName()] = macros.size();
13881388
auto soft_macro = std::make_unique<SoftMacro>(cluster.get());
1389-
clustering_engine_->updateInstancesAssociation(
1390-
cluster.get()); // we need this step to calculate nets
1389+
// Needed for computing the nets.
1390+
clustering_engine_->updateInstancesAssociation(cluster.get());
13911391
macros.push_back(*soft_macro);
13921392
cluster->setSoftMacro(std::move(soft_macro));
1393+
13931394
// merge fences and guides for hard macros within cluster
13941395
if (cluster->getClusterType() == StdCellCluster) {
13951396
continue;
@@ -1429,7 +1430,7 @@ void HierRTLMP::placeChildren(Cluster* parent)
14291430
graphics_->setFences(fences);
14301431
}
14311432

1432-
const int num_of_macros_to_place = static_cast<int>(macros.size());
1433+
const int number_of_sequence_pair_macros = static_cast<int>(macros.size());
14331434

14341435
for (Cluster* io_cluster : io_clusters) {
14351436
soft_macro_id_map[io_cluster->getName()] = macros.size();
@@ -1619,7 +1620,7 @@ void HierRTLMP::placeChildren(Cluster* parent)
16191620
graphics_.get(),
16201621
logger_,
16211622
block_);
1622-
sa->setNumberOfMacrosToPlace(num_of_macros_to_place);
1623+
sa->setNumberOfSequencePairMacros(number_of_sequence_pair_macros);
16231624
sa->setCentralizationAttemptOn(true);
16241625
sa->setFences(fences);
16251626
sa->setGuides(guides);
@@ -1831,7 +1832,7 @@ void HierRTLMP::placeChildrenUsingMinimumTargetUtil(Cluster* parent)
18311832
graphics_->setFences(fences);
18321833
}
18331834

1834-
const int macros_to_place = static_cast<int>(macros.size());
1835+
const int number_of_sequence_pair_macros = static_cast<int>(macros.size());
18351836

18361837
for (Cluster* io_cluster : io_clusters) {
18371838
soft_macro_id_map[io_cluster->getName()] = macros.size();
@@ -2007,7 +2008,7 @@ void HierRTLMP::placeChildrenUsingMinimumTargetUtil(Cluster* parent)
20072008
graphics_.get(),
20082009
logger_,
20092010
block_);
2010-
sa->setNumberOfMacrosToPlace(macros_to_place);
2011+
sa->setNumberOfSequencePairMacros(number_of_sequence_pair_macros);
20112012
sa->setCentralizationAttemptOn(true);
20122013
sa->setFences(fences);
20132014
sa->setGuides(guides);
@@ -2468,15 +2469,18 @@ void HierRTLMP::placeMacros(Cluster* cluster)
24682469
exchange_swap_prob = exchange_swap_prob / action_sum;
24692470
float flip_prob = flip_prob_ / action_sum;
24702471

2471-
const int macros_to_place = static_cast<int>(hard_macros.size());
2472+
const int number_of_sequence_pair_macros
2473+
= static_cast<int>(hard_macros.size());
24722474

2473-
int num_perturb_per_step = (macros_to_place > num_perturb_per_step_ / 10)
2474-
? macros_to_place
2475-
: num_perturb_per_step_ / 10;
2475+
int num_perturb_per_step
2476+
= (number_of_sequence_pair_macros > num_perturb_per_step_ / 10)
2477+
? number_of_sequence_pair_macros
2478+
: num_perturb_per_step_ / 10;
24762479

24772480
SequencePair initial_seq_pair;
24782481
if (cluster->isArrayOfInterconnectedMacros()) {
2479-
setArrayTilingSequencePair(cluster, macros_to_place, initial_seq_pair);
2482+
setArrayTilingSequencePair(
2483+
cluster, number_of_sequence_pair_macros, initial_seq_pair);
24802484

24812485
pos_swap_prob = 0.0f;
24822486
neg_swap_prob = 0.0f;
@@ -2485,7 +2489,7 @@ void HierRTLMP::placeMacros(Cluster* cluster)
24852489
flip_prob = 0.05;
24862490

24872491
// Large arrays need more steps to properly converge.
2488-
if (num_perturb_per_step > macros_to_place) {
2492+
if (num_perturb_per_step > number_of_sequence_pair_macros) {
24892493
num_perturb_per_step *= 2;
24902494
}
24912495
}
@@ -2528,7 +2532,7 @@ void HierRTLMP::placeMacros(Cluster* cluster)
25282532
graphics_.get(),
25292533
logger_,
25302534
block_);
2531-
sa->setNumberOfMacrosToPlace(macros_to_place);
2535+
sa->setNumberOfSequencePairMacros(number_of_sequence_pair_macros);
25322536
sa->setNets(nets);
25332537
sa->setFences(fences);
25342538
sa->setGuides(guides);

0 commit comments

Comments
 (0)