Professional Documents
Culture Documents
High Level Synthesis - 05 - Scheduling
High Level Synthesis - 05 - Scheduling
Scheduling
20/03/20
The Scheduling
-2-
What is Scheduling
❑ Definition:
– Scheduling is the assignment of operations to time (control
steps), possibly within given limits on hardware resources and
timing
❑ Exploits potential parallelism (i.e. data dependencies)
❑ Exploits mutual exclusion
❑ Exploits loops
-3-
What is necessary to solve the
scheduling problem?
❑ Circuit model:
– Intermediate representation (DFG,CDFG, etc).
– 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:
Do you remember what is
– Determine area/latency trade-off.
latency?
-4-
Scheduling affects
-5-
What are types of Scheduling
Algorithms?
Scheduling problems are NP-hard, so all kind of heuristics are used
-6-
Simplest model of scheduling
-7-
ASAP algorithm
while V Ø do
for each node vi V do
if ALL_NODES_SCHED ( Pred_vi, E ) then
Ei = MAX ( Pred_vi, E ) + 1;
V = V - {vi};
endif;
endfor;
endwhile;
-8-
Example of ASAP: differential equation
HDL description
-9-
Example of ASAP: scheduling
3 x u dx 3 y u dx x dx
v1
v2
v3 v4 v10
v2 * * v1 v3 * v4 * + v10
E=1
* * * * +
dx y a
x1
* v5 v6 * v9 + < v11
E=2 v5 * v6 + v9 < v11
u *
- v7 y1 c
E=3
- v7
- v8
DFG u1 E=4 - v8
ASAP result
- 10 -
❑ Dual algorithm to ASAP
❑ ALAP solves a latency-constrained problem.
❑ Latency bound can be set to latency computed by ASAP
algorithm.
❑ Mobility
– Defined for each operation.
L=1 * v1 * v2
L=2 * v5 * v3
L=3 - v7 * v6 * v4 + v10
ASAP result
- 12 -
Example of using mobility
1. Start from
ALAP
2.Use mobility to
improve
Various Operator types in Scheduling
❑ Operator variety
– Single cycle
– Single cycle-multifunction
– Multi-cycle
– Multi-speed for the same operation
– Pipelined operator
- 14 -
Resource sharing
1 +
2 + <
3 -
-
4
NOP
[©Gupta]
Portion of the Datapath
b R1
R1 R2
0 1 mux1
0 1
mux2
Multiplier, 0
Controller
FSM
we_r1
R1
we_r2
R2
- 16 -
Resource Constrained 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
– ILP: Integer Linear Programming
❑ Heuristics
– List scheduling
– Force-directed scheduling
ILP Formulation of ML-RCS
[Mic94] p.198
Start Time vs. Execution Time
𝑥𝑖𝑚 = 1
𝑚=𝑙−𝑑𝑖 +1
Operation vi Still Running at Step l ?
❑ Is v9 running at step 6?
– Is x9,6 + x9,5 + x9,4 = 1 ?
4 4 4
5 5 5 v9
6 v9 6 v9 6
❑ Is vi running at step l ?
– Is xi,l + xi,l-1 + ... + xi,l-di+1 = 1 ?
...
...
...
l-1 l-1 l-1
l vi l vi l
❑ Constraints:
– Unique start times: 𝑥𝑖𝑙 = 1, 𝑖 = 0,1, … , 𝑛
𝑙
– Resource constraints
𝑙
𝑥𝑖𝑚 ≤ 𝑎𝑘 , 𝑘 = 1, … , 𝑛𝑟𝑒𝑠 , 𝑙 = 1, … , 𝜆ሜ + 1
𝑖:𝑇(𝑣𝑖 )=𝑘 𝑚=𝑙−𝑑𝑖 +1
❑ Assume l = 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 NOP
1 v1 v2 v6 v8 + v10 1 v1 v2
2 v3 v7 + v9 < v11 2 v3 v6
3 - v4 3 - v4 v7 v8 + v10
- v5 - v5 + v9 < v11
4 4
NOP vn NOP vn
ILP Example: Unique Start Times
Constraint
❑ Without using ASAP ❑ Using ASAP and ALAP:
and ALAP values: x1,1 = 1
x2 ,1 = 1
x1,1 + x1, 2 + x1, 3 + x1, 4 = 1
x3, 2 = 1
x2 ,1 + x2 , 2 + x2 , 3 + x2 , 4 = 1 x4 , 3 = 1
... x5, 4 = 1
... x6 ,1 + x6 , 2 = 1
... x7 , 2 + x7 , 3 = 1
x1,1 + x2 ,1 + x6 ,1 + x8,1 2
x3, 2 + x6 , 2 + x7 , 2 + x8, 2 2
x7 , 3 + x8, 3 2
x10,1 2
❑ Objective: Min Xn,4
x9 , 2 + x10, 2 + x11, 2 2
x4 , 3 + x9 , 3 + x10, 3 + x11, 3 2
x5, 4 + x9 , 4 + x11, 4 2
ILP Formulation of MR-LCS
𝑙. 𝑥𝑛𝑙 ≤ 𝜆ሜ + 1
𝑙
– Note: unknown ak appears in constraints.
[©Gupta]
List Scheduling
LIST_L (G(V,E), a) {
l=1
repeat {
for each resource type k {
Ul,k = available vertices in V
Tl,k = operations in progress.
Select Sk Ul,k such that|Sk| + |Tl,k| ak
Schedule the Sk operations at step l
}
l=l+1
} until vn is scheduled.
}
RCS: List Scheduling
Source: Gupta
List Scheduling Algorithm: MR-LCS
LIST_R (G(V,E), l’) {
a = 1, l=1
Compute the ALAP times tL.
if t0L < 0
return (not feasible)
repeat {
for each resource type k {
Ul,k = available vertices in V.
Compute the slacks { si = tiL - l, vi Ul,k }.
Schedule operations with zero slack, update a
Schedule additional Sk Ul,k under a constraints
}
l = l + 1}
until vn is scheduled. }