EE382C Embedded Software Systems - Topology Matrices
Topology matrices are a compact representation of connections
in dataflow graphs.
For dataflow graphs that can be statically scheduled, they can also
be used to represent the balance equations.
We will use topology matrices to represent the balance equations of
Synchronous Dataflow (SDF) graphs to show that the repetitions vector
either does not exist or exists and is unique.
Recall that the repetition vector has positive, coprime entries.
An SDF graph is sample rate consistent if a repetition vector can
be computed for it.
Topology Matrices
A topology matrix specifies the connections between vertices in
directed multigraph.
In one representation, the row entries are the edges in the graph, and
the column entries are the vertices in the graph.
As an example of this edge-vector topology matrix, a matrix entry
T(e,v) would be 0 if edge e does not connect to
vertex v, 1 if vertex v is the source vertex of edge
e, and -1 if vertex v is the sink vertex of e.
This representation of a topology matrix does not specify self-loops.
Self-loops are edges that have the same source and sink vertices.
A self-loop would mean that the corresponding entry in the edge-vector
topology would be both -1 and 1 at the same time, which is not possible.
Self-loops must be handled separately from the topology matrix.
In dataflow graphs, the absolute value of an element in the edge-vertex
topology matrix T(e,v) indicates the amount of data that flows along
edge e from vertex v.
Depending on the dataflow model being used, the amount of data that
flows along an arc might be a symbolic expression.
In Synchronous Dataflow (SDF), however, all of the elements of an edge-vertex
topology matrix are integers:
-
| prd(e) if v = src(e)
T(e,v) = < -cns(e) if v = snk(e)
| 0 otherwise
-
When a self-loop edge does not consume what it produces, a periodic
schedule does not exist in SDF.
Otherwise, the self-loop may be executed periodically, and since it
has no effect on the existence of a periodic schedule, it can be ignored
during load balancing.
Figure 1 shows a simple SDF graph and its
topology matrix.
e e
---- 1 ---- 2 ----
| v | -**--> | v | -----> | v |
| 1 | | 2 | | 3 |
---- ---- ----
3 2 1 1
(a) A simple SDF graph. The **
means a two-token delay.
- -
| 3 -2 0 |
T = | |
| 0 1 -1 |
- -
(b) A possible topology matrix.
Figure 1
The edge-vertex topology matrix ignores delays on the edges; in other words,
it represents the SDF graph when all delays are set to zero.
From now on, we will refer to an edge-vertex topology matrix as simply
a topology matrix.
Properties of Topology Matrices
The topology matrix is one way to find the rate at which we should
fire each vertex (actor) in the SDF graph, a.k.a. the repetitions
vector.
The repetitions vector q is found by load balancing the SDF graph.
One way to compute the repetitions vector is to solve the following
equation over the integers for q such that the elements of
q are positive and coprime:
T q = 0
In Figure 1, this equation becomes:
- - - - - -
| 3 -2 0 | | q | | 0 |
| | | 1 | | |
| 0 1 -1 | | q | = | 0 |
- - | 2 | - -
| q |
| 3 |
- -
The solution is q = [2 3 3]'.
Finding the solution requires finding the null space.
One family of methods to find the null space of a matrix relies on the
singular value decomposition of the matrix.
For an M x N matrix, singular value decomposition requires on the
order of min3(M, N) arithmetic operations.
For the case of SDF graphs, the linear-time, linear-space algorithm to
compute the repetitions vector is the preferred algorithm.
From linear algebra, the previous equation has a non-trivial solution
if and only if it has rank n-1 where n is the number
of blocks (vertices) in the SDF graph.
When the rank of matrix T is n-1, the null space has
dimension 1.
Therefore, there is exactly one solution that is unique to within a
scale factor to the equation T q = 0.
The graph in the previous example has three blocks, and the
2 x 3 topology matrix has rank two since the two rows
of the matrix are linearly independent.
So, we can find the repetitions vector as the positive, coprime
vector in the null space.
The repetitions vector corresponds to the
least
fixed point of the SDF graph.
A topology matrix is not unique for a given graph.
If we renumber the vertices, then we reorder the entries in the
topology matrix.
Nonetheless, all topology matrices for a given graph differ only
by a permutation of rows and columns, and therefore have the same
rank and null space.
Every connected SDF graph has an associated topology matrix that has
a rank of either n or n-1.
If the topology matrix has rank n, then no repetitions
vector can be found.
If the topology matrix has rank n-1, then a repetitions
vector always exists.
These statements are combined in the following theorem:
A connected SDF graph with n blocks has a periodic schedule
if and only if its topology matrix T has rank n-1.
Moreover, if its topology matrix T has rank n-1, then
there exists a unique smallest [positive] integer solution q to the
balance equations T q = 0.
Moreover, the entries in q are coprime.
This theorem and its proof are presented in the following paper:
E. A. Lee and D. G. Messerschmitt, "Static Scheduling of
Synchronous Dataflow Programs for Digital Signal Processing,"
IEEE Transactions on Computers, vol. 36, no. 2, Feb. 1987.
The proof follows from these lemmas:
- A connected, tree-structured graph with n vertices has
exactly n - 1 edges.
- A topology matrix T for a tree-structured SDF graph G
with n blocks has rank n-1.
- A topology matrix T for a connected SDF graph G
with n blocks either has rank n-1 or n.
- Consider a connected SDF graph G with topology matrix
T.
Let b be any vector such that T b = 0.
Denote any connected path of length L through the graph
by the set of blocks A = {A1, ..., AL},
where Ai is connected to Ai+1 for
1 <= i <= L.
Then in the set { b(a), a in A }, either all members are
zero, all are positive, or all are negative.
Moreover, if any member of the set is rational,
then all of the members are rational.
- Given a topology matrix T, if the solution to the balance
equations T b = 0 yields a rational solution
b, then the repetitions vector q = m b
where m is the least common multiple of the denominators
of b.
Now that we know when we can compute a repetitions vector and how
to compute it, we can find a periodic schedule of firings for the SDF graph.
The next step is to use the repetitions and the SDF graph to find
an admissible schedule that satisfies the data dependencies in the
graph and delays on the edges.
Updated 02/28/02.