Skip to content

drt: Fix 6 crashes/errors observed during detail_route - #12406

Open
mikesinouye wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
mikesinouye:drt
Open

mikesinouye wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
mikesinouye:drt

Conversation

@mikesinouye

Copy link
Copy Markdown
Contributor

Summary

For my PDK, I observed these 6 crashes/errors while running DRT. This PR merges all fixes together, each fix in isolation is fairly small so hope that's OK. 6 C++ unit tests are also added to demonstrate/catch these issues.

Observation General Conditions______________________ Files Test
Uncaught std::out_of_range (map::at) A technology LEF defines metal-width via-map rules that reference a via cut class or a via definition not imported into the router technology database. frTechObject.h, FlexGC_cut.cpp, FlexPA_acc_point.cpp GCFixture.metal_width_via_map_cut_class in gcTest.cpp
SIGSEGV (null pointer dereference) A marker without an associated design-rule constraint pointer is present in the block when a detail-route worker initializes or runs shape patching. FlexDR_init.cpp, FlexGC_main.cpp Fixture.null_constraint_marker in gcTest.cpp
Fatal error (DRT-0073: no access point) A standard-cell pin on a via-access or right-way-on-grid-only layer has no routing track intersecting its pin geometry and its synthetic access probe is shorter than the upper layer's minimum-step rule. FlexGC.h, FlexGC_impl.h, FlexGC.cpp, FlexGC_main.cpp, FlexPA.h, FlexPA_acc_point.cpp TAFixture.pa_off_track_pin_with_min_step in taTest.cpp
Fatal error (DRT-0255: failed to add access point paths) An off-track pin falls closer to a half-pitch midpoint between routing tracks than to a full routing track during nearby-grid access-point search on a right-way-on-grid-only upper layer. FlexPA_acc_point.cpp TAFixture.pa_nearby_grid_skips_half_track in taTest.cpp
Fatal error (DRT-0085: no valid pattern) Every candidate pin-access combination across the pins of a densely packed cell instance produces an intra-cell DRC conflict. FlexPA_acc_pattern.cpp TAFixture.pa_conflicting_pins_fallback_pattern in taTest.cpp
Fatal error (DRT-0206: connectivity error / DRT-0255) An off-grid pin-access stub segment is split, merged with an adjacent wire, or crosses a detail-route worker tile boundary across routing iterations. frShape.h, FlexDR.h, FlexDR_conn.cpp, FlexDR_end.cpp, FlexDR_init.cpp Fixture.boundary_merge_resets_ap_pathseg in gcTest.cpp

Type of Change

  • Bug fix

Impact

Prevent segfaults and avoidable fatals in detail route.

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).

Signed-off-by: Mike Inouye <mikeinouye@google.com>
@mikesinouye
mikesinouye requested a review from a team as a code owner November 21, 2026 00:23
@mikesinouye
mikesinouye requested a review from bnmfw November 21, 2026 00:23

@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 several updates to the detail router and pin access (PA) modules, including resetting the AP path segment flag during splits and merges, adding support to ignore min-step constraints in the design rule checker (DRC), and implementing a fallback pattern in PA when no valid pattern is found. It also adds null checks for marker constraints to prevent crashes. The review feedback highlights a missing ignoreMinStep_ guard in checkMetalShape_lef58MinStep_minAdjLength and raises concerns about potential downstream null pointer dereferences caused by adding nullptr to the fallback pattern in FlexPA.

Comment on lines +1909 to +1911
if (ignoreMinStep_) {
return;
}

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

The ignoreMinStep_ guard is added to checkMetalShape_lef58MinStep and checkMetalShape_minStep, but it appears to be missing from checkMetalShape_lef58MinStep_minAdjLength. Since checkMetalShape_lef58MinStep_minAdjLength is also a min-step rule, it should also be guarded by ignoreMinStep_ to prevent false violations during pin access (PA) when min-step rules are ignored.

Comment on lines +101 to +112
auto fallback_pattern = std::make_unique<FlexPinAccessPattern>();
for (auto& inst_term : unique_inst->getInstTerms()) {
if (isSkipInstTerm(inst_term.get())) {
continue;
}
for (size_t i = 0; i < inst_term->getTerm()->getPins().size(); i++) {
fallback_pattern->addAccessPoint(nullptr);
}
}
fallback_pattern->updateCost();
unique_inst_patterns_.at(unique_insts_.getUniqueClass(unique_inst))
.push_back(std::move(fallback_pattern));

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

Adding nullptr to the fallback pattern can lead to downstream SIGSEGV crashes in FlexDR if the detail router attempts to access the properties of these null access points (e.g., calling ap->getPoint()). According to the repository style guide, reachable null dereferences must be reported with a loud failure (e.g., logger_->error(...) or an assert) rather than being silently ignored or causing a crash. Please ensure that any downstream code accessing these access points is either guaranteed to fail loudly on nullptr or that the fallback pattern is handled safely without silent defaults.

References
  1. Never suggest a guard that hides an impossible state: a null check... that returns a default, skips, clamps, continues or logs a warning and carries on. A null dereference that is reachable is reported with its triggering input; the fix is logger_->error(...) or an assert, never a silent default. (link)

@mikesinouye

Copy link
Copy Markdown
Contributor Author

Hi @lokesh-vutla, could you PTAL when you get a chance?

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