synchronous networks an interconnection structure with an interconnection structure with • boolean nodes, primary inputs and primary outputs • a propagation delay is associated with each boolean node; ti d l i i t d ith h b l d all input-output delays of a node are equal • single-phase edge-triggered memory elements on the edges; g p g gg y g all memory elements are triggered by the same clock • cycles have at least one memory element v a d d c D b D D D D e e i i u D
retiming retiming = i i adding, deleting, moving clocked memory elements, ddi d l i i l k d l neither changing the topology of the network nor the boolean operations in the node nor th oo an op rat ons n th no
retiming original fir-filter: i i l fi filt clock -2 -1 0 1 time input outputs of flipflops output p retiming adder delay flipflop delay retimed fir-filter: clock clock -2 -1 0 1 time input outputs of flipflops flipflops output adder delay retiming changes m g g flipflop delay flipflop delay the temporal behavior of the network, and not the sequential behavior
leiserson's correlator + + + g g e e f f host host = = = = a b c d a finite directed multigraph, vertex weighted g f e 0 0 7 (delay ≥ 0), and 7 7 0 0 arc weighted (number of h d 0 0 0 memory 0 3 elements) ) 1 1 3 3 3 1 1 a b c
retiming steps shifting clocked memory elements: b D b D a a c D c clock clock l k model: d d b b b b d d a a a a c c d d c c = delay of boolean node d • retiming = adding, deleting, moving clocked memory elements, neither changing the topology of the network nor the boolean operations in the node
retiming model retiming = an integer labeling r of vertices. interpretation: interpretation: r > 0 r < 0 r elements r elements r elements r elements added removed removed added a retiming is legal r netwerk, retimed by : if the retimed network w ij w has no negative weights has no negative weights r i j r j i all “equivalent” synchronous networks can be obtained from an initial network by be obtained from an initial network by r i r j legal retiming i j w ij + r j - r i [Leiserson 1983]
feasible clock periods d(p)=path delay= d(p)=path delay= sum of all vertex-weights (delays) on a directed path w(p)=path weight= ( ) h i h sum of all arc-weights ( # memory elements) on a directed path condition: all cycle weights must be positive! properties under retiming: properties under retiming: � changes in path weights depend only on end vertices � cycle weights are invariant a clock period is feasible if it exceeds any path delay on a zero-weight path y p y g p the minimum feasible clock period Φ = max {d(p) | w(p) = 0}
a retiming problem formulation problem statement for clock period minimization : given G (V, E, d, w), find a legal retiming r so that Φ = max { d(p) | w(p) = 0 } { d( ) | ( ) 0 } Φ is minimized example : smaller correlator 7 a a a + 0 0 h c c host host 0 0 0 3 2 0 = = b c 3 b b
two auxiliary matrices p W(u,v) = min {w(p) | u → v}: the minimum number of m.e. on any path from u to v p D(u,v) max {d(p) | u → v and w(p) W(u,v)}: D(u v) = max {d(p) | u → v and w(p) = W(u v)}: the maximum path delay over a "critical" path a real number φ is a feasible clock period fif D(u,v) > φ → W(u,v)>0 l b φ i f ibl l k i d fif D( ) φ W( ) 0 other facts: the set of "critical" paths invariant under retiming W r (u,v) := W(u,v) + r(v) - r(u) D (u v) := D(u v) D r (u,v) := D(u,v) Φ , the minimum feasible clock period, is equal to some D(u,v) W and D are useful quantities! →
all-pairs shortest paths 2 input: 3 4 4 0 0 3 3 8 8 -4 4 ∞ 0 1 7 ∞ ∞ 8 1 3 M = 4 0 ∞ ∞ ∞ 2 -5 0 ∞ ∞ 1 1 2 2 -5 -4 6 0 ∞ ∞ ∞ 7 6 5 4 output: 0 1 -3 2 -4 N 3 4 5 1 3 0 -4 1 -1 4 N 4 2 1 C = 7 4 0 5 3 Π = 4 3 N 2 1 2 -1 -5 0 -2 4 3 4 N 1 8 5 1 6 0 4 3 4 5 N
floyd-warshall assume V = {1,2,…,n} � consider the subset V(k) = {1 2 � consider the subset V(k) = {1,2,…,k} for some k ≤ n k} for some k ≤ n � let i and j be two vertices � consider the set P(i,j,k) of paths from i to j with intermediate nodes from V(k) ith i t m di t d s f m V(k) let p be a shortest path in P(i,j,k) � if k is not an intermediate node of p then � if k is not an intermediate node of p, then p is a shortest path in P(i,j,k-1) � if k is an intermediate node of p, then p=qr with q a shortest path in P(i,k,k-1) i h h h i P(i k k 1) and r a shortest path in P(k,j,k-1) recursively formulated: y let be the weight of the shortest path in P(i,j,k) (k) c ij if k = 0 m (k) = = ij j c c − − − if k > 0 ij (k 1) (k 1) + (k 1) min(c ,c c ) ij ik kj ( ) desired answer: (n) = (n) C c ij
bottom-up computation floyd-warshall(W) 2 3 4 1 n ← rows[W] [ ] 2 8 (0) ← C W 1 3 3 for k ← 1 to n 4 do for i ← 1 to n 1 2 -5 5 -4 4 5 do for j ← 1 to n 7 6 − − − 6 (k) ← (k 1) (k 1) + (k 1) 5 4 c min(c ,c c ) ij ij ik kj 7 return (n) C C ( 0 ) ( 0 ) ( 0 ) + min( d , d d ) 41 41 11 0 0 3 3 8 8 -4 4 0 0 0 0 3 3 3 3 8 8 8 8 -4 -4 4 4 ∞ ∞ ∞ 0 1 7 0 1 7 ∞ 0 ∞ 1 7 ∞ ∞ ∞ ∞ (0) (1) (0) C = C = D = 4 0 4 0 ∞ 4 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 2 -5 0 2 -5 0 ∞ ∞ ∞ ∞ 6 0 6 0 ∞ ∞ ∞ ∞ ∞ ∞
bottom-up computation floyd-warshall(W) 2 3 4 1 n ← rows[W] [ ] 2 8 (0) ← C W 1 3 3 for k ← 1 to n 4 do for i ← 1 to n 1 2 -5 5 -4 4 5 do for j ← 1 to n 7 6 − − − 6 (k) ← (k 1) (k 1) + (k 1) 5 4 c min(c ,c c ) ij ij ik kj 7 return (n) C C ( 0 ) ( 0 ) ( 0 ) + min( d , d d ) 42 41 12 0 0 3 3 8 8 -4 4 0 0 0 0 3 3 3 3 8 8 8 8 -4 -4 4 4 ∞ ∞ ∞ 0 1 7 0 1 7 ∞ 0 ∞ 1 7 ∞ ∞ ∞ ∞ (0) (1) (0) C = C = D = 4 0 4 0 ∞ 4 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 2 -5 0 2 2 -5 0 ∞ ∞ ∞ ∞ 6 0 6 0 ∞ ∞ ∞ ∞ ∞ ∞
bottom-up computation floyd-warshall(W) 2 3 4 1 n ← rows[W] [ ] 2 8 (0) ← C W 1 3 3 for k ← 1 to n 4 do for i ← 1 to n 1 2 -5 5 -4 4 5 do for j ← 1 to n 7 6 − − − 6 (k) ← (k 1) (k 1) + (k 1) 5 4 c min(c ,c c ) ij ij ik kj 7 return (n) C C 0 3 8 -4 0 1 -3 2 -4 ∞ 0 0 0 0 3 3 3 3 8 8 8 8 -4 -4 4 4 ∞ ∞ 0 1 7 3 0 0 -4 1 1 -1 7 ∞ ∞ ∞ 0 ∞ 1 7 ∞ ∞ (0) (n) (1) (0) C = C = 4 0 C = D = 7 4 4 0 0 5 3 ∞ ∞ ∞ ∞ 4 0 ∞ ∞ ∞ ∞ ∞ 2 -5 0 2 -1 -5 -5 0 0 -2 -2 ∞ ∞ 2 2 5 -5 0 ∞ ∞ 6 0 8 5 1 6 0 ∞ ∞ ∞ 6 6 0 0 ∞ ∞ ∞ ∞ ∞ ∞
construction of shortest paths let be the predecessor of j on a shortest path in P(i,j,k) π ( k ) ij if i = j or = ∞ NIL w π = ( 0 ) ij i if i ≠ j and ij < ∞ w ij (k > 0) π − − ≤ − + − ( k 1 ) ( k 1 ) ( k 1 ) ( k 1 ) if d d d π = ij ij ik kj ( k ) ij π π − − > > − + + − ( k 1 ) ( k 1 ) ( k 1 ) ( k 1 ) if if d d d d d d kj kj ij ij ik ik kj kj ( ) Π = π desired answer: ( n ) ( n ) ij
remarks floyd-warshall(W) 1 n ← rows[W] [ ] 2 (0) ← C W 3 for k ← 1 to n 4 do for i ← 1 to n 5 do for j ← 1 to n − − − 6 (k) ← (k 1) (k 1) + (k 1) c min(c ,c c ) ij ij ik kj 7 return (n) C C (V 3 • running time ) O • detection of negative-weight cycles (a negative number on the diagonal of ) (a negative number on the diagonal of ) (n) ( ) C C • space-optimization possible • works for any (min,+)algebra that is a semiring
calculating W and D ( ) • reweight each edge with − w d ij, i • calculate all-pair shortest paths with: – additions must be done as two-component vectors – comparisons must be done lexicographically, p g p y, i.e. for and = = c (a ,b ) c (a ,b ) 1 1 1 2 2 2 if or ( and ) f ( ) < < = < c c a a a a b b 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 – if then and (n) = = = − c (x ,y ) w x d d y ij ij ij ij ij ij j ij
Recommend
More recommend