problem formulation - university of california, los...
TRANSCRIPT
CS258F 2006W
Prof. J. Cong 1
Jason Cong 1
Jason Cong 2
Problem FormulationGiven , for each block Bi
Area of Biwihi=Bi
Aspect ratio of Bi
(continuous or discrete)
Connectivity
Determine: for each blocklocation (xi,yi), anddimension (wi, hi)
minimize - total area- interconnections
ii
ii r
hs ≤≤
w
511
37
42
10
CS258F 2006W
Prof. J. Cong 2
Jason Cong 3
Slicing Floorplan and General Floorplan
non-slicing floorplanSlicing Tree
1 2h
vh
74vv
3 h65
Slicing floorplan
1
2
35
6
4 7
Jason Cong 4
Overview of This Chapter
4.1. Module orientation problem
4.2. Slicing floorplan design
4.3. Non-slicing floorplan design
CS258F 2006W
Prof. J. Cong 3
Jason Cong 5
4.1. Module Orientation Problems“Optimal Orientation of Cells in Slicing floorplan Designs”L. Stockmeyer, Information and Control 57(1983), 91-101
A
DC E
BA: (4,5)B: (2,7)C: (2,3)D: (3,4)E: (5,5)
8x117x13
AB
C
DE
5 8
42
3 2
53
8 5
A B
C
DE
5
4 7
2
3
3
6
6
5
2
Jason Cong 6
4.1. Module Orientation Problems(Cont’d)
ρwρψ ))(),((min h) or (),( wwwψ hh2h +=
In general, straightly increasing in both arguments :
)',(),('),'(),('
wψwψwwψψwψ
hhhhhh
<⇒<<⇒<
ρ
Possible Objecive Functions: perimeter or area
CS258F 2006W
Prof. J. Cong 4
Jason Cong 7
Module Orientation Problem for General Floorplan is NP-hard
For a given floorplan, determination whether there is an orientation ρ such that ψ(h( ρ ), w( ρ )) ≤ k. NP-Complete
Reduction from: Integer partitioning problem.
For a given set of positive integers{a1, a2,…,an} such that a1+a2+…+an=mB, determine whether the aj’s can be partitioned into m disjoint sets such that the sum of the aj’sin each set is B. NP-Complete
Idea: show that if we can solve orientation problem, then we can solve m-partition of integers
Jason Cong 8
Optimal Module Orientation for Slicing Floorplan
A
D
BC F
E
GH
Slicing
A
C
B
GFE
D
H
v
h
h
v
h
A
C
B
GF
ED
H
v
h
h
v
h
h
CS258F 2006W
Prof. J. Cong 5
Jason Cong 9
Basic Approach
• Bottom-up dynamic programming– Compute a set of irredundant solutions at each
subtree root from the lists of irredundant solutions for its two child subtrees
– Pick the best solution from the list of irredundant solutions at the root
Jason Cong 10
Merging Two Subtrees
v
y z
x
|L(y)| leaves |L(z)| leaves
hi
w i
h’j
w ’jh ww )),,(max()],(),,[(( ''''
jijijjii hhhjoin ww +=
w1|)(|}),(),,(),,{(1|)(|}),(),,(),,{(
'''2
'2
'1
'1
2211
ll
kk
zLlhhhyLkhhh
wwwww
+≤
+≤
…… ,
,
Given k possible shapes of subtree y and l possible shapes of subtree z
Compute all possible (irredundant) shapes of subtree x
CS258F 2006W
Prof. J. Cong 6
Jason Cong 11
Difficultyv
2
v
2
4
2
v
2
4
16
m1•m2 choices
m1m2
Jason Cong 12
Main Result
h1
w 1
h2
w 2
h3
w 3 hm w m
{(h1, w 1), (h2, w 2), (h3, w 3), … (hm, w m)}
h1 > h2 > h3> … >hm
w 1 < w 2 < w 3 < … < w m
We shall show: m≤ |L(x)|+1
I.e., we only need to keep |L(x)|+1 choices for each subtree rooted at x.
vx
|L(x)| leaves
CS258F 2006W
Prof. J. Cong 7
Jason Cong 13
Key IdeaL1
L2
L1 v L2
v
L1 L2
• Solid edges represent the combinations need to be examined
• Dotted edges represent the combinations to be skipped
Jason Cong 14
Complexity of the Algorithmn= # of leaves = 2 * # of modulesd=depth of the tree
Running time= O(nd)Storage = O(n)
because, at depth k,sum of the lengths of the lists =O(n)time to construct these lists =O(n)configurations stored at this node can be release as soon as the node is processed
Extension
Each module has k possible shapes
Running time and storage O(nkd)
depthk
CS258F 2006W
Prof. J. Cong 8
Jason Cong 15
Floorplan using Simulated AnnealingReferences1. D.F. Wong and C.L. Liu
A New Algorithm for Floorplan Design
23rd IEEE/ACM Design Automation Conference 1986,
P101-107
2. D.F. Wong and C.L. Liu
Floorplan Design for Rectangular and L-shaped modules
ICCAD-87 P520-523
3. D.F. Wong, H.W. Lceng, C.L. Liu
Simulated Annealing for VLSI Design
Kluwer Academic Publishers 1988 P31-71
Jason Cong 16
Simulated Annealing
Local Search
cost
fun
ctio
n
solution space
o
o
oo
o
oo
o?
CS258F 2006W
Prof. J. Cong 9
Jason Cong 17
Statistical Mechanics
Combinatorial Optimization
State { r: } (configuration -- a set of atomic position)
Weight -- Boltzmann distribution
E({r:}): energy of configuration
KB: Boltzmann constant
T: temperature.
Low temperature limit??
TKrE be /:})({−
Jason Cong 18
Analogy
Physical SystemState(configuration)
Energy
Ground State
Rapid Quenching
Careful Annealing
Optimization ProblemSolution
Cost function
Optimal solution
Iterative Improvement
Simulated Annealing
CS258F 2006W
Prof. J. Cong 10
Jason Cong 19
Generic Simulated Annealing Algorithm1. Get an initial solution S
2. Get an initial temperature T>0
3. While not yet “frozen” do he following:3.1 For 1≤ i ≤ L, do the following:
3.1.1 Pick a random neighbor S’ of S3.1.2 Let Δ=cost( s’ )-cost(s)3.1.3 If Δ ≤ 0 (downhill move),
Set S=S’3.1.4 If Δ > 0 (uphill move)
set S=S’ with probability 3.2 Set T <- rT (reduce temperature)
4. Return S
Te /Δ−
Jason Cong 20
Basic Ingredients for S.A.
Solution space
Neighborhood Structure
Cost Function
Annealing Schedule
CS258F 2006W
Prof. J. Cong 11
Jason Cong 21
Representation of Solutions
1
6
3 5
2 4
7
*
*
*+++
1 6
3 5
2 7 4
16+35* 2+74+ **
Jason Cong 22
Corresponding Slicing Tree May Not Unique
13
24
*
*
1 +
3 2
4
*
*1+
3 2
4
132+4** 132+*4*
+
••• ++ •••
+
*
••• ** •••
*
Normalization: do not allow following slicing trees
CS258F 2006W
Prof. J. Cong 12
Jason Cong 23
Normalized Polish Expressions16+35* 2+ *74+ *
# of operands = 4
# of operators = 2
…….. = 7
…….. = 5
Total length =2n-1
Permutation of { 1, 2, …, n} and # of operators =n-1
# of operators < # of operands at every position
No consecutive operators of the same type (due to normalization)
Jason Cong 24
Neighborhood Structure
The moves:
M1: swap adjacent operands
M2: Complement some chain of operators
M3: swap 2 adjacent operand and operator
Chain: +*+*+….. or * +*+*….
16+35 *2+ *74+ *
chains
CS258F 2006W
Prof. J. Cong 13
Jason Cong 25
Examples of Neighboring Solutions1 2 * 3 + 4 * 5 +
1 2 * 4 + 3 * 5 +
1 2 * 4 + 3 5 * +
1 2 * 4 3 + 5 * +
1 2 + 4 3 5 * + *
1 2 * 4 3 5 + * +
1 2 + 4 3 5 + * +
2
53 41
53
24
13
241
5
32
4
1
5
1
53
24
32
415
54
2 31
M1
M3
M3
M3
M2
M2
Jason Cong 26
Cost Function
*3*2 41 5 ++:A
),(),(),(
+=+= ∑∈
jicjidAAEji
λλ wψ
35
21 435
21 435
21 4
A=minimum area
ijijdc∑=w
:W Wirelength:
CS258F 2006W
Prof. J. Cong 14
Jason Cong 27
Computing cost function*
+
+
*
7
4
*10 8 9
*
++
*1 6 2
3 5
6
1
2
3 5
4
10 89
7
byax ii≥≥ , byax ii
≥≥ ,
aybx ii≥≥ ,
byax ii≥≥ ,
orb,yax ii
≥≥ , Ayx ii≥
Ayx ii≥ a,ybx ii
≥≥ , Ayx ii≥
or
Jason Cong 28
Computing Cost Function(Cont’d)
*
+
* 4
*
++
*1 6 2
3 5
+
7
*
10 8 9
CS258F 2006W
Prof. J. Cong 15
Jason Cong 29
Evaluating Cost Funcation“Efficient floorplan optimization” by R. Otten DAC-82 pp 499-502
shape constraint curve
xy=A
feasible region
General representation: piecewise linear function (approximation)
Jason Cong 30
“Adding” Two Curves
Compute new breakpoints at each breakpoint on either C1 or C2A=xy
ρ=2(x+y) ……
Min cost solution achieves at one of the breakpoints.
C1C2
C1 h C2
C1
h
C2
..
CS258F 2006W
Prof. J. Cong 16
Jason Cong 31
Incremental Update of Cost Function
*
+
* 4*
++
*1 6 2
3 5
+
7
*
10 8 9
16+35*2+ *10 8 * 7 9+ *4+ *
16+35*2+ *10 7 * 8 9+ *4+ *M1
*
+* 4
*
++
*1 6 2
3 5
+
8
*10 7 9
Jason Cong 32
Updating Cost Function(Cont’d)
16+35*2+ *108* 79 +* 4+ *
16+35*2+ *108* 79 *+ 4+ *M2
*
+
* 4*
++
*1 6 2
3 5
+
7
*
10 8 9
*
+
*
4*
++
*1 6 2
3 5
+
8
*10 7 9
√
√
√√
CS258F 2006W
Prof. J. Cong 17
Jason Cong 33
Updating Cost Function(Cont’d)
16 + 3 5*2+ *108* 7 9+ *4+ *
16 3 + 5*2+ *108* 7 9+ *4+ *M3
*
+* 4
*
+
*+
6 3
2
1
5+
8
*10 7 9
√
√
√
√
√*
+
* 4*
++
*1 6 2
3 5
+
7
*
10 8 9
Jason Cong 34
Annealing ScheduleTi=riT0, i=1,2,3, …
r=0.85
At each temperature,try k•n moves. (k=5 to 10)
Terminate the annealing process if 1) # of accepted moves <5%2) the temperature is low enough
Initial Solution1 2 3 … n
12 * 3 * … n *
CS258F 2006W
Prof. J. Cong 18
Jason Cong 35
Example27 29 35 18 23 24 36
9 5 32
22 14
38
3015 73
39 1 40
312816413 17
21 11 2 810
19
37 12
23
20
2834 6 25
number of modules: 40sum of all block areas: 407.44total area of random solution: 1002.3total area of initial solution: 3965.4total area of final solution: 422.95packing efficiency = 407.44/422.95
Jason Cong 36
Another Example27 29 35 18 23 24 36
9 5 32
22 14
38
3015 73
39 1 40
312816413 17
21 11 2 810
19
37 12
23
20
2834 6 25
41 43 51 52 53 54 56
46 42 47
48 49
50
3055 5774
69 71 70
6158764544 77
75 73 62 6880
59
67 72
63
60
7864 66 65
81 82 83 84
858687
88
89 90
91 92
93 95
96 9798
99
100
Number of modules: 100 sum of areas: 1007.9area Wire length
Random solutionInitial solutionFinal solution
7612.625092.11076.1
10429.913306.73557.2
CS258F 2006W
Prof. J. Cong 19
Jason Cong 37
Limitations
• Generate only slicing floorplans• Need to consider I/O pin locations• Wirelength was not used in the solution
pruning• Need to consider routing congestion
Limitations of Simulated Annealing
• In theory, temperature needs to be decreased logarithmically to achieve global optima:– (tn= t0 / log (1+n))
• In practice, exponential cooling schedules were used, thus SA tends to be trapped at local minimum:– (tn = t0*αn: 0 <α < 1)
• Hill-climbing is restrictive at low temperatures-- not good for exploiting global configuration changes.
CS258F 2006W
Prof. J. Cong 20
Jason Cong 39
Extension to Non-slicing FloorplansUnary Operator :
Change a L-shape figure into a rectangle
Binary Operators *1, *2, +1, + 2Combine 2 rectangle or L-shape figures to form a rectangle or a L-shape figure
Can generate non-slicing floorplans
A EC
DB
Jason Cong 40
Non-slicing Floorplan Design Using Hierarchical Floorplan Representation
Hierarchical floorplan with degree-5 nodes
M1
M7
M3M5
M6
M2
M4 M1
M2
M3 …… M7
V-cuth-cut
CS258F 2006W
Prof. J. Cong 21
Jason Cong 41
Sequence Pair Representation of Non-Slicing Floorplans
[Murata, Fujiyoshi, Nakatake, Kajitani, ICCAD95]
• Given a set of blocks {a,b,c,d,e,f}.• Use a pair of sequences to represent a floorplan
– Γ+={abdecf} and Γ-={cbfade} .• Packing (Γ+, Γ-)= {abdecf, cbfade}
Jason Cong 42
Derivation of Sequence Pair from a Given Floorplan
CS258F 2006W
Prof. J. Cong 22
Jason Cong 43
– If Γ+= (…i…j…), Γ-= (…i…j…) , then j is to the right of i.
– If Γ+= (…j…i…), Γ-= (…i…j…) , then j is above i.
(3 2 7 5 4 1 6, 1 2 3 4 5 6 7)(3 2 7 5 4 1 6, 1 2 3 4 5 6 7)(3 2 7 5 4 1 6, 1 2 3 4 5 6 7)3
4
57
1
2
611
2
1
2
61
Construction of Floorplan from a Sequence Pair
Jason Cong 44
Area-Calculation of a Sequence-Pair Based Floorplan with Fixed Block Dimensions
• Uses data structure containing relevant information about all the cells– Γ+ and Γ- positions,widths, heights, x- and y-
coordinates, shapes and adjacent cells.• Constructing horizontal and vertical
constraint graphs.
CS258F 2006W
Prof. J. Cong 23
Jason Cong 45
Construction of Horizontal Constraint Graph
• Given a sequence pair (X,Y), the horizontal constraint graph Gh(V,E) can be constructed as follows:
– V = {sh} ∪ {th} ∪ {ui | i = 1,…,n}, where uicorresponds to a block
– E = {(sh, ui) | i = 1,…,n} ∪ {(ui, th) | i = 1,…,n} ∪{(ui, uj) | block i is left to block j}
– Vertex weight = width of block i for vertex ui, and 0 for sh and th.
• Similar for vertical constraint graph.• The construction of the graphs takes O(n2)
time
Jason Cong 46
Example
Sequence Pair:
(<4 3 1 6 2 5>, <6 3 5 4 1 2>)
Horizontal constraint graph (transitive edges are excluded for simplicity)
4
3
1
6
2
5
6
35
4
1
2
CS258F 2006W
Prof. J. Cong 24
Jason Cong 47
Computation of (x,y)-coordinates of blocks
• Given the horizontal constraint graph Gh(V,E), the x-coordinate of block ui is the longest path from sh to ui.
• Similar for y-coordinate of block ui.• If the graphs have n vertices and m edges,
we can compute the coordinates for all blocks in O(n+m) time (using recursion).
Jason Cong 48
Wirelength Computation
• Construct the compact floorplan from a sequence pair
• Use half-perimeter of minimum bounding box for wirelength estimation of each net
CS258F 2006W
Prof. J. Cong 25
Jason Cong 49
Fast Sequence-Pair Evaluation (O(nlogn) time)
[X. Tang, R. Tian, D.F. Wong, DATE 2000]• Consider weighted sequences (X,Y), where the weight of every
element is the width of the corresponding block.• The width of the optimal packing is the length of the longest common
subsequence (LCS) of the weighted sequences X and Y.
•Sequence Pair:
(X,Y) = <4 3 1 6 2 5>, <6 3 5 4 1 2>
•For the dimensions of the blocks as shown in the figure:
LCS(X,Y) = <3 1 2> and <6 5>
Jason Cong 50
Fast Sequence-Pair Evaluation (cont’d)
• Consider weighted sequences (XR,Y), where the weight of every element is the height of the corresponding block.
• The height of the optimal packing is the length of the longest common subsequence (LCS) of the weighted sequences XR and Y.
•Sequence Pair:
(XR,Y) = <5 2 6 1 3 4>, <6 3 5 4 1 2 >
•For the dimensions of the blocks as shown in the figure:
LCS(XR,Y) = <6 3 4> and <6 1> and <5 2>
CS258F 2006W
Prof. J. Cong 26
Jason Cong 51
Computation of the (x,y)-coordinates of the blocks
• For a block b, let sequence pair (X,Y) = (X1bX2, Y1bY2),– Length of LCS(X1,Y1) is the x coordinate of block b, where the
weight of every block in the sequences is their width.
• For a block b, let sequence pair (X,Y) = (X1bX2, Y1bY2)– (XR,Y)= (X2
R bX1R, Y1bY2)
– Length of LCS(X2R ,Y1) is the y coordinate of block b, where the
weight of every block in the sequences is their height.
• The longest common subsequence of two weighted sequences can be computed in O(nlogn) time.
Jason Cong 52
Example•Sequence Pair:
(X,Y) = <4 3 1 6 2 5>, <6 3 5 4 1 2>
•For block 2:
X1 = < 4 3 1 6>, X2 = <5>
Y1 = <6 3 5 4 1 > , Y2 = < >
•For the dimensions of the blocks as shown in the figure:
LCS(X1 ,Y1) = <3 1>
LCS(X2R,Y1) = <5>
CS258F 2006W
Prof. J. Cong 27
Jason Cong 53
Compute Weighted LCS in O(n2) Time
• march[b].y is the indices of block b in sequence Y• L[p] is the length of the weighted LCS of X and Y up to location p• P[b] is the starting position of block b in the packing
Jason Cong 54
Example for Computing Weighted LCS in O(n2) Time
CS258F 2006W
Prof. J. Cong 28
Jason Cong 55
Compute Weighted LCS in O(nlogn) Time
• Use a balanced search tree as a data structure
• Properties of a balanced search tree:
•Every node has an index and a value
•For a node k, a node m at the left sub-tree of k, and a node n at the right sub-tree of k, we have indexm < indexk < indexn
•For every node k, if j is the depth of its left subtree, then the depth of its right subtree is j-1 or j or j+1.
• Can be updated in O(logn) time
Jason Cong 56
Compute Weighted LCS in O(nlogn) Time (Cont’d)
• Sequence Pair <X1, X2,….,Xn>, <Y1,Y2,….,Yn>
• For i= 1 to n
• Select Xi and corresponding Yk.
• Find the largest index j less than k in the BST and the corresponding value (which is equal to LCS(X[1…m],Y[1…j]), Xm ,=Yj )
• v = LCS(X[1…i],Y[1…k])= LCS(X[1…m],Y[1…j]) + weight(Xi )
• Store (k,v) on the BST and remove nodes with higher index than k and lower value than v.
CS258F 2006W
Prof. J. Cong 29
Jason Cong 57
Area Optimization for Blocks with Flexible Sizes
• For a given sequence pair, we can get the optimal area and block dimensions by convex programming
• Variables:– Block locations– Block dimensions
• Linear constraints for positions• Convex products for areas• Objective: convex
Jason Cong 58
O-tree[P. Guo, C.-K. Cheng, T. Yoshimura, DAC 1999]
-Encoding: (00110100011011, adbcegf)-Needs O(n) time to compute the coordinates of all the blocks-Can represent a subset of the floorplans than can be represented by Sequence Pair
CS258F 2006W
Prof. J. Cong 30
Jason Cong 59
Summary of floorplanning representations
Slicing Floorplans:Slicing tree: Otten, DAC’82 (O(n) packing time)Normalized Polish expression: Wong and Liu, DAC’86 (O(n) packing time)
Non-slicing Floorplans:Sequence pair: Murata et al., ICCAD’95 (O(n2) packing time, later
improved to O(nloglogn) time)BSG: Nakatake et al., ICCAD’96 (O(n2) packing time)O-tree: Guo et al., DAC’99 (O(n) packing time – cannot represent all
floorplans)B*-tree: Chang et al, DAC’2k (O(n) packing time – cannot represent all
floorplans)Corner block list: Hong et al., ICCAD’2k (O(n) packing time – cannot
represent all floorplans)TCG: Lin and Chang, DAC’00 (O(n2) packing time)
Jason Cong 60
Summary• Floorplan is a very important step for design planning• Floorplan may be performed before synthesis of each
block (at RTL level)• Slicing floorplan allows efficient representation and
optimization– Module orientation and sizing problem can be solved easily– Good results using SA on Polish expression representation
• Recent progress on non-slicing floorplan– Sequence pair representation– O–tree