Download presentation

Presentation is loading. Please wait.

Published byLucas Salisbury Modified over 2 years ago

1
Spring EE384y: Packet Switch Architectures Matchings, implementation and heuristics Nick McKeown Professor of Electrical Engineering and Computer Science, Stanford University

2
Spring Outline Finding a maximum match. Maximum network flow problems Definitions and example Augmenting paths Maximum size/weight matchings as examples of maximum network flows Maximum size matching Complexity of maximum size matchings and maximum weight matchings What algorithms are used in practice? Maximal Matches Wavefront Arbiter (WFA) Parallel Iterative Matching (PIM) iSLIP

3
Spring Network Flows Source s Sink t ac bd Let G = [V,E] be a directed graph with capacity cap(v,w) on edge [v,w]. A flow is an (integer) function, f, that is chosen for each edge so that We wish to maximize the flow allocation.

4
Spring A maximum network flow example By inspection Source s Sink t ac bd Step 1: Source s Sink t ac bd 10, , , 10 Flow is of size 10

5
Spring A maximum network flow example Source s Sink t ac bd 10, 10 10, 1 10, , 1 10, 1 10, 10 Step 2: Flow is of size 10+1 = 11 Source s Sink t ac bd 10, 10 10, 2 10, 9 1,1 10, 2 10, 10 Maximum flow: Flow is of size 10+2 = 12 Not obvious

6
Spring Ford-Fulkerson method of augmenting paths 1. Set f(v,w) = -f(w,v) on all edges. 2. Define a Residual Graph, R, in which res(v,w) = cap(v,w) – f(v,w) 3. Find paths from s to t for which there is positive residue. 4. Increase the flow along the paths to augment them by the minimum residue along the path. 5. Keep augmenting paths until there are no more to augment.

7
Spring Example of Residual Graph st ac bd 10, , , 10 Flow is of size 10 t ac bd s res(v,w) = cap(v,w) – f(v,w) Residual Graph, R Augmenting path

8
Spring Example of Residual Graph st ac bd 10, 10 10, 1 10, , 1 10, 1 10, 10 Step 2: Flow is of size 10+1 = 11 st ac bd Residual Graph 9 9

9
Spring Example of Residual Graph st ac bd 10, 10 10, 2 10, 9 1, 1 10, 2 10, 10 Step 3: Flow is of size 10+2 = 12 st ac bd Residual Graph 8 8 1

10
Spring Complexity of network flow problems In general, it is possible to find a solution by considering at most |V|.|E| paths, by picking shortest augmenting path first. There are many variations, such as picking most augmenting path first.

11
Spring Outline Finding a maximum match. Maximum network flow problems Definitions and example Augmenting paths Maximum size/weight matchings as examples of maximum network flows Maximum size matching Complexity of maximum size matchings and maximum weight matchings What algorithms are used in practice? Maximal Matches Wavefront Arbiter (WFA) Parallel Iterative Matching (PIM) iSLIP

12
Spring Finding a maximum size match How do we find the maximum size (weight) match? A B C D E F

13
Spring Network flows and bipartite matching Finding a maximum size bipartite matching is equivalent to solving a network flow problem with capacities and flows of size 1. A1 Source s Sink t B C D E F

14
Spring Network flows and bipartite matching Ford-Fulkerson method A1 s t B C D E F Residual Graph for first three paths:

15
Spring Network flows and bipartite matching A1 s t B C D E F Residual Graph for next two paths:

16
Spring Network flows and bipartite matching A1 s t B C D E F Residual Graph for augmenting path:

17
Spring Network flows and bipartite matching A1 s t B C D E F Residual Graph for last augmenting path: Note that the path augments the match: no input and output is removed from the match during the augmenting step.

18
Spring Network flows and bipartite matching A1 s t B C D E F Maximum flow graph:

19
Spring Network flows and bipartite matching A1 B C D E F Maximum Size Matching:

20
Spring Complexity of Maximum Matchings Maximum Size Matchings: Algorithm by Dinic O(N 5/2 ) Maximum Weight Matchings Algorithm by Kuhn O(N 3 ) In general: Hard to implement in hardware Slooooow.

21
Spring Outline Finding a maximum match. Maximum network flow problems Definitions and example Augmenting paths Maximum size/weight matchings as examples of maximum network flows Maximum size matching Complexity of maximum size matchings and maximum weight matchings What algorithms are used in practice? Maximal Matches Wavefront Arbiter (WFA) Parallel Iterative Matching (PIM) iSLIP

22
Spring Maximal Matching A maximal matching is one in which each edge is added one at a time, and is not later removed from the matching. i.e. no augmenting paths allowed (they remove edges added earlier). No input and output are left unnecessarily idle.

23
Spring Example of Maximal Size Matching A1 B C D E F A1 B C D E F Maximal Size Matching Maximum Size Matching A B C D E F

24
Spring Maximal Matchings In general, maximal matching is simpler to implement, and has a faster running time. A maximal size matching is at least half the size of a maximum size matching. A maximal weight matching is defined in the obvious way. A maximal weight matching is at least half the weight of a maximum weight matching.

25
Spring Outline Finding a maximum match. Maximum network flow problems Definitions and example Augmenting paths Maximum size/weight matchings as examples of maximum network flows Maximum size matching Complexity of maximum size matchings and maximum weight matchings What algorithms are used in practice? Maximal Matches Wavefront Arbiter (WFA) Parallel Iterative Matching (PIM) iSLIP

26
Spring Wave Front Arbiter (Tamir) RequestsMatch

27
Spring Wave Front Arbiter RequestsMatch

28
Spring Wave Front Arbiter Implementation 1,11,21,31,42,12,22,32,43,13,23,33,44,14,24,34,4 Simple combinational logic blocks

29
Spring Wave Front Arbiter Wrapped WFA (WWFA) Requests Match N steps instead of 2N-1

30
Spring Wavefront Arbiters Properties Feed-forward (i.e. non-iterative) design lends itself to pipelining. Always finds maximal match. Usually requires mechanism to prevent Q 11 from getting preferential service. In principle, can be distributed over multiple chips.

31
Spring Outline Finding a maximum match. Maximum network flow problems Definitions and example Augmenting paths Maximum size/weight matchings as examples of maximum network flows Maximum size matching Complexity of maximum size matchings and maximum weight matchings What algorithms are used in practice? Maximal Matches Wavefront Arbiter (WFA) Parallel Iterative Matching (PIM) iSLIP

32
Spring Parallel Iterative Matching : Requests : Grant : Accept/Match uar selection #1 #2 Iteration:

33
Spring PIM Properties Guaranteed to find a maximal match in at most N iterations. In each phase, each input and output arbiter can make decisions independently. In general, will converge to a maximal match in < N iterations. How many iterations should we run?

34
Spring Parallel Iterative Matching Convergence Time Number of iterations to converge:

35
Spring Parallel Iterative Matching

36
Spring Parallel Iterative Matching PIM with a single iteration

37
Spring Parallel Iterative Matching PIM with 4 iterations

38
Spring Outline Finding a maximum match. Maximum network flow problems Definitions and example Augmenting paths Maximum size/weight matchings as examples of maximum network flows Maximum size matching Complexity of maximum size matchings and maximum weight matchings What algorithms are used in practice? Maximal Matches Wavefront Arbiter (WFA) Parallel Iterative Matching (PIM) iSLIP

39
Spring iSLIP : Requests : Accept/Match #1 # : Grant

40
Spring iSLIP Operation Grant phase: Each output selects the requesting input at the pointer, or the next input in round-robin order. It only updates its pointer if the grant is accepted. Accept phase: Each input selects the granting output at the pointer, or the next output in round-robin order. Consequence: Under high load, grant pointers tend to move to unique values.

41
Spring iSLIP Properties Random under low load TDM under high load Lowest priority to MRU 1 iteration: fair to outputs Converges in at most N iterations. (On average, simulations suggest < log 2 N ) Implementation: N priority encoders 100% throughput for uniform i.i.d. traffic. But…some pathological patterns can lead to low throughput.

42
Spring iSLIP

43
Spring iSLIP

44
Spring iSLIP Implementation Grant Accept 1 2 N 1 2 N State N N N Decision log 2 N Programmable Priority Encoder

45
Spring Maximal Matches Maximal matching algorithms are widely used in industry (PIM, iSLIP, WFA and others). PIM and iSLIP are rarely run to completion (i.e. they are sub-maximal). We will see shortly that a maximal match with a speedup of 2 is stable for non- uniform traffic.

Similar presentations

© 2016 SlidePlayer.com Inc.

All rights reserved.

Ads by Google