Skip to content

Commit 6366280

Browse files
authored
Merge pull request The-OpenROAD-Project#7216 from AcKoucher/mpl-remove-shrink-and-restart
mpl: remove shrink & restart mechanism
2 parents bb2a3e8 + 4b37f35 commit 6366280

File tree

7 files changed

+3
-69
lines changed

7 files changed

+3
-69
lines changed

src/mpl/src/SACoreHardMacro.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class SACoreHardMacro : public SimulatedAnnealingCore<HardMacro>
4949
private:
5050
float calNormCost() const override;
5151
void calPenalty() override;
52-
void shrink() override {}
5352

5453
void perturb() override;
5554
void restore() override;

src/mpl/src/SACoreSoftMacro.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,13 +800,6 @@ void SACoreSoftMacro::resizeOneCluster()
800800
}
801801
}
802802

803-
void SACoreSoftMacro::shrink()
804-
{
805-
for (auto& macro_id : pos_seq_) {
806-
macros_[macro_id].shrinkArea(shrink_factor_);
807-
}
808-
}
809-
810803
void SACoreSoftMacro::printResults() const
811804
{
812805
reportCoreWeights();

src/mpl/src/SACoreSoftMacro.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ class SACoreSoftMacro : public SimulatedAnnealingCore<SoftMacro>
7878
// actions used
7979
void resizeOneCluster();
8080

81-
void shrink() override;
82-
8381
// A utility function for FillDeadSpace.
8482
// It's used for calculate the start point and end point for a segment in a
8583
// grid

src/mpl/src/SimulatedAnnealingCore.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,6 @@ void SimulatedAnnealingCore<T>::fastSA()
741741
// as it is too expensive
742742
notch_weight_ = 0.0;
743743

744-
int num_restart = 1;
745-
const int max_num_restart = 2;
746-
747744
if (isValid()) {
748745
updateBestValidResult();
749746
}
@@ -777,20 +774,6 @@ void SimulatedAnnealingCore<T>::fastSA()
777774
cost_list_.push_back(pre_cost);
778775
T_list_.push_back(temperature);
779776

780-
if (best_valid_result_.macro_id_to_width.empty()
781-
&& (num_restart <= max_num_restart)
782-
&& (step == std::floor(max_num_step_ / max_num_restart)
783-
&& (outline_penalty_ > 0.0))) {
784-
shrink();
785-
packFloorplan();
786-
calPenalty();
787-
pre_cost = calNormCost();
788-
num_restart++;
789-
step = 1;
790-
num_perturb_per_step_ *= 2;
791-
temperature = init_temperature_;
792-
}
793-
794777
if (step == max_num_step_ - macros_.size() * 2) {
795778
notch_weight_ = original_notch_weight_;
796779
packFloorplan();

src/mpl/src/SimulatedAnnealingCore.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ class SimulatedAnnealingCore
124124
void exchangeMacros();
125125
void generateRandomIndices(int& index1, int& index2);
126126

127-
virtual void shrink() = 0; // Shrink the size of macros
128-
129127
// utilities
130128
static float calAverage(std::vector<float>& value_list);
131129

@@ -159,10 +157,6 @@ class SimulatedAnnealingCore
159157
int max_num_step_ = 0;
160158
int num_perturb_per_step_ = 0;
161159

162-
// shrink_factor for dynamic weight
163-
const float shrink_factor_ = 0.8;
164-
const float shrink_freq_ = 0.1;
165-
166160
// seed for reproduciabilty
167161
std::mt19937 generator_;
168162
std::uniform_real_distribution<float> distribution_;

src/mpl/src/object.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,38 +1095,6 @@ void SoftMacro::setHeight(float height)
10951095
}
10961096
}
10971097

1098-
void SoftMacro::shrinkArea(float percent)
1099-
{
1100-
if (percent < 0.0) {
1101-
percent = 0.0;
1102-
}
1103-
1104-
if (percent > 1.0) {
1105-
percent = 1.0;
1106-
}
1107-
1108-
if (area_ == 0.0 || width_intervals_.size() != height_intervals_.size()
1109-
|| width_intervals_.empty() || cluster_ == nullptr
1110-
|| cluster_->getClusterType() != StdCellCluster
1111-
|| cluster_->isIOCluster()) {
1112-
return;
1113-
}
1114-
1115-
for (Interval& width_interval : width_intervals_) {
1116-
width_interval.min *= percent;
1117-
width_interval.max *= percent;
1118-
}
1119-
1120-
for (Interval& height_interval : height_intervals_) {
1121-
height_interval.max *= percent;
1122-
height_interval.min *= percent;
1123-
}
1124-
1125-
width_ = width_ * percent;
1126-
height_ = height_ * percent;
1127-
area_ = width_ * height_;
1128-
}
1129-
11301098
void SoftMacro::setArea(float area)
11311099
{
11321100
if (area_ == 0.0 || width_intervals_.size() != height_intervals_.size()

src/mpl/src/object.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,9 @@ class SoftMacro
486486
void setX(float x);
487487
void setY(float y);
488488
void setLocation(const std::pair<float, float>& location);
489-
void setWidth(float width); // only for StdCellCluster and MixedCluster
490-
void setHeight(float height); // only for StdCellCluster and MixedCluster
491-
void shrinkArea(float percent); // only for StdCellCluster
492-
void setArea(float area); // only for StdCellCluster and MixedCluster
489+
void setWidth(float width); // only for StdCellCluster and MixedCluster
490+
void setHeight(float height); // only for StdCellCluster and MixedCluster
491+
void setArea(float area); // only for StdCellCluster and MixedCluster
493492
void resizeRandomly(std::uniform_real_distribution<float>& distribution,
494493
std::mt19937& generator);
495494
void setShapes(const TilingList& tilings, bool force = false);

0 commit comments

Comments
 (0)