Skip to content

dpl: fail in seconds, not 82 minutes, when no search can legalize within the window - #12122

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:dpl-window-supply
Open

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:dpl-window-supply

Conversation

@oharboe

@oharboe oharboe commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

A placement that no legalizer search can legalize within its displacement window now fails in seconds, before the diamond search, instead of after it:

before after
CTS stage, hierarchical asap7 design, clock buffers in channels narrower than they needed 82 min of diamond search, then failure stops before the first move, worst windows in microns

On a placement that legalizes today nothing changes: the check passes and the search runs as before.

Why it is a proof

The diamond search puts a cell's origin within +/- max_displacement of where it starts (legalGridPt), and rip-up-and-replace places the cells it displaces from their own starts. Legalization is a matching of cells to free sites, so by Hall's condition every set of cells needs, in the union of the sites it can cover, as many free sites as it covers. One failing set is proof. The core is tiled into boxes the size of the window; the cells starting in a box are compared with the free sites in the box grown by one window on every side, and on the high sides by the widest and tallest cell beyond that (a cell whose origin sits at the window's far edge covers sites past it). Only a cell's own sites are demand: padding may overhang the core edge or a row hole, where no cell can be.

The negotiation legalizer only gets a warning

The negotiation legalizer, the default, also searches around a cell's current position (NegotiationLegalizer::findBestLocation, the second window built at cell.x, cell.y) and nothing bounds the distance from the start, so the proof does not hold for it. Before the negotiation the same report is a warning (DPL-1108) and legalization goes on.

Messages

  • DPL-1106, DPL-1109: how many windows fall short, and the worst ten with sites needed / sites reachable.
  • DPL-1107 (error, diamond search): the placement cannot be legalized within the window.
  • DPL-1108 (warning, negotiation): the same windows, legalization continues.

Tests

  • WindowSupplyTest.DiamondStopsWhenWindowsCannotHoldTheCells: DPL-1107. Without the check the search runs and fails on its own (DPL-0036).
  • WindowSupplyTest.NegotiationIsNotStoppedByTheCheck: the same placement is not stopped with the negotiation legalizer; with the check made fatal there it is.
  • WindowSupplyTest.DiamondLegalizesWhenWindowsHoldTheCells: a window with room passes the check and legalizes.
  • fragmented_row03 and report_failures goldens gain the warning (their cores hold 2 free sites for cells needing 7 and 8); nothing else in their logs changes.
  • All dpl tests pass.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the size/M label Nov 4, 2026

@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 a pre-search check, checkWindowSupply, to verify if cells can be legalized within the displacement window before starting detailed placement. It tiles the core into boxes and compares cell demand against free site supply, failing early for diamond search or warning for the negotiation legalizer if a shortfall is detected. The review feedback correctly identifies a potential integer overflow and out-of-memory risk when calculating the total number of boxes on large designs with small displacement values, and suggests using int64_t with a safety threshold check to prevent crashes.

Comment thread src/dpl/src/Place.cpp Resolved
Comment thread src/dpl/src/Place.cpp Resolved
The diamond search puts a cell's origin only within its displacement
window around where it starts, and rip-up-and-replace places the cells
it displaces from their own starts, so legalization is a matching of
cells to free sites and Hall's condition applies: it exists only if
every set of cells has, in the union of the sites it can cover, at least
as many free sites as it needs. Checking every set is exponential; any
one set that fails is proof. Tile the core into boxes the size of the
window, take the cells that start in each, and compare the sites they
cover with the free sites in the box grown by the window on every side,
and on the high sides by the widest and tallest cell beyond it. Demand
over supply is a placement no search order can legalize, reported in
seconds with the worst windows in microns (DPL-1106, DPL-1109) and
stopped (DPL-1107), instead of the hours the search takes to prove it
cell by cell. A cell's own sites are counted, not its padding, which
may hang over a site no cell can use.

Measured on a hierarchical asap7 design whose clock buffers landed in
channels narrower than they needed: 82 minutes of diamond search in the
CTS stage, 37 % of samples in one function, on a placement this check
rejects before the first move.

The negotiation legalizer, the default, also searches around a cell's
current position and can move it further than the window, so the proof
does not hold for it: before the negotiation the same windows are
reported as a warning (DPL-1108) and legalization goes on.

Passing proves nothing; some other set of cells may still fail. The
override is the option the search already has: a wider
-max_displacement, which the check re-runs against.

Tests: WindowSupplyTest, the diamond search stops with DPL-1107 on a
window that cannot hold its cells (without the check it fails in the
search, DPL-0036), the negotiation is not stopped on the same placement,
and a window that can hold its cells legalizes. The goldens of
fragmented_row03 and report_failures, placements with fewer free sites
in the core than their cells need, gain the warning.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oharboe
oharboe marked this pull request as ready for review November 4, 2026 09:13
@oharboe
oharboe requested a review from a team as a code owner November 4, 2026 09:13
@oharboe
oharboe requested a review from osamahammad21 November 4, 2026 09:13
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