Skip to content

Commit 7b5802c

Browse files
committed
rsz: apply max_iterations on repair setup
Signed-off-by: Eder Monteiro <emrmonteiro@precisioninno.com>
1 parent 11a3520 commit 7b5802c

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

src/rsz/src/RepairSetup.cc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void RepairSetup::init()
8585
bool RepairSetup::repairSetup(const float setup_slack_margin,
8686
const double repair_tns_end_percent,
8787
const int max_passes,
88+
int max_iterations,
8889
const int max_repairs_per_pass,
8990
const bool verbose,
9091
const std::vector<MoveType>& sequence,
@@ -448,6 +449,9 @@ bool RepairSetup::repairSetup(const float setup_slack_margin,
448449
end = worst_vertex;
449450
}
450451
pass++;
452+
if (max_iterations > 0 && opto_iteration >= max_iterations) {
453+
break;
454+
}
451455
} // while pass <= max_passes
452456
if (verbose || opto_iteration == 1) {
453457
printProgress(opto_iteration, true, false, false, num_viols);
@@ -459,6 +463,9 @@ bool RepairSetup::repairSetup(const float setup_slack_margin,
459463
// clang-format on
460464
break;
461465
}
466+
if (max_iterations > 0 && opto_iteration >= max_iterations) {
467+
break;
468+
}
462469
} // for each violating endpoint
463470

464471
if (!skip_last_gasp) {
@@ -473,7 +480,7 @@ bool RepairSetup::repairSetup(const float setup_slack_margin,
473480
skip_vt_swap);
474481
params.iteration = opto_iteration;
475482
params.initial_tns = initial_tns;
476-
repairSetupLastGasp(params, num_viols);
483+
repairSetupLastGasp(params, num_viols, max_iterations);
477484
}
478485

479486
if (!skip_crit_vt_swap && !skip_vt_swap
@@ -865,7 +872,9 @@ bool RepairSetup::terminateProgress(const int iteration,
865872

866873
// Perform some last fixing based on sizing only.
867874
// This is a greedy opto that does not degrade WNS or TNS.
868-
void RepairSetup::repairSetupLastGasp(const OptoParams& params, int& num_viols)
875+
void RepairSetup::repairSetupLastGasp(const OptoParams& params,
876+
int& num_viols,
877+
int max_iterations)
869878
{
870879
move_sequence.clear();
871880
if (!params.skip_vt_swap) {
@@ -926,6 +935,10 @@ void RepairSetup::repairSetupLastGasp(const OptoParams& params, int& num_viols)
926935
float fix_rate_threshold = inc_fix_rate_threshold_;
927936

928937
for (const auto& end_original_slack : violating_ends) {
938+
if (max_iterations > 0 && opto_iteration >= max_iterations) {
939+
break;
940+
}
941+
929942
fallback_ = false;
930943
Vertex* end = end_original_slack.first;
931944
Slack end_slack = sta_->vertexSlack(end, max_);
@@ -1015,6 +1028,9 @@ void RepairSetup::repairSetupLastGasp(const OptoParams& params, int& num_viols)
10151028
end = worst_vertex;
10161029
}
10171030
pass++;
1031+
if (max_iterations > 0 && opto_iteration >= max_iterations) {
1032+
break;
1033+
}
10181034
} // while pass <= max_last_gasp_passes_
10191035
if (params.verbose || opto_iteration == 1) {
10201036
printProgress(opto_iteration, true, false, true, num_viols);

src/rsz/src/RepairSetup.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class RepairSetup : public sta::dbStaState
9696
// reduce tns (0.0-1.0).
9797
double repair_tns_end_percent,
9898
int max_passes,
99+
int max_iterations,
99100
int max_repairs_per_pass,
100101
bool verbose,
101102
const std::vector<MoveType>& sequence,
@@ -131,7 +132,9 @@ class RepairSetup : public sta::dbStaState
131132
float& fix_rate_threshold,
132133
int endpt_index,
133134
int num_endpts);
134-
void repairSetupLastGasp(const OptoParams& params, int& num_viols);
135+
void repairSetupLastGasp(const OptoParams& params,
136+
int& num_viols,
137+
int max_iterations);
135138
bool swapVTCritCells(const OptoParams& params, int& num_viols);
136139
void traverseFaninCone(Vertex* endpoint,
137140
std::unordered_map<Instance*, float>& crit_insts,

0 commit comments

Comments
 (0)