You are on page 1of 5

ASAP and ALAP scheduling ASAP Scheduling

• We’re now entering the final portion of the course • The simplest type of scheduling occurs when we
– Scheduling and retiming wish to optimize the overall latency of the
– Resource sharing algorithms computation and do not care about the number of
– Floorplanning resources required
– Function Approximation • This can be achieved by simply starting each
– Perspectives for the future operation in a CDFG as soon as its predecessors
• This lecture covers have completed
– The ASAP scheduling algorithm • This strategy gives rise to the name ASAP for “As
– The ALAP scheduling algorithm and operation slack Soon As Possible”
– Introducing timing constraints into schedules

1/31/2006 Lecture9 gac1 1 1/31/2006 Lecture9 gac1 2

ASAP Scheduling ASAP Scheduling


• Let’s label each edge in the CDFG with the latency # # 0
0 0
of the node producing that edge 0 0
* * * * + * 0 * 0 * 0 * 0 + 0
• Then scheduling under ASAP is equivalent to 2 2 2 2 1
* * + < * 2
finding the longest path between each operation * 2 + 2 < 1
2
and the source node - 2 1 1 - 4
• Since a CDFG is a DAG, we can use the DAG 1
- - 5
longest path algorithm presented in Lecture 8 1 # # 6
• Consider the original example from Lecture 1, and Edge weighted CDFG Scheduled start times
assume that multiplication takes two cycles, • Applying the DFG algorithm to finding the longest path
whereas addition and comparison take one cycle between the start and end nodes leads to the scheduled
start times on the right-hand diagram
1/31/2006 Lecture9 gac1 3 1/31/2006 Lecture9 gac1 4
ALAP Scheduling ALAP Scheduling
• The ASAP algorithm schedules each operation at the # # 6
0 0
earliest opportunity. Given an overall latency constraint, it is 0 0
equally possible to schedule operations at the latest * * * * + * 6 * 6 * 5 * 3 + 2
opportunity. 2 2 2 2 1
* * + < * 4 * 3 + 1 < 1
• This leads to the concept of As-Late-As-Possible (ALAP) 2
scheduling. - 2 1 1 - 2
• ALAP scheduling can be performed by seeking the longest 1
- - 1
path between each operation and the end or “sink” node. # # 0
1
• We will re-examine the example, under the same delay Edge-weighted CDFG Longest paths to sink node
assumptions, with an overall latency constraint of 6 clock
cycles. • The ALAP schedule start times can be derived by
subtracting the longest path time from the desired overall
latency constraint
1/31/2006 Lecture9 gac1 5 1/31/2006 Lecture9 gac1 6

ALAP Scheduling Mobility


# 0 • Let’s compare the ASAP and ALAP schedules:
• Here are the ALAP start
# 0 # 0
* 0 * 0 * 1 * 3 + 4 times. You can see that
each operation starts at * 0 * 0 * 0 * 0 + 0 * 0 * 0 * 1 * 3 + 4
* 2 * 3 + 5 < 5 the latest opportunity
* 2 * 2 + 2 < 1 * 2 * 3 + 5 < 5
- 4 possible to still meet 6
- 5
cycles overall - 4 - 4
# 6 - 5 - 5
# 6 # 6

• The highlighted nodes have equal ASAP and ALAP times.


For all others there is a difference of at least once cycle.
1/31/2006 Lecture9 gac1 7 1/31/2006 Lecture9 gac1 8
Mobility Types of Timing Constraint
• The difference between the ALAP and ASAP times • As well as an overall latency constraint, other types
for an operation is called the operation mobility or of timing constraint are important
slack. • Consider these examples [DeMicheli94]
• Mobility measures how free we are to move the – A circuit reads data from a bus, performs a computation,
operation into different time-slots. and writes the result back onto the bus. The bus interface
specifies that the data must be written exactly three
• Operations with zero mobility are critical operations, cycles after the read
and together form the critical path, which – A circuit has two independent streams of operations,
determines how fast our circuit will run. constrained to communicate simultaneously to external
• More sophisticated scheduling algorithms will take circuits by providing two pieces of data at two interfaces.
advantage of positive mobility to balance the The cycle in which the data are made available is
resource requirements over time. irrelevant, although the simultaneity of the data is
essential.
1/31/2006 Lecture9 gac1 9 1/31/2006 Lecture9 gac1 10

Types of Timing Constraint Modelling Timing Constraints


• We will consider two types of constraint • How can we incorporate these timing constraints
– a minimum timing constraint lij between within our sequencing graph-based model, and
operations vi and vj: S(vj) ≥ S(vi) + lij how do they affect the schedule?
– a maximum timing constraint uij between • From the sequencing graph G(V,E), we construct
operations vi and vj : S(vj) ≤ S(vi) + uij an edge-weighted constraint graph GC(V,EC),
• These constraints are sufficient to model the where E ⊂ EC:
situations on the previous slide, in addition to many – the edge weights for edges in E are the same as before
(i.e. the delay of the node producing that edge)
others. Solutions for previous slide:
– we add extra edges to model the timing constraints
– set both min and max of 3 cycles between read and write
– set both min and max of 0 cycles between the two writes

1/31/2006 Lecture9 gac1 11 1/31/2006 Lecture9 gac1 12


Modelling Timing Constraints Modelling Timing Constraints
• Minimum timing constraints can simply be modelled • Maximum timing constraints can be modelled by
by adding an extra edge (vi, vj) with weight lij adding an extra edge (vj, vi) with weight -uij

# # • Now the multiplication cannot


0 0 • By adding the curved edge 0 0
0 0 0 occur before -5 cycles after
* *
0
* * + with weight 5, the * * * * + the subtraction starts
2 2 2 2 1 subtraction operation 2 2 2 2 1
* * + < cannot start for at least 5
* * + < • S(mult) ≥ S(sub) – 5, i.e.
2 cycles after the 2 2 S(sub) ≤ S(mult) + 5
- 2 1 1
- 1 1 • The subtraction cannot occur
1 multiplication starts 1
-
5 - -5 later than five cycles after the
# 1 #
1 multiplication starts
1/31/2006 Lecture9 gac1 13 1/31/2006 Lecture9 gac1 14

Scheduling with timing constraints Summary


• ASAP / ALAP scheduling can still be performed on • This lecture has covered
constraint graphs through the longest path – The ASAP scheduling algorithm
technique, BUT… – The ALAP scheduling algorithm and operation slack
– the graph may no longer be a DAG (e.g. on the previous – Introducing timing constraints into schedules
slide)
– we may need to use Liao-Wong to find the longest path
• Next lecture will look at list scheduling, an heuristic
method to find a short schedule given constraints
on the number of each type of resource available

1/31/2006 Lecture9 gac1 15 1/31/2006 Lecture9 gac1 16


Suggested Problem More Suggested Problems
• Consider again the differential equation example • DeMicheli, Chapter 5, Problems 2 and 3 (note that
from Lecture 1, repeated again below. DeMicheli refers to a combined min and max
• It is required that the constraint between the source vertex and an
# subtraction operation operation as a “release time” constraint)
0 0
0 marked (α) begin no later
* β +
0
* * *
2 2 2 1 than 3 cycles after the
2
* * + < multiplication operation
2 marked (β)
- 2 1 1
• Compare the ALAP
- α
1
# schedules with and without
1
this constraint
1/31/2006 Lecture9 gac1 17 1/31/2006 Lecture9 gac1 18

You might also like