Algorithm Search⌘K

Definitioncore

Shape function

Also called shape curve.

The staircase curve of allowed width and height pairs of a block, which for a slicing tree is combined bottom up by adding widths or heights.

A shape function tells, for each width, the least height of a rectangle that holds a block, so it describes all the shapes that the block can take. A hard block of fixed size that can turn by a quarter turn has a staircase with two steps. A soft block of fixed area has a curve h=A/wh = A / w between two limits of the aspect ratio. Shape functions are the tool that makes slicing floorplans easy to size: at a horizontal cut the shape functions of the two parts add up, and at a vertical cut their inverse functions add up. So a pass from the leaves of the slicing tree to the root gives the shape function of the whole chip, and its lowest point of w⋅hw \cdot h is the least area. The corners of a staircase are the Pareto front of the shapes, and Stockmeyer's algorithm is this pass on lists of corners.

Definition

Shape function of a block. Let S⊆R>02S \subseteq \mathbb{R}_{>0}^2 be the set of shapes (w,h)(w, h) that a block can take: each shape is a rectangle of width ww and height hh that the block fills. A room of width WW and height HH holds the block if some (w,h)∈S(w, h) \in S has w≤Ww \le W and h≤Hh \le H. The shape function of the block is

f(W)=inf⁡{ h:(w,h)∈S, w≤W },f(W) = \inf \{\, h : (w, h) \in S,\ w \le W \,\},

with f(W)=∞f(W) = \infty when no shape is narrow enough. The function ff is nonincreasing, and the set of rooms that hold the block is the region {(W,H):H≥f(W)}\{(W, H) : H \ge f(W)\} above its graph, which is closed upward and to the right. The inverse shape function g(H)=inf⁡{ w:(w,h)∈S, h≤H }g(H) = \inf \{\, w : (w, h) \in S,\ h \le H \,\} describes the same region from the other side.

Staircase and corners. If SS is finite, ff is a step function. Its corners are the shapes in SS that no other shape in SS dominates, that is, the points (w,h)(w, h) with no other (w′,h′)(w', h') with w′≤ww' \le w and h′≤hh' \le h. Sorted by width, the corners have strictly increasing widths and strictly decreasing heights, and the list of corners stores ff exactly.

Common blocks.

  • A hard block a×ba \times b with a<ba < b that can turn has the two corners (a,b)(a, b) and (b,a)(b, a). A square block, or a block that cannot turn, has one corner.
  • A soft block of area AA whose aspect ratio h/wh / w must lie in [r1,r2][r_1, r_2] has the widths ww from w1=A/r2w_1 = \sqrt{A / r_2} to w2=A/r1w_2 = \sqrt{A / r_1}. Its shape function is ∞\infty for W<w1W < w_1, equal to A/WA / W for w1≤W≤w2w_1 \le W \le w_2, and equal to A/w2A / w_2 for W>w2W > w_2, since a wider room can hold the widest shape. This function is convex on [w1,∞)[w_1, \infty): the slope −A/W2-A / W^2 increases with WW, and it then jumps up to 00.

Combination at a cut. Let a node of a slicing tree have the children aa and bb with shape functions faf_a and fbf_b and inverse functions gag_a and gbg_b.

  • At an HH node, bb is above aa. A room of width WW holds both exactly when its height is at least fa(W)+fb(W)f_a(W) + f_b(W), so f=fa+fbf = f_a + f_b.
  • At a VV node, bb is to the right of aa. In the same way, a room of height HH holds both exactly when its width is at least ga(H)+gb(H)g_a(H) + g_b(H), so g=ga+gbg = g_a + g_b.

For the HH node, put aa at the bottom in its best shape for width WW and bb on top of it in its best shape for width WW: the height is fa(W)+fb(W)f_a(W) + f_b(W). Conversely, in any room of width WW the two parts have widths at most WW, so their heights are at least fa(W)f_a(W) and fb(W)f_b(W) because faf_a and fbf_b are nonincreasing. The VV case is the same with the two axes swapped.

Number of corners. If faf_a has k1k_1 corners and fbf_b has k2k_2 corners, then fa+fbf_a + f_b has at most k1+k2−1k_1 + k_2 - 1 corners. The sum changes only at a width where faf_a or fbf_b changes, so each corner of the sum has the width of a corner of faf_a or of fbf_b. The sum is finite only from w0=max⁡(first width of fa,first width of fb)w_0 = \max(\text{first width of } f_a, \text{first width of } f_b) on. If the two first widths differ, the smaller one is below w0w_0 and gives no corner. If they are equal, they give the same width. In both cases at most k1+k2−1k_1 + k_2 - 1 widths remain. The same holds at a VV node with heights in place of widths. By induction, a node with ℓ\ell hard blocks below it, each with two corners, has at most 2ℓ−(ℓ−1)=ℓ+12 \ell - (\ell - 1) = \ell + 1 corners, and the merge of two sorted corner lists takes time linear in their lengths.

Convexity is kept. For soft blocks the shape functions are convex. A sum of convex functions is convex, so an HH node keeps convexity. The region above the graph of a convex nonincreasing function is a convex set, so its inverse function is convex too, and a VV node, which adds the inverse functions, keeps convexity as well. So a slicing tree of soft blocks has a convex shape function, and the sizing of soft blocks can be done with convex methods such as geometric programming.

Examples and non-examples

Take three hard blocks that can turn: AA is 2×42 \times 4, with corners (2,4)(2, 4) and (4,2)(4, 2). BB is the square 3×33 \times 3, with the one corner (3,3)(3, 3). CC is 1×51 \times 5, with corners (1,5)(1, 5) and (5,1)(5, 1).

Side by side. A B VA\,B\,V adds widths at each height. For H≥4H \ge 4 the least widths are 22 and 33, which gives the corner (5,4)(5, 4). For 3≤H<43 \le H < 4 the block AA needs width 44, which gives (7,3)(7, 3). Below height 33 the square does not fit. So the corners are (5,4)(5, 4) and (7,3)(7, 3).

Stacked. A B HA\,B\,H adds heights at each width. At W=3W = 3 the heights are 44 and 33, which gives (3,7)(3, 7), and at W=4W = 4 they are 22 and 33, which gives (4,5)(4, 5). So the corners are (3,7)(3, 7) and (4,5)(4, 5).

A whole tree. The four trees with AA and BB below and CC added at the root give these corner lists:

expression corners (w,h)(w, h) least area
A B V C HA\,B\,V\,C\,H (5,5)(5, 5), (7,4)(7, 4) 2525
A B V C VA\,B\,V\,C\,V (6,5)(6, 5), (10,4)(10, 4), (12,3)(12, 3) 3030
A B H C VA\,B\,H\,C\,V (4,7)(4, 7), (5,5)(5, 5) 2525
A B H C HA\,B\,H\,C\,H (3,12)(3, 12), (4,10)(4, 10), (5,6)(5, 6) 3030

None of them is the best slicing floorplan. The expression A C H B VA\,C\,H\,B\,V first stacks CC on AA: at widths 22, 44 and 55 the heights are 4+5=94 + 5 = 9, 2+5=72 + 5 = 7 and 2+1=32 + 1 = 3, so the corners are (2,9)(2, 9), (4,7)(4, 7) and (5,3)(5, 3), which is 2+2−1=32 + 2 - 1 = 3 corners, the bound. Then the square goes to the right, and each width grows by 33: the corners are (5,9)(5, 9), (7,7)(7, 7) and (8,3)(8, 3). The corner (8,3)(8, 3) has area 2424, the least over all slicing trees of these three blocks. The blocks have area 8+9+5=228 + 9 + 5 = 22, so the best slicing floorplan leaves 22 units empty. A node must keep all its corners, not only the one of least area: in A B V C HA\,B\,V\,C\,H the root uses both corners of A B VA\,B\,V, and the corner (7,3)(7, 3) of area 2121, which is larger than the 2020 of (5,4)(5, 4), gives the root corner (7,4)(7, 4) with the least height.

Non-example: a dominated shape. A block with the allowed shapes (3,3)(3, 3) and (4,4)(4, 4) has the one corner (3,3)(3, 3). The shape (4,4)(4, 4) is not on the staircase, because each room that holds it also holds (3,3)(3, 3).

Non-example: a floorplan without a cut. In the pinwheel of five rooms no segment runs from one side of the chip to the other. The least height at width WW is then not a sum of the shape functions of two parts, and the combination rules do not apply. For floorplans that are not slicing, the choice of the orientations of the blocks is NP-complete (Stockmeyer 1983).

References

  1. Ralph H. J. M. Otten, Automatic floorplan design, Proceedings of the 19th Design Automation Conference, 261 to 267, 1982, shapes of blocks and of slicing structures
  2. Ralph H. J. M. Otten, Efficient floorplan optimization, Proceedings of the IEEE International Conference on Computer Design, 1983, shape functions and their addition at the cuts of a slicing tree
  3. Larry Stockmeyer, Optimal orientations of cells in slicing floorplan designs, Information and Control 57(2-3), 91 to 101, 1983, the merge of lists of non-dominated shapes and the bound on their lengths
  4. Andrew B. Kahng, Jens Lienig, Igor L. Markov and Jin Hu, VLSI Physical Design, From Graph Partitioning to Timing Closure, second edition, Springer, 2022, Chapter 3, Chip Planning (floorplan sizing with shape functions; general locator)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/CXGS6Q/text.yaml