Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grt: getCost refactor and mazeRouteMSMD relax grids refactor #5906

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/grt/src/fastroute/include/FastRoute.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ struct parent3D
int x, y;
};

struct CostParams
{
const float logistic_coef;
const float cost_height;
const int slope;

CostParams(const float logistic_coef,
const float cost_height,
const int slope)
: logistic_coef(logistic_coef), cost_height(cost_height), slope(slope)
{
}
};

class FastRouteCore
{
public:
Expand Down Expand Up @@ -253,17 +267,15 @@ class FastRouteCore

// maze functions
// Maze-routing in different orders
double getCost(int index, bool is_horizontal, const CostParams& cost_params);
void mazeRouteMSMD(const int iter,
const int expand,
const float cost_height,
const int ripup_threshold,
const int maze_edge_threshold,
const bool ordering,
const int cost_type,
const float logis_cof,
const int via,
const int slope,
const int L,
const CostParams& cost_params,
float& slack_th);
void convertToMazeroute();
void updateCongestionHistory(int up_type, bool stop_decreasing, int& max_adj);
Expand Down
42 changes: 16 additions & 26 deletions src/grt/src/fastroute/src/FastRoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ NetRouteMap FastRouteCore::run()
const int mazeRound = 500;
int bmfl = BIG_INT;
int minofl = BIG_INT;
float LOGIS_COF = 0;
float logistic_coef = 0;
int slope;
int max_adj;

Expand Down Expand Up @@ -1053,23 +1053,22 @@ NetRouteMap FastRouteCore::run()
costheight_ = COSHEIGHT;
if (maxOverflow > 700) {
costheight_ = 8;
LOGIS_COF = 1.33;
logistic_coef = 1.33;
VIA = 0;
THRESH_M = 0;
CSTEP1 = 30;
}

for (int i = 0; i < LVIter; i++) {
LOGIS_COF = std::max<float>(2.0 / (1 + log(maxOverflow)), LOGIS_COF);
LOGIS_COF = 2.0 / (1 + log(maxOverflow));
logistic_coef = 2.0 / (1 + log(maxOverflow));
debugPrint(logger_,
GRT,
"patternRouting",
1,
"LV routing round {}, enlarge {}.",
i,
enlarge_);
routeMonotonicAll(newTH, enlarge_, LOGIS_COF);
routeMonotonicAll(newTH, enlarge_, logistic_coef);

past_cong = getOverflow2Dmaze(&maxOverflow, &tUsage);

Expand All @@ -1094,7 +1093,6 @@ NetRouteMap FastRouteCore::run()

slope = 20;
L = 1;
int cost_type = 1;

InitLastUsage(upType);
if (total_overflow_ > 0 && overflow_iterations_ > 0 && verbose_) {
Expand Down Expand Up @@ -1151,20 +1149,17 @@ NetRouteMap FastRouteCore::run()
slope = BIG_INT;
if (i == 5) {
VIA = 0;
LOGIS_COF = 1.33;
logistic_coef = 1.33;
ripup_threshold = -1;
// cost_type = 3;

} else if (i > 6) {
if (i % 2 == 0) {
LOGIS_COF += 0.5;
logistic_coef += 0.5;
}
if (i > 40) {
break;
}
}
if (i > 10) {
cost_type = 1;
ripup_threshold = 0;
}
}
Expand All @@ -1174,10 +1169,11 @@ NetRouteMap FastRouteCore::run()
mazeedge_threshold_ = THRESH_M;

if (upType == 3) {
LOGIS_COF
= std::max<float>(2.0 / (1 + log(maxOverflow + max_adj)), LOGIS_COF);
logistic_coef = std::max<float>(2.0 / (1 + log(maxOverflow + max_adj)),
logistic_coef);
} else {
LOGIS_COF = std::max<float>(2.0 / (1 + log(maxOverflow)), LOGIS_COF);
logistic_coef
= std::max<float>(2.0 / (1 + log(maxOverflow)), logistic_coef);
}

if (i == 8) {
Expand All @@ -1196,17 +1192,15 @@ NetRouteMap FastRouteCore::run()
L = 0;
}

auto cost_params = CostParams(logistic_coef, costheight_, slope);
mazeRouteMSMD(i,
enlarge_,
costheight_,
ripup_threshold,
mazeedge_threshold_,
!(i % 3),
cost_type,
LOGIS_COF,
VIA,
slope,
L,
cost_params,
slack_th);
int last_cong = past_cong;
past_cong = getOverflow2Dmaze(&maxOverflow, &tUsage);
Expand Down Expand Up @@ -1236,17 +1230,15 @@ NetRouteMap FastRouteCore::run()
upType = 3;
stopDEC = true;
slope = 5;
auto cost_params = CostParams(logistic_coef, costheight_, slope);
mazeRouteMSMD(i,
enlarge_,
costheight_,
ripup_threshold,
mazeedge_threshold_,
!(i % 3),
cost_type,
LOGIS_COF,
VIA,
slope,
L,
cost_params,
slack_th);
last_cong = past_cong;
past_cong = getOverflow2Dmaze(&maxOverflow, &tUsage);
Expand Down Expand Up @@ -1287,17 +1279,15 @@ NetRouteMap FastRouteCore::run()
bmfl = past_cong;

L = 0;
auto cost_params = CostParams(logistic_coef, costheight_, slope);
mazeRouteMSMD(i,
enlarge_,
costheight_,
ripup_threshold,
mazeedge_threshold_,
!(i % 3),
cost_type,
LOGIS_COF,
VIA,
slope,
L,
cost_params,
slack_th);
last_cong = past_cong;
past_cong = getOverflow2Dmaze(&maxOverflow, &tUsage);
Expand Down
Loading
Loading