cyclic scheduling an introduction
play

Cyclic scheduling: an introduction Claire Hanen - PowerPoint PPT Presentation

Cyclic scheduling: an introduction Claire Hanen Claire.Hanen@lip6.fr Universit e Paris X Nanterre / LIP6 UPMC Cyclic scheduling for EPIT 2007 p. 1/ ?? Summary Definition Uniform precedence constraints Feasibility Periodic schedules


  1. Cyclic scheduling: an introduction Claire Hanen Claire.Hanen@lip6.fr Universit´ e Paris X Nanterre / LIP6 UPMC Cyclic scheduling for EPIT 2007 – p. 1/ ??

  2. Summary Definition Uniform precedence constraints Feasibility Periodic schedules Earliest schedule Resource constraints Periodicity and Patterns Complexity approximation ILP formulations Perspectives Cyclic scheduling for EPIT 2007 – p. 2/ ??

  3. Definition A set of tasks T to be repeated many times assumed infinite For i ∈ T , < i, k > denotes k th occurrence of i An infinite schedule σ defines: ∀ k ≥ 0 t σ ( < i, k > ) starting time of < i, k > Resources for each task execution Cyclic scheduling for EPIT 2007 – p. 3/ ??

  4. Optimizing Minimizing the average cycle time : t σ ( < i, k > ) A ( σ ) = max i ∈T A ( σ, i ) = limsup k → + ∞ k Maximizing the throughput: 1 D ( σ ) = A ( σ ) For a given average cycle time, minimizing the amount of resources per time units (ex: nb of processors, nb of registers,...) Cyclic scheduling for EPIT 2007 – p. 4/ ??

  5. Applications and models Implementing loops on parallel architectures → compiling, code generation → embedded applications litterature on software pipelining and dataflow computations Mass production → Cyclic shop problems → Hoist scheduling problem. litterature on cyclic scheduling in production systems Models of parallelism → timed Petri Nets → Graphs → Max + algebra litterature on parametric paths, timed event graphs, Max + Cyclic scheduling for EPIT 2007 – p. 5/ ??

  6. Infinite schedule? Algorithms-> finite description Static schedule Must be regular /time and resources Dynamic policy examples: earliest schedule, regular priorities on resources assignment Cyclic scheduling for EPIT 2007 – p. 6/ ??

  7. Loop example Assume arrays A, B, C, D , and that the processor can compute several instructions in parallel : for I = 2 to N do B ( I ) = A ( I − 1) + 1 task 1 < 4 , k − 1 > precedes < 1 , k > C ( I ) = B ( I ) + 5 task 2 < 1 , k > precedes < 2 , k > D ( I ) = B ( I − 2) ∗ D ( I ) task 3 < 1 , k − 2 > precedes < 3 , k > A ( I ) = C ( I − 2) + D ( I ) task 4 < 2 , k − 2 >, < 1 , k > precede < 2 , k > Precedence constraints are uniforms: if < i, k > precedes < j, l > then for all integers δ , < i, k + δ > precedes < j, l + δ > Cyclic scheduling for EPIT 2007 – p. 7/ ??

  8. Cyclic scheduling with uniform precedence A set T of n generic tasks with processing times p 1 , . . . , p n non reentrance: < i, k > precedes < i, k + 1 > ∀ k ≥ 1 A multi-graph G = ( T , A ) of uniform constraints For each arc a ∈ A , A value called length L ( a ) ∈ Z also mentioned as latency or delay A value called height H ( a ) ∈ Z also called dependence distance If i = b ( a ) et j = e ( a ) , ∀ k ≥ 1 , t σ ( < i, k > ) + L ( a ) ≤ t σ ( < j, k + H ( a ) > ) ( L ( a ) , H ( a )) b ( a ) e ( a ) Find an infinite feasible schedule minimizing the average cycle time. Definition 1. The Length of path µ , denoted L ( µ ) = sum of arcs length. Height of µ , denoted by H ( µ ) = sum of arcs height. Remark 1. Non-reentrance can be expressed with uniform constraints : arcs ( i, i ) with length p i and height 1 . Cyclic scheduling for EPIT 2007 – p. 8/ ??

  9. Example Negative length can be used to model deadlines : t σ ( < 5 , k > ) ≤ t σ ( < 4 , k > ) + 10 Cyclic scheduling for EPIT 2007 – p. 9/ ??

  10. Questions Feasibility Construction and properties of schedules. Periodic schedules Earliest schedule Performance Cyclic scheduling for EPIT 2007 – p. 10/ ??

  11. Feasibility For any path µ from i to j , t σ ( < i, k > ) + L ( µ ) ≤ t σ ( < j, k + H ( µ ) > ) ∀ k ≥ max(1 , 1 − H ( C )) , For any circuit C of G , and task i in C : t σ ( < i, k > ) + L ( C ) ≤ t σ ( < i, k + H ( C ) > ) ∀ k ≥ max(1 , 1 − H ( C )) , Non reentrance ⇒ Lemma 1. [Lee 05][Munier 06] If G is feasible then for any circuit C such that H ( C ) ≤ 0 , L ( C ) ≤ 0 . If H ∈ N this condition is sufficient [many authors] [Chretienne 85] t σ ( < i, k > ) ≥ qL ( C ) + t σ ( < i, r > ) . If H ( C ) > 0 , k = qH ( C ) + r then t σ ( < i, k > ) ≤ − qL ( C ) + t σ ( < i, r > ) If H ( C ) < 0 and k = − qH ( C ) + r then t σ ( < i, k > ) ≥ L ( C ) Lemma 2. If H ( C ) ≥ 0 , A ( σ, i ) = lim sup . k H ( C ) k → + ∞ A ( σ, i ) ≤ L ( C ) If H ( C ) < 0 , H ( C ) Cyclic scheduling for EPIT 2007 – p. 11/ ??

  12. Feasibility and performance bounds For a circuit C the Index of C : α ( C ) = L ( C ) H ( C ) C + = ∪ i ∈T C + ( i ) C + ( i ) set of circuits C s.t. i ∈ C and H ( C ) ≥ 0 . C − = ∪ i ∈T C − ( i ) C − ( i ) set of circuits C s.t. i ∈ C and H ( C ) < 0 . Corollary 1. If G is feasible then for any task i , and for any schedule σ C ∈C + ( i ) α ( C ) ≤ A ( σ, i ) ≤ max C ∈C − ( i ) α ( C ) min A critical circuit is a circuit C ∗ ∈ C + s.t α ( C ) is maximum : lower bound on A ( σ ) . Cyclic scheduling for EPIT 2007 – p. 12/ ??

  13. Periodic schedules Definition 2. A schedule σ is periodic if each task i has a period w i such that: t σ ( < i, k > ) = t σ ( < i, 1 > ) + ( k − 1) w i Let a be an arc from b ( a ) to e ( a ) t σ ( < b ( a ) , 1 > ) + ( k − 1) w b ( a ) + L ( a ) ≤ t σ ( < e ( a ) , 1 > ) + ( k − 1) w e ( a ) + H ( a ) w e ( a ) ∀ k, ⇔ t σ ( < e ( a ) , 1 > ) − t σ ( < b ( a ) , 1 > ) ≥ L ( a ) − w e ( a ) H ( a ) + ( k − 1)( w b ( a ) − w e ( a ) ) Cyclic scheduling for EPIT 2007 – p. 13/ ??

  14. Existence of a periodic schedule Lemma 3. for any arc a , w b ( a ) ≤ w e ( a ) . We denote by C 1 , . . . , C q the strong components of G . Let α + ( C s ) = C ∈ C s ,H ( C ) > 0 α ( C ) and α − ( C s ) = max C ∈ C s ,H ( C ) < 0 α ( C ) min Corollary 2. α + ( C s ) ≤ W s ≤ α − ( C s ) ∀ s, ∀ i, j ∈ C s , w i = w j = W s and Moreover, if there is an arc a s.t. b ( a ) ∈ C s , e ( a ) ∈ C s ′ then W s ≤ W s ′ Cyclic scheduling for EPIT 2007 – p. 14/ ??

  15. Example C 1 = { 1 , 2 , 3 } , C 2 = { 4 , 5 } , C 3 = { 6 } α + ( C 1 ) = 10 , α − ( C 1 ) = 17 , α + ( C 2 ) = 7 , α − ( C 2 ) = 11 , α + ( C 3 ) = 5 10 ≤ W 1 ≤ 17 , 7 ≤ W 2 ≤ 11 , 5 ≤ W 3 , W 3 ≥ W 2 , W 3 ≥ W 1 W 1 = 10 , W 2 = 7 , W 3 = 10 . Notice that W 1 = W 2 = W 3 = 10 is also a solution. Cyclic scheduling for EPIT 2007 – p. 15/ ??

  16. Feasibility Theorem 1. [Munier 06] G is feasible if and only if there exists a periodic schedule. Idea : If no periodic schedule exists, build paths µ x between i and j in G such that H ( µ x ) = h and x → + ∞ L ( µ x ) → + ∞ , which contradicts lim t σ ( < j, k > ) − t σ ( < i, k + h > ) ≥ L ( µ x ) for some k . Cyclic scheduling for EPIT 2007 – p. 16/ ??

  17. Computation of a periodic schedule For a strong connected graph G and a given W : t σ ( < e ( a ) , 1 > ) − t σ ( < b ( a ) , 1 > ) ≥ L ( a ) − W.H ( a ) ∀ a, Let V W ( a ) = L ( a ) − W.H ( a ) If ( G, V W ) has positive circuits then infeasibility. otherwise t σ ( < i, 1 > ) = longest path to i in ( G, V W ) is a solution. Bellman-Ford algorithm Cyclic scheduling for EPIT 2007 – p. 17/ ??

  18. Computation of critical circuits [Dasdan et al 99] Polynomial algorithms : Binary search on W: at each step check if ( G, V W ) has positive circuits 0( nm (log n + log max a ( L ( a ) , H ( a )))) [Lawler 79][Gondran-Minoux 85] Linear programming with primal dual approach O ( n 2 m ) [Burns 91] An efficient pseudo polynomial algorithm: Howard’s algorithm[Cochet-Terrasson et al 98] W = lower bound At each step check if G, V W ) has positive circuit C with breadth first search. If H ( C ) < = 0 stop. Otherwise set W = α ( C ) . complexity O ( m.X ) , X product of degrees of nodes. Cyclic scheduling for EPIT 2007 – p. 18/ ??

  19. Computation of an optimal periodic schedu Compute the strong components of G O ( n + m ) Check feasibility for each component C s , and the critical circuit value α s . O ( nm log( n ) + log( V max )) Compute the reduced graph of components. O ( n + m ) Sort the components by topological order. O ( n + m ) for each component C s . if C s has no predecessor, set W s = α s . if C x 1 , . . . , C x r are predecessors of C s . Let β s = max i W x i If α s ≥ β s set W s = α s . otherwise check if ( C s , V β s ) has some positive circuit. O ( nm ) if so,infeasibility otherwise set W s = β s . Compute the longest paths from a dummy source node to any node i on G with on each component value V W s and on each intermediate arc between C s , C s ′ value V W s ′ . O ( nm ) t σ ( < i, 1 > ) = longest path to i . Cyclic scheduling for EPIT 2007 – p. 19/ ??

  20. Example Graph with L − W s H values: 7 6 ✁ ✁ 3 3 3 ✁ 2 5 1 2 2 5 4 0 1 0 ✁ 5 1 0 8 4 ✁ 6 7 ✁ 7 ✁ 1 0 3 1 4 7 ✁ 5 ✁ 7 ✁ A periodic schedule: period of 1,2,3,6 is 10, period of 4,5 is 7 1 1 1 2 2 2 3 3 3 4 4 4 4 5 5 5 5 6 6 10 20 Cyclic scheduling for EPIT 2007 – p. 20/ ??

  21. Positive heights The problem has been studied earlier [Chretienne 85][many authors] Theorem 2. For any w ≥ max C circuit α ( C ) there is a periodic schedule, all tasks have period w . No need to compute strong components. Cyclic scheduling for EPIT 2007 – p. 21/ ??

Recommend


More recommend