Algorithm Search⌘K

Modelcore

Synchronous dataflow

Also called SDF graph, synchronous data flow graph.

Lee and Messerschmitt's dataflow model whose actors produce and consume fixed numbers of tokens per firing, so schedules and buffer sizes are known at compile time.

Synchronous dataflow, or SDF, is a model of a signal processing program as a directed graph of actors that pass tokens along FIFO edges. Each actor consumes a fixed number of tokens from each input edge and produces a fixed number of tokens on each output edge every time it fires, and these numbers never depend on the data. Lee and Messerschmitt introduced it in 1987. Because the rates are fixed, a compiler can decide before the program runs whether it can run forever in bounded memory, how often each actor fires per period, and how large each buffer must be. This page defines the model and proves its basic theorems: the rank condition, the repetition vector, the cycle criterion for deadlock and the bounded memory theorem. The method that builds a schedule is on the static scheduling of SDF page.

The machine

An SDF graph has actors 1,…,n1, \ldots, n and a finite set EE of directed edges. Each edge e=(a,b)e = (a, b) from actor aa to actor bb carries three integers: the production rate pe≥1p_e \ge 1, the consumption rate ce≥1c_e \ge 1 and the delay de≥0d_e \ge 0. Parallel edges and self loops are allowed. The delay is not a time: it is the number of tokens on the edge at the start, and in a signal flow graph it is the number of unit delays z−1z^{-1} on the arc.

The state of the machine is the vector b∈Z≥0Eb \in \mathbb{Z}_{\ge 0}^E of token counts, with b=db = d at the start. Actor aa is enabled in state bb when every input edge ee of aa holds be≥ceb_e \ge c_e tokens. One step fires one enabled actor: it removes cec_e tokens from each input edge and then adds pep_e tokens to each output edge. A firing is atomic, and the values of the tokens play no part in the model. A firing sequence is admissible when each actor in it is enabled at the moment it fires.

The topology matrix Γ\Gamma has one row per edge and one column per actor. For e=(a,b)e = (a, b) with a≠ba \ne b, row ee has pep_e in column aa, −ce-c_e in column bb and 0 elsewhere. For a self loop on aa, row ee has pe−cep_e - c_e in column aa. If 1a\mathbf{1}_a is the unit vector of actor aa, firing aa changes the state from bb to b+Γ1ab + \Gamma \mathbf{1}_a. So after an admissible sequence in which actor aa fires xax_a times, the state is

b=d+Γx,b = d + \Gamma x,

whatever the order of the firings. This is the same bookkeeping as the state equation of a Petri net.

The graph is called connected when it is connected after the edge directions are dropped. A graph with several components is a set of separate programs, so the results below assume a connected graph.

What it counts

The cost unit is one firing, and the memory is the number of tokens on the edges. The questions of the model are about firing sequences:

  • Periodic admissible sequential schedule (PASS). A finite admissible sequence σ\sigma in which every actor fires at least once and after which the state is dd again. Repeating σ\sigma runs the program forever.
  • Repetition vector. The firing counts qq of the shortest periodic schedules.
  • Buffer bound. The largest token count of each edge while a schedule runs, which is the memory a compiler must reserve.
  • Deadlock. A state that no admissible sequence can leave toward the end of a period.

With an execution time per actor, the model also has a throughput, the number of periods per unit of time on unlimited processors. That question reduces to the iteration bound of an expanded graph, as explained below.

Relation to other models

  • Petri nets and marked graphs. An SDF graph is a weighted Petri net in which every place has exactly one input transition and one output transition: actors are transitions, edges are places, rates are arc weights and delays are the initial marking. When all rates are 1 the graph is homogeneous, and it is exactly a marked graph in the sense of Commoner, Holt, Even and Pnueli. A timed event graph is the timed version of a marked graph.
  • Kahn process networks. An SDF actor is a Kahn process that reads a fixed number of tokens from each input with blocking reads, so SDF is a special case of a Kahn process network and inherits its determinacy. The fixed rates are what make the questions above decidable, while they are undecidable for general Kahn networks.
  • Signal flow graphs and data flow graphs. A homogeneous SDF graph whose actors have execution times is the data flow graph of the iteration bound, retiming, unfolding and folding pages: one firing of each actor is one iteration, and the delays are registers.
  • Control data flow graphs. A CDFG describes one run of a block with branches. SDF has no branches and describes a stream that never ends; its edges are queues, not single values.
  • Models with data-dependent rates. Boolean dataflow adds actors whose rates depend on a control token. Lee and Parks (1995) survey this family and explain that such models can simulate any program, so the questions that SDF answers become undecidable for them.

Known results in the model

Throughout, GG is connected, with nn actors and topology matrix Γ\Gamma.

Theorem 1 (rank condition and repetition vector). If GG has a PASS, then rank⁡Γ=n−1\operatorname{rank} \Gamma = n - 1. If rank⁡Γ=n−1\operatorname{rank} \Gamma = n - 1, then the integer vectors xx with Γx=0\Gamma x = 0 are exactly the multiples tqt q, t∈Zt \in \mathbb{Z}, of one vector qq whose entries are positive integers with greatest common divisor 1. Every PASS fires each actor aa exactly JqaJ q_a times for one integer J≥1J \ge 1.

Proof. First, rank⁡Γ≥n−1\operatorname{rank} \Gamma \ge n - 1. Let Γx=0\Gamma x = 0 with xx real. The row of an edge e=(a,b)e = (a, b) with a≠ba \ne b says pexa=cexbp_e x_a = c_e x_b, so xb=(pe/ce)xax_b = (p_e / c_e) x_a. Along a spanning tree of the undirected graph, every entry of xx is a fixed positive multiple of x1x_1. So the null space has dimension at most 1, and the rank-nullity theorem gives rank⁡Γ≥n−1\operatorname{rank} \Gamma \ge n - 1.

Now let σ\sigma be a PASS with firing counts xx. The state after σ\sigma is d+Γx=dd + \Gamma x = d, so Γx=0\Gamma x = 0 with x≠0x \ne 0. Hence the null space is not zero and rank⁡Γ=n−1\operatorname{rank} \Gamma = n - 1.

If rank⁡Γ=n−1\operatorname{rank} \Gamma = n - 1, the null space is one line. The spanning tree argument shows that this line is spanned by the vector yy with y1=1y_1 = 1 whose entries are the positive rationals forced by the tree. Multiply yy by the least common multiple of the denominators and divide by the greatest common divisor of the result: this gives qq, with positive integer entries and gcd 1. Let xx be an integer null vector. Then x=rqx = r q for a rational r=u/vr = u / v in lowest terms, and vv divides uqau q_a for every aa, so vv divides every qaq_a and hence their gcd, which is 1. So rr is an integer. For a PASS, xx is a null vector with positive entries, so x=Jqx = J q with J≥1J \ge 1. □\square

The vector qq is the repetition vector. A graph with rank⁡Γ=n−1\operatorname{rank} \Gamma = n - 1 is called consistent, and one with rank⁡Γ=n\operatorname{rank} \Gamma = n is inconsistent: it has no PASS at all. The nullspace computation by Gaussian elimination gives qq, but the spanning tree walk above is simpler and is what the scheduling page uses.

Theorem 2 (bounded memory). If GG is inconsistent, then every infinite admissible firing sequence of GG has unbounded token counts.

Proof. Suppose an infinite admissible sequence keeps every count at most BB. Then it visits finitely many states, so some state appears after two prefixes with firing counts x<x′x < x' (componentwise ≤\le, and not equal). Then d+Γx=d+Γx′d + \Gamma x = d + \Gamma x', so y=x′−xy = x' - x is a nonzero null vector with y≥0y \ge 0. For each edge, peya=ceybp_e y_a = c_e y_b, so ya=0y_a = 0 exactly when yb=0y_b = 0, and since GG is connected, every entry of yy is positive. So rank⁡Γ≤n−1\operatorname{rank} \Gamma \le n - 1, and GG is consistent, a contradiction. □\square

So an inconsistent graph either deadlocks or overflows any finite memory. A consistent graph can still deadlock, and the next theorem says exactly when.

Theorem 3 (deadlock comes from a cycle). Let GG be consistent with repetition vector qq. For a directed simple cycle CC of GG, let GCG_C be the graph that has only the actors and edges of CC, with the same rates and delays. Then GG has a PASS exactly when, for every directed simple cycle CC, the graph GCG_C alone has an admissible sequence in which each actor aa of CC fires qaq_a times.

In words: deadlock always comes from a directed cycle whose initial tokens are too few for the cycle alone to complete its share of one period. An acyclic consistent graph never deadlocks. For a homogeneous graph, q=1q = \mathbf{1}, and a cycle alone completes one firing of each actor exactly when it holds at least one token, which is the liveness theorem of Commoner, Holt, Even and Pnueli for marked graphs.

Proof. Number the firings of each actor aa as (a,1),(a,2),…(a, 1), (a, 2), \ldots. For an edge e=(a,b)e = (a, b), the jj-th firing of bb needs jcej c_e tokens taken from ee in total, which holds exactly when aa has fired at least

fe(j)=max⁡(0,⌈jce−depe⌉)f_e(j) = \max\left(0, \left\lceil \frac{j c_e - d_e}{p_e} \right\rceil\right)

times. Each fef_e is nondecreasing, fe(0)=0f_e(0) = 0, and fe(j)≤⌈jce/pe⌉f_e(j) \le \lceil j c_e / p_e \rceil. Since peqa=ceqbp_e q_a = c_e q_b, this gives fe(qb)≤qaf_e(q_b) \le q_a, so j≤qbj \le q_b implies fe(j)≤qaf_e(j) \le q_a.

Firings only add tokens to the edges that other actors read, so an enabled actor stays enabled until it fires. Hence the firings that a run can reach form a set that is closed downward, and GG reaches the counts qq exactly when the following requirement graph RR has no directed cycle. Its nodes are the firings (a,j)(a, j) with 1≤j≤qa1 \le j \le q_a. It has an arc (b,j)→(b,j−1)(b, j) \to (b, j - 1) for j≥2j \ge 2, and an arc (b,j)→(a,fe(j))(b, j) \to (a, f_e(j)) for each input edge e=(a,b)e = (a, b) of bb with fe(j)≥1f_e(j) \ge 1. If RR is acyclic, firing in reverse topological order is admissible and reaches qq, and the state is then d+Γq=dd + \Gamma q = d, so this is a PASS. If RR has a cycle, no firing on it can come first, so no run fires all of them. By Theorem 1 a PASS fires each actor aa at least qaq_a times, so it would fire every node of RR, and no PASS exists. The same holds for GCG_C with its own requirement graph RCR_C, whose arcs are a subset of the arcs of RR on the same nodes.

If some GCG_C fails, then RCR_C has a cycle, which is also a cycle of RR, so GG has no PASS.

Conversely, suppose every GCG_C completes, and let a closed walk WW in GG pass through actor bb. Write fWf_W for the composition of the functions fef_e of the edges of WW, read backward from bb around to bb. A cycle of RR through (b,j)(b, j) projects to a closed walk WW with fW(j)≥j≥1f_W(j) \ge j \ge 1, since the arcs inside one actor only lower the index and every fef_e is nondecreasing. So it is enough to show fW(j)≤j−1f_W(j) \le j - 1 for every closed walk WW and every 1≤j≤qb1 \le j \le q_b. For a simple cycle CC, a value fC(j)≥jf_C(j) \ge j would give a cycle of RCR_C through (b,j)(b, j), since all the intermediate values stay in their windows and stay at least 1 (once a value is 0, all later ones are 0). So fC(j)≤j−1≤jf_C(j) \le j - 1 \le j on the window, and fC(0)=0f_C(0) = 0. A closed walk WW that is not simple contains a simple cycle CC as a closed sub-walk at some actor vv. Removing CC gives a shorter closed walk W′W', and since fC(i)≤if_C(i) \le i and every fef_e is nondecreasing, fW(j)≤fW′(j)f_W(j) \le f_{W'}(j). Induction on the length of WW gives fW(j)≤j−1f_W(j) \le j - 1. So RR is acyclic and GG has a PASS. □\square

The condition "fires qaq_a times" can be read with the repetition vector of GCG_C instead: the rows of CC are rows of Γ\Gamma, so the repetition vector qCq^C of GCG_C satisfies q∣C=tqCq|_C = t q^C for an integer t≥1t \ge 1, and a cycle that completes qCq^C is back in its start state and can repeat it tt times.

Precedence expansion. Lee and Messerschmitt (1987, IEEE Transactions on Computers) expand a consistent SDF graph into an acyclic precedence graph with qaq_a nodes for actor aa, one per firing in one period, and an arc from each firing to the firings of the same period that need its tokens. It orders the same firings as the requirement graph RR above, read in the other direction. If the dependencies on tokens of earlier periods are added as edges with delays, the result is a homogeneous graph with one iteration per period. With execution times on the actors, the throughput on unlimited processors is then the inverse of the iteration bound of that homogeneous graph.

Example

Take three actors A,B,CA, B, C on a ring: AA produces 2 tokens and BB consumes 3 on edge A→BA \to B; BB produces 1 and CC consumes 2 on edge B→CB \to C; CC produces 3 and AA consumes 1 on edge C→AC \to A, which holds dd initial tokens. Then

Γ=(2−3001−2−103),q=(3,2,1).\Gamma = \begin{pmatrix} 2 & -3 & 0 \\ 0 & 1 & -2 \\ -1 & 0 & 3 \end{pmatrix}, \qquad q = (3, 2, 1).

The rows give 2qA=3qB2 q_A = 3 q_B, qB=2qCq_B = 2 q_C and 3qC=qA3 q_C = q_A, which qq meets, and the rank is 2. One period fires AA three times, BB twice and CC once.

The graph is one cycle, so Theorem 3 reduces to running it. With d=3d = 3, the sequence AAABBCAAABBC is admissible: AA uses the 3 tokens and puts 6 on A→BA \to B, BB fires twice and puts 2 on B→CB \to C, and CC fires once and puts 3 tokens back on C→AC \to A. With d=2d = 2, AA fires twice, BB fires once, and then 1 token waits on A→BA \to B for BB, 1 token waits on B→CB \to C for CC, and nothing waits for AA: a deadlock, although the graph is consistent. Any d≤2d \le 2 deadlocks in the same way.

Change the rates of C→AC \to A to "CC produces 2, AA consumes 1". The third row becomes (−1,0,2)(-1, 0, 2), the determinant is −2-2, the rank is 3, and by Theorem 2 every infinite run of this graph either stops or needs unbounded memory: AA now gets 2/32/3 of the tokens it needs per period of the other two actors.

References

  1. Edward A. Lee and David G. Messerschmitt, Synchronous data flow, Proceedings of the IEEE 75(9), 1235 to 1245, 1987, the model (actors with fixed token rates, delays as initial tokens), the topology matrix and the rank condition, and its use for signal processing
  2. Edward A. Lee and David G. Messerschmitt, Static scheduling of synchronous data flow programs for digital signal processing, IEEE Transactions on Computers C-36(1), 24 to 35, 1987, the theorems on periodic admissible schedules (rank n - 1 is necessary, the repetition vector, deadlock, bounded memory) and the expansion into a precedence graph
  3. F. Commoner, A. W. Holt, S. Even and A. Pnueli, Marked directed graphs, Journal of Computer and System Sciences 5(5), 511 to 523, 1971, the token count of a directed cycle is invariant, and a marked graph is live exactly when every directed cycle holds a token
  4. Shuvra S. Bhattacharyya, Praveen K. Murthy and Edward A. Lee, Software Synthesis from Dataflow Graphs, Kluwer, 1996, the chapters on SDF consistency, scheduling and the buffer memory of schedules
  5. Edward A. Lee and Thomas M. Parks, Dataflow process networks, Proceedings of the IEEE 83(5), 773 to 801, 1995, SDF as a special case of Kahn process networks, and the dataflow models with data-dependent rates

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/SZZFZY/text.yaml