Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#4271 from eder-matheus/revert…
Browse files Browse the repository at this point in the history
…_grt

Revert "Merge pull request The-OpenROAD-Project#4262 from eder-matheus/grt_congestion"
  • Loading branch information
eder-matheus authored Nov 15, 2023
2 parents e7af3d0 + c890e39 commit 777f77f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 62 deletions.
68 changes: 28 additions & 40 deletions src/gpl/src/routeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,51 +475,44 @@ void RouteBase::updateRoute()
tg_->setTileCnt(gridX.size(), gridY.size());
tg_->initTiles();

int min_routing_layer = grouter_->getMinRoutingLayer();
int max_routing_layer = grouter_->getMaxRoutingLayer();
for (int i = 1; i <= numLayers; i++) {
odb::dbTechLayer* layer = tech->findRoutingLayer(i);
bool isHorizontalLayer
= (layer->getDirection() == odb::dbTechLayerDir::HORIZONTAL);

for (auto& tile : tg_->tiles()) {
float ratio;
if (i >= min_routing_layer && i <= max_routing_layer) {
// Check left and down tile
// and set the minimum usage/cap vals for
// TileGrid setup.

// first extract current tiles' usage
ratio = getUsageCapacityRatio(
tile, layer, gGrid, rbVars_.ignoreEdgeRatio);

// if horizontal layer (i.e., vertical edges)
// should consider LEFT tile's RIGHT edge == current 'tile's LEFT edge
// (current 'ratio' points to RIGHT edges usage)
if (isHorizontalLayer && tile->x() >= 1) {
Tile* leftTile
= tg_->tiles()[tile->y() * tg_->tileCntX() + tile->x() - 1];
float leftRatio = getUsageCapacityRatio(
leftTile, layer, gGrid, rbVars_.ignoreEdgeRatio);
ratio = std::fmax(leftRatio, ratio);
}
// Check left and down tile
// and set the minimum usage/cap vals for
// TileGrid setup.

// if vertical layer (i.e., horizontal edges)
// should consider DOWN tile's UP edge == current 'tile's DOWN edge
// (current 'ratio' points to UP edges usage)
if (!isHorizontalLayer && tile->y() >= 1) {
Tile* downTile
= tg_->tiles()[(tile->y() - 1) * tg_->tileCntX() + tile->x()];
float downRatio = getUsageCapacityRatio(
downTile, layer, gGrid, rbVars_.ignoreEdgeRatio);
ratio = std::fmax(downRatio, ratio);
}
// first extract current tiles' usage
float ratio
= getUsageCapacityRatio(tile, layer, gGrid, rbVars_.ignoreEdgeRatio);

ratio = std::fmax(ratio, 0.0f);
} else {
ratio = 0.0;
// if horizontal layer (i.e., vertical edges)
// should consider LEFT tile's RIGHT edge == current 'tile's LEFT edge
// (current 'ratio' points to RIGHT edges usage)
if (isHorizontalLayer && tile->x() >= 1) {
Tile* leftTile
= tg_->tiles()[tile->y() * tg_->tileCntX() + tile->x() - 1];
float leftRatio = getUsageCapacityRatio(
leftTile, layer, gGrid, rbVars_.ignoreEdgeRatio);
ratio = fmax(leftRatio, ratio);
}

// if vertical layer (i.e., horizontal edges)
// should consider DOWN tile's UP edge == current 'tile's DOWN edge
// (current 'ratio' points to UP edges usage)
if (!isHorizontalLayer && tile->y() >= 1) {
Tile* downTile
= tg_->tiles()[(tile->y() - 1) * tg_->tileCntX() + tile->x()];
float downRatio = getUsageCapacityRatio(
downTile, layer, gGrid, rbVars_.ignoreEdgeRatio);
ratio = fmax(downRatio, ratio);
}

ratio = fmax(ratio, 0.0f);

// update inflation Ratio
if (ratio >= rbVars_.minInflationRatio) {
float inflationRatio = pow(ratio, rbVars_.inflationRatioCoef);
Expand Down Expand Up @@ -773,8 +766,6 @@ float RouteBase::getRC() const

odb::dbGCellGrid* gGrid = db_->getChip()->getBlock()->getGCellGrid();
for (auto& tile : tg_->tiles()) {
int min_routing_layer = grouter_->getMinRoutingLayer();
int max_routing_layer = grouter_->getMaxRoutingLayer();
for (int i = 1; i <= tg_->numRoutingLayers(); i++) {
odb::dbTechLayer* layer = db_->getTech()->findRoutingLayer(i);
bool isHorizontalLayer
Expand All @@ -783,9 +774,6 @@ float RouteBase::getRC() const
// extract the ratio in the same way as inflation ratio cals
float ratio
= getUsageCapacityRatio(tile, layer, gGrid, rbVars_.ignoreEdgeRatio);
if (i < min_routing_layer || i > max_routing_layer) {
ratio = 0.0;
}

// escape the case when blockageRatio is too huge
if (ratio >= 0.0f) {
Expand Down
13 changes: 2 additions & 11 deletions src/grt/include/grt/GlobalRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,7 @@ class GlobalRouter : public ant::GlobalRouteSource
void setAdjustment(const float adjustment);
void setMinRoutingLayer(const int min_layer);
void setMaxRoutingLayer(const int max_layer);
int getMaxRoutingLayer() const
{
return std::max(max_routing_layer_, max_layer_for_clock_);
}
int getMaxRoutingLayer() const { return max_routing_layer_; }
void setMinLayerForClock(const int min_layer);
void setMaxLayerForClock(const int max_layer);
void setCriticalNetsPercentage(float critical_nets_percentage);
Expand All @@ -179,13 +176,7 @@ class GlobalRouter : public ant::GlobalRouteSource
void setAllowCongestion(bool allow_congestion);
void setMacroExtension(int macro_extension);
void setPinOffset(int pin_offset);
int getMinRoutingLayer() const
{
int min_layer = min_layer_for_clock_ > 0
? std::min(min_routing_layer_, min_layer_for_clock_)
: min_routing_layer_;
return min_layer;
}
int getMinRoutingLayer() const { return min_routing_layer_; }

// flow functions
void readGuides(const char* file_name);
Expand Down
16 changes: 10 additions & 6 deletions src/grt/src/GlobalRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ void GlobalRouter::globalRoute(bool save_guides,
max_routing_layer_ = computeMaxRoutingLayer();
}

int min_layer = getMinRoutingLayer();
int min_layer = min_layer_for_clock_ > 0
? std::min(min_routing_layer_, min_layer_for_clock_)
: min_routing_layer_;
int max_layer = std::max(max_routing_layer_, max_layer_for_clock_);

std::vector<Net*> nets = initFastRoute(min_layer, max_layer);
Expand Down Expand Up @@ -322,9 +324,7 @@ void GlobalRouter::globalRoute(bool save_guides,

void GlobalRouter::updateDbCongestion()
{
int min_layer = getMinRoutingLayer();
int max_layer = std::max(max_routing_layer_, max_layer_for_clock_);
fastroute_->updateDbCongestion(min_layer, max_layer);
fastroute_->updateDbCongestion();
heatmap_->update();
}

Expand Down Expand Up @@ -1457,7 +1457,9 @@ void GlobalRouter::initGridAndNets()
routes_.clear();
if (max_routing_layer_ == -1 || routing_layers_.empty()) {
max_routing_layer_ = computeMaxRoutingLayer();
int min_layer = getMinRoutingLayer();
int min_layer = min_layer_for_clock_ > 0
? std::min(min_routing_layer_, min_layer_for_clock_)
: min_routing_layer_;
int max_layer = std::max(max_routing_layer_, max_layer_for_clock_);

initRoutingLayers();
Expand Down Expand Up @@ -3041,7 +3043,9 @@ void GlobalRouter::findLayerExtensions(std::vector<int>& layer_extensions)
{
layer_extensions.resize(routing_layers_.size() + 1, 0);

int min_layer = getMinRoutingLayer();
int min_layer = min_layer_for_clock_ > 0
? std::min(min_routing_layer_, min_layer_for_clock_)
: min_routing_layer_;
int max_layer = std::max(max_routing_layer_, max_layer_for_clock_);

for (auto const& [level, obstruct_layer] : routing_layers_) {
Expand Down
2 changes: 1 addition & 1 deletion src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class FastRouteCore
NetRouteMap run();
int totalOverflow() const { return total_overflow_; }
bool has2Doverflow() const { return has_2D_overflow_; }
void updateDbCongestion(int min_routing_layer, int max_routing_layer);
void updateDbCongestion();
void findCongestedEdgesNets(NetsPerCongestedArea& nets_in_congested_edges,
bool vertical);
void getCongestionGrid(std::vector<CongestionInformation>& congestionGridV,
Expand Down
7 changes: 3 additions & 4 deletions src/grt/src/fastroute/src/FastRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,7 @@ NetRouteMap FastRouteCore::getPlanarRoutes()
return routes;
}

void FastRouteCore::updateDbCongestion(int min_routing_layer,
int max_routing_layer)
void FastRouteCore::updateDbCongestion()
{
auto block = db_->getChip()->getBlock();
auto db_gcell = block->getGCellGrid();
Expand All @@ -819,8 +818,8 @@ void FastRouteCore::updateDbCongestion(int min_routing_layer,
db_gcell->addGridPatternX(x_corner_, x_grid_, tile_size_);
db_gcell->addGridPatternY(y_corner_, y_grid_, tile_size_);
auto db_tech = db_->getTech();
for (int k = min_routing_layer - 1; k < max_routing_layer - 1; k++) {
auto layer = db_tech->findRoutingLayer(k);
for (int k = 0; k < num_layers_; k++) {
auto layer = db_tech->findRoutingLayer(k + 1);
if (layer == nullptr) {
continue;
}
Expand Down

0 comments on commit 777f77f

Please sign in to comment.