Repository navigation
Conversation
Tiling and Interval are plain value types; a library of their own lets code that needs only them depend on them without object.cpp and odb. No change in behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Contributor
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
This was referenced Oct 17, 2026
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an exact packing feasibility check using OR-Tools CP-SAT to determine if a valid macro tiling exists when annealing fails, integrating it into the hierarchical macro placement flow and providing detailed outline fix suggestions. The review feedback highlights several safety improvements to prevent potential division-by-zero errors in utility functions, a signed integer overflow risk when calculating block areas, and an out-of-bounds access vulnerability if width and height interval sizes mismatch.
checkPacking() decides whether rectangles fit in a fixed outline without overlap, with OR-tools CP-SAT, which OpenROAD already links: rigid blocks with one or more shapes, soft blocks whose height is floor(area / width) as SoftMacro computes it, and fixed blocks. The answer is kFits with a placement, kDoesNotFit with a cause (a block too wide or too tall, the area, or the arrangement), or kUndecided when the deterministic budget runs out; it does not depend on machine load or thread scheduling. Cheap bounds and constructions settle most problems first: a block that fits nowhere, the area, blocks wider than half the outline that must stack, identical blocks that must fit as a grid, and a shelf packing. The rest go to CP-SAT on a ladder of grids, coarse first: rounding blocks up gives placements legal at full resolution, rounding them down gives proofs that nothing fits. Nothing calls it yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
smallestHeight(), smallestWidth() and smallestSameAspect() bisect over exact checks for the one outline change that makes a problem fit, on a given grid (rows, sites); a bigger outline never makes a packing impossible, so a bisection is exact. The questions share one budget, and an undecided one widens the reported range instead of stalling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
explainDoesNotFit() states that the problem is proven not to fit, its cause, and each single change to the outline that fixes it, in microns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
toPackingProblem() states what an annealer is asked: its sequence-pair macros inside its outline, each with every shape the annealer can give it (SoftMacro::resizeRandomly's area per width interval), fixed ones where they are; terminals and empty macros take no room. The test checks that every shape the annealer produces is one the problem allows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
MPL-0003 said only that annealing found no tiling. When no run finds
one, the exact check now either finds an arrangement, whose bounding box
becomes the tiling, or proves that none exists, and the error says why
and which single change to the core fixes it, on the row and site grid:
[ERROR MPL-0003] There are no valid tilings for mixed cluster root.
The blocks, halos included, cannot fit in the 108.432 x 108.270 um
outline (proven).
Cause: the area suffices (83% of the outline), but no arrangement of
the blocks does.
It fits with any one of:
same width 108.432 um: height >= 109.350 um
same height 108.270 um: width >= 109.350 um
same aspect ratio: width >= 109.296 um
The outline is the core area.
That is asap7/aes-block at a core of 110.5 um; a core 109.350 um wide
(2025 sites) places, one site narrower does not. A problem the check
cannot decide within its budget keeps the plain error; the README's
limitations say so.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
oharboe
force-pushed
the
mpl-exact-tilings
branch
from
October 17, 2026 08:56
771fba2 to
160f111
Compare
oharboe
marked this pull request as ready for review
October 17, 2026 09:52
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.
Opened for discussion.
When no annealing run finds a tiling for a mixed cluster, MPL-0003 now settles whether one exists with an exact fixed-outline packing check (OR-tools CP-SAT, which OpenROAD already links). Either it finds an arrangement, whose bounding box becomes the tiling, or it proves that none exists and the error names each single change to the core that fixes it. When annealing succeeds, nothing changes: the check runs only after every annealing run has failed.
asap7/aes-block with a 110.5 um core (The-OpenROAD-Project/OpenROAD-flow-scripts#4681), before and after:
Checked in the ORFS flow: at a 111.35 um core (outline 109.296 um wide) MPL-0003 proves again that the macros do not fit; at 111.402 um (outline 109.350 um, the proposed width) the floorplan completes.
Measured on 18 ORFS designs (asap7, gf180, nangate45):
How these were measured, and the rest of the study: The-OpenROAD-Project/bazel-orfs#1290.
Commits
shapesas a library of its own, so the check depends onTilingandIntervalwithoutobject.cppand odbTests
C++ gtests that check what the code must do against an independent reference, not golden output: planted packings with known answers, an exhaustive search on small cases, a geometry validator written in the test, the same answer for the same input, a tiny budget answering "undecided" rather than failing, the fixes being the smallest that fit on the given grid, every shape
SoftMacro::resizeRandomlyproduces being one the packing problem allows, and malformed input (an outline without area, a block without a shape, a step <= 0) being refused with an exception rather than answered. The existing Tcl regressions pass unchanged.#11809 offers the 136 packing problems behind the table above as a gtest, and the bench used to measure.
Limits
Claude made the changes and stared at paint drying.
🤖 Generated with Claude Code