Skip to content

Commit

Permalink
grt: use vectors instead of array for large containers
Browse files Browse the repository at this point in the history
Signed-off-by: Eder Monteiro <[email protected]>
  • Loading branch information
eder-matheus committed Jan 26, 2024
1 parent b5648be commit c13da34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/grt/src/fastroute/src/RSMT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void FastRouteCore::copyStTree(const int ind, const Tree& rsmt)

// initialize the nbrcnt for treenodes
const int sizeV = 2 * nets_[ind]->getNumPins();
int nbrcnt[sizeV];
std::vector<int> nbrcnt(sizeV);
for (int i = 0; i < numnodes; i++)
nbrcnt[i] = 0;

Expand Down
18 changes: 10 additions & 8 deletions src/grt/src/fastroute/src/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,7 @@ float FastRouteCore::CalculatePartialSlack()
auto partial_routes = getPlanarRoutes();

std::vector<float> slacks;
slacks.reserve(netCount());
for (auto& net_route : partial_routes) {
odb::dbNet* db_net = net_route.first;
GRoute& route = net_route.second;
Expand Down Expand Up @@ -2085,12 +2086,13 @@ int FastRouteCore::edgeShift(Tree& t, int net)

// TODO: check this size
const int sizeV = 2 * nets_[net]->getNumPins();
int nbr[sizeV][3];
int nbrCnt[sizeV];
int pairN1[nets_[net]->getNumPins()];
int pairN2[nets_[net]->getNumPins()];
int costH[y_grid_];
int costV[x_grid_];
multi_array<int, 2> nbr;
nbr.resize(boost::extents[sizeV][3]);
std::vector<int> nbrCnt(sizeV);
std::vector<int> pairN1(nets_[net]->getNumPins());
std::vector<int> pairN2(nets_[net]->getNumPins());
std::vector<int> costH(y_grid_);
std::vector<int> costV(x_grid_);

deg = t.deg;
// find root of the tree
Expand Down Expand Up @@ -2422,8 +2424,8 @@ int FastRouteCore::edgeShiftNew(Tree& t, int net)
deg = t.deg;

const int sizeV = nets_[net]->getNumPins();
int pairN1[sizeV];
int pairN2[sizeV];
std::vector<int> pairN1(sizeV);
std::vector<int> pairN2(sizeV);

iter = 0;
cur_pairN1 = cur_pairN2 = -1;
Expand Down

0 comments on commit c13da34

Please sign in to comment.