Skip to content

Commit

Permalink
early stop to avoid linear solver divergence
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang-Yihang committed Jul 10, 2023
1 parent 223ac19 commit aaa744f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dali/placer/global_placer/hpwl_optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ double B2BHpwlOptimizer::OptimizeQuadraticMetricX(double cg_stop_criterion) {
}
double evaluate_result = ckt_ptr_->WeightedHPWLX();
eval_history.push_back(evaluate_result);
if (evaluate_result < hpwl_early_stop_threshold_){
break;
}
//BOOST_LOG_TRIVIAL(info) <<" %d WeightedHPWLX: %e\n", i, evaluate_result);
if (eval_history.size() >= 3) {
bool is_converge = IsSeriesConverge(eval_history, 3, cg_stop_criterion);
Expand Down Expand Up @@ -465,6 +468,9 @@ double B2BHpwlOptimizer::OptimizeQuadraticMetricY(double cg_stop_criterion) {
}
double evaluate_result = ckt_ptr_->WeightedHPWLY();
eval_history.push_back(evaluate_result);
if (evaluate_result < hpwl_early_stop_threshold_){
break;
}
//BOOST_LOG_TRIVIAL(info) <<" %d WeightedHPWLY: %e\n", i, evaluate_result);
if (eval_history.size() >= 3) {
bool is_converge = IsSeriesConverge(eval_history, 3, cg_stop_criterion);
Expand Down Expand Up @@ -669,6 +675,9 @@ void B2BHpwlOptimizer::OptimizeHpwlXWithAnchor(int num_threads) {
BuildProblemWithAnchorX();
double evaluate_result = OptimizeQuadraticMetricX(cg_stop_criterion_);
eval_history_x.push_back(evaluate_result);
if (evaluate_result < hpwl_early_stop_threshold_){
break;
}
if (eval_history_x.size() >= 3) {
bool is_converge = IsSeriesConverge(
eval_history_x,
Expand Down Expand Up @@ -722,6 +731,9 @@ void B2BHpwlOptimizer::OptimizeHpwlYWithAnchor(int num_threads) {
double evaluate_result =
OptimizeQuadraticMetricY(cg_stop_criterion_);
eval_history_y.push_back(evaluate_result);
if (evaluate_result < hpwl_early_stop_threshold_){
break;
}
if (eval_history_y.size() >= 3) {
bool is_converge = IsSeriesConverge(
eval_history_y,
Expand Down
2 changes: 2 additions & 0 deletions dali/placer/global_placer/hpwl_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class B2BHpwlOptimizer : public HpwlOptimizer {
double width_epsilon_ = 1e-5;
// this value will be set to 1/epsilon_factor_ times the average movable cell height
double height_epsilon_ = 1e-5;
// early stop threshold
double hpwl_early_stop_threshold_ = 1.0;

std::vector<int> Ax_row_size;
std::vector<int> Ay_row_size;
Expand Down

0 comments on commit aaa744f

Please sign in to comment.