Docsity

Streamlt Language, Lecture Slides - Assembly Programming, Slides of Assembly Language Programming

Partial preview of the text

Download Streamlt Language, Lecture Slides - Assembly Programming and more Slides Assembly Language Programming in PDF only on Docsity!

6.189 IAP 2007

Lecture 8

The StreamIt Language

6.189 IAP 2007 MIT

Bill Thies, MIT.

Languages Have Not Kept Up

Modern architecture

C

von-Neumann

machine

●

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 „^

complicated, ad-hoc languageBend over backwards to supportold languages like C/C++

6.189 IAP 2007 MIT

Bill Thies, MIT.

old languages like C/C++

Why a New Language?

Pi^

hi

512

Pi^

hi

Uniprocessors:C is the common

IntelTflops CiscoCSR- PicochipPC

512256128

AmbricAM2045IntelTflops CiscoCSR- PicochipPC

AmbricAM

machine language

Raw

Tflops^ CaviumO t RazaXLR

of

64 32

Raw

Tflops^ CaviumO t RazaXLR

Raw

Niagara

Octeon Cell XLR

#^

of cores

16 8 4

Opteron 4P

Raw

Niagara

Octeon Cell XLR

Opteron 4P

Broadcom 1480

Pentium

P^

P

ItaniumP

Power

Opteron

Power Yonah PExtreme

Tanglewood

Xbox PA-

4 2 1

Xeon MP

Power

Opteron

Power Yonah PExtreme

Tanglewood

Xbox PA-

Xeon MP

Broadcom 1480

6.189 IAP 2007 MIT

Bill Thies, MIT.

1985

1990

1980

1970

1975

1995

2000

P

Itanium 2^2005

20??

1

Athlon

Why a New Language?

What is the common

Pi^

hi

512

Pi^

hi

machine languagefor multicores?

IntelTflops CiscoCSR- PicochipPC

512256128

AmbricAM2045IntelTflops CiscoCSR- PicochipPC

AmbricAM

Raw

Tflops CaviumO t RazaXLR

of

64 32

Raw

Tflops^ CaviumO t RazaXLR

Raw

Niagara

Octeon Cell XLR

#^

of cores

16 8 4

Opteron 4P

Raw

Niagara

Octeon Cell XLR

Opteron 4P

Broadcom 1480

Pentium

P^

P

ItaniumP

Power

Opteron

Power Yonah PExtreme

Tanglewood

Xbox PA-

4 2 1

Xeon MP

Power

Opteron

Power Yonah PExtreme

Tanglewood

Xbox PA-

Xeon MP

Broadcom 1480

6.189 IAP 2007 MIT

Bill Thies, MIT.

1985

1990

1980

1970

1975

1995

2000

P

Itanium 2^2005

20??

1

Athlon

Streaming as a Common Machine Language ●

For programs based on streams of data

A di

id

DSP

t^

ki

d

AtoD FMDemod

„^

A

udio, video, DSP, networking, and cryptographic processing kernels „^

Examples: HDTV editing, radar

FMDemodScatter

p^

g,

tracking, microphone arrays, cellphone base stations, graphics

LPF

LPF

LPF

●

Several attractive properties

„^

Regular and repeating computation

HPF

HPF

HPF

„^

Independent filterswith explicit communication „^

Task data and pipeline parallelism

Gather Adder

6.189 IAP 2007 MIT

Bill Thies, MIT.

„^

Task, data, and pipeline parallelism

Adder Speaker

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 Networks 2

S

h^

D t fl

Synchronous Dataflow

Communicating Sequential Processes

6.189 IAP 2007 MIT

Bill Thies, MIT.

The StreamIt Language ●

A high-level, architecture-independent language for

t^

i^

li^

ti

streaming applications „^

Improves programmer productivity (vs. Java, C) „^

Offers scalable performance on multicores „^

Offers scalable performance on multicores

●

Based on synchronous dataflow, with dynamic

y^

,^

y

extensions „^

Compiler determines execution order of filters „^

Many aggressive optimizations possible

6.189 IAP 2007 MIT

Bill Thies, MIT.

The StreamIt Project ●^

Applications

„^

DES and Serpent [PLDI 05] „^

MPEG-2 [IPDPS 06]

StreamIt Program

[^

]

„^

SAR, DSP benchmarks, JPEG, …

●^

Programmability

„^

StreamIt Language (CC 02) „^

Teleport Messaging (PPOPP 05)

Front-end

„^

Teleport Messaging (PPOPP 05) „^

Programming Environment in Eclipse (P-PHEC 05)

●^

Domain Specific Optimizations

„^

Linear Analysis and Optimization (PLDI 03)

Stream

-Aware

Annotated Java

Simulator

„^

Optimizations for bit streaming (PLDI 05) „^

Linear State Space Analysis (CASES 05)

●^

Architecture Specific Optimizations

„^

Compiling for Communication

-Exposed

Stream

Aware

Optimizations

Simulator (Java Library)

„^

Compiling

for Communication Exposed

Architectures (ASPLOS 02) „^

Phased Scheduling (LCTES 03) „^

Cache Aware Optimization (LCTES 05) „^

Load-Balanced Rendering

Uniprocessor

backend

Clusterbackend

Rawbackend

IBM X10backend

C/C++

C per tile +

Streaming

MPI-like

6.189 IAP 2007 MIT

Bill Thies, MIT.

g

(Graphics Hardware 05)

C/C++

C^ per tile +msg code

StreamingX10 runtime

MPI-likeC/C++

Representing Streams ●

Conventional wisdom: streams are graphs

G „^

G

raphs have no simple textual representation „^

Graphs are difficult to analyze and optimize

●

Insight: stream programs have structure ●

Insight: stream programs have structure

6.189 IAP 2007 MIT

Bill Thies, MIT.

unstructured

structured

Structured Streamsfilterpipeline

●

Each structure is single-input, single-output

parallel computation

may be

any StreamItlanguage construct

splitjoin

●

Hierarchical andcomposable

parallel computation

joiner

splitter splitjoin

joiner

splitter feedback loop

joiner

splitter

6.189 IAP 2007 MIT

Bill Thies, MIT.

Low Pass Filter in C void FIR(

i t*

●

FIR functionality obscured by

int 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 implementationstrategy

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; }**

6.189 IAP 2007 MIT

Bill Thies, MIT.

Pipeline Example: Band Pass Filter float

→

float

pipeline

BandPassFilter (int N,

float low,

LowPassFilter

float high) {

add

LowPassFilter(N, low); add

HighPassFilter(N, high);

HighPassFilter

add

HighPassFilter(N,

high);

}

6.189 IAP 2007 MIT

Bill Thies, MIT.

Building Larger Programs: FMRadio

void->void

pipeline

FMRadio(int N, float lo, float hi) {

add

AtoD();

AtoD

add

FMDemod(); add splitjoin

{

split duplicate

;

FMDemodDuplicate

split

duplicate

;

for (int i=0; i The Beauty of Streaming

“Some programs are elegant, some are

i it

kli

M

l i

exquisite, some are sparkling. My claimis that it is possible to write

grand

programs,

noble

p

rograms, truly

magnificient

ones!”

p

g

,^

y^

g

— Don Knuth, ACM Turing Award Lecture

6.189 IAP 2007 MIT

Bill Thies, MIT.