Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#4576 from eder-matheus/grt_st…
Browse files Browse the repository at this point in the history
…atic_limits

grt: remove arrays with static size
  • Loading branch information
eder-matheus authored Jan 25, 2024
2 parents bc92882 + 81f2a31 commit b5648be
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 287 deletions.
12 changes: 5 additions & 7 deletions src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,9 @@ class FastRouteCore
int n2,
std::vector<TreeEdge>& treeedges,
int edge_n1n2,
int gridsX_n1n2[],
int gridsY_n1n2[],
int gridsL_n1n2[]);
std::vector<int>& gridsX_n1n2,
std::vector<int>& gridsY_n1n2,
std::vector<int>& gridsL_n1n2);
void updateRouteType13D(int netID,
std::vector<TreeNode>& treenodes,
int n1,
Expand Down Expand Up @@ -473,7 +473,8 @@ class FastRouteCore
int k,
int l,
bool horizontal,
int& best_cost);
int& best_cost,
multi_array<int, 2>& layer_grid);
bool skipNet(int netID);
void assignEdge(int netID, int edgeID, bool processDIR);
void recoverEdge(int netID, int edgeID);
Expand Down Expand Up @@ -507,7 +508,6 @@ class FastRouteCore

typedef std::tuple<int, int, int> Tile;

static const int MAXLEN = 20000;
static const int BIG_INT = 1e9; // big integer used as infinity
static const int HCOST = 5000;

Expand Down Expand Up @@ -589,8 +589,6 @@ class FastRouteCore
multi_array<Edge3D, 3> h_edges_3D_; // The way it is indexed is (Layer, Y, X)
multi_array<Edge3D, 3> v_edges_3D_; // The way it is indexed is (Layer, Y, X)
multi_array<int, 2> corr_edge_;
multi_array<int, 2> layer_grid_;
multi_array<int, 2> via_link_;
multi_array<short, 2> parent_x1_;
multi_array<short, 2> parent_y1_;
multi_array<short, 2> parent_x3_;
Expand Down
6 changes: 0 additions & 6 deletions src/grt/src/fastroute/src/FastRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ void FastRouteCore::clear()
v_capacity_3D_.clear();
h_capacity_3D_.clear();

layer_grid_.resize(boost::extents[0][0]);
via_link_.resize(boost::extents[0][0]);

cost_hvh_.clear();
cost_vhv_.clear();
cost_h_.clear();
Expand Down Expand Up @@ -196,9 +193,6 @@ void FastRouteCore::setGridsAndLayers(int x, int y, int nLayers)
last_row_h_capacity_3D_[i] = 0;
}

layer_grid_.resize(boost::extents[num_layers_][MAXLEN]);
via_link_.resize(boost::extents[num_layers_][MAXLEN]);

hv_.resize(boost::extents[y_range_][x_range_]);
hyper_v_.resize(boost::extents[y_range_][x_range_]);
hyper_h_.resize(boost::extents[y_range_][x_range_]);
Expand Down
57 changes: 37 additions & 20 deletions src/grt/src/fastroute/src/maze3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,49 +388,56 @@ int FastRouteCore::copyGrids3D(std::vector<TreeNode>& treenodes,
int n2,
std::vector<TreeEdge>& treeedges,
int edge_n1n2,
int gridsX_n1n2[],
int gridsY_n1n2[],
int gridsL_n1n2[])
std::vector<int>& gridsX_n1n2,
std::vector<int>& gridsY_n1n2,
std::vector<int>& gridsL_n1n2)
{
const int n1x = treenodes[n1].x;
const int n1y = treenodes[n1].y;
const int n1l = treenodes[n1].botL;
const int routelen = treeedges[edge_n1n2].route.routelen;

if (routelen > 0) {
gridsX_n1n2.reserve(routelen + 1);
gridsY_n1n2.reserve(routelen + 1);
gridsL_n1n2.reserve(routelen + 1);
}

int cnt = 0;
if (treeedges[edge_n1n2].n1 == n1) { // n1 is the first node of (n1, n2)
if (treeedges[edge_n1n2].route.routelen > 0) {
for (int i = 0; i <= treeedges[edge_n1n2].route.routelen; i++) {
gridsX_n1n2[cnt] = treeedges[edge_n1n2].route.gridsX[i];
gridsY_n1n2[cnt] = treeedges[edge_n1n2].route.gridsY[i];
gridsL_n1n2[cnt] = treeedges[edge_n1n2].route.gridsL[i];
gridsX_n1n2.push_back(treeedges[edge_n1n2].route.gridsX[i]);
gridsY_n1n2.push_back(treeedges[edge_n1n2].route.gridsY[i]);
gridsL_n1n2.push_back(treeedges[edge_n1n2].route.gridsL[i]);
cnt++;
}
} // MazeRoute
else
// NoRoute
{
fflush(stdout);
gridsX_n1n2[cnt] = n1x;
gridsY_n1n2[cnt] = n1y;
gridsL_n1n2[cnt] = n1l;
gridsX_n1n2.push_back(n1x);
gridsY_n1n2.push_back(n1y);
gridsL_n1n2.push_back(n1l);
cnt++;
}
} // if n1 is the first node of (n1, n2)
else // n2 is the first node of (n1, n2)
{
if (treeedges[edge_n1n2].route.routelen > 0) {
for (int i = treeedges[edge_n1n2].route.routelen; i >= 0; i--) {
gridsX_n1n2[cnt] = treeedges[edge_n1n2].route.gridsX[i];
gridsY_n1n2[cnt] = treeedges[edge_n1n2].route.gridsY[i];
gridsL_n1n2[cnt] = treeedges[edge_n1n2].route.gridsL[i];
gridsX_n1n2.push_back(treeedges[edge_n1n2].route.gridsX[i]);
gridsY_n1n2.push_back(treeedges[edge_n1n2].route.gridsY[i]);
gridsL_n1n2.push_back(treeedges[edge_n1n2].route.gridsL[i]);
cnt++;
}
} // MazeRoute
else // NoRoute
{
gridsX_n1n2[cnt] = n1x;
gridsY_n1n2[cnt] = n1y;
gridsL_n1n2[cnt] = n1l;
gridsX_n1n2.push_back(n1x);
gridsY_n1n2.push_back(n1y);
gridsL_n1n2.push_back(n1l);
cnt++;
} // MazeRoute
}
Expand All @@ -449,8 +456,12 @@ void FastRouteCore::updateRouteType13D(int netID,
int edge_n1A1,
int edge_n1A2)
{
int gridsX_n1A1[MAXLEN], gridsY_n1A1[MAXLEN], gridsL_n1A1[MAXLEN],
gridsX_n1A2[MAXLEN], gridsY_n1A2[MAXLEN], gridsL_n1A2[MAXLEN];
std::vector<int> gridsX_n1A1;
std::vector<int> gridsY_n1A1;
std::vector<int> gridsL_n1A1;
std::vector<int> gridsX_n1A2;
std::vector<int> gridsY_n1A2;
std::vector<int> gridsL_n1A2;

// copy all the grids on (n1, A1) and (n2, A2) to tmp arrays, and keep the
// grids order A1->n1->A2 copy (n1, A1)
Expand Down Expand Up @@ -671,9 +682,15 @@ void FastRouteCore::updateRouteType23D(int netID,
int edge_C1C2)
{
int cnt;
int gridsX_n1A1[MAXLEN], gridsY_n1A1[MAXLEN], gridsL_n1A1[MAXLEN];
int gridsX_n1A2[MAXLEN], gridsY_n1A2[MAXLEN], gridsL_n1A2[MAXLEN];
int gridsX_C1C2[MAXLEN], gridsY_C1C2[MAXLEN], gridsL_C1C2[MAXLEN];
std::vector<int> gridsX_n1A1;
std::vector<int> gridsY_n1A1;
std::vector<int> gridsL_n1A1;
std::vector<int> gridsX_n1A2;
std::vector<int> gridsY_n1A2;
std::vector<int> gridsL_n1A2;
std::vector<int> gridsX_C1C2;
std::vector<int> gridsY_C1C2;
std::vector<int> gridsL_C1C2;

const int A1x = treenodes[A1].x;
const int A1y = treenodes[A1].y;
Expand Down
Loading

0 comments on commit b5648be

Please sign in to comment.