Skip to content

dpl: introduce new legalization algorithm - negotiation based#10064

Open
gudeh wants to merge 70 commits intoThe-OpenROAD-Project:masterfrom
gudeh:dpl-negotiation-legalizer
Open

dpl: introduce new legalization algorithm - negotiation based#10064
gudeh wants to merge 70 commits intoThe-OpenROAD-Project:masterfrom
gudeh:dpl-negotiation-legalizer

Conversation

@gudeh
Copy link
Copy Markdown
Contributor

@gudeh gudeh commented Apr 6, 2026

Summary

This PR introduces a new algorithm option to DPL which shows better legalization capabilities on designs with higher density.

As default we still use the original diamond search. To use the new DPL option just add -use_negotiation.

Type of Change

  • New feature

Impact

Far better legalization capability on denser designs. Experiments show reduced displacement with increased HPWL. Negotiation legalizer is also more runtime costly compared to the simpler diamond search.

Verification

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

Negotiation legalizer

An iterative rip-up-and-replace algorithm where illegal cells compete with their spatial neighbors for grid resources. The algorithm proceeds in iterations, allowing overlaps among instances and progressively reducing them. The cost function incorporates a history term: sites that have been repeatedly over-capacity accumulate a higher cost, preventing the algorithm from thrashing. The implementation also integrates OpenROAD's existing DPL DRC checks directly into the cost function.

The DPL debug mode was also extended to paint sites (a.k.a. pixels) depending on their state (free, occupied, overflowing, DRC)

TODO and limitations:

  • Improve runtime.
  • Introduce region awareness.
  • Investigate "stuck" instances, which are currently handled with the old diamond search.
  • Include multi-threading (single threaded for now).
  • Parametrize inputs, such as window search range and max iterations.
  • Have a single Node object, use the existing object from original DPL implementation.
  • Revisit post-optimization.
  • Revisit abacus or other options for initialization.
  • Review Negotiation rail adjustment on cost function and DPL rail handling.

precisionmoon and others added 30 commits April 3, 2026 12:20
Introduces a two-pass hybrid legalizer into the dpl (detailed
placement) module:

1. **Abacus pass** — O(n log n) row-by-row sweep that handles single-
   and mixed-cell-height cells with power-rail alignment and fence
   regions.  Illegal cells (overlaps / fence violations) are forwarded
   to the negotiation pass.

2. **Negotiation pass** — iterative rip-up & replace adapted from the
   NBLG algorithm (Chen et al., IEEE TCAD 2022).  Active cells compete
   for grid resources; history costs penalise persistent congestion and
   an isolation-point mechanism skips already-legal cells in phase 2.

3. **Post-optimisation** — greedy displacement improvement (5 passes)
   and cell-swap via bipartite matching.

New files (src/dpl/src/):
  HybridLegalizer.h          — class definition, structs, constants
  HybridLegalizer.cpp        — initialisation, grid, Abacus pass, metrics
  HybridLegalizerNeg.cpp     — negotiation pass, post-optimisation

CMakeLists.txt: add HybridLegalizer.cpp and HybridLegalizerNeg.cpp to
the dpl_lib target.

Call site (Opendp.cpp, not wired in this PR):
  dpl::HybridLegalizer hybrid(db_, logger_);
  hybrid.setMf(1.5); hybrid.setTh(30); hybrid.setMaxIterNeg(600);
  hybrid.legalize();

References:
  - Spindler et al., "Abacus", ISPD 2008.
  - Chen et al., "NBLG", IEEE TCAD vol. 41 no. 11, 2022.
  - McMurchie & Ebeling, "PathFinder", 1995.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
Signed-off-by: Cho Moon <cmoon@precisioninno.com>
incorporate debug mode inyo hybrid legalizer,
skip abacus
consider original DPL DRCs into hybrid legalizer
stand-alone hybrid legalizer

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
fix orientation,
abacus parameter for detailed_placement command:

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
also includes a failed attempt to solve it placing instances on inexisting sites

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
incorporate DRCs into cost function for negotiation
a few variable renamings
debug: paint outline of selecte instance final position
debug: iterative mode for negotiation legalizer

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
iterative debug together with debug instance

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
debug: include runtime measurements
debug: use iterative for main iterations, and deep iterative for cell moves

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
…), now we use snapToLegal() only once, not every iteartion, fixing both runtime and the issue of not legalizing instances on top of blockages

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
…roach

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
…instances

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
gudeh added 7 commits April 8, 2026 13:59
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

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

@gudeh gudeh requested a review from eder-matheus April 9, 2026 10:13
gudeh added 3 commits April 9, 2026 10:38
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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

gudeh added 2 commits April 9, 2026 15:34
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
fix deep_iterative to pause at every iteration if no debug inst is given,
if deep_iterative is active and debug inst set, only pause at debug inst moves

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

gudeh added 2 commits April 9, 2026 16:36
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@gudeh gudeh requested a review from maliberty April 9, 2026 21:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

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

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

Signed-off-by: Augusto Berndt <augusto.berndt@precisioninno.com>
@github-actions
Copy link
Copy Markdown
Contributor

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

`-use_negotiation` on the `detailed_placement` command.

```
Global Placement result
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.

Is the following diagram still accurate?

Comment on lines +218 to +221
"negotiation_runtime",
1,
"{} illegal cells",
illegal.size());
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.

unrelated to runtime

// The snapping here is actually quite similar to the "hopeless" approach
// in original DPL.
// they achieve the same objective, and the previous is more simple,
// consider replacing this.
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.

I thought you had replaced this due to performance concern.

@@ -0,0 +1,909 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2018-2025, The OpenROAD Authors
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.

New files should be 2026 (same elsewhere)

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