Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Efficient Algorithm for Scheduling Instructions with Deadline Constraints on ILP Machines Wu Hui Joxan Jaffar School of Computing National University.

Similar presentations


Presentation on theme: "An Efficient Algorithm for Scheduling Instructions with Deadline Constraints on ILP Machines Wu Hui Joxan Jaffar School of Computing National University."— Presentation transcript:

1

2 An Efficient Algorithm for Scheduling Instructions with Deadline Constraints on ILP Machines Wu Hui Joxan Jaffar School of Computing National University of Singapore

3 2 What is an ILP machine? Multiple functional units of different types. Issue an instruction every machine cycle on each functional unit. Multiple instructions executed in parallel. Latencies exist between instructions. Two categories: Superscalar and VLIW (Very Long Instruction Word). Typical Example: Intel Itanium processor (http://developer.intel.com/design/ia64/microarch_ovw/ind ex.htm)

4 3 What is the problem? Given a problem instance P: a set of n UET instructions in a basic block with the following constraints: precedence-latency constraints: DAG G = (V, E, W), where each latency l ij  -1, deadline constraints: individual pre-assigned deadlines, and m functional units with p different types, compute a feasible schedule which satisfies all constraints whenever one exists, or a valid schedule with minimum lateness if no feasible schedule exists.

5 4 v 1 [4] v 2 [4] v 4 [5] v 5 [5] Example 1. A problem instance P with two functional units of different types. 0 1 v 3 [4] v 6 [5] 0 1 0 1 0 v 11 [6] v 12 [6] v 9 [6] v 7 [5] v 8 [6] v 10 [6] 0 0 0 00 Table 1. A feasible schedule for P. FU1 FU2

6 5 What does our algorithm achieve? Our scheduling algorithm computes a feasible schedule whenever one exists for any problem instance of the following special cases. 1) Arbitrary DAG, latencies of 0 and two functional units of different types. 2) Monotone interval graph, latencies  -1 and multiple functional units of different types. 3) In-forest, equal latencies and multiple functional units of different types.

7 6 In the case that there is no feasible schedule, our algorithm computes a schedule with minimum lateness for all the above special cases. Furthermore, by setting all deadlines to a constant, our algorithm will compute a schedule with minimum completion time for any instance of the above special cases and any instance of the special case of out-forest, equal latencies and multiple functional units of different types.

8 7 An in-tree. An out-tree 4 3 2 2 1 21 A monotone interval graph. v1v1 v3v3 v2v2 v4v4 v5v5 v6v6 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 v3v3 v1v1 v2v2 v4v4 v5v5 v6v6 v7v7 3

9 8 What is the Time Complexity ? Given the transitive closure of the precedence graph, O(ne+nd) for the general model, where d is the maximum latency. O(min{ne, de}+nd) if no latency of -1 exists. O(n 2 ) if for each instruction the latencies between it and all its immediate successors are equal. Transitive closure can be computed in O(min(ne, n 2.367 )) time.

10 9 What has been done in the past? Palem and Simon’s algorithm on identical processors [ACM TOPLAS, 1993]. Wu, Joxan and Yap’s algorithm on identical processors [PACT 2000]. Berstein, Rodeh and Gertner’s work on two processors of different types [IEEE TOC, 1989].

11 10 What are the contributions of our work? Propose an efficient polynomial algorithm which solves several special cases for each of which no polynomial algorithm was known before. Present the first approximation ratio, i.e. for any greedy algorithm, the length of any schedule computed never exceeds p+1, where p is the number of types of functional units.

12 11 What are the main ideas of our algorithm? Compute the l max (v i )-successor-tree-consistent deadline for each instruction v i, where l max (v i ) is the maximum latency between v i and all its immediate successors. Compute a schedule by using list scheduling, where the priority of each instruction is its successor-tree-consistent deadline and a smaller number implies higher priority.

13 12 What is the l max (v i )-successor-tree- consistent deadline? For each sink instruction, its l max (v i )-successor- tree-consistent deadline d´ i is equal to its pre- assigned deadline. For a non-sink instruction v i, d´ i is the upper bound on its latest completion time in any feasible schedule for the relaxed problem instance P(i).

14 13 What is P(i)? P(i) consists of a set V(i)={v i }  Succ(v i ) of instructions with following new constraints. Precedence-latency constraints: The l max ( v i )-successor- tree of v i. Deadline constraints: The deadline of each instruction v j in Succ(v i ) is its l max (v j )-successor-tree-consistent deadline and the deadline of v i is its pre-assigned deadline.

15 14 What is the k-successor-tree of v i ? Given a weighted graph G=(V, E, W), an integer k and v i  V, the k-successor-tree of v i is a subgraph G= (V, E, W), where V ={v i }  {v j : v j  Succ(v i )}, E={(v i, v j ): v j  Succ(v i )} and each edge weight l´ ij in W is defined as follows. 1) In the case that k= -1, if l + ij = -1, then l´ ij = -1; otherwise l´ ij = 0. 2) In the case that k  -1, if l + ij < k, then l´ ij = l + ij ; otherwise, l´ ij = k.

16 15 v1v1 v2v2 v3v3 v4v4 v5v5 v6v6 v7v7 v8v8 2 1 4 1 101 Figure 1: The precedence-latency constraints. v3v3 v6v6 v4v4 v7v7 v5v5 v8v8 44121 Figure 2: The 4-successor tree of v 2. v2v2

17 16 How to compute l max (v i )- successor-tree-consistent deadline for v i ? Key idea: Backward Scheduling At any time t, among all ready instructions, an instruction v k with the largest latency in P(i) is chosen and scheduled as late as possible on a functional unit of the same type. In case of ties, among all instructions with the same latency, an instruction with the latest deadline is chosen. A schedule computed by backward scheduling is called a backward schedule.

18 17 v 2 [5] v 3 [6] v 4 [5] v 5 [3] v 6 [4] v 7 [3] 33121 v 1 [2] Example 2: A relaxed problem instance P(1). Table 2. A backward schedule for P(1). FU2 FU1

19 18 Scheduling Algorithm repeat choose an instruction v i satisfying that 1) its l max (v i )-successor-tree- consistent deadline d´ i has not been computed; and 2) either v i is a sink or the successor-tree-consistent deadlines of all its successors have been computed; if v i is a sink then d´ i = d i ; else { if v i has only one immediate successor v j and l ij  -1 then d´ i = min{d i, d j - l ij - 1}; else { compute a backward schedule  b for P(i); d´ i = min{d i, min{  b (v j ) - l ij : v j  Succ(v i ) }}; } } until the successor-tree-consistent deadlines of all instructions have been computed; use list scheduling to compute a schedule for P, where the priority of each instruction v i is d´ i and a smaller number implies higher priority;

20 19 Example 1. A problem instance P with two functional units of different types. V 5 [5]V 6 [5] V 8 [6]V 9 [6] V 11 [6] Figure 4: The relaxed problem P(1). 01 111 V 4 [4] V 10 [6] V 1 [4] 01 v 4 [5, 4] v 5 [5, 5] 0 1 v 6 [5, 5] 0 1 0 1 0 v 11 [6, 6] v 12 [6, 6] v 9 [6, 6] v 7 [5, 5] v 10 [6, 6] 0 0 0 00 v 2 [4] v 3 [4] v 1 [4, ?] v 8 [6, 6] FU2 FU1

21 20 Since min{  b (v j ) - l 1j : v j  Succ(v 1 )}= 2, the l max (v 1 )- successor-tree-consistent deadline of v 1 is min{d 1, 2}= min{4, 2}= 2. Table 3: A backward schedule  b for Succ(v 1 ).

22 21 v 4 [5, 4] v 5 [5, 5] Example 1. A problem instance P with two functional units of different types. 0 1 v 6 [5, 5] 0 1 0 1 0 v 11 [6, 6] v 12 [6, 6] v 9 [6, 6] v 7 [5, 5] v 10 [6, 6] 0 0 0 00 v 2 [4, 3] v 3 [4, 3] v 1 [4, 2] v 8 [6, 6] Table 3. A feasible schedule computed by list scheduling. FU1 FU2

23 22 Conclusion K-successor-tree-consistency: A general technique for instruction scheduling problem. Approximating precedence-latency constraints by using priorities which are k-successor-tree consistent. Successfully used to solve several open instruction scheduling problems such as two processor scheduling with equal execution times and release time-deadline constraints. Open Problem: What is the tight worst-case approximation ratio of our algorithm (Conjecture: L ours / L opt = 4/3)?


Download ppt "An Efficient Algorithm for Scheduling Instructions with Deadline Constraints on ILP Machines Wu Hui Joxan Jaffar School of Computing National University."

Similar presentations


Ads by Google