103
6.189 IAP 2007 Lecture 8 The StreamIt Language 1 6.189 IAP 2007 MIT Bill Thies, MIT.

streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

6.189 IAP 2007

Lecture 8

The StreamIt Language

1 6.189 IAP 2007 MITBill Thies, MIT.

Page 2: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Languages Have Not Kept Up

Modernarchitecture

C von-Neumannmachine

● Two choices:

Develop cool architecture with li t d d h l

● Two choices:

Develop cool architecture with li t d d h l

● Two choices:

complicated, ad-hoc language

Bend over backwards to supportold languages like C/C++

complicated, ad-hoc language

2 6.189 IAP 2007 MITBill Thies, MIT.

old languages like C/C++

Page 3: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Why a New Language?

For uniprocessors, Pi hi512 Pi hiFor uniprocessors,C was:•Portable Intel

Tflops

CiscoCSR-1

PicochipPC102

128256

512 AmbricAM2045

IntelTflops

CiscoCSR-1

PicochipPC102

AmbricAM2045

Portable•High Performance•Composable Raw

Tflops

CaviumO t

RazaXLR# of 32

64

Raw

Tflops

CaviumO t

RazaXLRComposable

•Malleable•Maintainable

Raw

Niagara Cell

OcteonXLR# ofcores

4

8

16

Opteron 4P

Raw

Niagara Cell

OcteonXLR

Opteron 4PBroadcom 1480a a ab e

4004 80868080 286 386 486 Pentium P2 P3P4Itanium

Power4 Opteron

Power6Yonah

PExtreme

TanglewoodXbox360

PA-8800

1

2

4 Xeon MP

Power4 Opteron

Power6Yonah

PExtreme

TanglewoodXbox360

PA-8800

Xeon MPBroadcom 1480

3 6.189 IAP 2007 MITBill Thies, MIT.

1985 199019801970 1975 1995 2000

8008P4

Itanium 2

2005 20??

1Athlon

Page 4: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Why a New Language?

Pi hi512 Pi hi

Uniprocessors:C is the common Intel

Tflops

CiscoCSR-1

PicochipPC102

128256

512 AmbricAM2045

IntelTflops

CiscoCSR-1

PicochipPC102

AmbricAM2045

machine languageRaw

Tflops

CaviumO t

RazaXLR# of 32

64

Raw

Tflops

CaviumO t

RazaXLRRaw

Niagara Cell

OcteonXLR# ofcores

4

8

16

Opteron 4P

Raw

Niagara Cell

OcteonXLR

Opteron 4PBroadcom 1480

4004 80868080 286 386 486 Pentium P2 P3P4Itanium

Power4 Opteron

Power6Yonah

PExtreme

TanglewoodXbox360

PA-8800

1

2

4 Xeon MP

Power4 Opteron

Power6Yonah

PExtreme

TanglewoodXbox360

PA-8800

Xeon MPBroadcom 1480

4 6.189 IAP 2007 MITBill Thies, MIT.

1985 199019801970 1975 1995 2000

8008P4

Itanium 2

2005 20??

1Athlon

Page 5: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Why a New Language?

What is the commonPi hi512 Pi hi

machine languagefor multicores? Intel

Tflops

CiscoCSR-1

PicochipPC102

128256

512 AmbricAM2045

IntelTflops

CiscoCSR-1

PicochipPC102

AmbricAM2045

Raw

Tflops

CaviumO t

RazaXLR# of 32

64

Raw

Tflops

CaviumO t

RazaXLRRaw

Niagara Cell

OcteonXLR# ofcores

4

8

16

Opteron 4P

Raw

Niagara Cell

OcteonXLR

Opteron 4PBroadcom 1480

4004 80868080 286 386 486 Pentium P2 P3P4Itanium

Power4 Opteron

Power6Yonah

PExtreme

TanglewoodXbox360

PA-8800

1

2

4 Xeon MP

Power4 Opteron

Power6Yonah

PExtreme

TanglewoodXbox360

PA-8800

Xeon MPBroadcom 1480

5 6.189 IAP 2007 MITBill Thies, MIT.

1985 199019801970 1975 1995 2000

8008P4

Itanium 2

2005 20??

1Athlon

Page 6: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Common Machine Languages

C P tiUniprocessors:

C P tiMulticores:

Common PropertiesSingle flow of control

Single memory image

Common PropertiesMultiple flows of control

Multiple local memoriesSingle memory image

Differences:Register File

Multiple local memories

Differences:Number and capabilities of coresg

ISA

Functional Units

p

Communication Model

Synchronization Model

von-Neumann languages represent the common properties and abstract away the differences

Need common machine language(s) for multicores

6 6.189 IAP 2007 MITBill Thies, MIT.

the differences

Page 7: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Streaming as a Common Machine Language

● For programs based on streams of dataA di id DSP t ki d

AtoD

FMDemodAudio, video, DSP, networking, and cryptographic processing kernels Examples: HDTV editing, radar

FMDemod

Scatterp g,tracking, microphone arrays, cell phone base stations, graphics LPF1 LPF2 LPF3

● Several attractive propertiesRegular and repeating computation

HPF1 HPF2 HPF3

Independent filters with explicit communicationTask data and pipeline parallelism Adder

Gather

7 6.189 IAP 2007 MITBill Thies, MIT.

Task, data, and pipeline parallelism Adder

Speaker

Page 8: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Streaming Models of Computation

● Many different ways to represent streaming/ ?Do senders/receivers block?

How much buffering is allowed on channels?Is computation deterministic?Is computation deterministic?Can you avoid deadlock?

● Three common models:1. Kahn Process Networks2 S h D t fl2. Synchronous Dataflow3. Communicating Sequential Processes

8 6.189 IAP 2007 MITBill Thies, MIT.

Page 9: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Streaming Models of Computation

CommunicationPattern

Buffering Notes

Kahn process networks (KPN)

Data-dependent,but deterministic

Conceptually unbounded

- UNIX pipes- Ambric (startup)

Synchronous dataflow (SDF)

Static Fixed by compiler

- Static scheduling- Deadlock freedom

Communicating Data dependent None Rich synchronizationCommunicating Sequential Processes (CSP)

Data-dependent, allows non-determinism

None(Rendesvouz)

- Rich synchronization primitives

- Occam language

SDF

KPN CSP

9 6.189 IAP 2007 MITBill Thies, MIT.

KPN CSPspace of program behaviors

Page 10: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

The StreamIt Language

● A high-level, architecture-independent language for t i li tistreaming applications

Improves programmer productivity (vs. Java, C)Offers scalable performance on multicoresOffers scalable performance on multicores

● Based on synchronous dataflow, with dynamic y , yextensions

Compiler determines execution order of filtersMany aggressive optimizations possible

10 6.189 IAP 2007 MITBill Thies, MIT.

Page 11: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

The StreamIt Project ● Applications

DES and Serpent [PLDI 05]MPEG-2 [IPDPS 06]

StreamIt Program

[ ]SAR, DSP benchmarks, JPEG, …

● ProgrammabilityStreamIt Language (CC 02) Teleport Messaging (PPOPP 05)

Front-end

Teleport Messaging (PPOPP 05)Programming Environment in Eclipse (P-PHEC 05)

● Domain Specific OptimizationsLinear Analysis and Optimization (PLDI 03) Stream-Aware

Annotated Java

SimulatorOptimizations for bit streaming (PLDI 05)Linear State Space Analysis (CASES 05)

● Architecture Specific OptimizationsCompiling for Communication-Exposed

Stream AwareOptimizations

Simulator(Java Library)

Compiling for Communication Exposed Architectures (ASPLOS 02)Phased Scheduling (LCTES 03)Cache Aware Optimization (LCTES 05)Load-Balanced Rendering

Uniprocessorbackend

Clusterbackend

Rawbackend

IBM X10backend

C/C++ C per tile + StreamingMPI-like

11 6.189 IAP 2007 MITBill Thies, MIT.

g(Graphics Hardware 05) C/C++ C per tile +

msg codeStreamingX10 runtime

MPI-likeC/C++

Page 12: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Example: A Simple Counter

void->void pipeline Counter() {add IntSource(); Counteradd IntSource();add IntPrinter();

}IntSource

void->int filter IntSource() {int x;init { x = 0; }

IntPrinter

% strc Counter str o counterwork push 1 { push (x++); }

}int->void filter IntPrinter() {

% strc Counter.str –o counter% ./counter –i 401int >void filter IntPrinter() {

work pop 1 { print(pop()); }

}

123

12 6.189 IAP 2007 MITBill Thies, MIT.

Page 13: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Representing Streams

● Conventional wisdom: streams are graphsGGraphs have no simple textual representationGraphs are difficult to analyze and optimize

● Insight: stream programs have structure● Insight: stream programs have structure

13 6.189 IAP 2007 MITBill Thies, MIT.

unstructured structured

Page 14: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Structured Streams

pipeline

filter ● Each structure is single-input, single-output

parallel computation

may be any StreamIt language construct

splitjoin

● Hierarchical and composable

parallel computation

joinersplitter

splitjoin

joinersplitter

feedback loop

joiner splitter

14 6.189 IAP 2007 MITBill Thies, MIT.

Page 15: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Filter Example: Low Pass Filterfloat->float filter LowPassFilter (int N, float freq) {

float[N] weights;

N

init {weights = calcWeights(freq);

}}

work peek N push 1 pop 1 {float result = 0; filterfloat result = 0;for (int i=0; i<weights.length; i++) {

result += weights[i] * peek(i);}}push(result);pop();

}

15 6.189 IAP 2007 MITBill Thies, MIT.

}

Page 16: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Low Pass Filter in C

void FIR(i t* ● FIR functionality obscured byint* src, int* dest, int* srcIndex, int* destIndex, int srcBufferSize

FIR functionality obscured by buffer management details

● Programmer must commit to a int srcBufferSize, int destBufferSize,int N) {

float result = 0.0;

particular buffer implementation strategy

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;

}

16 6.189 IAP 2007 MITBill Thies, MIT.

Page 17: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Pipeline Example: Band Pass Filter

float→float pipeline BandPassFilter (int N, float low, LowPassFilterfloat high) {

add LowPassFilter(N, low);add HighPassFilter(N, high);

HighPassFilteradd HighPassFilter(N, high);

}

17 6.189 IAP 2007 MITBill Thies, MIT.

Page 18: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoin Example: Equalizer

Equalizerfloat→float pipeline Equalizer (int N, float lo,

duplicatefloat hi) {

add splitjoin {

li d li

BPF BPF BPF

split duplicate;

for (int i=0; i<N; i++)

add BandPassFilter(64 lo + i*(hi - lo)/N);

roundrobin

add BandPassFilter(64, lo + i (hi lo)/N);

join roundrobin(1);

}

Adder

roundrobinadd Adder(N);

}

18 6.189 IAP 2007 MITBill Thies, MIT.

Adder

Page 19: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Building Larger Programs: FMRadiovoid->void pipeline FMRadio(int N, float lo, float hi) {

add AtoD(); AtoD

add FMDemod();

add splitjoin {split duplicate;

FMDemod

Duplicatesplit duplicate;for (int i=0; i<N; i++) {

add pipeline {add LowPassFilter(lo + i*(hi - lo)/N); LPF1

Duplicate

LPF2 LPF3add LowPassFilter(lo + i (hi lo)/N);

add HighPassFilter(lo + i*(hi - lo)/N);}

LPF1 LPF2 LPF3

HPF1 HPF2 HPF3}

}join roundrobin();

}add Adder(); Adder

RoundRobin

19 6.189 IAP 2007 MITBill Thies, MIT.

add Adder();

add Speaker();}

Adder

Speaker

Page 20: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

The Beauty of Streaming

“Some programs are elegant, some are i it kli M l iexquisite, some are sparkling. My claim

is that it is possible to write grand programs, noble programs, truly magnificient ones!”p g , y g

— Don Knuth, ACM Turing Award Lecture

20 6.189 IAP 2007 MITBill Thies, MIT.

Page 21: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

21 6.189 IAP 2007 MITBill Thies, MIT.

Page 22: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

22 6.189 IAP 2007 MITBill Thies, MIT.

Page 23: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

23 6.189 IAP 2007 MITBill Thies, MIT.

Page 24: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

24 6.189 IAP 2007 MITBill Thies, MIT.

Page 25: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

25 6.189 IAP 2007 MITBill Thies, MIT.

Page 26: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

26 6.189 IAP 2007 MITBill Thies, MIT.

Page 27: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

27 6.189 IAP 2007 MITBill Thies, MIT.

Page 28: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

28 6.189 IAP 2007 MITBill Thies, MIT.

Page 29: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

29 6.189 IAP 2007 MITBill Thies, MIT.

Page 30: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

30 6.189 IAP 2007 MITBill Thies, MIT.

Page 31: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

31 6.189 IAP 2007 MITBill Thies, MIT.

Page 32: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

32 6.189 IAP 2007 MITBill Thies, MIT.

Page 33: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

33 6.189 IAP 2007 MITBill Thies, MIT.

Page 34: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(N) join roundrobin(N)

34 6.189 IAP 2007 MITBill Thies, MIT.

Page 35: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

35 6.189 IAP 2007 MITBill Thies, MIT.

Page 36: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

36 6.189 IAP 2007 MITBill Thies, MIT.

Page 37: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

37 6.189 IAP 2007 MITBill Thies, MIT.

Page 38: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

38 6.189 IAP 2007 MITBill Thies, MIT.

Page 39: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

39 6.189 IAP 2007 MITBill Thies, MIT.

Page 40: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

40 6.189 IAP 2007 MITBill Thies, MIT.

Page 41: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

41 6.189 IAP 2007 MITBill Thies, MIT.

Page 42: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

42 6.189 IAP 2007 MITBill Thies, MIT.

Page 43: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

43 6.189 IAP 2007 MITBill Thies, MIT.

Page 44: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

44 6.189 IAP 2007 MITBill Thies, MIT.

Page 45: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

45 6.189 IAP 2007 MITBill Thies, MIT.

Page 46: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

46 6.189 IAP 2007 MITBill Thies, MIT.

Page 47: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

47 6.189 IAP 2007 MITBill Thies, MIT.

Page 48: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

48 6.189 IAP 2007 MITBill Thies, MIT.

Page 49: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

49 6.189 IAP 2007 MITBill Thies, MIT.

Page 50: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

50 6.189 IAP 2007 MITBill Thies, MIT.

Page 51: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

51 6.189 IAP 2007 MITBill Thies, MIT.

Page 52: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

52 6.189 IAP 2007 MITBill Thies, MIT.

Page 53: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

53 6.189 IAP 2007 MITBill Thies, MIT.

Page 54: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

54 6.189 IAP 2007 MITBill Thies, MIT.

Page 55: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

55 6.189 IAP 2007 MITBill Thies, MIT.

Page 56: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

56 6.189 IAP 2007 MITBill Thies, MIT.

Page 57: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

57 6.189 IAP 2007 MITBill Thies, MIT.

Page 58: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

58 6.189 IAP 2007 MITBill Thies, MIT.

Page 59: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

59 6.189 IAP 2007 MITBill Thies, MIT.

Page 60: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

60 6.189 IAP 2007 MITBill Thies, MIT.

Page 61: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(1) join roundrobin(1)

61 6.189 IAP 2007 MITBill Thies, MIT.

Page 62: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

62 6.189 IAP 2007 MITBill Thies, MIT.

Page 63: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

63 6.189 IAP 2007 MITBill Thies, MIT.

Page 64: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

64 6.189 IAP 2007 MITBill Thies, MIT.

Page 65: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

65 6.189 IAP 2007 MITBill Thies, MIT.

Page 66: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

66 6.189 IAP 2007 MITBill Thies, MIT.

Page 67: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

67 6.189 IAP 2007 MITBill Thies, MIT.

Page 68: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

68 6.189 IAP 2007 MITBill Thies, MIT.

Page 69: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

69 6.189 IAP 2007 MITBill Thies, MIT.

Page 70: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1)

70 6.189 IAP 2007 MITBill Thies, MIT.

Page 71: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

71 6.189 IAP 2007 MITBill Thies, MIT.

Page 72: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

72 6.189 IAP 2007 MITBill Thies, MIT.

Page 73: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

73 6.189 IAP 2007 MITBill Thies, MIT.

Page 74: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

74 6.189 IAP 2007 MITBill Thies, MIT.

Page 75: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

75 6.189 IAP 2007 MITBill Thies, MIT.

Page 76: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

76 6.189 IAP 2007 MITBill Thies, MIT.

Page 77: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

77 6.189 IAP 2007 MITBill Thies, MIT.

Page 78: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

SplitJoins are Beautiful

split duplicate split roundrobin(2) join roundrobin(1,2,3)

78 6.189 IAP 2007 MITBill Thies, MIT.

Page 79: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Matrix TransposeN

M

TransposeTranspose

M

79 6.189 IAP 2007 MITBill Thies, MIT.N

Page 80: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Matrix TransposeN

M

?

roundrobin(?)

roundrobin(?)

M

80 6.189 IAP 2007 MITBill Thies, MIT.N

Page 81: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Matrix TransposeN

M

?

roundrobin(?)

roundrobin(?)

M

81 6.189 IAP 2007 MITBill Thies, MIT.N

Page 82: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Matrix TransposeN

M

N

roundrobin(1)

roundrobin(M)

M

82 6.189 IAP 2007 MITBill Thies, MIT.N

Page 83: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Matrix TransposeN

M

N

roundrobin(1)

roundrobin(M)

M

83 6.189 IAP 2007 MITBill Thies, MIT.N

Page 84: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Matrix TransposeN

M

float->float splitjoin Transpose (int M,int N) {

split roundrobin(1);for (int i = 0; i<N; i++) {N

roundrobin(1)

( ; ; ) {add Identity<float>;

}join roundrobin(M);

roundrobin(M)

M

join roundrobin(M);}

84 6.189 IAP 2007 MITBill Thies, MIT.N

Page 85: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Bit-reversed ordering

● 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:● For 3-digit binary numbers:

00001111001100110011001101010101

000011110011001101010101

85 6.189 IAP 2007 MITBill Thies, MIT.

01010101

Page 86: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Bit-reversed ordering

● 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:● For 3-digit binary numbers:

0000111100110011

RR(w1)0011001101010101 RR(w1) RR(w1)

000011110011001101010101

RR(w2)RR(w2)

RR( )

86 6.189 IAP 2007 MITBill Thies, MIT.

01010101 RR(w3)

Page 87: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Bit-reversed ordering

● 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:● For 3-digit binary numbers:

0000111100110011

RR(1)0011001101010101 RR(1) RR(1)

000011110011001101010101

RR(2)RR(2)

RR(4)

87 6.189 IAP 2007 MITBill Thies, MIT.

01010101 RR(4)

Page 88: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Bit-reversed ordering

complex->complex pipeline BitReverse (int N) {if (N==2) { rrif (N==2) {

add Identity<complex>;} else {

1 1 1 1

1 1rr rr

1 1 1 1

1 1rr rr

1 1rr

rrrr

add splitjoin {split roundrobin(1);add BitReverse(N/2); 4 4

2 2 2 2

1 1 1 1

rrrr

4 4

2 2 2 2

1 1 1 1

rrrr

rrrradd BitReverse(N/2);join roundrobin(N/2);

}

8 8rr

rrrr

} }

}

88 6.189 IAP 2007 MITBill Thies, MIT.

Page 89: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

N-Element Merge Sort

int->int pipeline MergeSort (int N) {if (N==2) { Nif (N==2) {

add Sort(N);} else {

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

add splitjoin {split roundrobin(N/2);add MergeSort(N/2);

Sort Sort SortSort

Sort Sort Sort Sort

MergeMerge Merge Merge

g ( )add MergeSort(N/2);join roundrobin(N/2);

}

Merge Merge

Merge

} }add Merge(N);

}

89 6.189 IAP 2007 MITBill Thies, MIT.

}

Page 90: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

N-Element Merge Sort (3-level)

N/2 N/2N

S t S t S t S t S t S t S t S t

N/4 N/4 N/4 N/4

N/8 N/8 N/8 N/8 N/8 N/8 N/8 N/8

Sort Sort Sort Sort Sort Sort Sort Sort

MergeMerge Merge Merge

Merge Merge

90 6.189 IAP 2007 MITBill Thies, MIT.

Merge

Page 91: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Bitonic Sort

91 6.189 IAP 2007 MITBill Thies, MIT.

Page 92: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

FFT

92 6.189 IAP 2007 MITBill Thies, MIT.

Page 93: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Block Matrix Multiply

93 6.189 IAP 2007 MITBill Thies, MIT.

Page 94: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Filterbank

94 6.189 IAP 2007 MITBill Thies, MIT.

Page 95: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

FM Radio with Equalizer

95 6.189 IAP 2007 MITBill Thies, MIT.

Page 96: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Radar-Array Front End

96 6.189 IAP 2007 MITBill Thies, MIT.

Page 97: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

MP3 Decoder

97 6.189 IAP 2007 MITBill Thies, MIT.

Page 98: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Case Study:MPEG 2 D d i St ItMPEG-2 Decoder in StreamIt

98 6.189 IAP 2007 MITBill Thies, MIT.

Page 99: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

MPEG-2 Decoder in StreamIt

splitter

VLDmacroblocks, motion vectorsquantization coefficients

picture type

<QC>

add VLD(QC, PT1, PT2);

add splitjoin {

split roundrobin(N∗B, V);

MPEG bit stream

IQuantization

splitterfrequency encodedmacroblocks differentially coded

motion vectorsZigZag

Motion Vector Decode

<QC>

<QC>

<PT1, PT2>

p ( , );

add pipeline {add ZigZag(B);add IQuantization(B) to QC;add IDCT(B);add Saturation(B);

}

joiner

IDCT

motion vectorsspatially encoded macroblocks

Saturation

Repeat}add pipeline {

add MotionVectorDecode();add Repeat(V, N);

}

join roundrobin(B, V);}

splitterY Cb Cr

reference i

Motion Compensation

<PT1> referencei t

Motion Compensation

<PT1>reference i t

Motion Compensation

<PT1>

}

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 {dd M ti C ti (B+V) t PT1

joinerrecovered picture

Channel Upsample Channel Upsample

picture picturepicture add MotionCompensation(B+V) to PT1;add ChannelUpsample(B);

}}

join roundrobin(1, 1, 1);}

99 6.189 IAP 2007 MITBill Thies, MIT.output to player

Picture Reorder<PT2>

Color Space Conversion

add PictureReorder(3∗W∗H) to PT2;

add ColorSpaceConversion(3∗W∗H);

Page 100: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Teleport Messaging in MPEG-2

picture type

VLD

splitter

picture type

IQ

Cr

MotionCompensation

MotionCompensation

Motion Compensation

Y Cb

joiner

Channel Upsample

Channel Upsample

MCMCMC

joinerrecovered picture

Order

100 6.189 IAP 2007 MITBill Thies, MIT.

Page 101: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Messaging Equivalent in C

File Parsing

The MPEG Bitstream

Decode ZigZagUnordering Inverse

g

DecodePicture

ecodeMacroblock Decode

BlockQuantization

Global Variable SpacePicture

Decode M ti

Motion Compensation

Saturate

IDCT

Space

Frame Reordering

MotionVectors

Motion Compensation For Single Channel

101 6.189 IAP 2007 MITBill Thies, MIT.

Frame Reordering

Output Video

Page 102: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

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 referenceVs. 3477 lines of C code in MPEG-2 reference

● 48 static streams 643 instantiated filters● 48 static streams, 643 instantiated filters

102 6.189 IAP 2007 MITBill Thies, MIT.

Page 103: streamit-language-lecture - for pdf [Read-Only] · 2009. 3. 3. · Architectures (ASPLOS 02) Phased Scheduling (LCTES 03) Cache Aware Optimization (LCTES 05) Load-Balanced Rendering

Conclusions

● StreamIt language preserves program structureN t l fNatural for programmers

● Parallelism and communication naturally exposed● Parallelism and communication naturally exposedCompiler managed buffers, and portable parallelization technologygy

● StreamIt increases programmer productivity, enables parallel performance

103 6.189 IAP 2007 MITBill Thies, MIT.