110 likes | 454 Views
Algorithm Representations and Iteration Bound. The basic representation of an algorithm. Shows only dependency among operations. No notion of delay is represented. No loop, cycle allowed. Can be used to represent asynchronous operations.
E N D
The basic representation of an algorithm. Shows only dependency among operations. No notion of delay is represented. No loop, cycle allowed. Can be used to represent asynchronous operations. Most useful in exploiting inherent parallelism in the algorithm No implementation or hardware constraint are imposed on DG. Dependence Graph (DG) (C)2002-2006 Yu Hen Hu
Node: Computation Associated with a computing time. Direct edge: data path and delay Delay: iteration count Example y(n) = a*y(n-1) + b*u(n) The delay of 1 u.t. indicates that to compute y(n+1) in the next iteration depends on result y(n) of the present iteration. Delay labeled with D or positive integer on edges Data Flow Graph (C)2002-2006 Yu Hen Hu
Intra-iteration dependency A direct edge without any delay Inter-iteration dependency Direct edge with 1 or more delays Node computing delay labeled with parenthesis. Critical path: longest path between … Example: critical path delay = 4+2+2 = 8 t.u. Recursive DFG: contains loops. Must have at least one delay element along any loop. Otherwise, the algorithm is NON-computable! DFG x(n) D D M1 M2 (4) (4) M0 (4) y(n) A1 A0 (2) (2) (C)2002-2006 Yu Hen Hu
T{A-B-A} = (2+4)/2 = 3 t.u. T = max{(2+4)/2, (2+4+5)/1} = max{3, 11} = 11 Loop bound and Iteration bound D (2) (5) (4) A B C 2D (2) (4) A B 2D (C)2002-2006 Yu Hen Hu
Paths are from one delay element to another. Matrix L(m) dimension d by d, d: # of delay elements Element ij(m) = longest computing time from output of di to input of dj with exactly m-1 delays in between. If no such path exists, ij(m)=-1. Let K = {k; k [1, d], ik(1) > -1 and kj(m) > -1}, then Once L(m) is computed, the iteration bound can be found as: This algorithm can be easily programmed once L(1) is given. Longest Path Matrix Algorithm (C)2002-2006 Yu Hen Hu
1 (1) D d1 D d2 (2) 4 2 (1) D d3 (2) 5 3 (1) (2) D d4 6 LPM Example (Fig. 2.2) lpm.m (C)2002-2006 Yu Hen Hu
Create a new Graph Gd from the given DFG G. Each node of Gd is a delay element in G. Edge from node i to node j in Gd is the longest path from delay i to delay j in G. So Gd can be constructed from non-negative entries of L(1). Compute cycle mean of each cycle in Gd. A cycle mean is the average lengths of all eges in a cycle Maximum cycle mean of Gd is the maximum cycle (loop) bound of all loops in G and hence is the iteration bound. Algorithm: Compute Gc’ whose edge is negative of that of G. Choose an arbitrary node s, such that fs(0)=0, fk(0) = . Iterations: iteration bound = Minimum Cycle Mean Algorithm mcm.m (C)2002-2006 Yu Hen Hu
(1) (2) (1) (1) (1) (2) 1 2 4 3 6 5 D d1 D d2 (1) 7 Example (Figure 2.4) (C)2002-2006 Yu Hen Hu
LPM Method MCM Method i-m matrix T = 8 -8 -4 Gd’ -4 2 1 -8 LPM and MCM for Fig. 2.4 (C)2002-2006 Yu Hen Hu