-
Notifications
You must be signed in to change notification settings - Fork 593
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
gpl: revert if diverge #6561
gpl: revert if diverge #6561
Changes from 16 commits
1b72d58
7f91020
60fd26c
bacb646
99a5025
c0e0f78
3432b5e
e43a0b7
f3dfd6d
492e7f0
1442c07
5879308
ea3dc03
170fa4b
b1272df
f01415c
a9a9d73
76bba71
a3baff2
b273e56
7236b71
cf2e9d9
53397c4
4893563
4d54af6
3a40747
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -318,14 +318,16 @@ int NesterovPlace::doNesterovPlace(int start_iter) | |
graphics_->cellPlot(true); | ||
} | ||
|
||
// snapshot saving detection | ||
bool isSnapshotSaved = false; | ||
|
||
// snapshot info | ||
float snapshotA = 0; | ||
float snapshotWlCoefX = 0, snapshotWlCoefY = 0; | ||
// routability snapshot info | ||
bool is_routability_snapshot_saved = false; | ||
float route_snapshotA = 0; | ||
float route_snapshotWlCoefX = 0, route_snapshotWlCoefY = 0; | ||
bool isDivergeTriedRevert = false; | ||
|
||
// divergence snapshot info | ||
float diverge_snapshotA = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'diverge_snapshotA' set but not used [clang-diagnostic-unused-but-set-variable] float diverge_snapshotA = 0;
^ |
||
float diverge_snapshotWlCoefX = 0, diverge_snapshotWlCoefY = 0; | ||
|
||
// backTracking variable. | ||
float curA = 1.0; | ||
|
||
|
@@ -342,7 +344,6 @@ int NesterovPlace::doNesterovPlace(int start_iter) | |
|
||
// here, prevA is a_(k), curA is a_(k+1) | ||
// See, the ePlace-MS paper's Algorithm 1 | ||
// | ||
curA = (1.0 + sqrt(4.0 * prevA * prevA + 1.0)) * 0.5; | ||
|
||
// coeff is (a_k - 1) / ( a_(k+1) ) in paper. | ||
|
@@ -412,9 +413,19 @@ int NesterovPlace::doNesterovPlace(int start_iter) | |
|
||
updateNextIter(iter); | ||
|
||
if (npVars_.allowRevertIfDiverge) { | ||
if (is_min_hpwl_) { | ||
diverge_snapshotWlCoefX = wireLengthCoefX_; | ||
diverge_snapshotWlCoefY = wireLengthCoefY_; | ||
diverge_snapshotA = curA; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Value stored to 'diverge_snapshotA' is never read [clang-analyzer-deadcode.DeadStores] diverge_snapshotA = curA;
^ Additional contextsrc/gpl/src/nesterovPlace.cpp:419: Value stored to 'diverge_snapshotA' is never read diverge_snapshotA = curA;
^ |
||
for (auto& nb : nbVec_) { | ||
nb->snapshot(); | ||
} | ||
} | ||
} | ||
|
||
// For JPEG Saving | ||
// debug | ||
|
||
const int debug_start_iter = npVars_.debug_start_iter; | ||
if (graphics_ && (debug_start_iter == 0 || iter + 1 >= debug_start_iter)) { | ||
bool update | ||
|
@@ -531,13 +542,10 @@ int NesterovPlace::doNesterovPlace(int start_iter) | |
if (!isDivergeTriedRevert && rb_->numCall() >= 1) { | ||
// get back to the working rc size | ||
rb_->revertGCellSizeToMinRc(); | ||
|
||
curA = snapshotA; | ||
wireLengthCoefX_ = snapshotWlCoefX; | ||
wireLengthCoefY_ = snapshotWlCoefY; | ||
|
||
curA = route_snapshotA; | ||
wireLengthCoefX_ = route_snapshotWlCoefX; | ||
wireLengthCoefY_ = route_snapshotWlCoefY; | ||
nbc_->updateWireLengthForceWA(wireLengthCoefX_, wireLengthCoefY_); | ||
|
||
for (auto& nb : nbVec_) { | ||
nb->revertDivergence(); | ||
} | ||
|
@@ -548,27 +556,47 @@ int NesterovPlace::doNesterovPlace(int start_iter) | |
isDivergeTriedRevert = true; | ||
// turn off the RD forcely | ||
isRoutabilityNeed_ = false; | ||
} else if (npVars_.allowRevertIfDiverge) { | ||
// In case diverged and not in routability mode, finish with min hpwl | ||
// stored since overflow below 0.25 | ||
log_->warn(GPL, | ||
90, | ||
"Divergence detected, reverting to snapshot with min hpwl."); | ||
log_->warn(GPL, | ||
91, | ||
"Revert to iter: {:4d} overflow: {:.3f} HPWL: {}", | ||
diverge_snapshot_iter_, | ||
diverge_snapshot_average_overflow_unscaled_, | ||
min_hpwl_); | ||
curA = diverge_snapshotA; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Value stored to 'curA' is never read [clang-analyzer-deadcode.DeadStores] curA = diverge_snapshotA;
^ Additional contextsrc/gpl/src/nesterovPlace.cpp:572: Value stored to 'curA' is never read curA = diverge_snapshotA;
^ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: Value stored to 'curA' is never read [clang-analyzer-deadcode.DeadStores] curA = diverge_snapshotA;
^ Additional contextsrc/gpl/src/nesterovPlace.cpp:570: Value stored to 'curA' is never read curA = diverge_snapshotA;
^ |
||
wireLengthCoefX_ = diverge_snapshotWlCoefX; | ||
wireLengthCoefY_ = diverge_snapshotWlCoefY; | ||
nbc_->updateWireLengthForceWA(wireLengthCoefX_, wireLengthCoefY_); | ||
for (auto& nb : nbVec_) { | ||
nb->revertDivergence(); | ||
} | ||
isDiverged_ = false; | ||
break; | ||
} else { | ||
// no way to revert | ||
break; | ||
} | ||
} | ||
|
||
if (!isSnapshotSaved && npVars_.routabilityDrivenMode | ||
if (!is_routability_snapshot_saved && npVars_.routabilityDrivenMode | ||
&& 0.6 >= average_overflow_unscaled_) { | ||
snapshotWlCoefX = wireLengthCoefX_; | ||
snapshotWlCoefY = wireLengthCoefY_; | ||
snapshotA = curA; | ||
isSnapshotSaved = true; | ||
route_snapshotWlCoefX = wireLengthCoefX_; | ||
route_snapshotWlCoefY = wireLengthCoefY_; | ||
route_snapshotA = curA; | ||
is_routability_snapshot_saved = true; | ||
|
||
for (auto& nb : nbVec_) { | ||
nb->snapshot(); | ||
} | ||
|
||
log_->report("[NesterovSolve] Snapshot saved at iter = {}", iter); | ||
log_->info(GPL, 88, "Routability snapshot saved at iter = {}", iter); | ||
} | ||
|
||
// check routability using GR | ||
// check routability using RUDY or GR | ||
if (npVars_.routabilityDrivenMode && isRoutabilityNeed_ | ||
&& npVars_.routabilityCheckOverflow >= average_overflow_unscaled_) { | ||
// recover the densityPenalty values | ||
|
@@ -582,17 +610,17 @@ int NesterovPlace::doNesterovPlace(int start_iter) | |
// cutFillerCoordinates(); | ||
|
||
// revert back the current density penality | ||
curA = snapshotA; | ||
wireLengthCoefX_ = snapshotWlCoefX; | ||
wireLengthCoefY_ = snapshotWlCoefY; | ||
curA = route_snapshotA; | ||
wireLengthCoefX_ = route_snapshotWlCoefX; | ||
wireLengthCoefY_ = route_snapshotWlCoefY; | ||
|
||
nbc_->updateWireLengthForceWA(wireLengthCoefX_, wireLengthCoefY_); | ||
|
||
for (auto& nb : nbVec_) { | ||
nb->revertDivergence(); | ||
nb->resetMinSumOverflow(); | ||
} | ||
log_->report("[NesterovSolve] Revert back to snapshot coordi"); | ||
log_->info(GPL, 89, "Routability: revert back to snapshot"); | ||
} | ||
} | ||
|
||
|
@@ -658,6 +686,19 @@ void NesterovPlace::updateNextIter(const int iter) | |
|
||
// For coefficient, using average regions' overflow | ||
updateWireLengthCoef(average_overflow_); | ||
|
||
// Update divergence snapshot | ||
if (npVars_.allowRevertIfDiverge) { | ||
int64_t hpwl = nbc_->getHpwl(); | ||
if (hpwl < min_hpwl_ && average_overflow_unscaled_ <= 0.25) { | ||
min_hpwl_ = hpwl; | ||
diverge_snapshot_average_overflow_unscaled_ = average_overflow_unscaled_; | ||
diverge_snapshot_iter_ = iter; | ||
is_min_hpwl_ = true; | ||
} else { | ||
is_min_hpwl_ = false; | ||
} | ||
} | ||
} | ||
|
||
void NesterovPlace::updateDb() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are going to flip this to on by default with a disable.