Skip to content

Commit 20ea68f

Browse files
authored
Merge pull request #7530 from gudeh/gpl-allow-load-fastroute
gpl: allow load fastroute heatmap in gui
2 parents 8986d63 + 5944f55 commit 20ea68f

File tree

8 files changed

+52
-6
lines changed

8 files changed

+52
-6
lines changed

src/gpl/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ global_placement
9898
[-timing_driven_nets_percentage]
9999
[-keep_resize_below_overflow]
100100
[-disable_revert_if_diverge]
101+
[-enable_routing_congestion]
101102
```
102103

103104
#### Options
@@ -121,6 +122,7 @@ global_placement
121122
| `-pad_right` | Set right padding in terms of number of sites. The default value is 0, and the allowed values are integers `[1, MAX_INT]` |
122123
| `-skip_io` | Flag to ignore the IO ports when computing wirelength during placement. The default value is False, allowed values are boolean. |
123124
| `-disable_revert_if_diverge` | Flag to make gpl store the placement state along iterations, if a divergence is detected, gpl reverts to the snapshot state. The default value is disabled. |
125+
| `-enable_routing_congestion` | Flag to run global routing after global placement, enabling the Routing Congestion Heatmap.|
124126

125127
#### Routability-Driven Arguments
126128

src/gpl/include/gpl/Replace.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class Replace
105105
void setRoutabilityInflationRatioCoef(float coef);
106106
void setRoutabilityMaxInflationRatio(float ratio);
107107
void setRoutabilityRcCoefficients(float k1, float k2, float k3, float k4);
108+
void setEnableRoutingCongestion(bool mode);
108109

109110
void addTimingNetWeightOverflow(int overflow);
110111
void setTimingNetWeightMax(float max);
@@ -162,15 +163,14 @@ class Replace
162163
float routabilityTargetRcMetric_ = 1.01;
163164
float routabilityInflationRatioCoef_ = 3;
164165
float routabilityMaxInflationRatio_ = 6;
166+
int routabilityMaxInflationIter_ = 4;
165167

166168
// routability RC metric coefficients
167169
float routabilityRcK1_ = 1.0;
168170
float routabilityRcK2_ = 1.0;
169171
float routabilityRcK3_ = 0.0;
170172
float routabilityRcK4_ = 0.0;
171173

172-
int routabilityMaxInflationIter_ = 4;
173-
174174
float timingNetWeightMax_ = 5;
175175
float keepResizeBelowOverflow_ = 0.3;
176176

@@ -180,6 +180,7 @@ class Replace
180180
bool uniformTargetDensityMode_ = false;
181181
bool skipIoMode_ = false;
182182
bool disableRevertIfDiverge_ = false;
183+
bool enable_routing_congestion_ = false;
183184

184185
std::vector<int> timingNetWeightOverflows_;
185186
Clusters clusters_;

src/gpl/src/nesterovPlace.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ int NesterovPlace::doNesterovPlace(int start_iter)
448448
gui->deleteLabel(label_name);
449449
}
450450

451-
// Save image if routability not needed and below routability overflow
451+
// Save image once if routability not needed and below routability overflow
452452
if (npVars_.routability_driven_mode && !is_routability_need_
453453
&& average_overflow_unscaled_ <= npVars_.routability_end_overflow
454454
&& !final_routability_image_saved) {
@@ -460,6 +460,13 @@ int NesterovPlace::doNesterovPlace(int start_iter)
460460
routability_driven_count,
461461
timing_driven_count);
462462

463+
graphics_->saveLabeledImage(
464+
fmt::format("{}/1_routability_final_{:05d}.png",
465+
routability_driven_dir,
466+
iter),
467+
label,
468+
/* select_buffers = */ false);
469+
463470
graphics_->saveLabeledImage(
464471
fmt::format("{}/1_density_routability_final_{:05d}.png",
465472
routability_driven_dir,
@@ -808,6 +815,7 @@ int NesterovPlace::doNesterovPlace(int start_iter)
808815
/* select_buffers = */ false,
809816
"Heat Maps/Estimated Congestion (RUDY)");
810817
}
818+
811819
// recover the densityPenalty values
812820
// if further routability-driven is needed
813821
std::pair<bool, bool> result = rb_->routability();

src/gpl/src/replace.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,13 @@ int Replace::doNesterovPlace(int threads, int start_iter)
371371
1,
372372
"NP->doNesterovPlace() runtime: {} seconds ",
373373
elapsed.count());
374+
375+
if (enable_routing_congestion_) {
376+
fr_->setAllowCongestion(true);
377+
fr_->setCongestionIterations(0);
378+
fr_->setCriticalNetsPercentage(0);
379+
fr_->globalRoute();
380+
}
374381
return return_do_nesterov;
375382
}
376383

@@ -490,6 +497,11 @@ void Replace::setDisableRevertIfDiverge(bool mode)
490497
disableRevertIfDiverge_ = mode;
491498
}
492499

500+
void Replace::setEnableRoutingCongestion(bool mode)
501+
{
502+
enable_routing_congestion_ = mode;
503+
}
504+
493505
void Replace::setSkipIoMode(bool mode)
494506
{
495507
skipIoMode_ = mode;

src/gpl/src/replace.i

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ set_routability_driven_mode(bool routability_driven)
183183
}
184184

185185
void
186-
set_routability_use_grt(bool use_grt)
186+
set_routability_use_grt(bool use_grt)
187187
{
188188
Replace* replace = getReplace();
189189
replace->setRoutabilityUseGrt(use_grt);
@@ -270,6 +270,13 @@ set_disable_revert_if_diverge(bool disable_revert_if_diverge)
270270
replace->setDisableRevertIfDiverge(disable_revert_if_diverge);
271271
}
272272

273+
void
274+
set_enable_routing_congestion(bool enable_routing_congestion)
275+
{
276+
Replace* replace = getReplace();
277+
replace->setEnableRoutingCongestion(enable_routing_congestion);
278+
}
279+
273280
float
274281
get_global_placement_uniform_density_cmd()
275282
{

src/gpl/src/replace.tcl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ sta::define_cmd_args "global_placement" {\
3535
[-pad_left pad_left]\
3636
[-pad_right pad_right]\
3737
[-disable_revert_if_diverge]\
38+
[-enable_routing_congestion]
3839
}
3940

4041
proc global_placement { args } {
@@ -63,8 +64,9 @@ proc global_placement { args } {
6364
-disable_timing_driven \
6465
-disable_routability_driven \
6566
-skip_io \
66-
-incremental\
67-
-disable_revert_if_diverge}
67+
-incremental \
68+
-disable_revert_if_diverge \
69+
-enable_routing_congestion}
6870

6971
# flow control for initial_place
7072
if { [info exists flags(-skip_initial_place)] } {
@@ -156,6 +158,9 @@ proc global_placement { args } {
156158
"Revert-to-snapshot on divergence detection is disabled."
157159
}
158160

161+
set enable_routing_congestion [info exists flags(-enable_routing_congestion)]
162+
gpl::set_enable_routing_congestion $enable_routing_congestion
163+
159164
if { [info exists keys(-initial_place_max_fanout)] } {
160165
set initial_place_max_fanout $keys(-initial_place_max_fanout)
161166
sta::check_positive_integer "-initial_place_max_fanout" $initial_place_max_fanout

src/gpl/src/routeBase.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ void RouteBase::getGrtResult()
314314
updateGrtRoute();
315315
}
316316

317+
void RouteBase::loadGrt()
318+
{
319+
grouter_->setAllowCongestion(true);
320+
grouter_->setCongestionIterations(0);
321+
grouter_->setCriticalNetsPercentage(0);
322+
grouter_->globalRoute();
323+
}
324+
317325
int64_t RouteBase::inflatedAreaDelta() const
318326
{
319327
return inflatedAreaDelta_;

src/gpl/src/routeBase.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ class RouteBase
155155
// Functions using fastroute on grt are saved as backup.
156156
void updateGrtRoute();
157157
void getGrtResult();
158+
// TODO: understand why this function is breaking RUDY.
159+
// Allow for grt heatmap during gpl execution.
160+
void loadGrt();
158161
float getGrtRC() const;
159162

160163
void updateRudyRoute();

0 commit comments

Comments
 (0)