Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
Bill Thies, MIT. 1 6.189 IAP 2007 MIT
6.189 IAP 2007
Lecture 8
The StreamIt Language
2 6.189 IAP 2007 MITBill Thies, MIT.
Languages Have Not Kept Up
Modernarchitecture
C von-Neumannmachine
● Two choices:
Develop cool architecture with complicated, ad-hoc language
Bend over backwards to supportold languages like C/C++
● Two choices:
Develop cool architecture with complicated, ad-hoc language
● Two choices:
3 6.189 IAP 2007 MITBill Thies, MIT.
Why a New Language?
For uniprocessors,C was:•Portable•High Performance•Composable•Malleable•Maintainable
1985 199019801970 1975 1995 2000
4004
8008
80868080 286 386 486 Pentium P2 P3P4Itanium
Itanium 2
2005
Raw
Power4 Opteron
Power6
Niagara
YonahPExtreme
Tanglewood
Cell
IntelTflops
Xbox360
CaviumOcteon
RazaXLR
PA-8800
CiscoCSR-1
PicochipPC102
Boardcom 1480
20??
# ofcores
1
2
4
8
16
32
64
128256
512
Opteron 4PXeon MP
Athlon
AmbricAM2045
Raw
Power4 Opteron
Power6
Niagara
YonahPExtreme
Tanglewood
Cell
IntelTflops
Xbox360
CaviumOcteon
RazaXLR
PA-8800
CiscoCSR-1
PicochipPC102
Boardcom 1480 Opteron 4PXeon MP
AmbricAM2045
4 6.189 IAP 2007 MITBill Thies, MIT.
Why a New Language?
Uniprocessors:C is the commonmachine language
1985 199019801970 1975 1995 2000
4004
8008
80868080 286 386 486 Pentium P2 P3P4Itanium
Itanium 2
2005
Raw
Power4 Opteron
Power6
Niagara
YonahPExtreme
Tanglewood
Cell
IntelTflops
Xbox360
CaviumOcteon
RazaXLR
PA-8800
CiscoCSR-1
PicochipPC102
Boardcom 1480
20??
# ofcores
1
2
4
8
16
32
64
128256
512
Opteron 4PXeon MP
Athlon
AmbricAM2045
Raw
Power4 Opteron
Power6
Niagara
YonahPExtreme
Tanglewood
Cell
IntelTflops
Xbox360
CaviumOcteon
RazaXLR
PA-8800
CiscoCSR-1
PicochipPC102
Boardcom 1480 Opteron 4PXeon MP
AmbricAM2045
5 6.189 IAP 2007 MITBill Thies, MIT.
Why a New Language?
What is the commonmachine languagefor multicores?
1985 199019801970 1975 1995 2000
4004
8008
80868080 286 386 486 Pentium P2 P3P4Itanium
Itanium 2
2005
Raw
Power4 Opteron
Power6
Niagara
YonahPExtreme
Tanglewood
Cell
IntelTflops
Xbox360
CaviumOcteon
RazaXLR
PA-8800
CiscoCSR-1
PicochipPC102
Boardcom 1480
20??
# ofcores
1
2
4
8
16
32
64
128256
512
Opteron 4PXeon MP
Athlon
AmbricAM2045
Raw
Power4 Opteron
Power6
Niagara
YonahPExtreme
Tanglewood
Cell
IntelTflops
Xbox360
CaviumOcteon
RazaXLR
PA-8800
CiscoCSR-1
PicochipPC102
Boardcom 1480 Opteron 4PXeon MP
AmbricAM2045
6 6.189 IAP 2007 MITBill Thies, MIT.
Common Machine Languages
Single memory image
Single flow of control
Common PropertiesUniprocessors:
ISA
Functional Units
Register FileDifferences:
Multiple local memories
Multiple flows of control
Common PropertiesMulticores:
Communication Model
Synchronization Model
Number and capabilities of cores
Differences:
von-Neumann languages represent the common properties and abstract away the differences
Need common machine language(s) for multicores
7 6.189 IAP 2007 MITBill Thies, MIT.
● For programs based on streams of dataAudio, video, DSP, networking, and cryptographic processing kernels Examples: HDTV editing, radar tracking, microphone arrays, cell phone base stations, graphics
● Several attractive propertiesRegular and repeating computationIndependent filters with explicit communicationTask, data, and pipeline parallelism Adder
Speaker
AtoD
FMDemod
LPF1
Scatter
Gather
LPF2 LPF3
HPF1 HPF2 HPF3
Streaming as a Common Machine Language
8 6.189 IAP 2007 MITBill Thies, MIT.
Streaming Models of Computation
● Many different ways to represent streamingDo senders/receivers block?How much buffering is allowed on channels?Is computation deterministic?Can you avoid deadlock?
● Three common models:1. Kahn Process Networks2. Synchronous Dataflow3. Communicating Sequential Processes
9 6.189 IAP 2007 MITBill Thies, MIT.
Streaming Models of Computation
None(Rendesvouz)
Fixed by compiler
Conceptually unbounded
Buffering
- Rich synchronization primitives
- Occam language
- Static scheduling- Deadlock freedom
- UNIX pipes- Ambric (startup)
Notes
Data-dependent, allows non-determinism
Communicating Sequential Processes (CSP)
Static Synchronous dataflow (SDF)
Data-dependent,but deterministic
Kahn process networks (KPN)
CommunicationPattern
SDF
KPN CSPspace of program behaviors
10 6.189 IAP 2007 MITBill Thies, MIT.
The StreamIt Language
● A high-level, architecture-independent language for streaming applications
Improves programmer productivity (vs. Java, C)Offers scalable performance on multicores
● Based on synchronous dataflow, with dynamic extensions
Compiler determines execution order of filtersMany aggressive optimizations possible
11 6.189 IAP 2007 MITBill Thies, MIT.
● ApplicationsDES and Serpent [PLDI 05]MPEG-2 [IPDPS 06]SAR, DSP benchmarks, JPEG, …
● ProgrammabilityStreamIt Language (CC 02) Teleport Messaging (PPOPP 05)Programming Environment in Eclipse (P-PHEC 05)
● Domain Specific OptimizationsLinear Analysis and Optimization (PLDI 03)Optimizations for bit streaming (PLDI 05)Linear State Space Analysis (CASES 05)
● Architecture Specific OptimizationsCompiling for Communication-Exposed Architectures (ASPLOS 02)Phased Scheduling (LCTES 03)Cache Aware Optimization (LCTES 05)Load-Balanced Rendering (Graphics Hardware 05)
StreamIt Program
Front-end
Stream-AwareOptimizations
Uniprocessorbackend
Clusterbackend
Rawbackend
IBM X10backend
C/C++ C per tile +msg code
StreamingX10 runtime
Annotated Java
MPI-likeC/C++
Simulator(Java Library)
The StreamIt Project
12 6.189 IAP 2007 MITBill Thies, MIT.
Example: A Simple Counter
void->void pipeline Counter() {add IntSource();add IntPrinter();
}void->int filter IntSource() {
int x;init { x = 0; }work push 1 { push (x++); }
}int->void filter IntPrinter() {
work pop 1 { print(pop()); }
}
Counter
IntSource
IntPrinter
% strc Counter.str –o counter% ./counter –i 40123
13 6.189 IAP 2007 MITBill Thies, MIT.
Representing Streams
● Conventional wisdom: streams are graphsGraphs have no simple textual representationGraphs are difficult to analyze and optimize
● Insight: stream programs have structure
unstructured structured
14 6.189 IAP 2007 MITBill Thies, MIT.
parallel computation
Structured Streams
may be any StreamIt language construct
joinersplitter
pipeline
feedback loop
joiner splitter
splitjoin
filter ● Each structure is single-input, single-output
● Hierarchical and composable
15 6.189 IAP 2007 MITBill Thies, MIT.
Filter Example: Low Pass Filter
N
float->float filter LowPassFilter (int N, float freq) {float[N] weights;
init {weights = calcWeights(freq);
}
work peek N push 1 pop 1 {float result = 0;for (int i=0; i<weights.length; i++) {
result += weights[i] * peek(i);}push(result);pop();
}}
filter
16 6.189 IAP 2007 MITBill Thies, MIT.
Low Pass Filter in C
void FIR(int* src, int* dest, int* srcIndex, int* destIndex, int srcBufferSize, int destBufferSize,int N) {
float result = 0.0;for (int i = 0; i < N; i++) {result += weights[i] * src[(*srcIndex + i) % srcBufferSize];
}dest[*destIndex] = result;*srcIndex = (*srcIndex + 1) % srcBufferSize;*destIndex = (*destIndex + 1) % destBufferSize;
}
● FIR functionality obscured by buffer management details
● Programmer must commit to a particular buffer implementation strategy
17 6.189 IAP 2007 MITBill Thies, MIT.
float→float pipeline BandPassFilter (int N, float low, float high) {
add LowPassFilter(N, low);add HighPassFilter(N, high);
}
HighPassFilter
LowPassFilter
Pipeline Example: Band Pass Filter
18 6.189 IAP 2007 MITBill Thies, MIT.
duplicate
SplitJoin Example: Equalizer
BPF BPF BPF
Adder
roundrobin
Equalizerfloat→float pipeline Equalizer (int N, float lo, float hi) {
add splitjoin {
split duplicate;
for (int i=0; i<N; i++)
add BandPassFilter(64, lo + i*(hi - lo)/N);
join roundrobin(1);
}
add Adder(N);
}
19 6.189 IAP 2007 MITBill Thies, MIT.
void->void pipeline FMRadio(int N, float lo, float hi) {add AtoD();
add FMDemod();
add splitjoin {split duplicate;for (int i=0; i<N; i++) {
add pipeline {
add LowPassFilter(lo + i*(hi - lo)/N);
add HighPassFilter(lo + i*(hi - lo)/N);}
}join roundrobin();
}add Adder();
add Speaker();}
Adder
Speaker
AtoD
FMDemod
LPF1
Duplicate
RoundRobin
LPF2 LPF3
HPF1 HPF2 HPF3
Building Larger Programs: FMRadio
20 6.189 IAP 2007 MITBill Thies, MIT.
The Beauty of Streaming
“Some programs are elegant, some are exquisite, some are sparkling. My claim is that it is possible to write grand programs, noble programs, truly magnificient ones!”
— Don Knuth, ACM Turing Award Lecture
21 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
22 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
23 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
24 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
25 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
26 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
27 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
28 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
29 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
30 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
31 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
32 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
33 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
34 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(N) join roundrobin(N)
35 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
36 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
37 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
38 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
39 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
40 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
41 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
42 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
43 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
44 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
45 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
46 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
47 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
48 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
49 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
50 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
51 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
52 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
53 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
54 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
55 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
56 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
57 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
58 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
59 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
60 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
61 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(1) join roundrobin(1)
62 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
63 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
64 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
65 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
66 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
67 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
68 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
69 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
70 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1)
71 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
72 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
73 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
74 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
75 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
76 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
77 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
78 6.189 IAP 2007 MITBill Thies, MIT.
SplitJoins are Beautiful
split duplicate split roundrobin(2) join roundrobin(1,2,3)
79 6.189 IAP 2007 MITBill Thies, MIT.
Transpose
M
N
N
M
Matrix Transpose
80 6.189 IAP 2007 MITBill Thies, MIT.
M
N
N
M
?
roundrobin(?)
roundrobin(?)
Matrix Transpose
81 6.189 IAP 2007 MITBill Thies, MIT.
M
N
N
M
?
roundrobin(?)
roundrobin(?)
Matrix Transpose
82 6.189 IAP 2007 MITBill Thies, MIT.
M
N
N
M
N
roundrobin(M)
roundrobin(1)
Matrix Transpose
83 6.189 IAP 2007 MITBill Thies, MIT.
M
N
N
M
N
roundrobin(M)
roundrobin(1)
Matrix Transpose
84 6.189 IAP 2007 MITBill Thies, MIT.
M
N
N
M
Matrix Transpose
float->float splitjoin Transpose (int M,int N) {
split roundrobin(1);for (int i = 0; i<N; i++) {
add Identity<float>;}join roundrobin(M);
}
N
roundrobin(M)
roundrobin(1)
85 6.189 IAP 2007 MITBill Thies, MIT.
● Many FFT algorithms require a bit-reversal stage● If item is at index n (with binary digits b0 b1 … bk),
then it is transferred to reversed index bk … b1 b0
● For 3-digit binary numbers:
000011110011001101010101
000011110011001101010101
Bit-reversed ordering
86 6.189 IAP 2007 MITBill Thies, MIT.
● Many FFT algorithms require a bit-reversal stage● If item is at index n (with binary digits b0 b1 … bk),
then it is transferred to reversed index bk … b1 b0
● For 3-digit binary numbers:
000011110011001101010101
000011110011001101010101
Bit-reversed ordering
RR(w1)
RR(w1) RR(w1)
RR(w2)RR(w2)
RR(w3)
87 6.189 IAP 2007 MITBill Thies, MIT.
● Many FFT algorithms require a bit-reversal stage● If item is at index n (with binary digits b0 b1 … bk),
then it is transferred to reversed index bk … b1 b0
● For 3-digit binary numbers:
000011110011001101010101
000011110011001101010101
Bit-reversed ordering
RR(1)
RR(1) RR(1)
RR(2)RR(2)
RR(4)
88 6.189 IAP 2007 MITBill Thies, MIT.
complex->complex pipeline BitReverse (int N) {if (N==2) {
add Identity<complex>;} else {
add splitjoin {split roundrobin(1);add BitReverse(N/2);add BitReverse(N/2);join roundrobin(N/2);
} }
}
Bit-reversed ordering
4 4
2 2 2 2
1 1 1 1
1 1rr rr
rrrr
4 4
2 2 2 2
1 1 1 1
1 1rr rr
rrrr
1 1rr
rrrr
8 8rr
rrrr
89 6.189 IAP 2007 MITBill Thies, MIT.
N-Element Merge Sort
int->int pipeline MergeSort (int N) {if (N==2) {
add Sort(N);} else {
add splitjoin {split roundrobin(N/2);add MergeSort(N/2);add MergeSort(N/2);join roundrobin(N/2);
} }add Merge(N);
}
Sort Sort SortSort
Sort Sort Sort Sort
MergeMerge Merge Merge
Merge Merge
Merge
N/2 N/2
N/4 N/4 N/4 N/4
N/8 N/8N/8 N/8 N/8 N/8 N/8 N/8
N
90 6.189 IAP 2007 MITBill Thies, MIT.
N-Element Merge Sort (3-level)
Sort Sort Sort Sort Sort Sort Sort Sort
MergeMerge Merge Merge
Merge Merge
Merge
N/2 N/2
N/4 N/4 N/4 N/4
N/8 N/8 N/8 N/8 N/8 N/8 N/8 N/8
N
91 6.189 IAP 2007 MITBill Thies, MIT.
Bitonic Sort
92 6.189 IAP 2007 MITBill Thies, MIT.
FFT
93 6.189 IAP 2007 MITBill Thies, MIT.
Block Matrix Multiply
94 6.189 IAP 2007 MITBill Thies, MIT.
Filterbank
95 6.189 IAP 2007 MITBill Thies, MIT.
FM Radio with Equalizer
96 6.189 IAP 2007 MITBill Thies, MIT.
Radar-Array Front End
97 6.189 IAP 2007 MITBill Thies, MIT.
MP3 Decoder
98 6.189 IAP 2007 MITBill Thies, MIT.
Case Study:MPEG-2 Decoder in StreamIt
99 6.189 IAP 2007 MITBill Thies, MIT.
MPEG-2 Decoder in StreamIt
output to player
Picture Reorder
joiner
joiner
IDCT
IQuantization
splitter
splitter
VLDmacroblocks, motion vectors
frequency encodedmacroblocks differentially coded
motion vectors
motion vectorsspatially encoded macroblocks
recovered picture
ZigZag
Saturation
Channel Upsample Channel Upsample
Motion Vector Decode
Y Cb Cr
quantization coefficients
picture type
<QC>
<QC>
reference picture
Motion Compensation
<PT1> referencepicture
Motion Compensation
<PT1>reference picture
Motion Compensation
<PT1>
<PT2>
Repeat
Color Space Conversion
<PT1, PT2>
add VLD(QC, PT1, PT2);
add splitjoin {
split roundrobin(N∗B, V);
add pipeline {add ZigZag(B);add IQuantization(B) to QC;add IDCT(B);add Saturation(B);
}add pipeline {
add MotionVectorDecode();add Repeat(V, N);
}
join roundrobin(B, V);}
add splitjoin {split roundrobin(4∗(B+V), B+V, B+V);
add MotionCompensation(4∗(B+V)) to PT1;for (int i = 0; i < 2; i++) {
add pipeline {add MotionCompensation(B+V) to PT1;add ChannelUpsample(B);
}}
join roundrobin(1, 1, 1);}
add PictureReorder(3∗W∗H) to PT2;
add ColorSpaceConversion(3∗W∗H);
MPEG bit stream
100 6.189 IAP 2007 MITBill Thies, MIT.
Teleport Messaging in MPEG-2
joiner
splitter
recovered picture
Channel Upsample
Channel Upsample
Cr
MotionCompensation
MotionCompensation
Motion Compensation
Y Cb
picture type
Order
IQ
VLD
MCMCMC
101 6.189 IAP 2007 MITBill Thies, MIT.
Frame Reordering
DecodePicture
Decode Macroblock
Decode MotionVectors
Motion Compensation
Decode Block
Motion Compensation For Single Channel
Saturate
IDCT
ZigZagUnordering InverseQuantization
File Parsing
Global Variable Space
The MPEG Bitstream
Output Video
Messaging Equivalent in C
102 6.189 IAP 2007 MITBill Thies, MIT.
MPEG-2 Implementation
● Fully-functional MPEG-2 decoder and encoder
● Developed by 1 programmer in 8 weeks
● 2257 lines of code Vs. 3477 lines of C code in MPEG-2 reference
● 48 static streams, 643 instantiated filters
103 6.189 IAP 2007 MITBill Thies, MIT.
Conclusions
● StreamIt language preserves program structureNatural for programmers
● Parallelism and communication naturally exposedCompiler managed buffers, and portable parallelization technology
● StreamIt increases programmer productivity, enables parallel performance