Download presentation
Presentation is loading. Please wait.
Published byGladys Cori Stephens Modified over 9 years ago
1
Winter 2005ICS 252-Intro to Computer Design ICS 252 Introduction to Computer Design Lecture 5-Scheudling Algorithms Winter 2005 Eli Bozorgzadeh Computer Science Department-UCI
2
Winter 2005ICS 252-Intro to Computer Design References Lecture notes by Kia Bazargan on High level Synthesis [©Bazargan] –http://www.ece.umn.edu/users/kia/Courses/EE5301 Lecture note by Rajesh Gupta on scheduling [©Gupta] –http://www.ics.uci.edu/~rgupta/ics280.html Chapter 5 (5.1-5.4.4) of the textbook
3
Winter 2005ICS 252-Intro to Computer Design Scheduling Without resource constraint –Unconstrained Scheduling: ASAP –Latency-constrained scheduling :ALAP –Scheduling under timing constraint With resource constraint –Exact: ILP model –Heuristic: List scheduling, force-directed scheduling, etc.
4
Winter 2005ICS 252-Intro to Computer Design ASAP Scheduling Schedule each operation as-soon-as- possible NOP * * * * * * + +< - - 1 2 3 4 5 6 7 8 9 10 11 Time 1 Time 2 Time 3 Time 4
5
Winter 2005ICS 252-Intro to Computer Design ALAP scheduling Schedule each operation as late as possible under given latency NOP * * * * * * + +< - - 1 2 3 4 5 6 7 8 9 10 11 Time 1 Time 2 Time 3 Time 4
6
Winter 2005ICS 252-Intro to Computer Design Quick overview Tasks in high-level synthesis –Scheduling √ –Allocation –Binding Scheduling –Without resource constraint √ –With resource constraint (next) ILP model: exact solution List scheduling, force-directed scheduling: heuristic
7
Winter 2005ICS 252-Intro to Computer Design Resource Constraint Scheduling Constrained scheduling –General case NP-complete –Minimize latency given constraints on area or the resources (ML-RCS) –Minimize resources subject to bound on latency (MR- LCS) Exact solution methods: –Integer linear programming (ILP) model –Hu’s algorithm Heuristics: –List scheduling –Force-directed scheduling [©Bazargan]
8
Winter 2005ICS 252-Intro to Computer Design ILP model for scheduling problem Binary variable x il –x il =1 if start time of operation i is at time l –x il =0 otherwise Constraints: set of linear inequalities –Uniqueness of start time for each operation ∑x il = 1 i =0,1…,n How to compute t i, start time of operation i ? –Sequencing relation
9
Winter 2005ICS 252-Intro to Computer Design Start Time vs. Execution Time For each operation v i, only one start time If d i =1, then the following questions are the same: –Does operation v i start at step l ? –Is operation v i running at step l ? But if d i >1, then the two questions should be formulated as: –Does operation v i start at step l ? Does x il = 1 hold? –Is operation v i running at step l ? Does the following hold? ? [©Bazargan]
10
Winter 2005ICS 252-Intro to Computer Design Operation v i Still Running at Step l ? Is v 9 running at step 6? –Is x 9,6 + x 9,5 + x 9,4 = 1 ? Note: –Only one (if any) of the above three cases can happen –To meet resource constraints, we have to ask the same question for ALL steps, and ALL operations of that type v9v9 4 5 6 x 9,4 =1 v9v9 4 5 6 x 9,5 =1 v9v9 4 5 6 x 9,6 =1 [©Bazargan]
11
Winter 2005ICS 252-Intro to Computer Design Operation v i Still Running at Step l ? Is v i running at step l ? –Is x i,l + x i,l-1 +... + x i,l-di+1 = 1 ? vivi l l-1 l-d i +1... x i,l-di+1 =1 vivi l l-1 l-d i +1... x i,l-1 =1 vivi l l-1 l-d i +1... x i,l =1... [©Bazargan]
12
Winter 2005ICS 252-Intro to Computer Design ILP Model (cont’d) Constraints (cont’d) –Resource bound at each time step of scheduling Objective –Minimize c T t –t = vector of start time of operations
13
Winter 2005ICS 252-Intro to Computer Design ILP Example Assume = 4 First, perform ASAP and ALAP –(we can write the ILP without ASAP and ALAP, but using ASAP and ALAP will simplify the inequalities) + NOP +< - - 1 2 3 4 + +< - - 1 2 3 4 v2v1 v3 v4 v5 vn v6 v7 v8 v9 v10 v11 v2 v1 v3 v4 v5 vn v6 v7 v8 v9 v10 v11 [©Bazargan]
14
Winter 2005ICS 252-Intro to Computer Design ILP Example: Unique Start Times Constraint Without using ASAP and ALAP values: Using ASAP and ALAP: [©Bazargan]
15
Winter 2005ICS 252-Intro to Computer Design ILP Example: Dependency Constraints Using ASAP and ALAP, the non-trivial inequalities are: (assuming unit delay for + and *) [©Bazargan]
16
Winter 2005ICS 252-Intro to Computer Design ILP Example: Resource Constraints Resource constraints (assuming 2 adders and 2 multipliers) Objective: –Since =4 and sink has no mobility, any feasible solution is optimum, but we can use the following anyway: [©Bazargan]
17
Winter 2005ICS 252-Intro to Computer Design ILP Formulation of MR-LCS Dual problem to ML-RCS Objective: –Goal is to optimize total resource usage, a. –Objective function is c T a, where entries in c are respective area costs of resources Constraints: –Same as ML-RCS constraints, plus: –Latency constraint added: –Note: unknown a k appears in constraints. [©Gupta]
18
Winter 2005ICS 252-Intro to Computer Design Hu’s Algorithm Simple case of the scheduling problem –Operations of unit delay –Operations (and resources) of the same type Hu’s algorithm –Greedy –Polynomial AND optimal –Computes lower bound on number of resources for a given latency OR: computes lower bound on latency subject to resource constraints Basic idea: –Label operations based on their distances from the sink –Try to schedule nodes with higher labels first (i.e., most “critical” operations have priority) [©Gupta]
19
Winter 2005ICS 252-Intro to Computer Design Hu’s Algorithm HU (G(V,E), a) { Label the vertices // label = length of longest path passing through the vertex l = 1 repeat { U = unscheduled vertices in V whose predecessors have been scheduled (or have no predecessors) Select S U such that |S| a and labels in S are maximal Schedule the S operations at step l by setting t i =l, i: v i S. l = l + 1 } until v n is scheduled. } [©Bazargan]
20
Winter 2005ICS 252-Intro to Computer Design Hu’s Algorithm: Example [©Gupta]
21
Winter 2005ICS 252-Intro to Computer Design List Scheduling Greedy algorithm for ML-RCS and MR-LCS –Does NOT guarantee optimum solution Similar to Hu’s algorithm –Operation selection decided by criticality –O(n) time complexity More general input –Resource constraints on different resource types [©Bazargan]
22
Winter 2005ICS 252-Intro to Computer Design List Scheduling Algorithm: ML-RCS LIST_L (G(V,E), a) { l = 1 repeat { for each resource type k { U l,k = available vertices in V. T l,k = operations in progress. Select S k U l,k such that | S k | + | T l,k | a k Schedule the S k operations at step l } l = l + 1 } until v n is scheduled. } [©Bazargan]
23
Winter 2005ICS 252-Intro to Computer Design List Scheduling Example [©Gupta]
24
Winter 2005ICS 252-Intro to Computer Design List Scheduling Algorithm: MR-LCS LIST_R (G(V,E), ’) { a = 1, l = 1 Compute the ALAP times t L. if t 0 L < 0 return (not feasible) repeat { for each resource type k { U l,k = available vertices in V. Compute the slacks { s i = t i L - l, v i U l,k }. Schedule operations with zero slack, update a Schedule additional S k U l,k under a constraints } l = l + 1 } until v n is scheduled. } [©Bazargan]
25
Winter 2005ICS 252-Intro to Computer Design Force-Directed Scheduling Similar to list scheduling –Can handle ML-RCS and MR-LCS –For ML-RCS, schedules step-by-step –BUT, selection of the operations tries to find the globally best set of operations Idea: –Find the mobility i = t i L – t i S of operations –Look at the operation type probability distributions –Try to flatten the operation type distributions Definition: operation probability density –p i ( l ) = Pr { v i starts at step l }. –Assume uniform distribution: [©Gupta]
26
Winter 2005ICS 252-Intro to Computer Design Force-Directed Scheduling: Definitions Operation-type distribution (NOT normalized to 1) – Operation probabilities over control steps: – Distribution graph of type k over all steps: – – q k ( l ) can be thought of as expected operator cost for implementing operations of type k at step l. [©Bazargan]
27
Winter 2005ICS 252-Intro to Computer Design Example + NOP +< - - 1 2 3 4 2.83 2.33.83 0 1 2 1.66 0.33 [©Bazargan]
28
Winter 2005ICS 252-Intro to Computer Design Force-Directed Scheduling Algorithm: Idea Very similar to LIST_L(G(V,E), a) –Compute mobility of operations using ASAP and ALAP –Computer operation probabilities and type distributions –Select and schedule operations –Update operation probabilities and type distributions –Go to next control step Difference with list scheduling in selecting operations –Select operations with least force –Consider the effect on the type distribution –Consider the effect on successor nodes and their type distributions [©Bazargan]
29
Winter 2005ICS 252-Intro to Computer Design Summary Architectural Synthesis –Scheduling –Binding and resource allocation –Challenge: Area/performance trade-off Scheduling –Without resource constraints –With resource constraints Exact solution Heuristics Next: Resource sharing and binding
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.