grt: Add HPWL and Detour Ratio metrics to CUGR statistics#9829
grt: Add HPWL and Detour Ratio metrics to CUGR statistics#9829Divinesoumyadip wants to merge 3 commits intoThe-OpenROAD-Project:masterfrom
Conversation
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>
There was a problem hiding this comment.
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.
| 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); | ||
| } |
There was a problem hiding this comment.
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); }| updated_nets_.insert(db_net); | ||
| } | ||
| | ||
| void CUGR::removeRouteUsage(odb::dbNet* db_net) |
There was a problem hiding this comment.
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>
| clang-tidy review says "All clean, LGTM! 👍" |
| clang-tidy review says "All clean, LGTM! 👍" |
This PR introduces new observability metrics to the
CUGRengine 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::printStatisticsto aggregate HPWL for all nets usingnet->getBoundingBox().hp().Implemented logic to compute and report theAverage Detour Ratioalongside existing wire length and via count statistics.(Included from previous branch) Refreshes timing data and sorts critical nets during thererouteNetsincremental pass.