Skip to content

gpl: report HPWL after global placement - #11201

Draft
minjukim55 wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-gpl-hpwl-metric
Draft

gpl: report HPWL after global placement#11201
minjukim55 wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:secure-gpl-hpwl-metric

Conversation

@minjukim55

Copy link
Copy Markdown
Contributor

What

Global placement printed HPWL only inside its iteration table and wrote no wirelength metric, so neither the log nor a metrics file had a final global placement number. Now both:

[INFO GPL-1018] Final HPWL (um): 2597.56
"route__wirelength__estimated": 2597.56
void Replace::reportHpwlMetric()
{
  odb::dbBlock* block = db_->getChip()->getBlock();
  const int64_t hpwl = odb::WireLengthEvaluator(block).hpwl();
  log_->info(GPL, 1018, "Final HPWL (um): {:.2f}", block->dbuToMicrons(hpwl));
  log_->metric("route__wirelength__estimated", block->dbuToMicrons(hpwl));
}

Called at the end of Replace::doNesterovPlace(), after NesterovPlace::doNesterovPlace() has updated the db.

Why this name and this evaluator

route__wirelength__estimated measured with odb::WireLengthEvaluator is exactly what dpl reports (src/dpl/src/Opendp.cpp). Under ORFS metrics stages the two land as globalplace__route__wirelength__estimated and detailedplace__route__wirelength__estimated, measured the same way, so the gpl -> dpl HPWL delta is meaningful.

Testing

  • ctest -L " gpl ": 75/75 pass. 35 golden logs updated, each with exactly the one new line and nothing else, so placement results are unchanged.
  • openroad -metrics ... src/gpl/test/simple01.tcl writes "route__wirelength__estimated": 2597.56.

Note

global_placement -incremental runs nesterov up to twice, so the metric key can appear twice in one metrics file with the final value last (JSON readers keep the last). Same pattern grt already has with antenna_diodes_count.

Global placement printed HPWL only inside its iteration table, and wrote
no wirelength metric at all, so neither the log nor a metrics file had a
final global placement number to compare against the one dpl reports.

Report it both ways at the end of doNesterovPlace, measured with
odb::WireLengthEvaluator, the same evaluator dpl uses for the metric of
that name, so the global and detailed placement numbers are directly
comparable:

  [INFO GPL-1018] Final HPWL (um): 2597.56
  "route__wirelength__estimated": 2597.56

Golden logs updated for the new line, in src/gpl/test, src/odb/test and test/.

Signed-off-by: Minju Kim <mkim@precisioninno.com>
@minjukim55 minjukim55 self-assigned this Aug 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new method reportHpwlMetric to calculate, log, and record the final Half-Parameter Wire Length (HPWL) metric after global placement, updating various test expectations to reflect this new log output. The review feedback recommends adding defensive null checks for db_, the chip, and the block within reportHpwlMetric to prevent potential segmentation faults.

Comment thread src/gpl/src/replace.cpp
Comment on lines +437 to +443
void Replace::reportHpwlMetric()
{
odb::dbBlock* block = db_->getChip()->getBlock();
const int64_t hpwl = odb::WireLengthEvaluator(block).hpwl();
log_->info(GPL, 1018, "Final HPWL (um): {:.2f}", block->dbuToMicrons(hpwl));
log_->metric("route__wirelength__estimated", block->dbuToMicrons(hpwl));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To prevent potential segmentation faults, add defensive null checks for db_, db_->getChip(), and the retrieved block before attempting to evaluate the wire length.

void Replace::reportHpwlMetric()
{
  if (!db_ || !db_->getChip() || !db_->getChip()->getBlock()) {
    return;
  }
  odb::dbBlock* block = db_->getChip()->getBlock();
  const int64_t hpwl = odb::WireLengthEvaluator(block).hpwl();
  log_->info(GPL, 1018, "Final HPWL (um): {:.2f}", block->dbuToMicrons(hpwl));
  log_->metric("route__wirelength__estimated", block->dbuToMicrons(hpwl));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant