Sei sulla pagina 1di 30

KL Algorithm and Its Extensions

Overview
      

Introduction KL Algorithm Drawbacks of KL algorithm Extensions to KL Algorithm FM algorithm Conclusion References

KL Algorithm

 

Step 0:
V = 2n nodes {A, B} is an initial arbitrary partitioning


 

Step 1:
i=1 Compute D(v) for all nodes vV


 

Step 2:
Choose ai and bi such that (gi = D(ai) + D(bi) 2 * c(aibi) is maximized Swap and fix ai and bi


   

Step 3:
If all nodes are fixed, go to Step 4. Otherwise Compute and update D values for all nodes that are not connected to a-i and bi and are not fixed. i=i+1 Go to Step 2


 

Step 4:
Find the move sequence 1...m (1 e m e i), such that is maximized If Gm > 0, go to Step 5. Otherwise, END


 

Step 5:
Execute m swaps, reset remaining nodes Go to Step 1

KL - Definitions
 

T = cost(A, B), newT = cost(newA, newB) Need an efficient formula for newT; will use E(a) = external cost of a in A = 7{W(a,b) for b in B} I(a) = internal cost of a in A = 7 {W(a,a) for other a in A} D(a) = cost of a in A = E(a) - I(a) Moving a from A to B would decrease T by D(a) E(b), I(b) and D(b) defined analogously for b in B Consider swapping X = {a} and Y = {b}  newA = A - {a} U {b}, newB = B - {b} U {a} newT = T - ( D(a) + D(b) - 2*w(a,b) ) = T - gain(a,b)  gain(a,b) measures improvement gotten by swapping a and b Update formulas, after a and b are swapped  newD(a) = D(a) + 2*w(a,a) - 2*w(a,b) for a in A, a != a  newD(b) = D(b) + 2*w(b,b) - 2*w(b,a) for b in B, b != b

Drawbacks of the KL Algorithm


 

The K-L Algorithm handles only unit vertex weights. Vertex weights might represent block sizes, different from blocks to blocks. The K-L Algorithm handles only exact bisections. Need dummy vertices to handle the unbalanced problem. The K-L Algorithm cannot handle hypergraphs. Need to handle multi-terminal nets directly. The time complexity of a pass is high, O(n3).

 

 

Extensions of K-L Algorithm


Unequal sized subsets (assume n1 < n2) Total number of vertices 2n Number of vertices in Partition A: n1 Number of vertices in Partition B: n2 Without loss of generality assume n1 < n2
 1.

2.

3. 4.

Divide V into blocks A and B; A contains n1 vertices and B contains n2 vertices. Add n2-n1 dummy vertices to block A. Dummy vertices have no connections to the original graph. Apply the Kernighan-Lin algorithm. Remove all dummy vertices.

Extensions of K-L Algorithm




Unequal sized vertices"


1. Assume that the smallest vertex" has unit size. 2. Replace each vertex of size s with s vertices which are fully connected with edges of infinite weight. 3. Apply the Kernighan-Lin algorithm.

B A

w w w

A
w

Extensions of K-L Algorithm




K way partitioning of kn vertices

Assume that the graph has kn vertices, k > 2, and it is required to generate a kway partition, each with n elements.

1. 2.

Begin with a random partition of k sets of n vertices each. Apply the two-way partitioning procedure on each pair of partitions.

FM Algorithm


Fiduccia-Mattheyses algorithm is an iterative procedure that takes into consideration multipin nets as well as sizes of circuit elements.

Given a circuit consisting of C cells connected by a set of N nets (where each net connects at least two cells), the problem is to partition circuit C into two blocks A and B such that the number of nets which have cells in both the blocks is minimized and a balance factor r is satisfied.

KL vs. FM Algorithm
Movement of cells 1. In Kernighan-Lin algorithm , during each pass a pair of cells is selected for swapping, one from each block. 2. In the Fiduccia-Mattheyses algorithm a single cell at a time, from either block is selected and considered for movement to the other block. Objective of partitioning 1. Kernighan-Lin algorithm partitions a graph into two blocks such that the cost of edges cut is minimum. 2. Fiduccia-Mattheyses algorithm aims at reducing the cost of nets cut by the partition.

KL vs. FM Algorithm - contd


Selection of cells 1. FM algorithm is similar to the Kernighan-Lin in the selection of cells. But the gain due to the movement of a single cell from one block to another is computed instead of the gain due to swap of two cells. Once a cell is selected for movement, it is locked for the remainder of that pass. The total number of cells that can change blocks is then given by the best sequence of moves c1, c2ck. 2. In contrast, in Kernighan-Lin the first best k pairs in a pass are swapped.

KL vs. FM Algorithm contd.


Balance criterion 1. Kernighan-Lin Algorithm can produce imbalanced partition in case cells are of different sizes. 2. FM algorithm is designed to handle imbalance, and it produces a balanced partition with respect to size. The balance factor r (called ratio) is user specified and is defined as follows: r = |A|/|A|+|B| , where |A| and |B| are the sizes of partitioned blocks A and B.


Time complexity of FM Algorithm is linear. O(P),where P is the total no of terminals.

Terms in FM Algorithm


Let p(j) be the number of pins of cell `j', and s(j) be the size of cell `j', for j = 1,2,,C. If V is the set of the C cells, then |V | = s(i) Cut-Set Refers to the set of all the nets in the network which cross the boundary between the two defined partitions. In other words, the cut-set is equal to the set of nets, which are connected to at least one node in each of the two defined partitions. Gain of cell. : The gain g(i) of a cell `i' is the number of nets by which the cutset would decrease if cell `i' were to be moved. A cell is moved from its current block (the From_block) to its complementary block (the To_block).

Net cuts
3 4

m 1 k 2 p 6 5

Reducing the number of net cuts is more realistic than reducing the number of edge cut.

Terms in FM Algorithm


Balance criterion

: To avoid having all cells migrate to one block a

balancing criterion is maintained.




A partition (A,B) is balanced iff r X |V | - smax |A| r |V | + smax where |V| = |A| + |B| = total size of both partitions Smax = Weight of the largest cell in the network R = Balance factor between 0 and 1 (typically ~ 0.5)

Base cell

: The cell selected for movement from one block to another is

called base cell . It is the cell with maximum gain and the one whose movement will not violate the balance criterion.

Distribution of a net n
 

A(n) : the number of cells of net n in A B(n): the number of cells of net n in B

Distribution of a net n

A(n) : the number of cells of net n in A B(n): the number of cells of net n in B A B

Terms in FM Algorithm


Distribution of a net : Distribution of a net n is a pair (A(n),B(n)) where (A,B) is an arbitrary partition, and, A(n) is the number of cells of net n that are in A and B(n) is the number of cells of net n that are in B.

Critical net. : A net is critical if it has a cell which if moved will change its cutstate. That is, if and only if A(n) is either 0 or 1, or B(n) is either 0 or 1.

 

Gain of a cell depends only on its critical nets. Free Cell All the remaining cells in the network which are marked as unlocked and also not being evaluated as the base cell.

FM Algorithm
Step 1. Compute gains of all cells. Step 2. i =1. Select `base cell' and call it ci; If no base cell Then Exit; A base cell is one which (i) has maximum gain; (ii) satisfies balance criterion; If tie Then use Size criterion or Internal connections; Step 3. Lock cell ci; Update gains of cells of those affected critical nets; Step 4. If free cells Then i = i + 1; select next base cell; If ci then Goto Step 3; Step 5. Select best sequence of moves c1,c2 ck (1 k i) such that G= gj is max; If tie then choose subset that achieves a superior balance; If G 0 Then Exit; Step 6. Make all i moves permanent; Free all cells; Goto Step 1

FM Algorithm -Step 1
 

The first step consists of computing the gains of all free cells. Similar to the Kernighan-Lin algorithm, the effect of the movement of a cell on the cutset is quantified with a gain function.

Let F(i) and T(i) be the From block and To block of cell i.  The gain g(i) resulting from the movement of cell i from block F(i) to block T(i) is: g(i) = F(i) --T(i) Where  From Block F(i) the number of nets connected to cell i and not connected to any other cell in the From Block F(i) of cell i.  To BlockT(i) the number of nets that are connected to cell i and not crossing the cut.


Cell i
3 4 m k 2 p 6 5 j

F A A A B B B

T B B B A A A

F(i) 0 2 0 1 1 1

T(i) 1 1 1 1 1 0

g(i) -1 +1 -1 0 0 +1

1 2 3 4 5

Example - contd
Consider cell 2, its From_Block is A and its To_Block is B. Nets k, m, p, and q are connected to cell 2 of block A, of these only two nets k and p are not connected to any other cell in block A.


 

Therefore, by definition, F(2)=2. And T(2)=1 since the only net connected and not crossing the cut is net m.

Hence g(2)=2-1=1. Which means that the number of nets cut will be reduced by 1 (from 3 to 2) if cell 2 were to be moved from A to B.

Compute the gains of all the free cells of the circuit.

Selection of base cell- Step 2


 

Having computed the gains of each cell, we now choose the `base cell'. The base cell is one that has a maximum gain and does not violate the balance criterion.

 

If no base cell is found then the procedure stops. To avoid migration of all cells to one block, during each move, the balance criterion is maintained.

If more than one cell of maximum gain exists, and all such cells satisfy the balance criterion, then ties may be broken depending on the size, internal connectivity, or any other criterion.

Steps (Contd.)
Step 3  Lock cell and update gains:  After each move the selected cell is locked in its new block for the remainder of the pass.  Then the gains of cells of affected critical net are updated Step 4 - Select next base cell:  In this step, if more free cells exist then we search for the next base cell. If found then we go back to Step 3, lock the cell, and repeat the update. If no free cells are found then we move on to Step 5.

Steps (Contd.)
Step 5 - Select best sequence of moves:


After all the cells have been considered for movement, as in the case of Kernighan-Lin, the best partition encountered during the pass is taken as the output of the pass. The number of cells to move is given by the value of k which yields maximum positive gain Gk, where G = gj

Step 6- Make moves permanent:




Only the cells given by the best sequence, that is, c1,c2 ck are permanently moved to their complementary blocks. Then all cells are freed and the procedure is repeated from the beginning.

Conclusion


Several modifications and generalization of the algorithms are present and framework are also available.

These framework tool enables the partitioning of larger VLSI circuits

These frameworks are extremely fast and provide solutions of reasonable quality

References


B. W. Kernighan and S. Lin, An efficient heuristic procedure for partitioning graphs, Bell Systems Technical Journal, 49, 2, pp.291307 (1970). Sandeep Koranne, A Distributed Algorithm for k-way Graph Partitioning, Electronic Design and Tools Philips Research laboratories, pp 777-779 M S Khan and K F Li, Fast Graph Partitioning Algorithms , Intelligent Computing and Intelligent Systems (ICIS), IEEE International Conference, pp 337-342

References


Martinello, O. Marques, F.S. Ribas, R.P. Reis, KL-Cuts: A new approach for logic synthesis targeting multiple output blocks, Design ,Automation and Test in Europe Conference and Exhibition , 2010, pp 777-779 Li Deng Li-Zuo Jin Key Lab. of Power Station Autom., Shanghai Univ., Shanghai, China , Data Dispose Algorithm for Scheduling in Multi Channels , Intelligent Computing and Intelligent Systems (ICIS), 2010 IEEE International Conference, pp 638-640

THANK YOU

Potrebbero piacerti anche