Skip to content

DRT: Fix track assignment spacing cost#10503

Merged
osamahammad21 merged 6 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:TR-fix-ta-cost
Jun 3, 2026
Merged

DRT: Fix track assignment spacing cost#10503
osamahammad21 merged 6 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:TR-fix-ta-cost

Conversation

@openroad-ci

Copy link
Copy Markdown
Member

Summary

After implementing the unit tests for Track assignment in DRT, a bug was discovered in Track assignment costing that led to incorrectly dismiss costing tracks in the disallowed spacing vicinity of the assigned track.

Type of Change

  • Bug fix

Impact

Number of designs: 63

"------------------------------"
Failing designs
"------------------------------"
asap7 mock-alu (base)
Flow reached last stage.
Found 1 metrics failures.
[ERROR] finish__timing__setup__tns fail test: -18422.2 >= -18400

asap7 swerv_wrapper (base)
Flow reached last stage.
Found 1 metrics failures.
[ERROR] finish__timing__setup__tns fail test: -47674.7 >= -47000

nangate45 tinyRocket (base)
Flow reached last stage.
Found 1 metrics failures.
[ERROR] finish__timing__setup__tns fail test: -46.3923 >= -46

sky130hd microwatt (base)
Flow reached last stage.
Found 2 metrics failures.
[ERROR] detailedroute__antenna__violating__nets fail test: 2 <= 1
[ERROR] detailedroute__antenna_diodes_count fail test: 1429 <= 1384

sky130hd riscv32i (base)
Flow reached last stage.
Found 1 metrics failures.
[ERROR] finish__timing__setup__tns fail test: -167.293 >= -167

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

@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 fixes a bug in FlexTA_assign.cpp by moving the instantiation of box2 inside the loop, ensuring it is reset for each track location. It also introduces a new unit test two_parallel_no_coupling and helper methods in the test fixture to verify this behavior. The review feedback suggests a performance optimization in the hot loop of modMinSpacingCostPlanar to directly calculate the vertical distance dy and avoid expensive geometric transformations and box-to-box distance calculations.

Comment on lines 86 to 94
frCoord dx, dy;
auto& trackLocs = getTrackLocs(lNum);
auto& workerRegionQuery = getWorkerRegionQuery();
for (int i = idx1; i <= idx2; i++) {
auto trackLoc = trackLocs[i];
odb::Rect box2(-halfwidth2, -halfwidth2, halfwidth2, halfwidth2);
odb::dbTransform xform(odb::Point(boxLeft, trackLoc));
xform.apply(box2);
box2boxDistSquare(box1, box2, dx, dy);

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

Since box1 and box2 always overlap in the X direction (both are aligned around boxLeft), the horizontal distance dx is always 0. Therefore, we can completely avoid constructing box2, creating and applying odb::dbTransform, and calling box2boxDistSquare inside this hot loop. Instead, we can compute the vertical distance dy directly using the interval boundaries of box1 (boxLow, boxHigh) and box2 (trackLoc - halfwidth2, trackLoc + halfwidth2). This simplifies the code and improves track assignment performance.

  auto& trackLocs = getTrackLocs(lNum);
  auto& workerRegionQuery = getWorkerRegionQuery();
  for (int i = idx1; i <= idx2; i++) {
    auto trackLoc = trackLocs[i];
    frCoord dy = 0;
    if (trackLoc - halfwidth2 > boxHigh) {
      dy = trackLoc - halfwidth2 - boxHigh;
    } else if (boxLow > trackLoc + halfwidth2) {
      dy = boxLow - (trackLoc + halfwidth2);
    }

@github-actions

Copy link
Copy Markdown
Contributor

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

@osamahammad21 osamahammad21 requested a review from maliberty May 25, 2026 18:59
@maliberty

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

osamahammad21 added 2 commits June 2, 2026 22:40
@openroad-ci openroad-ci requested a review from a team as a code owner June 2, 2026 22:02
@github-actions github-actions Bot added size/L and removed size/S labels Jun 2, 2026
@osamahammad21 osamahammad21 merged commit 7f09c4c into The-OpenROAD-Project:master Jun 3, 2026
16 checks passed
@openroad-ci openroad-ci deleted the TR-fix-ta-cost branch June 3, 2026 01:33
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.

3 participants