Skip to content

Commit 732db97

Browse files
authored
Merge pull request #9206 from The-OpenROAD-Project-staging/grt-extra-step
grt: new resistance-aware strategy
2 parents c596b97 + d0f4e07 commit 732db97

File tree

7 files changed

+322
-113
lines changed

7 files changed

+322
-113
lines changed

src/grt/src/GlobalRouter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ void GlobalRouter::globalRoute(bool save_guides,
335335
} else {
336336
try {
337337
if (end_incremental) {
338+
fastroute_->setResistanceAware(resistance_aware_);
338339
updateDirtyRoutes();
339340
grouter_cbk_->removeOwner();
340341
delete grouter_cbk_;

src/grt/src/fastroute/include/DataType.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ struct FrNet // A Net is a set of connected MazePoints
106106
bool isSoftNDR() { return is_soft_ndr_; }
107107
void setIsResAware(bool res_aware) { is_res_aware_ = res_aware; }
108108
bool isResAware() { return is_res_aware_; }
109+
float getResistance() { return resistance_; }
110+
void setResistance(float resistance) { resistance_ = resistance; }
111+
int getNetLength() { return net_length_; }
112+
void setNetLength(int net_length) { net_length_ = net_length; }
109113

110114
private:
111115
odb::dbNet* db_net_;
@@ -121,6 +125,8 @@ struct FrNet // A Net is a set of connected MazePoints
121125
float slack_;
122126
bool is_soft_ndr_ = false;
123127
bool is_res_aware_ = false;
128+
float resistance_;
129+
int net_length_;
124130
// Non-null when an NDR has been applied to the net.
125131
std::unique_ptr<std::vector<int8_t>> edge_cost_per_layer_;
126132
};
@@ -240,8 +246,7 @@ struct OrderNetPin
240246
int minX;
241247
float length_per_pin; // net length over pin count
242248
int ndr_priority; // NDR nets are assigned first
243-
int res_aware;
244-
float slack;
249+
float res_aware_score;
245250
int clock;
246251
};
247252

src/grt/src/fastroute/include/FastRoute.h

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class FastRouteCore
229229
void setCongestionReportIterStep(int congestion_report_iter_step);
230230
void setCongestionReportFile(const char* congestion_file_name);
231231
void setGridMax(int x_max, int y_max);
232+
void setDetourPenalty(int penalty);
232233
void getCongestionNets(std::set<odb::dbNet*>& congestion_nets);
233234
void computeCongestionInformation();
234235
std::vector<int> getOriginalResources();
@@ -287,7 +288,7 @@ class FastRouteCore
287288
double dbuToMicrons(int dbu);
288289
odb::Rect globalRoutingToBox(const GSegment& route);
289290
NetRouteMap getRoutes();
290-
void updateSlacks(float percentage = 1);
291+
void updateSlacks(float percentage = 0.15);
291292
void preProcessTechLayers();
292293
odb::dbTechLayer* getTechLayer(int layer, bool is_via);
293294

@@ -383,7 +384,8 @@ class FastRouteCore
383384
std::vector<int*>& points_heap_3D,
384385
multi_array<int, 3>& dist_3D,
385386
multi_array<Direction, 3>& directions_3D,
386-
multi_array<int, 3>& corr_edge_3D);
387+
multi_array<int, 3>& corr_edge_3D,
388+
multi_array<int, 3>& path_len_3D);
387389
void setupHeap3D(int netID,
388390
int edgeID,
389391
std::vector<int*>& src_heap_3D,
@@ -392,6 +394,7 @@ class FastRouteCore
392394
multi_array<int, 3>& corr_edge_3D,
393395
multi_array<int, 3>& d1_3D,
394396
multi_array<int, 3>& d2_3D,
397+
multi_array<int, 3>& path_len_3D,
395398
int regionX1,
396399
int regionX2,
397400
int regionY1,
@@ -537,16 +540,24 @@ class FastRouteCore
537540
multi_array<int, 2>& layer_grid,
538541
int net_cost);
539542
void assignEdge(int netID, int edgeID, bool processDIR);
540-
int getLayerResistance(int layer, int length, FrNet* net);
541-
int getViaResistance(int from_layer, int to_layer);
542-
bool needResistanceAware(int net_id);
543543
void recoverEdge(int netID, int edgeID);
544544
void layerAssignmentV4();
545545
void netpinOrderInc();
546546
void checkRoute3D();
547547
void StNetOrder();
548548
float CalculatePartialSlack();
549549
float getNetSlack(odb::dbNet* net);
550+
551+
// Resistance-aware related functions
552+
float getWireResistance(int layer, int length, FrNet* net);
553+
float getViaResistance(int from_layer, int to_layer);
554+
int getWireCost(int layer, int length, FrNet* net);
555+
int getViaCost(int from_layer, int to_layer);
556+
float getNetResistance(FrNet* net, bool assume_layer = false);
557+
float getResAwareScore(FrNet* net);
558+
void updateWorstMetrics(FrNet* net);
559+
void resetWorstMetrics();
560+
550561
/**
551562
* @brief Validates the routing of edges for a specified net.
552563
*
@@ -622,6 +633,10 @@ class FastRouteCore
622633
bool enable_resistance_aware_ = false;
623634
bool is_3d_step_ = false;
624635
bool is_incremental_grt_ = false;
636+
float worst_slack_;
637+
float worst_net_resistance_;
638+
int worst_net_length_;
639+
int worst_fanout_;
625640
int num_adjust_;
626641
int v_capacity_;
627642
int h_capacity_;
@@ -718,6 +733,8 @@ class FastRouteCore
718733
std::vector<int*> dest_heap_3D_;
719734
multi_array<int, 3> d1_3D_;
720735
multi_array<int, 3> d2_3D_;
736+
multi_array<int, 3> path_len_3D_;
737+
int detour_penalty_;
721738
};
722739

723740
extern const char* getNetName(odb::dbNet* db_net);

src/grt/src/fastroute/src/FastRoute.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ void FastRouteCore::clear()
128128

129129
vertical_blocked_intervals_.clear();
130130
horizontal_blocked_intervals_.clear();
131+
132+
detour_penalty_ = 0;
131133
}
132134

133135
void FastRouteCore::clearNets()
@@ -203,6 +205,7 @@ void FastRouteCore::setGridsAndLayers(int x, int y, int nLayers)
203205

204206
d1_3D_.resize(boost::extents[num_layers_][y_range_][x_range_]);
205207
d2_3D_.resize(boost::extents[num_layers_][y_range_][x_range_]);
208+
path_len_3D_.resize(boost::extents[num_layers_][y_range_][x_range_]);
206209
}
207210

208211
void FastRouteCore::addVCapacity(int16_t verticalCapacity, int layer)
@@ -1371,7 +1374,7 @@ NetRouteMap FastRouteCore::run()
13711374
int slope;
13721375
int max_adj;
13731376
int long_edge_len = 40;
1374-
const int short_edge_len = 12;
1377+
int short_edge_len = 12;
13751378
const int soft_ndr_overflow_th = 10000;
13761379

13771380
// call FLUTE to generate RSMT and break the nets into segments (2-pin nets)
@@ -1471,6 +1474,7 @@ NetRouteMap FastRouteCore::run()
14711474
if (debug_->isOn() && debug_->rectilinearSTree) {
14721475
for (const int& netID : net_ids_) {
14731476
if (nets_[netID]->getDbNet() == debug_->net) {
1477+
logger_->report("RST Tree before overflow iterations");
14741478
StTreeVisualization(sttrees_[netID], nets_[netID], false);
14751479
}
14761480
}
@@ -1759,9 +1763,9 @@ NetRouteMap FastRouteCore::run()
17591763

17601764
// Debug mode Tree 2D after overflow iterations
17611765
if (debug_->isOn() && debug_->tree2D) {
1762-
logger_->report("Tree 2D after overflow iterations");
17631766
for (const int& netID : net_ids_) {
17641767
if (nets_[netID]->getDbNet() == debug_->net) {
1768+
logger_->report("Tree 2D after overflow iterations");
17651769
StTreeVisualization(sttrees_[netID], nets_[netID], false);
17661770
}
17671771
}
@@ -1812,6 +1816,7 @@ NetRouteMap FastRouteCore::run()
18121816
// Increase ripup threshold if res-aware is enabled
18131817
if (enable_resistance_aware_) {
18141818
long_edge_len = BIG_INT;
1819+
short_edge_len = BIG_INT;
18151820
}
18161821

18171822
mazeRouteMSMDOrder3D(enlarge_, 0, long_edge_len);
@@ -1843,6 +1848,7 @@ NetRouteMap FastRouteCore::run()
18431848
if (debug_->isOn() && debug_->tree3D) {
18441849
for (const int& netID : net_ids_) {
18451850
if (nets_[netID]->getDbNet() == debug_->net) {
1851+
logger_->report("Tree 3D after maze route 3D");
18461852
StTreeVisualization(sttrees_[netID], nets_[netID], true);
18471853
}
18481854
}
@@ -2005,6 +2011,11 @@ void FastRouteCore::setGridMax(int x_max, int y_max)
20052011
y_grid_max_ = y_max;
20062012
}
20072013

2014+
void FastRouteCore::setDetourPenalty(int penalty)
2015+
{
2016+
detour_penalty_ = penalty;
2017+
}
2018+
20082019
std::vector<int> FastRouteCore::getOriginalResources()
20092020
{
20102021
std::vector<int> original_resources(num_layers_);

src/grt/src/fastroute/src/RSMT.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ void FastRouteCore::gen_brk_RSMT(const bool congestionDriven,
680680
}
681681
if (debug_->isOn() && debug_->steinerTree
682682
&& net->getDbNet() == debug_->net) {
683+
logger_->report("Steiner Tree 2D");
683684
steinerTreeVisualization(rsmt, net);
684685
}
685686

0 commit comments

Comments
 (0)