Skip to content

dpl: runtime improvements#10936

Merged
maliberty merged 3 commits into
The-OpenROAD-Project:masterfrom
gudeh:dpl-runtime-improvements
Jul 18, 2026
Merged

dpl: runtime improvements#10936
maliberty merged 3 commits into
The-OpenROAD-Project:masterfrom
gudeh:dpl-runtime-improvements

Conversation

@gudeh

@gudeh gudeh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Runtime improvements for Negotiation Legalizer.

  • Use std::vector instead of std::unordered_set for checking new active cells.
  • Early abort when checking costs, cases where it is impossible to achieve better costs during calculation.
  • Early return false at checkDRC(), only check all cases for debug level.
  • Hoist a few variables.

Type of Change

  • Refactoring

Impact

Local experiments present 23.3% runtime reduction (versus current master with Negotiation) on a design with 154K instances.

Here are some runtime measurements (repeated 3x each). Left is diamond search, middle is current master with Negotiation, and right is this PR.
Screenshot from 2026-07-16 22-33-56

Negotiation (85.231sec) is still 49% slower than diamond search (57.074sec), in other words it takes 1.5x more time than diamond search.

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 signed my commits (DCO).

Related Issues

gudeh added 2 commits July 16, 2026 22:14
use std::vector<char> instead of std::unordered_set for checking new active cells.
early abort when checking costs.
early return at checkDRC(), only check all cases with debug level.
hoist a few variables.

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh
gudeh requested a review from a team as a code owner July 17, 2026 02:17
@gudeh
gudeh requested a review from osamahammad21 July 17, 2026 02:17

@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 performance optimizations to the NegotiationLegalizer and PlacementDRC modules. Key improvements include caching Node pointers within NegCell to eliminate redundant network lookups, adding early-abort logic in negotiationCost when the accumulated cost exceeds a threshold, and introducing a fast-path short-circuit in checkDRC. The review feedback suggests further performance enhancements: reordering the short-circuit checks in checkDRC to evaluate cheaper checks before the expensive edge spacing check, and avoiding repeated heap allocations in negotiationIter by reusing a member variable instead of allocating a local vector on each iteration.

Comment thread src/dpl/src/PlacementDRC.cpp
Comment thread src/dpl/src/NegotiationLegalizerPass.cpp
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh

gudeh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

From the internal runtime report in the logs (message [INFO DPL-0500] Runtime) we actually calculate a 46.1% runtime reduction, from 57.01sec on master to 30.69sec on this PR.

@maliberty

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: fdc4e2d63d

ℹ️ 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".

@gudeh

gudeh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Secure-CI confirms no-op.

We seem to get a decent runtime reduction.

Total elapsed reductions around 29%.
image

Around 37% reduction in runtime at DPL:
image

Here are the raw runtimes in seconds. Orange is master, green this branch.
image

@gudeh

gudeh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@osamahammad21 @maliberty we are clear to merge.

@maliberty

Copy link
Copy Markdown
Member

@QuantamHD @mikesinouye FYI

}
if (!isCellLegal(i)) {
activeCells.push_back(i);
active_set.insert(i);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need is_active[i] = 1 to replace this line?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it doesn't matter as you are linearly scanning and won't see that index again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly! we don't need that, we won't iterate over i again.

@gudeh

gudeh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

BTW here are the runtimes for current master without changes from PR #10929

=== iteration 1 ===
real    125.628
user    123.795
sys     1.278
=== iteration 2 ===
real    125.349
user    123.598
sys     1.281
=== iteration 3 ===
real    125.281
user    123.485
sys     1.326
=== summary ===
real avg 125.419 s  (min 125.281, max 125.628, n=3)

And negotiation alone is 71sec, so we go from this to 31sec, which is less half the measured time.

@maliberty
maliberty merged commit 59fb654 into The-OpenROAD-Project:master Jul 18, 2026
16 checks passed
@gudeh

gudeh commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Here are the runtimes for the latest changes at #10949. We do get a few seconds reduced, from around 85sec to 82sec. Going from 31sec to 27sec at the standalone Negotiation run.

=== iteration 1 ===
real    82.581
user    80.853
sys     1.317
=== iteration 2 ===
real    81.853
user    80.065
sys     1.312
=== iteration 3 ===
real    82.093
user    80.304
sys     1.322
=== summary ===
real avg 82.176 s  (min 81.853, max 82.581, n=3)

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.

2 participants