@@ -175,6 +175,7 @@ bool RepairSetup::repairSetup(const float setup_slack_margin,
175
175
}
176
176
float fix_rate_threshold = inc_fix_rate_threshold_;
177
177
for (const auto & end_original_slack : violating_ends) {
178
+ max_repairs_per_iter_ = 10 ;
178
179
Vertex* end = end_original_slack.first ;
179
180
Slack end_slack = sta_->vertexSlack (end, max_);
180
181
Slack worst_slack;
@@ -325,6 +326,7 @@ bool RepairSetup::repairSetup(const float setup_slack_margin,
325
326
// Progress, Save checkpoint so we can back up to here.
326
327
resizer_->journalBegin ();
327
328
} else {
329
+ max_repairs_per_iter_ = 1 ;
328
330
// Allow slack to increase to get out of local minima.
329
331
// Do not update prev_end_slack so it saves the high water mark.
330
332
decreasing_slack_passes++;
@@ -495,7 +497,7 @@ bool RepairSetup::repairPath(PathRef& path,
495
497
const float setup_slack_margin)
496
498
{
497
499
PathExpanded expanded (&path, sta_);
498
- bool changed = false ;
500
+ int changed = 0 ;
499
501
500
502
if (expanded.size () > 1 ) {
501
503
const int path_length = expanded.size ();
@@ -537,7 +539,19 @@ bool RepairSetup::repairPath(PathRef& path,
537
539
|| (pair1.second == pair2.second && pair1.first > pair2.first );
538
540
});
539
541
// Attack gates with largest load delays first.
542
+ int repairs_per_iter = std::round (std::max (-path_slack * 10e9f, 1 .0f ));
543
+ repairs_per_iter = std::min (repairs_per_iter, max_repairs_per_iter_);
544
+ debugPrint (logger_,
545
+ RSZ,
546
+ " repair_setup" ,
547
+ 3 ,
548
+ " Path slack: {}, repairs: {}" ,
549
+ delayAsString (path_slack, sta_, 3 ),
550
+ repairs_per_iter);
540
551
for (const auto & [drvr_index, ignored] : load_delays) {
552
+ if (changed >= repairs_per_iter) {
553
+ break ;
554
+ }
541
555
const PathRef* drvr_path = expanded.path (drvr_index);
542
556
Vertex* drvr_vertex = drvr_path->vertex (sta_);
543
557
const Pin* drvr_pin = drvr_vertex->pin ();
@@ -561,24 +575,21 @@ bool RepairSetup::repairPath(PathRef& path,
561
575
drvr_index,
562
576
&expanded,
563
577
setup_slack_margin)) {
564
- Pin* drvr_pin = drvr_path->pin (this );
565
- Instance* drvr = network_->instance (drvr_pin);
566
- buf_to_remove_.push_back (drvr);
567
- changed = true ;
568
- break ;
578
+ changed++;
579
+ continue ;
569
580
}
570
581
}
571
582
572
583
if (upsizeDrvr (drvr_path, drvr_index, &expanded)) {
573
- changed = true ;
574
- break ;
584
+ changed++ ;
585
+ continue ;
575
586
}
576
587
577
588
// Pin swapping
578
589
if (!skip_pin_swap) {
579
590
if (swapPins (drvr_path, drvr_index, &expanded)) {
580
- changed = true ;
581
- break ;
591
+ changed++ ;
592
+ continue ;
582
593
}
583
594
}
584
595
@@ -600,8 +611,8 @@ bool RepairSetup::repairPath(PathRef& path,
600
611
network_->pathName (drvr_pin),
601
612
rebuffer_count);
602
613
inserted_buffer_count_ += rebuffer_count;
603
- changed = true ;
604
- break ;
614
+ changed++ ;
615
+ continue ;
605
616
}
606
617
}
607
618
@@ -612,8 +623,8 @@ bool RepairSetup::repairPath(PathRef& path,
612
623
db_network_->instance (drvr_pin))
613
624
== resizer_->inserted_buffer_set_ .end ()
614
625
&& cloneDriver (drvr_path, drvr_index, path_slack, &expanded)) {
615
- changed = true ;
616
- break ;
626
+ changed++ ;
627
+ continue ;
617
628
}
618
629
619
630
if (!skip_buffering) {
@@ -623,8 +634,8 @@ bool RepairSetup::repairPath(PathRef& path,
623
634
const int init_buffer_count = inserted_buffer_count_;
624
635
splitLoads (drvr_path, drvr_index, path_slack, &expanded);
625
636
split_load_buffer_count_ = inserted_buffer_count_ - init_buffer_count;
626
- changed = true ;
627
- break ;
637
+ changed++ ;
638
+ continue ;
628
639
}
629
640
}
630
641
}
@@ -633,7 +644,7 @@ bool RepairSetup::repairPath(PathRef& path,
633
644
}
634
645
buf_to_remove_.clear ();
635
646
}
636
- return changed;
647
+ return changed > 0 ;
637
648
}
638
649
639
650
void RepairSetup::debugCheckMultipleBuffers (PathRef& path,
@@ -866,6 +877,7 @@ bool RepairSetup::removeDrvr(const PathRef* drvr_path,
866
877
}
867
878
868
879
if (resizer_->canRemoveBuffer (drvr, /* honorDontTouch */ true )) {
880
+ buf_to_remove_.push_back (drvr);
869
881
removed_buffer_count_++;
870
882
return true ;
871
883
}
@@ -1923,6 +1935,7 @@ void RepairSetup::repairSetupLastGasp(const OptoParams& params, int& num_viols)
1923
1935
float fix_rate_threshold = inc_fix_rate_threshold_;
1924
1936
1925
1937
for (const auto & end_original_slack : violating_ends) {
1938
+ max_repairs_per_iter_ = 10 ;
1926
1939
Vertex* end = end_original_slack.first ;
1927
1940
Slack end_slack = sta_->vertexSlack (end, max_);
1928
1941
Slack worst_slack;
@@ -2007,6 +2020,7 @@ void RepairSetup::repairSetupLastGasp(const OptoParams& params, int& num_viols)
2007
2020
resizer_->journalEnd ();
2008
2021
resizer_->journalBegin ();
2009
2022
} else {
2023
+ max_repairs_per_iter_ = 1 ;
2010
2024
resizer_->journalRestore (resize_count_,
2011
2025
inserted_buffer_count_,
2012
2026
cloned_gate_count_,
0 commit comments