Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan...
-
date post
21-Dec-2015 -
Category
Documents
-
view
215 -
download
0
Transcript of Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan...
![Page 1: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/1.jpg)
Dataflow Process NetworksLee & Parks
Synchronous DataflowLee & Messerschmitt
Abhijit Davare
Nathan Kitchen
![Page 2: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/2.jpg)
Dataflow
Data oriented Host Language
Java, C/C++ Coordination language
SDF, Cyclo-static Dataflow
![Page 3: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/3.jpg)
Kahn Process Networks
Dataflow process networks are a special case of Kahn process networks.
P2
a, b, c A, B, C
unbounded
channels
P1 P3
![Page 4: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/4.jpg)
Properties of Kahn Processes
The processes that we deal with are usually:ContinuousMonotonic
Which means that we can realistically compute them.
![Page 5: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/5.jpg)
Continuous Processes
Formally:
Practically: A continuous process
will not wait for the end of an infinite input stream before producing an output.
)( FF
![Page 6: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/6.jpg)
Monotonic Processes Adding to the input does not change the output
already produced. All continuous processes are monotonic.
monotonic not monotonic
P1, 2, 3 2, 4, 6
P1, 2 2, 4
P1, 2, 3 4, 2, 6
P1, 2 2, 4
![Page 7: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/7.jpg)
Computing Continuous Processes Continuity means:
We can start producing the output stream before we have received all the input.
We can process an infinite stream with finite resources.
Networks of processes are determinate.
![Page 8: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/8.jpg)
Nondeterminism
Pros: Compact system definition Incomplete specification OK
Cons: Loss of continuity Analysis more difficult
![Page 9: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/9.jpg)
Nondeterminism (2) Nondeterminism can be added to KPN by:
Processes can test for empty channels Internal Nondeterminism Channel has multiple sources Channel has multiple sinks Processes have shared variables
rand()
x+=2
x=0 empty?
![Page 10: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/10.jpg)
Streams Most relevant in real-time signal
processing Recursively defined or Channel oriented Be good at losing data, recycling memory,
and storing data.
Recursive Camp Channel Camp
![Page 11: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/11.jpg)
Dataflow Processes
When a dataflow actor fires, it consumes inputs and produces outputs.
We get a dataflow process by repeatedly firing an actor.
2
2+ 4
![Page 12: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/12.jpg)
Firing Rules for Actors
Dataflow processes are continuous if: Each actor firing is functional
(i.e., the outputs depend only on the inputs).
The firing rules are sequential. A firing rule is a set of patterns
that the inputs have to match.
![Page 13: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/13.jpg)
Examples of Firing Rules
At least one token on each input: R1 = { [*], [*] }
The select channel chooses an input channel to take a token from: R1 = { [*], , [T] }
R2 = { , [*], [F] }
+[*]
[*]
[*]
[*]
F
T
![Page 14: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/14.jpg)
Firing Rules in SDF
A synchronous dataflow actor has a single firing rule containing only wildcards—it is enabled by a fixed number of tokens.
downsample
4 1
R = { [*, *, *, *] }
![Page 15: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/15.jpg)
Firing Rules with a Problem
At least one token on either input:
R1 = { [*, ] }, R2 = { [, *] } Which rule should be checked first? If we check
with a blocking read, we will deadlock.
These rules are not sequential.
merge merge
![Page 16: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/16.jpg)
Sequential Firing Rules
If we can avoid deadlock by checking rules in the right order, the rules are sequential.
Example: the select actorR1 = { [*],, [T] }
R2 = { , [*], [F] }
We read the third input first, then we know which other input to read.
![Page 17: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/17.jpg)
Implications of Sequentiality
All sequential processes are continuous, therefore determinate.
Networks of functional actors with sequential firing rules can be scheduled; we do not have to synchronize processes using blocking reads.
![Page 18: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/18.jpg)
Execution models
For Dataflow Process Networks, execution independent of scheduling
1. Concurrent Processes
2. Dynamic Scheduling
3. Static Scheduling
![Page 19: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/19.jpg)
B
Concurrent Processes
C
B
A
![Page 20: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/20.jpg)
B
Concurrent Processes
C
B
A
hungry
![Page 21: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/21.jpg)
B
Concurrent Processes
C
B
A
hungry
suspended
hungry
![Page 22: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/22.jpg)
B
Concurrent Processes
C
B
A
hungrysuspended
hungry
suspended
hungry
enabled
![Page 23: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/23.jpg)
Concurrent Processes(2)
Large overhead of context switching In general, increasing process granularity
decreases relative overhead
![Page 24: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/24.jpg)
Dynamic Scheduling
Data dependencies can make static scheduling impossible
In particular, dynamic scheduling is necessary when number of input and output tokens for each actor cannot be defined a priori
Can be done in hardware or software Actors activated when inputs available
![Page 25: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/25.jpg)
Static Scheduling
Must have number of input & output tokens predetermined for all actors
Best schedule chosen among several based on objective (e.g. minimum buffer size, minimum code size)
Used for:Code generation by code stitchingHW synthesis
![Page 26: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/26.jpg)
Formalism for Static Scheduling
Rank: Number of linearly independent vectors
1
2
4
3
4080
1200
0120
0063
T
1
2
3
43
6
2
8
4
1
2
1
![Page 27: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/27.jpg)
Formalism for Static Scheduling
Rank: Number of linearly independent vectors
1
2
4
3
4080
1200
0120
0063
T
1
2
3
43
6
2
8
4
1
2
1
Full rankNo periodic solution
![Page 28: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/28.jpg)
Formalism for Static Scheduling
Rank: Number of linearly independent vectors
4080
2200
0120
0063
T
1
2
4
3
1
2
3
43
6
2
8
4
1
2
2
2
2
1
2
Jq
![Page 29: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/29.jpg)
Correctness of SDF graphs
1 2
3
A
BC
1 1
1
11
2
![Page 30: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/30.jpg)
Correctness of SDF graphs
1 2
3
A
BC
1 1
2
11
2
![Page 31: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/31.jpg)
Correctness of SDF graphs
1 2
3
A
BC
1 1
1
11
1
![Page 32: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/32.jpg)
Delays
On startup, need to make sure that arcs have enough tokens to activate nodes
b(i) represents number of tokens in buffer i
b(n+1) = b(n) + T v(n) b(0) affects which startup options are legal
![Page 33: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/33.jpg)
Single Processor Static Scheduling
Class S algorithms:Given a firing vector (q) and the initial number
of tokens in each bufferSelect each runnable node and update b(n)
iterativelyList of these selected nodes forms schedule If schedule cannot be met, deadlock has
occurred
![Page 34: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/34.jpg)
Parallel Processor Static Scheduling
Exploit concurrency to increase throughput
In this example, nodes 1 and 3 can be scheduled at the same time on different processors
Periodic Admissible Schedules:
{1,3,1,2}
{3,1,1,2}
{1,1,3,2}
![Page 35: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/35.jpg)
Static Buffering
Minimize execution time by having memory locations embedded as constants in the code, not variables
iq = KN Where
i = Number of tokens emitted per firing q = Number of firings in one period N = Size of buffer K = an integer
![Page 36: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/36.jpg)
Functional Behavior & Hierarchy
Dataflow Process Networks allow hierarchy
Functionality may be present at the higher level
Delay, internal state, and unbalanced subsystems can cause nodes to be non-functional
![Page 37: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/37.jpg)
Dataflow and Functional Languages Actors correspond to first-order functions:
Processes are higher-order functions (they take functions as arguments):
Process F results from applying first-order function f to a stream that starts with R and continues with X.
yxyxf ),(
)(:)():( XRXR FfF
![Page 38: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/38.jpg)
Language Features
RecursionIterationCarrying state
PolymorphismParallelism
![Page 39: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/39.jpg)
Recursion Not needed in dataflow to carry state
(we have feedback loops) Can be used with high-order functions
for compact models (e.g., FFT)Expensive unless unrolled at setup time
![Page 40: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/40.jpg)
Polymorphism
Tokens can have arbitrary typeArrays as sequence of tokensArrays as single tokens
In PtolemyOne actor can operate on several types
add doubles add ints (without converting to doubles)
![Page 41: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/41.jpg)
Parallelism
Functional languages Explicit Thwarted by recursion Use higher-order functions for parallelism instead
Dataflow Implicit Use higher-order functions as syntactic sugar
Unrolled at setup time Still parallel!
![Page 42: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/42.jpg)
Credits
Sean Connery as James Bond: http://www.speakeasy.org/~wvt3rd/ BONDLIT1.HTM
Screen Beans © 1995, 1996, 1997, 1998, 1999, 2000 A Bit Better Corporation
Screen Beans is a registered trademark of A Bit Better Corporation. Figures from “Dataflow Process Networks,” Lee & Parks, Proc.
IEEE, May 1995, and “Synchronous Data Flow,” Lee & Messerschmitt, Proc. IEEE, Sep 1987.
All episodes are filmed before a live studio audience. No animals were harmed during the production of this presentation.
![Page 43: Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.](https://reader030.fdocuments.us/reader030/viewer/2022032704/56649d565503460f94a34fef/html5/thumbnails/43.jpg)
Tagged Token Model
Tokens have tags + values
Out of order execution Channels are not FIFO Actors fire when input tags
match Graph would deadlock as
dataflow More expressive Limited value