partitioning outline –what is partitioning –partitioning example –partitioning theory...

19
Partition ing Outline What is Partitioning Partitioning Example Partitioning Theory Partitioning Algorithms Goal Understand partitioning problem Understand partitioning algorithms

Post on 22-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Partitioning

• Outline– What is Partitioning

– Partitioning Example

– Partitioning Theory

– Partitioning Algorithms

• Goal– Understand partitioning problem

– Understand partitioning algorithms

Page 2: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

What is Partitioning

• Divide a design into smaller pieces– based on a set of constraints

• Constraints– amount of design in a partition

– number of nets to/from partition

– number of partitions allowed

– balance between partition sizes

– weight nets crossing partition boundaries

• Applications– divide large design into multiple packages

– place circuit components on a chip or board

Page 3: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Partitioning Example

• Constraints– 12 transistors per package

– 7 pins per package

– few packages as possible

– nets of equal weight

• Bounds– 30 xistors => >=3 packages

– 21 terminals => <=3 packages

4

44

6

6

6

4

44

6

6

6

12 xistors7 pins 12 xistors

5 pins

6 xistors4 pins

4

44

6

6

6

12 xistors7 pins

10 xistors6 pins

8 xistors5 pins

etc.

Page 4: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Partitioning Theory

• Partitioning Set Formulation– V a set of nodes (components)

– each node r having area a(r)

– X a set of nodes (terminals) external to V

– S = (S1, S2, ..., SN) a set of subsets of V U X

» Si correspond to nets

– partition V into disjoint subsets V1, V2,..., Vk such that

» area of nodes in Vi <= Ai

» number of sets in S which have nodes external and internal to Vi is <= Ti, (pin count)

• Other formulations– graphs - weighted nets, edges

– connection matrix - eigenvectors

Page 5: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Partitioning Algorithms

• Direct– seed each module, grow based on constraints

• Group Migration– randomly place components, then move between partitions

• Metric Allocation– goodness metric for each component pair, partition to

minimize metric

• Simulated Annealing– shuffle components among partitions to minimize cost

function, permit uphill moves to get around local minima

Page 6: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Direct Partitioning

place a component r from V into each partition Vi

– pick relatively independent components

for each remaining component r in V {

for each Vi with area of nodes <= Ai and number of sets in S which have nodes external and internal to Vi <= Ti,

compute cost of placing r in Vi

place r in lowest-cost Vi

}

• Complexity– O(V*k)

– assumes placement cost computation is O(1)

• Issues– sensitive to initial seeding

– sensitive to component examination order

– gets stuck in local minimum

Page 7: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Direct Partitioning Example

AB

C

D

E

F

G A

B CD

E

F

G

D

A

D

A

ED

A

E

B

E

B

A

B CD

E

C

G, F

Page 8: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Group Migration

1. Partition nodes into groups A and B

2. For every a in A, and every b in B {

compute change in terminal counts Da and Db that occur if a and b are swapped.}

– set queue to empty and i = 1.

3. Select from all pairs (a, b) the pair (ai, bi) that gives most reduction in total terminal count when swapped.– add to queue– save the improvement in terminal count as gi

4. Remove ai from A and bi from B, recalculate Da and Db.– if A and B not empty, i++, go to 3.

5. Find k such that G = sum of g1 to gk is a minimum.

– swap a1,...ak and b1,...bk.– if G < 0 and k > 0, go to 2, else stop.

Page 9: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Group Migration Example

AB

C

D

E

F

G

A

B C

DE

F

G

Initial Partition, Cutset = 6

(A,E) 0 -3(A,F) -1 0(A,G) -1 0

(D,E) -2 -3(D,F) -2 +1(D,G) -2 +1

(B,E) +1 -3(B,F) 0 0(B,G) 0 0

(C,E) +1 -3(C,F) 0 0(C,G) 0 0

Queue1: (D,E) -52: (A,F) +1 (-1,+3)...

Minimum G=-5 at k=1Swap D and E

Next iteration:all pairs positivek=0, quit

Da Db Da Db

AB

C F

G

Final Partition, Cutset = 1

removed(D,E)

Page 10: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Group Migration

• Complexity– O(n2) per iteration in worst case for n nodes

» steps 2, 3

– converges in only a few iterations

– newer versions are O(nlogn)

• Application to partitioning– use bisection

– divide into two partitions, then split those partitions, etc.

– partition area is ignored, partitions remain balanced

» subdivide until partition area is small enough

– algorithm also called min-cut since it minimizes terminals

Page 11: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Fiduccia-Mattheyses Algorithm

• Approach– move one cell at a time between partitions A and B

» less restrictive than pair moves» no longer need to maintain partition size balance

– use special data structures to minimize cell gain updates– only move cells once per pass

• Complexity– prove constant number of updates per cell per pass– runtime per pass = O(P) - P pins/terminals

» vs. O(n2) for group migration– small (3-5) number of passes to converge– estimate total time is O(PlogP)

» more pins than nets» usually more pins than cells

Page 12: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Definitions

• ni - number of cells on neti

• si - size (area) of celli

• smax - largest cell = max(si)

• S - total size of cells = sum(si)

• pi - number of pins on celli

• pmax - most pins on a cell = max(pi)

• P - total number of pins = sum(pi)

• C - total number of cells

• N - total number of nets

• r - fraction of cell area in partition A

• CELL - C-entry array, entry is linked list of nets on cell

• NET - N-entry array, entry is linked list of cells on net

Page 13: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Cell Gain

• Cell Gain– gi - reduction in cutset by moving celli

– label each cell with its gain– -pi <= gi <= pi

– -pmax <= gi <= pmax

• Gain Data Structure– BUCKET array of cell gains

» one per partition– O(1) access to cells of a given gain– MAXGAIN tracks cells of max gain– remove cell once it has moved

» cells move once per pass» gain does not matter after that

+2 +1 0 -1

MAXGAIN

1 2 C

Cell # Cell #

+pmax

-pmax

BUCKET

CELL

Page 14: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Critical Nets

• Minimize cell gain updates– if all cells are updated on each move - O(C2) algorithm

– only cells that share a net with a moved cell must be updated

» but big net implies many moves and many updates

– only cells on critical nets must be updated

• Critical nets– moving a cell would change cutstate

» cutstate - whether net is cut or not

» critical only if net has 0 or 1 cells in A or B

A=0, B=3critical

A=1, B=2critical

A=2, B=2not critical

Page 15: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Partition Balance

• Control size balance between partitions– otherwise all cells move to one partition

– cutset = 0

• Balance criterion– rS - smax <= |A| <= rS + smax

– permits some “wiggle room” for cells to move

no yes

Page 16: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Algorithm

• Initially place cells randomly into A and B• Compute cell gains• Algorithm for each pass

– for all cells in A and B of maximum gain whose move would not cause imbalance

» choose one with best balance result - the base cell» if none qualify, quit pass

– move to opposite partition and lock (remove from BUCKET)» unlocked cells are free cells

– update cell gains and MAXGAIN pointer

• Repeat passes until no moves occur– unlock all cells at beginning of pass

Page 17: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Update Cell Gains

F = “from” partition of base cellT = “to” partition of base cellFT(n) = # free T cells of net nFF(n) = # free F cells of net nLT(n) = # locked T cells of net nLF(n) = # locked F cells of net nfor each net n on base cell doif LT(n) == 0

if FT(n) == 0 UpdateGains(NET(n))else if FT(n) == 1 UpdateGains(NET(n))

FF(n)--LT(n)++if LF(n) == 0

if FF(n) == 0 UpdateGains(NET(n))else if FF(n) == 1 UpdateGains(NET(n))

Page 18: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Example

+3 +1 +1 -1

a b c d

Initial partitioncutset = 3

si = 1, r = 0.5, 1 <= |A| <= 3

+1L +1 -1

ab c d

- b, c are highest-gain candidates- choose b, move and lock- recompute gains for a and b

- a, c are highest-gain candidates- choose c, move and lock- recompute gains for a, d

-3L L +1

ab c d

Final partition cutset = 1

- no candidates qualify- quit pass

- second pass- no candidates qualify- quit

-3-1 -1 +1

ab c d

Page 19: Partitioning Outline –What is Partitioning –Partitioning Example –Partitioning Theory –Partitioning Algorithms Goal –Understand partitioning problem –Understand

Properties of Algorithm

• Fast– O(PlogP)

– constant factors are small

» arrays, pointer access

• Space Efficient– 5 words/net overhead

– 4 words/cell overhead

– small constant overhead

• Suboptimal– gets stuck in local minima

– any one move has negative gain

– need multiple moves for positive gain

• Example– moving a or b results in -3 or -4 gain

– moving both a and b results in +1 gain

-3

-4

-3

-4

a

b