gpl: report HPWL after global placement - #11201
Draft
minjukim55 wants to merge 1 commit into
Draft
Conversation
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>
Contributor
There was a problem hiding this comment.
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 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)); | ||
| } |
Contributor
There was a problem hiding this comment.
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));
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Called at the end of
Replace::doNesterovPlace(), afterNesterovPlace::doNesterovPlace()has updated the db.Why this name and this evaluator
route__wirelength__estimatedmeasured withodb::WireLengthEvaluatoris exactly what dpl reports (src/dpl/src/Opendp.cpp). Under ORFS metrics stages the two land asglobalplace__route__wirelength__estimatedanddetailedplace__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.tclwrites"route__wirelength__estimated": 2597.56.Note
global_placement -incrementalruns 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 withantenna_diodes_count.