Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
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.
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
force-pushed
the
dpl-window-supply
branch
from
November 4, 2026 08:53
10506cd to
24e15c3
Compare
oharboe
marked this pull request as ready for review
November 4, 2026 09:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A placement that no legalizer search can legalize within its displacement window now fails in seconds, before the diamond search, instead of after it:
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_displacementof 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 atcell.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
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_row03andreport_failuresgoldens gain the warning (their cores hold 2 free sites for cells needing 7 and 8); nothing else in their logs changes.🤖 Generated with Claude Code