2.2 Dataflow classes
2.2.1 Static dataflow programs
Static dataflow (SDF ), sometimes also called synchronous dataflow, is a special class of dataflow MoC s where the number of tokens consumed and produced by each actor is fixed and known at compile-time. Repeated firings of the same actor respects the same behavior. This is the least expressive class of dataflow programs, but it is also the one that can be analyzed in the easiest way. In fact, its main advantage is its total predictability at compile-time, with respect to scheduling, memory consumption, and execution termination.
Static scheduling
In order to build a static schedule, the compiler should construct a single cycle of a periodic schedule. The first step is then to evaluate how many invocations of each actor should be included in each cycle. This can be established easily using the number of produced and consumed tokens for each actor firing. As depicted in Figure 2.2, the number of tokens consumed at each firing by the i − th actor from the n − th buffer is denoted by ci ,n∈ N, the number of tokens produced at each firing by the i − th actor on the n − th buffer is denoted by
pi ,n∈ N, and the number of times the i − t h actor is invoked (i .e., repeated) in each cycle of the iterated schedule is denoted by ri∈ N. Hence, in order to have a feasible periodic schedule, it must be ensured that for each n − th buffer of the dataflow graph the following condition is satisfied:
pi ,nri= cj ,nrj (2.6)
In other words, this equation ensures that in each cycle of the iterated schedule, the number of tokens produced on each buffer is equal to the number of tokens consumed on that buffer. Indeed, the first step to finding a schedule for an SDF graph is to solve a set of Equations (2.6) for the unknown ri. Since for SDF programs the number of consumed and produced tokens
a
ia
jb
npi,n cj,n
Figure 2.2 – A dataflow graph with two actors, aiand aj, connected through the buffer bn.
pi ,ndefines the number of tokens produced on bnduring each firing of ai. cj ,ndefines the number of tokens consumed from bnduring each firing of aj.
for each actor firing is fixed and known at compile-time, the set of equations can be concisely written by constructing a topological matrixΓ. The entry [Γ]i ,ncontains the integer pi ,nwhen
the i − th actor produces pi ,ntokens on the n − th buffer, and the integer ci ,nwhen the i − th actor consumes ci ,ntokens from the n − th buffer. In general, this matrix does not need to be square. For example, a dataflow graph shown in Figure 2.3 has the following topological matrix: Γ = pA,1 −cB,1 0 0 0 pA,4 0 0 −cD,4 0 0 pB,2 −cC ,2 0 0 0 0 pC ,3 0 −cE ,3 0 0 0 pD,5 −cE ,5 (2.7)
The system of equations to be solved can be formulated such as:
Γ −→r = −→0 (2.8)
where −→r is the repetition vector containing the rivalue for each i − th actor, and→−0 is a zero- vector. Equation (2.8) is usually referred to as the balance equation of a dataflow program. A special case is when an actor has a connection to itself (i .e., a self-loop). In this situation only one entry inΓ describes this buffer. This entry gives the net difference between the amount of tokens produced on this buffer and the amount of tokens consumed from this buffer each time the actor is executed. For a correctly constructed graph this difference needs to be zero. Hence, the entry describing a self-loop should be zero [41].
A
E
B
D
C
b
2 cB,1b
1b
4b
5b
3 pA,1 pA,4 pA,5 pB,2 cC,2 pC,3 cE,3 cE,5 cD,4Figure 2.3 – Example of a dataflow graph.
Existence of an admissible schedule
An admissible sequential scheduleφs is defined as a non-empty ordered list of actors such that if the actors are executed in the sequence given byφs, then the number of tokens stored in each buffer will remain non-negative and bounded. Each actor must appear inφsat least once.
A periodic admissible sequential schedule (P ASS) is infinite. In [41] it has been demonstrated that, for any connected SDF graph, a necessary condition to be able to construct a P ASS is that the rank ofΓ should be:
r ank(Γ) = s − 1 (2.9)
where s is the number of actors in the graph. In other words, the null space ofΓ should have a dimension of 1. Furthermore, it is shown in [41] that when the rank is correct, a repetition vector −→r that contains only integers and relies on this null space always exists. This vector
defines how many times each actor should be invoked in one period of a P ASS. In other words, the rank of the topology matrix indicates a sample rate consistent with the graph. SDF graphs that have a topology matrix such that r ank(Γ) = s are said to be defective: any schedule for this graph will result either in a deadlock or unbounded buffer size configuration.
The use of a P ASS scheduler requires using a single processing unit implementation: this does not exploit the parallelism advantages of a dataflow application. Clearly, if a feasible schedule for a single processing unit can be generated, then a feasible schedule for a multiprocessor system can be also generated. In that case the objective is to find a periodic admissible parallel schedule (P AP S) defined as a set of listsΨ = {ψi, i = 1,..., M} where M is the number of processing units, andψi specifies a periodic schedule for the i − th processing unit. If a single processing unit is targeted, some reasonable scheduling objectives might include minimization of data or program memory requirements. For the case of multiprocessor targets, the common objectives are the maximization of the throughput or the minimization of the flow-time [41, 42, 43].