Repository navigation
drt: Fix 6 crashes/errors observed during detail_route - #12406
mikesinouye wants to merge 1 commit into
Conversation
Signed-off-by: Mike Inouye <mikeinouye@google.com>
There was a problem hiding this comment.
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.
| if (ignoreMinStep_) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
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.
| 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)); |
There was a problem hiding this comment.
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
- 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 islogger_->error(...)or an assert, never a silent default. (link)
|
Hi @lokesh-vutla, could you PTAL when you get a chance? |
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.
std::out_of_range(map::at)GCFixture.metal_width_via_map_cut_classin gcTest.cppSIGSEGV(null pointer dereference)Fixture.null_constraint_markerin gcTest.cppDRT-0073: no access point)TAFixture.pa_off_track_pin_with_min_stepin taTest.cppDRT-0255: failed to add access point paths)TAFixture.pa_nearby_grid_skips_half_trackin taTest.cppDRT-0085: no valid pattern)TAFixture.pa_conflicting_pins_fallback_patternin taTest.cppDRT-0206: connectivity error /DRT-0255)Fixture.boundary_merge_resets_ap_pathsegin gcTest.cppType of Change
Impact
Prevent segfaults and avoidable fatals in detail route.
Verification
./etc/Build.sh).