Skip to content

Commit 3f585ad

Browse files
committed
mpl: group soft annealing weights in a struct
Signed-off-by: Arthur Koucher <[email protected]>
1 parent 72a6f31 commit 3f585ad

File tree

5 files changed

+26
-36
lines changed

5 files changed

+26
-36
lines changed

src/mpl/src/SACoreSoftMacro.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ SACoreSoftMacro::SACoreSoftMacro(PhysicalHierarchy* tree,
2929
const Rect& outline,
3030
const std::vector<SoftMacro>& macros,
3131
const SACoreWeights& core_weights,
32-
float boundary_weight,
33-
float macro_blockage_weight,
34-
float notch_weight,
32+
const SASoftWeights& soft_weights,
3533
// notch threshold
3634
float notch_h_threshold,
3735
float notch_v_threshold,
@@ -66,9 +64,9 @@ SACoreSoftMacro::SACoreSoftMacro(PhysicalHierarchy* tree,
6664
block),
6765
root_(tree->root.get())
6866
{
69-
boundary_weight_ = boundary_weight;
70-
macro_blockage_weight_ = macro_blockage_weight;
71-
original_notch_weight_ = notch_weight;
67+
boundary_weight_ = soft_weights.boundary;
68+
macro_blockage_weight_ = soft_weights.macro_blockage;
69+
original_notch_weight_ = soft_weights.notch;
7270
resize_prob_ = resize_prob;
7371
notch_h_th_ = notch_h_threshold;
7472
notch_v_th_ = notch_v_threshold;

src/mpl/src/SACoreSoftMacro.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ class SACoreSoftMacro : public SimulatedAnnealingCore<SoftMacro>
2727
const Rect& outline,
2828
const std::vector<SoftMacro>& macros,
2929
const SACoreWeights& core_weights,
30-
float boundary_weight,
31-
float macro_blockage_weight,
32-
float notch_weight,
30+
const SASoftWeights& soft_weights,
3331
// notch threshold
3432
float notch_h_threshold,
3533
float notch_v_threshold,

src/mpl/src/hier_rtlmp.cpp

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,17 @@ void HierRTLMP::setFenceWeight(float weight)
9393

9494
void HierRTLMP::setBoundaryWeight(float weight)
9595
{
96-
boundary_weight_ = weight;
96+
cluster_placement_weights_.boundary = weight;
9797
}
9898

9999
void HierRTLMP::setNotchWeight(float weight)
100100
{
101-
notch_weight_ = weight;
101+
cluster_placement_weights_.notch = weight;
102102
}
103103

104104
void HierRTLMP::setMacroBlockageWeight(float weight)
105105
{
106-
macro_blockage_weight_ = weight;
106+
cluster_placement_weights_.macro_blockage = weight;
107107
}
108108

109109
void HierRTLMP::setGlobalFence(float fence_lx,
@@ -304,9 +304,9 @@ void HierRTLMP::resetSAParameters()
304304

305305
placement_core_weights_.fence = 0.0;
306306

307-
boundary_weight_ = 0.0;
308-
notch_weight_ = 0.0;
309-
macro_blockage_weight_ = 0.0;
307+
cluster_placement_weights_.boundary = 0.0;
308+
cluster_placement_weights_.notch = 0.0;
309+
cluster_placement_weights_.macro_blockage = 0.0;
310310
}
311311

312312
void HierRTLMP::runCoarseShaping()
@@ -475,9 +475,7 @@ void HierRTLMP::calculateChildrenTilings(Cluster* parent)
475475
new_outline,
476476
macros,
477477
shaping_core_weights_,
478-
0.0, // boundary weight
479-
0.0, // macro blockage
480-
0.0, // notch weight
478+
SASoftWeights(),
481479
0.0, // no notch size
482480
0.0, // no notch size
483481
pos_swap_prob_ / action_sum,
@@ -535,9 +533,7 @@ void HierRTLMP::calculateChildrenTilings(Cluster* parent)
535533
new_outline,
536534
macros,
537535
shaping_core_weights_,
538-
0.0, // boundary weight
539-
0.0, // macro blockage
540-
0.0, // notch weight
536+
SASoftWeights(),
541537
0.0, // no notch size
542538
0.0, // no notch size
543539
pos_swap_prob_ / action_sum,
@@ -1320,9 +1316,9 @@ void HierRTLMP::adjustMacroBlockageWeight()
13201316
"Tree max level is {}, Changing macro blockage weight from {} "
13211317
"to {} (half of the outline weight)",
13221318
tree_->max_level,
1323-
macro_blockage_weight_,
1319+
cluster_placement_weights_.macro_blockage,
13241320
new_macro_blockage_weight);
1325-
macro_blockage_weight_ = new_macro_blockage_weight;
1321+
cluster_placement_weights_.macro_blockage = new_macro_blockage_weight;
13261322
}
13271323
}
13281324

@@ -1603,9 +1599,7 @@ void HierRTLMP::placeChildren(Cluster* parent)
16031599
outline,
16041600
shaped_macros,
16051601
placement_core_weights_,
1606-
boundary_weight_,
1607-
macro_blockage_weight_,
1608-
notch_weight_,
1602+
cluster_placement_weights_,
16091603
notch_h_th_,
16101604
notch_v_th_,
16111605
pos_swap_prob_ / action_sum,
@@ -1991,9 +1985,7 @@ void HierRTLMP::placeChildrenUsingMinimumTargetUtil(Cluster* parent)
19911985
outline,
19921986
shaped_macros,
19931987
placement_core_weights_,
1994-
boundary_weight_,
1995-
macro_blockage_weight_,
1996-
notch_weight_,
1988+
cluster_placement_weights_,
19971989
notch_h_th_,
19981990
notch_v_th_,
19991991
pos_swap_prob_ / action_sum,

src/mpl/src/hier_rtlmp.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ class HierRTLMP
269269
float notch_v_th_ = 10.0;
270270
float notch_h_th_ = 10.0;
271271

272-
// For cluster and macro placement.
273-
SACoreWeights placement_core_weights_;
272+
SACoreWeights placement_core_weights_; // For cluster and macro placement.
273+
SASoftWeights cluster_placement_weights_;
274274

275275
// For generation of the coarse shape (tiling) of clusters with macros.
276276
const SACoreWeights shaping_core_weights_{1.0f /* area */,
@@ -279,11 +279,6 @@ class HierRTLMP
279279
0.0f /* guidance */,
280280
0.0f /* fence */};
281281

282-
// Soft-Especific Weights
283-
float boundary_weight_ = 5.0;
284-
float notch_weight_ = 1.0; // Used inside Core, but only for Soft.
285-
float macro_blockage_weight_ = 1.0;
286-
287282
std::map<std::string, Rect> fences_; // macro_name, fence
288283
std::map<odb::dbInst*, Rect> guides_; // Macro -> Guidance Region
289284
std::vector<Rect> placement_blockages_;

src/mpl/src/util.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ struct SACoreWeights
7272
float fence{0.0f};
7373
};
7474

75+
struct SASoftWeights
76+
{
77+
float boundary{0.0f};
78+
float notch{0.0f};
79+
float macro_blockage{0.0f};
80+
};
81+
7582
// The cost of a certain penalty is:
7683
// cost = weight * normalized_penalty
7784
//

0 commit comments

Comments
 (0)