Skip to content

grt: Add HPWL and Detour Ratio metrics to CUGR statistics#9829

Open
Divinesoumyadip wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:grt-cugr-detour-metrics
Open

grt: Add HPWL and Detour Ratio metrics to CUGR statistics#9829
Divinesoumyadip wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
Divinesoumyadip:grt-cugr-detour-metrics

Conversation

@Divinesoumyadip
Copy link
Contributor

This PR introduces new observability metrics to the CUGR engine by tracking the Half-Parameter Wire Length (HPWL) and reporting the Average Detour Ratio in the routing statistics.MotivationWhile the router currently reports wire length, it lacks a baseline to quantify routing quality. By calculating the HPWL (the ideal Manhattan distance) for every net, we can now derive the Detour Ratio.
This metric is essential for quantifying the impact of congestion on routing detours.Measuring the effectiveness of timing-driven sorting heuristics.Benchmarking routing quality across different design sizes.
Updated CUGR::printStatistics to aggregate HPWL for all nets using net->getBoundingBox().hp().Implemented logic to compute and report the Average Detour Ratio alongside existing wire length and via count statistics.(Included from previous branch) Refreshes timing data and sorts critical nets during thererouteNetsincremental pass.

Adds HPWL tracking and detour ratio reporting. This allows for quantitative measurement of routing quality relative to the Manhattan ideal. Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
Copy link
Contributor

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

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 valuable observability metrics, HPWL and Average Detour Ratio, to the CUGR engine, which will aid in quantifying routing quality. Additionally, it enhances the incremental routing flow by refreshing timing data and re-prioritizing critical nets during the rerouteNets pass.

The implementation is mostly sound, but I've identified one area for improvement regarding the freshness of timing data in the incremental reroute logic. Please see my specific comment for details.

Comment on lines +698 to +706
if (sta_ != nullptr) {
for (const int idx : net_indices) {
odb::dbNet* db_net = gr_nets_[idx]->getDbNet();
float slack = getNetSlack(db_net);
gr_nets_[idx]->setSlack(slack);
}
// 3. Sort: Most negative slack (critical) nets go FIRST
sortNetIndices(net_indices);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

To ensure that you are using fresh slack values for sorting, it's important to trigger a parasitics estimation before querying for slacks. The current implementation may be using stale timing data because the routing for these nets has just been ripped up.

A similar function, calculatePartialSlack, calls callback_handler_->triggerOnEstimateParasiticsRequired() before getting net slacks. I recommend adding this call here as well to ensure the slacks reflect the current state of the design.

 if (sta_ != nullptr) { callback_handler_->triggerOnEstimateParasiticsRequired(); for (const int idx : net_indices) { odb::dbNet* db_net = gr_nets_[idx]->getDbNet(); float slack = getNetSlack(db_net); gr_nets_[idx]->setSlack(slack); } // 3. Sort: Most negative slack (critical) nets go FIRST sortNetIndices(net_indices); }
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

updated_nets_.insert(db_net);
}

void CUGR::removeRouteUsage(odb::dbNet* db_net)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: out-of-line definition of 'removeRouteUsage' does not match any declaration in 'grt::CUGR' [clang-diagnostic-error]

void CUGR::removeRouteUsage(odb::dbNet* db_net) ^
Declares removeRouteUsage in CUGR.h to fix build errors and triggers parasitic estimation before querying net slacks. Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
Signed-off-by: Divinesoumyadip <soumyacode7@gmail.com>
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@eder-matheus eder-matheus self-requested a review March 19, 2026 13:15
@github-actions
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

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

Labels

None yet

1 participant