Skip to content

DRT reroute#10800

Open
osamahammad21 wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
osamahammad21:drt-reroute
Open

DRT reroute#10800
osamahammad21 wants to merge 2 commits into
The-OpenROAD-Project:masterfrom
osamahammad21:drt-reroute

Conversation

@osamahammad21

Copy link
Copy Markdown
Member

Summary

  • Add a detailed-routing mode that reroutes an already-routed design from its existing DRC markers.
  • io::Parser::setMarkers() reads markers from the "DRC" marker category in the DB and creates frMarkers using each layer's recheck constraint, so DRT re-runs its own DRC over the marked regions and reroutes them.
  • frRegionQuery::init() now registers the block's markers into the marker RTree so workers pick them up.
  • FlexDR::main(): strategy loop is index-based on iter_; when the loaded design has DRC markers, routing resumes from REROUTE_VIOLATIONS_START_ITER (default 3), skipping the initial full rip-up passes.
  • New config RouterConfiguration::REROUTE_VIOLATIONS_START_ITER (serialized for distributed mode).
  • Add ispd18_sample_reroute regression test (registered in CMake + Bazel).

Type of Change

  • New feature

Impact

  • With no DRC markers in the DB, behavior is unchanged (normal routing from iteration 0).
  • With DRC markers present, detailed_route imports them and reroutes only the violating regions, starting from iteration 3.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

Related Issues

  • N/A

osamahammad21 added 2 commits July 1, 2026 13:15
Signed-off-by: osamahammad21 <osama@precisioninno.com>
Signed-off-by: osamahammad21 <osama@precisioninno.com>
@osamahammad21 osamahammad21 requested a review from a team as a code owner July 2, 2026 12:04
@osamahammad21 osamahammad21 requested a review from maliberty July 2, 2026 12:04
@github-actions github-actions Bot added the size/M label Jul 2, 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 enables detailed routing to resume from a configured iteration (skipping initial rip-up passes) when DRC markers are already present in the loaded design. It implements database parsing of DRC markers, registers them in the region query, and aligns the routing strategy loop with the starting iteration. The review feedback highlights three key areas for improvement: resolving a potential memory leak/overhead by clearing gcell2BoundaryPin_ when resuming from an iteration greater than 0, preventing undefined behavior/out-of-bounds access if iter_ is negative, and ensuring DRC markers on cut layers are not silently ignored by falling back to the layer's short constraint when the recheck constraint is null.

Comment thread src/drt/src/dr/FlexDR.cpp
Comment on lines +1971 to +1982
const int num_db_markers = getDesign()->getTopBlock()->getNumMarkers();
if (num_db_markers > 0) {
iter_ = router_cfg_->REROUTE_VIOLATIONS_START_ITER;
if (router_cfg_->VERBOSE > 0) {
logger_->info(DRT,
627,
"Found {} DRC marker(s) in the database; resuming detailed "
"routing from iteration {}.",
num_db_markers,
iter_);
}
}

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.

high

If iter_ starts at REROUTE_VIOLATIONS_START_ITER (which is greater than 0), the boundary pin query data structure gcell2BoundaryPin_ is initialized in init() but never cleared, because removeGCell2BoundaryPin() is only called at the end of iteration 0 (when !iter_ is true). This results in a significant memory overhead/leak for the entire routing process.

To prevent this, we should immediately clear gcell2BoundaryPin_ if we resume from an iteration greater than 0.

  const int num_db_markers = getDesign()->getTopBlock()->getNumMarkers();
  if (num_db_markers > 0) {
    iter_ = std::max(0, router_cfg_->REROUTE_VIOLATIONS_START_ITER);
    if (iter_ > 0) {
      removeGCell2BoundaryPin();
    }
    if (router_cfg_->VERBOSE > 0) {
      logger_->info(DRT,
                    627,
                    "Found {} DRC marker(s) in the database; resuming detailed "
                    "routing from iteration {}.",
                    num_db_markers,
                    iter_);
    }
  }

Comment thread src/drt/src/dr/FlexDR.cpp
= strategy(router_cfg_->ROUTESHAPECOST, router_cfg_->MARKERCOST);
// iter_ may start > 0 when resuming from imported DRC markers; index the
// strategy table by iter_ so the per-iteration parameters stay aligned.
while (iter_ < static_cast<int>(search_repair_args.size())) {

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

If iter_ is configured to a negative value, the loop condition iter_ < static_cast<int>(search_repair_args.size()) will evaluate to true, but accessing search_repair_args[iter_] inside the loop will result in an out-of-bounds vector access. We should ensure iter_ >= 0 in the loop condition to prevent undefined behavior.

  while (iter_ >= 0 && iter_ < static_cast<int>(search_repair_args.size())) {

Comment thread src/drt/src/io/io.cpp
Comment on lines +1369 to +1372
auto* recheck = layer->getRecheckConstraint();
if (recheck == nullptr) {
continue;
}

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

DRC markers on cut layers (vias) will be silently ignored because cut layers do not have a recheck constraint configured (unlike routing layers). To support rechecking and rerouting via violations, we should fall back to using the layer's short constraint if the recheck constraint is null.

Suggested change
auto* recheck = layer->getRecheckConstraint();
if (recheck == nullptr) {
continue;
}
auto* recheck = layer->getRecheckConstraint();
if (recheck == nullptr) {
recheck = layer->getShortConstraint();
}
if (recheck == nullptr) {
continue;
}

@osamahammad21 osamahammad21 changed the title Drt reroute DRT reroute Jul 2, 2026
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