Title: SCHEDULING
1SCHEDULING
- SOURCES-
- Mark Manwaring
- Kia Bazargan
- Giovanni De Micheli
- Gupta
- Youn-Long Lin
M. Balakrishnan Camposano, J. Hofstede,
Knapp, MacMillenLin
2Overview of Hardware Synthesis
assign times to operations under given constraints
assign operations to physical resources under
given constraints
- reduce the amount of hardware, optimize the
design in general. - May be done with the consideration of additional
constraints.
3Outline of scheduling
- The scheduling problem.
- Scheduling without constraints.
- 2. Scheduling under timing constraints.
- Relative scheduling.
- 3. Scheduling under resource constraints.
- The ILP model (Integer Linear Programming).
- Heuristic methods (graph coloring, etc).
Timing constraints versus resource constraints
4What is Scheduling
5Example of schedulingASAP
This is As Soon as Possible Scheduling (ASAP).
It can be used as a bound in other methods like
ILP or when latency only is important, not area.
6(No Transcript)
7Example of Scheduling
Adder number 1
Multiplier number 2
Adder number 3
8More complex example of Scheduling
9What is necessary to solve the scheduling problem?
- Circuit model
- Sequencing graph.
- Cycle-time is given.
- Operation delays expressed in cycles.
- Scheduling
- Determine the start times for the operations.
- Satisfying all the sequencing (timing and
resource) constraints. - Goal
- Determine area/latency trade-off.
Do you remember what is latency?
10- Scheduling affects
- Area maximum number of concurrent operations of
same type is a lower bound on required hardware
resources. - Performance concurrency of resulting
implementation.
11Taxonomy of scheduling problems to solve
- Unconstrained scheduling.
- 2. Scheduling with timing constraints
- Latency.
- Detailed timing constraints.
- 3. Scheduling with resource constraints.
- Related problems
- Chaining. What is chaining?
- Synchronization. What is synchronization?
- Pipeline scheduling.
12- Simplest scheduling model
- All operations have bounded delays.
- All delays are in cycles.
- Cycle-time is given.
- No constraints - no bounds on area.
- Goal
- Minimize latency.
13Scheduling 2
What are types of Scheduling Algorithms?
- Scheduling problems are NP-hard, so all kind of
heuristics are used - ASAP As soon as possible
- ALAP
- List scheduling Resource Constrained algorithms
- Force directed algorithms time constrained
- Path based
- Percolation algorithms
- Simulated annealing
- Tabu search and other heuristics
- Simulated evolution
- Linear Programming
- Integer Linear Programming - time constrained
- Time Resource Tradeoff
- Scheduling is temporal binding
14Types of Scheduling Processes
- Assignment of operations to time (control steps)
within given constraints and minimizing a cost
function - Time-constrained
- Resource-constrained
- With or without control (conditions)
- With or without iterations (infinite loops)
- Constructive
- Iterative
15Classification of Scheduling Algorithms
16 17Simplest model of scheduling
- All operations have bounded delays.
- All delays are expressed in numbers of cycles of
a single one-phase clock. - Cycle-time is given.
- No constraints - no bounds on area.
- Goal
- Minimize latency.
18Minimum Latency Unconstrained Scheduling
19Minimum-Latency UnconstrainedScheduling Problem
Minimum Latency Unconstrained Scheduling Problem
- Unconstrained scheduling used when
- Dedicated resources are used.
- Operations differ in type.
- Operations cost is marginal when compared to that
of steering logic, registers, wiring, and control
logic. - Binding is done before scheduling resource
conflicts solved by serializing operations
sharing same resource. - Deriving bounds on latency for constrained
problems.
20Minimum-latency unconstrainedscheduling problem
t j
- Given a set of operations V with set of
corresponding integer delays D and a partial
order on the operations E - Find an integer labeling of the operations
- ? V --gt Z , such that
- t i ? (v i ),
- t i ? t j d j ? i, j such that (v j , v
i ) ? E - and tn is minimum.
t i
dj
(v j , v i )
di
t i ? t j d j
Input to di must be stable
21Example of using mobility
- Operations with zero mobility
- v 1, v 2, v 3, v 4, v 5 .
- They are on the critical path.
- Operations with mobility one
- v 6 , v 7 .
- Operations with mobility two
- v 8 , v 9 , v 10 , v 11 .
mobility two
1. Start from ALAP 2.Use mobility to improve
22Operation Scheduling Formalisation
Classes of scheduling algorithms
23(No Transcript)
24- Time Constrained Scheduling
25Latency-Constrained Scheduling
Latency Constrained Scheduling
- ALAP solves a latency-constrained problem.
- Latency bound can be set to latency computed by
ASAP algorithm. - Mobility
- Defined for each operation.
- Difference between ALAP and ASAP schedule.
- Zero mobility implies that an operation can be
started only at one given time step. - Mobility greater than 0 measures span of time
interval in which an operation may start. - Slack on the start time.
26Time Constrained Scheduling
27Scheduling under Detailed Timing Constraints
- Motivation
- Interface design.
- Control over operation start time.
- Constraints
- Upper/lower bounds on start-time difference of
any operation pair. - Minimum timing constraints between two operations
- An operation follows another by at least a number
of prescribed time steps - lij ? 0 requires tj ? ti lij
- Maximum timing constraints between two operations
- An operation follows another by at most a number
of prescribed time steps - uij ? 0 requires tj ? ti uij
28 Scheduling under Detailed TimingConstraints
Scheduling under Detailed Timing Constraints
- Example
- Circuit reads data from a bus, performs
computation, writes result back on the bus. - Bus interface constraint data written three
cycles after read. - Minimum and maximum constraint of 3 cycles
between read and write operations. - Example
- Two circuits required to communicate
simultaneously to external circuits. - Cycle in which data available is irrelevant.
- Minimum and maximum timing constraint of zero
cycles between two write operations.
29 Constraint Graph Model
Mul delay 2 ADD delay 1
30Scheduling under detailed timing constraints
- Motivation
- Interface design.
- Control over
- operation start time.
- Constraints
- Upper/lower bounds on start-time difference of
any operation pair. - Feasibility of a solution.
31Constraint graph model
- Start from a sequencing graph.
- Model delays as weights on edges.
- Add forward edges for minimum constraints.
- Edge (vi , vj) with weight lij gt t j ? t i
lij . - Add backward edges for maximum constraints.
- Edge (vi , vj) with weight
- - u ij gt t j ? t i uij
- because t j ? t i uij gt t i ? t j - uij
Add this edge for min constraint
Add this edge for max constraint
32Method for Scheduling with Unbounded-Delay
Operations
- Unbounded delays
- Synchronization.
- Unbounded-delay operations (e.g. loops).
- Anchors.
- Unbounded-delay operations.
- Relative scheduling
- Schedule ops w.r. to the anchors.
- Combine schedules.
33Method for Scheduling Under Detailed Timing
Constraints
- Presence of maximum timing constraints may
prevent existence of a consistent schedule. - Required upper bound on time distance between
operations may be inconsistent with first
operation execution time. - Minimum timing constraints may conflict with
maximum timing constraints. - A criterion to determine existence of a schedule
- For each maximum timing constraint uij
- Longest weighted path between vi and vj must be ?
uij
34Example of using constraint graph with minimum
and maximum constraints
So now we can calculate this table from
sequencing graph
explain
Sequencing graph
Constraint graph
35 Methods for Schedulingunder Detailed Timing
Constraints
Method for Scheduling Under Detailed Timing
Constraints
- Weight of longest path from source to a vertex is
the minimum start time of a vertex. - Bellman-Ford or Lia-Wong algorithm provides the
schedule. - A necessary condition for existence of a schedule
is constraint graph has no positive cycles.
36Methods for Scheduling Under Detailed Timing
Constraints
Shown in last slide
Will follow
37Methods for schedulingunder detailed timing
constraints
- Start from the Sequencing Graph. Assumption
- All delays are fixed and known.
- Set of linear inequalities.
- Longest path problem.
- Algorithms for the longest path problem were
discussed in Chapter 2 of De Micheli - Bellman-Ford,
- Liao-Wong.
38Bellman-Fords algorithm
- BELLMAN_FORD(G(V, E, W))
-
- s 1 0 0
- for (i 1 to N)
- s 1 i w 0, i
- for (j 1 to N)
- for (i 1 to N)
- s j1 i
min s j i , (s j k w q, i ), -
- if (s j1 i s j i
?i ) return (TRUE) -
- return (FALSE)
-
k?i
39Longest path problem
- Use shortest path algorithms
- by reversing signs on weights.
- Modify algorithms
- by changing min with max.
- Remarks
- Dijkstras algorithm is not relevant.
- Inconsistent problem
- Positive-weighted cycles.
40Example Bellman-Ford
Use shortest path algorithms by reversing signs
on weights.
source
- Iteration 1 l 0 0, l 1 3, l 2 1, l 3 ?.
- Iteration 2 l 0 0, l 1 3, l 2 2, l 3 5.
- Iteration 3 l 0 0, l 1 3, l 2 2, l 3 6.
145
246
3 -12
41Liao-Wongs algorithm
- LIAO WONG(G( V, E? F, W))
-
- for ( i 1 to N)
- l 1 i 0
- for ( j 1 to F 1)
- foreach vertex v i
- l j1 i
longest path in G( V, E,W E ) - flag TRUE
- foreach edge ( v p, v q) ?F
- if ( l j1 q
lt l j 1 p w p,q ) - flag
FALSE - E E ? (
v 0 , v q) with weight ( l j 1 p w p,q) -
-
- if ( flag ) return (TRUE)
-
- return (FALSE)
adjust
42Example Liao-Wong
(b) adjusted by adding longest path from node 0
to node 2
Looking for longest path from node 0 to node 3
Only positive edges from (a)
- Iteration 1 l 0 0, l 1 3, l 2 1, l 3 5.
- Adjust add edge (v 0 , v 2 ) with weight 2.
- Iteration 2 l 0 0, l 1 3, l 2 2, l 3 6.
43Method for schedulingwith unbounded-delay
operations
- Unbounded delays
- Synchronization.
- Unbounded-delay operations (e.g. loops).
- Anchors.
- Unbounded-delay operations.
- Relative scheduling
- Schedule operations with respect to the anchors.
- Combine schedules.
44Relative scheduling method
45Relative scheduling method
- For each vertex
- Determine relevant anchor set R(.).
- Anchors affecting start time.
- Determine time offset from anchors.
- Start-time
- Expressed by
- Computed only at run-time because delays of
anchors are unknown.
46Relative scheduling under timingconstraints
- Problem definition
- Detailed timing constraints.
- Unbounded delay operations.
- Solution
- May or may not exist.
- Problem may be ill-specified.
47Relative scheduling under timingconstraints
- Feasible problem
- A solution exists when unknown delays are zero.
- Well-posed problem
- A solution exists for any value of the unknown
delays. - Theorem
- A constraint graph can be made well-posed iff
there are no cycles with unbounded weights.
48Example of Relative scheduling under timing
constraints
(a) (b) Ill-posed constraint
(c) well-posed constraint
49Relative scheduling approach
- Analyze graph
- Detect anchors.
- Well-posedness test.
- Determine dependencies from anchors.
- Schedule operations with respect to relevant
anchors - Bellman-Ford, Liao-Wong, Ku algorithms.
- Combine schedules to determine start times
50Example of Relative scheduling
51Example of control-unit synthesized for Relative
scheduling
52(No Transcript)
53Operations must be serialized
54Scheduling and Binding
55(No Transcript)
56binding
schedule
57Scheduling Problem formalization
Scheduling Problem
58Various Operator types in Scheduling
59ASAP Scheduling
60ASAP Scheduling
61ASAP scheduling algorithm
- ASAP ( Gs(V, E))
- Schedule v0 by setting t S 0 1
- repeat
- Select a vertex vi whose predecessors
are all scheduled - Schedule vi by setting t S i max t S
j dj -
- until (vn is scheduled)
- return (t S )
j(vj,vi)?E
Similar to breadth-first search
62Example - ASAP
- Solution
- Multipliers 4
- ALUs 2
Latency Time4
63ALAP Scheduling
64ALAP Scheduling
successor
65ALAP scheduling algorithm
- As Late as Possible - ALAP
- Similar to depth-first search
66Example ALAP
- Solution
- multipliers 2
- ALUs 3
Latency Time4
67Remarks on ALAP and mobility
- ALAP solves a latency-constrained problem.
- Latency bound can be set to latency computed by
ASAP algorithm. lt-- using bounds, also in other
approaches - Mobility
- Mobility is defined for each operation.
- Difference between ALAP and ASAP schedule.
- What is mobility?number of cycles that I can move
upwards or downwards the operation - Slack on the start time.
68Resource Constrained
69Scheduling under resource constraints
- Classical scheduling problem.
- Fix area bound - minimize latency.
- The amount of available resources affects the
achievable latency. - Dual problem
- Fix latency bound - minimize resources.
- Assumption
- All delays bounded and known.
70Minimum latency resource-constrainedscheduling
problem
- Given a set of operations V with integer delays D
a partial order on the operations E, and upper
bounds ak k 1, 2,,nres - Find an integer labeling of the operations ? V
--gt Z such that - t i '(v i ),
- t i t j d j 8 i j st (v j v i ) 2 E,
- jfv i jT (v i ) k and t i l lt t i d i gj a k
- and tn is minimum.
71- Number of operations of any given type in any
schedule step does not exceed bound.
V? 1,2, nres
72Scheduling under resource constraints
- Intractable problem.
- Algorithms
- Exact
- Integer linear program.
- Hu (restrictive assumptions).
- Approximate
- List scheduling.
- Force-directed scheduling.
73Resource Constraint Scheduling
ML-RCS minimize latency, bound on resources
MR-LCS minimize resources, bound on latency
74Algorithm of Hu for Resource Constraint Scheduling
ML-RCS minimize latency, bound on resources
75Example of using Hus algorithm
Hu's algorithm
- Additional assumptions
- Graph is a forest.
- Algorithm
- Label vertices with distance from sink.
- Greedy strategy.
- Exact solution.
Distance from sink
- Assumptions
- One resource type only.
- All operations have unit delay.
76Algorithm Hu's schedule with a resources
- Set step, l 1.
- Repeat until all operations are scheduled
- Select s ? a resources with
- All predecessors scheduled.
- Maximal labels.
- Schedule the s operations at step l.
- Increment step l l 1.
- All operations have unit delay.
- All operations have the same type.
77- Minimum latency with a 3 resources.
- Step 1
- Select v 1 , v 2 , v 6 .
- Step 2
- Select v 3 , v 7 , v 8 .
- Step 3
- Select v 4 , v 9 , v 10 .
- Step 4
- Select v 5 , v 11 .
Algorithm Hu's schedule with a resources
We always select 3 resources
78- Minimum latency with a 3 resources.
- Step 1
- Select v 1 , v 2 , v 6 .
- Step 2
- Select v 3 , v 7 , v 8 .
- Step 3
- Select v 4 , v 9 , v 10 .
- Step 4
- Select v 5 , v 11 .
Algorithm Hu's schedule with a resources
We always select 3 resources
79Example of Hus Algorithm
Distance from sink
80Example of Hus Algorithm
81(No Transcript)
82Exactness of Hu's algorithm
- Theorem1
- Given a DAG with operations of the same type.
- a is a lower bound on the number of resources
to complete a schedule with latency ? . - ? is a positive integer.
- Theorem2
- Hu's algorithm applied to a tree with unit-cycle
resources achieves latency ? with a resources. - Corollary
- Since a is a lower bound on the number of
resources for achieving ?, then ? is minimum.
83LIST scheduling
84List scheduling idea
85Example
DFG
List Schedule
86Example
- Assumptions
- a1 2 multipliers with delay 1.
- a2 2 ALUs with delay 1.
- First Step
- U1,1 v1, v2, v6, v8
- Select v1, v2
- U1,2 v10 selected
- Second step
- U2,1 v3, v6, v8
- select v3, v6
- U2,2 v11 selected
- Third step
- U3,1 v7, v8
- Select v7, v8
- U3,2 v4 selected
- Fourth step
- U4,2 v5, v9 selected
87List Scheduling Algorithms
List Scheduling Algorithms
- Priority list heuristics.
- Assign a weight to each vertex indicating its
scheduling priority - Longest path to sink.
- Longest path to timing constraint.
88List scheduling algorithms
- Heuristic method for
- 1. Minimum latency subject to resource bound.
- 2. Minimum resource subject to latency bound.
- Greedy strategy (like Hu's).
- General graphs (unlike Hu's).
89LIST scheduling
90 List scheduling algorithmfor minimum resource
Usage
91 List Scheduling Algorithm for Minimum Latency
List scheduling algorithmfor minimum latency
for resource bound
- Candidate Operations Ul,k
- Operations of type k whose predecessors are
scheduled and completed at time step before l - Unfinished operations Tl,k are operations of type
k that started at earlier cycles and whose
execution is not finished at time l - Note that when execution delays are 1, Tl,k is
empty.
92 List scheduling algorithmfor minimum latency
for resource bound
- LIST_L ( G(V, E), a )
- l 1
- repeat
- for each resource type k 1,
2,,nres - Determine candidate operations
U l,k - Determine unfinished operations
T l,k - Select Sk ? U l,k vertices,
such that Sk T l,k ? a k - Schedule the S k operations at
step l -
- l l 1
-
- until (vn is scheduled)
- return (t )
931. List scheduling algorithmfor minimum latency
for resource bound
List scheduling algorithmfor minimum latency
- Assumptions
- a 1 3 multipliers with delay 2.
- a 2 1 ALUs with delay 1.
Now we need two time units for multiplier
94Example
- Assumptions
- a1 3 multipliers with delay 2.
- a2 1 ALU with delay 1.
95- Assume ?4
- Let a 1, 1T
- First Step
- U1,1 v1, v2, v6, v8
- Operations with zero slack v1, v2
- a 2, 1T
- U1,2 v10
- Second step
- U2,1 v3, v6, v8
- Operations with zero slack v3, v6
- U2,2 v11
- Third step
- U3,1 v7, v8
- Operations with zero slack v7, v8
- U3,2 v4
- Fourth step
- U4,2 v5, v9
- Both have zero slack a 2, 2T
961. List scheduling algorithmfor minimum latency
for resource bound
- Assumptions
- a 1 3 multipliers with delay 2.
- a 2 1 ALUs with delay 1.
- Solution
- 3 multipliers as assumed
- 1 ALU as assumed
- LATENCY 7
97Compute the latest possible start times tL by
ALAP ( G(V,E), ?)
2. List scheduling algorithm for minimum resource
usage
982. Example List scheduling algorithm for minimum
resource usage
- Solution
- 2 multipliers
- 1 ALU
- LATENCY 4
We can move them
Now we assume the same time of each operation
From ALAP
99List Scheduling Algorithm example ML-RCS
Assume 3 multipliers
Assume 1 ALU
lt
-
Other way of explanation of the same as in last
slide
-
t0mul 3m 1 ALU
t1 1 ALU
t2 3mul
t3 1 ALU
t4 1 ALU
t5 1 ALU
Now we assume the same time of each operation
100List Scheduling Algorithm example ML-RCS
101Generic List Scheduling
102List Scheduling Example
- DFG with mobility labeling (inside ltgt)
- ready operation list/resource constraint
103Static-List Scheduling
- DFG
- Partial schedule of five nodes
The final schedule
104Classification of Scheduling Approaches
105Classification of Scheduling Approaches
106Classification of Scheduling Approaches
107(No Transcript)
108(No Transcript)
109Scheduling with chaining
- Consider propagation delays of resources not in
terms of cycles. - Use scheduling to chain multiple operations in
the same control step. - Useful technique to explore effect of cycle-time
on area/latency trade-off. - Algorithms
- ILP,
- ALAP/ASAP,
- List scheduling.
110Example of Scheduling with chaining
111Summary
- Scheduling determines area/latency trade-off.
- Intractable problem in general
- Heuristic algorithms.
- ILP formulation (small-case problems).
- Chaining
- Incorporate cycle-time considerations.
112(No Transcript)
113Other scheduling approaches
114Three variants of Scheduling
115Finite Impulse Response Filter
Example 1
This can be directly used for synthesis with 11
multipliers, 10 adders and 10 registers. But the
latency would be 1 multiplier 10 adders
116FIR Scheduling
2 multipliers
1 adder, 1 multiplier
This is also bad as we use both multipliers only
in stage 1
There are many ways to solve this problem,
transform the tree, schedule, allocate, pipeline,
retime
117Example Cascade Filter optimization
Example 2
Look to ci coefficients and compare with two
previous slides.
This is not FIR, six coefficients
118Cascade Filter Scheduling, cont example 2
2 mul, 2 add
119Infinite Impulse Response Filter
Example 3
IIR Filter, 10 coefficients
120IIR Filter Scheduling continued
IIR Filter, 10 coefficients
Two adders two multipliers
121(No Transcript)
122Minimize Resources Subject to bound on Latency
MR-LCS