29
The Stanford Pervasive Parallelism Lab Christos Kozyrakis and Kunle Olukotun http://ppl.stanford.edu Hot Chips 21 – Stanford – August 2009

Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

The Stanford

Pervasive Parallelism Lab

Christos Kozyrakis and Kunle Olukotun

ht tp: / / ppl.stanford.edu

Hot Chips 21 – Stanford – August 2009

Page 2: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

The PPL Team

Applicat ions Ron Fedkiw, Vladlen Koltun, Sebast ian Thrun

Program m ing & software system s Alex Aiken, Pat Hanrahan, John Ousterhout ,

Mendel Rosenblum

Architecture Bill Dally, John Hennessy, Mark Horowitz,

Christos Kozyrakis, Kunle Olukotun (director)

Page 3: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Goals and Organization

Goal: the parallel com put ing plat form for 2015 Parallel applicat ion developm ent pract ical for the m asses

Joe the program m er…

Parallel applicat ions without parallel program m ing

PPL is a collaborat ion of Leading Stanford researchers across mult iple domains

Applicat ions, languages, software system s, architecture

Leading companies in computer systems and software Sun, AMD, Nvidia, I BM, I ntel, NEC, HP

PPL is open Any company can join; all results in the public domain

Page 4: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

What Makes Parallel Programming Difficult?

1. Finding independent tasks2. Mapping tasks to execut ion units3. I m plem ent ing synchronizat ion

Races, livelocks, deadlocks, …

4. Com posing parallel tasks5. Recovering from HW & SW errors6. Opt im izing locality and com m unicat ion7. Predictable perform ance & scalabilit y8. … and all the sequent ial program m ing issues

Even with new tools, can Joe handle these issues?

Page 5: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Technical Approach

Guiding observat ions Must hide low- level issues from program m er No single discipline can solve all problem s Top-down research dr iven by applicat ions

Core techniques Dom ain specific languages (DSLs)

Sim ple & portable program s

Heterogeneous hardware Energy and area efficient com put ing

Page 6: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

The PPL Vision

Paralle l Object Language

Hardw are Architecture

OOO Cores SI MD Cores Threaded Cores

ProgrammableHierarchies

Scalable Coherence

I solat ion & Atom icity

Pervasive Monitor ing

Virtual W orlds

Personal Robot ics

DataI nform at ics

Scient ificEngineering

Physics Script ing Probabilist ic Machine LearningRendering

Com m on Paralle l Runt im e

Explicit / Stat ic I m plicit / Dynam ic

Applications

DomainSpecific

Languages

HeterogeneousHardware

DSLInfrastructure

Page 7: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Applications

Paralle l Object Language

Hardw are Architecture

OOO Cores SI MD Cores Threaded Cores

ProgrammableHierarchies

Scalable Coherence

I solat ion & Atom icity

Pervasive Monitor ing

Virtual W orlds

Personal Robot ics

DataI nform at ics

Scient ificEngineering

Physics Script ing Probabilist ic Machine LearningRendering

Com m on Paralle l Runt im e

Explicit / Stat ic I m plicit / Dynam ic

Applications

DomainSpecific

Languages

HeterogeneousHardware

DSLInfrastructure

Page 8: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Demanding Applications

Leverage dom ain expert ise at Stanford CS research groups, nat ional centers for scient ific comput ing

PPL

Media-X

NIH NCBC

DOE ASC

EnvironmentalScience

Geophysics

Web, MiningStreaming DB

GraphicsGames

MobileHCI

Existing Stanford research center

Seismic modeling

Existing Stanford CS research groups

AI/MLRobotics

Page 9: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Virtual Worlds

Next -generat ion web plat form Millions of players in vast landscapes I mmersive collaborat ion Social gam ing

Com put ing challenges Client -side game engine

Graphics rendering

Server-side world simulat ion Object scr ipt ing, geom etr ic queries,

AI , physics com putat ion

Dynamic content , huge datasets

More at ht tp: / / vw.stanford.edu/

Page 10: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Domain Specific Languages

Paralle l Object Language

Hardw are Architecture

OOO Cores SI MD Cores Threaded Cores

ProgrammableHierarchies

Scalable Coherence

I solat ion & Atom icity

Pervasive Monitor ing

Virtual W orlds

Personal Robot ics

DataI nform at ics

Scient ificEngineering

Physics Script ing Probabilist ic Machine LearningRendering

Com m on Paralle l Runt im e

Explicit / Stat ic I m plicit / Dynam ic

Applications

DomainSpecific

Languages

HeterogeneousHardware

DSLInfrastructure

Page 11: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Domain Specific Languages

High- level languages targeted at specific dom ains E.g.: SQL, Mat lab, OpenGL, Ruby/ Rails, … Usually declarat ive and sim pler than GP languages

DSLs ⇒ higher product ivity for developers High- level data types & ops (e.g. relat ions, t r iangles, …) Express high- level intent w/ o im plem entat ion art ifacts

DSLs ⇒ scalable parallelism for the system Declarat ive descript ion of parallelism & locality pat terns

Can be ported or scaled to available m achine

Allows for dom ain specific opt im izat ion Autom at ically adjust st ructures, m apping, and scheduling

Page 12: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Example DSL: Liszt

Goal: sim plify code of m esh-based PDE solvers Write once, run on any type of parallel machine From mult i- cores and GPUs to clusters

Language features Built - in mesh data types

Vertex, edge, face, cell

Collect ions of mesh elements cell.faces, face.edgesCCW

Mesh-based data storage Fields, sparse m atr ices

Parallelizable iterat ions Map, reduce, forall statem ents

Page 13: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Liszt Code Example

val position = vertexProperty[double3](“pos”)

val A = new SparseMatrix [ Vertex,Vertex ]

for (c < - mesh.cells ) {

val center = average position of c.vertices

for (f < - c.faces ) {

val face_dx = average position of f.vertices – center

for (e < - f.edges With c CounterClockwise ) {

val v0 = e.tail

val v1 = e.head

val v0_dx = position(v0) – center

val v1_dx = position(v1) – center

val face_normal = v0_dx cross v1_dx

// calculate flux for face …

A(v0,v1) += …

A(v1,v0) - = …

Page 14: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Liszt Code Example

val position = vertexProperty[double3](“pos”)

val A = new SparseMatrix [ Vertex,Vertex ]

for (c < - mesh.cells ) {

val center = average position of c.vertices

for (f < - c.faces ) {

val face_dx = average position of f.vertices – center

for (e < - f.edges With c CounterClockwise ) {

val v0 = e.tail

val v1 = e.head

val v0_dx = position(v0) – center

val v1_dx = position(v1) – center

val face_normal = v0_dx cross v1_dx

// calculate flux for face …

A(v0,v1) += …

A(v1,v0) - = …

High-level data types & operations

Explicit parallelism using map/reduce/forallImplicit parallelism with help from DSL & HW

No low-level code to manage parallelism

Page 15: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Liszt Parallelism & Optimizations

Liszt com piler & runt im e m anage parallel execut ion Data layout & access, dom ain decom posit ion, com m unicat ion, …

Dom ain specific opt im izat ions Select m esh layout (gr id, tet rahedral, unst ructured, custom , …) Select decom posit ion that im proves locality of access Opt im ize com m unicat ion st rategy across iterat ions

Opt im izat ions are possible because Mesh sem ant ics are visible to com piler & runt im e I terat ive program s with data accesses based on m esh topology Mesh topology is known to runt im e

Page 16: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

DSL Infrastructure

Paralle l Object Language

Hardw are Architecture

OOO Cores SI MD Cores Threaded Cores

ProgrammableHierarchies

Scalable Coherence

I solat ion & Atom icity

Pervasive Monitor ing

Virtual W orlds

Personal Robot ics

DataI nform at ics

Scient ificEngineering

Physics Script ing Probabilist ic Machine LearningRendering

Com m on Paralle l Runt im e

Explicit / Stat ic I m plicit / Dynam ic

Applications

DomainSpecific

Languages

HeterogeneousHardware

DSLInfrastructure

Page 17: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

DSL Infrastructure Goals

Provide a shared fram ework for DSL developm ent

Features

Common parallel language that retains DSL semant ics

Mechanism to express domain specific opt im izat ions

Stat ic compilat ion + dynam ic management environment

For regular and unpredictable pat terns respect ively

Synthesize HW features into high- level solut ions

E.g. from HW m essaging to fast runt im e for fine-grain tasks

Exploit heterogeneous hardware to improve efficiency

Page 18: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Parallel Object Language

Required features

Support for funct ional programming (FP) Declarat ive programm ing style for portable parallelism

High-order funct ions allow parallel cont rol st ructures

Support for object -oriented programming (OOP) Familiar model for complex programs

Allows mutable data-st ructures and domain-specif ic at t r ibutes

Managed execut ion environment For runt ime opt im izat ions & automated memory management

Our approach: em bed DSLs in the Scala language

Supports both FP and OOP features

Supports embedding of higher- level abst ract ions

Compiles to Java bytecode

Page 19: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

DSL Execution with the Delite Parallel Runtime

Calls Matrix DSL methods

Delite applies generic & domain transformations to generate mapping

DSL defers OP execution to Delite

Page 20: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Performance with Delite

0

20

40

60

80

100

120

1 2 4 8 16 32 64 128

Sp

ee

du

p

Execut ion Cores

Gaussian Discr im inant Analysis

Original + Dom ain Opt im izat ions + Data Parallelism

Low speedup due to loop dependencies

Page 21: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Performance with Delite

0

20

40

60

80

100

120

1 2 4 8 16 32 64 128

Sp

ee

du

p

Execut ion Cores

Gaussian Discr im inant Analysis

Original + Dom ain Opt im izat ions + Data Parallelism

Domain info used to refactor dependencies

Page 22: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Performance with Delite

0

20

40

60

80

100

120

1 2 4 8 16 32 64 128

Sp

ee

du

p

Execut ion Cores

Gaussian Discr im inant Analysis

Original + Dom ain Opt im izat ions + Data Parallelism

Exploiting data parallelism within tasks

Page 23: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Hardware Architecture

Paralle l Object Language

Hardw are Architecture

OOO Cores SI MD Cores Threaded Cores

ProgrammableHierarchies

Scalable Coherence

I solat ion & Atom icity

Pervasive Monitor ing

Virtual W orlds

Personal Robot ics

DataI nform at ics

Scient ificEngineering

Physics Script ing Probabilist ic Machine LearningRendering

Com m on Paralle l Runt im e

Explicit / Stat ic I m plicit / Dynam ic

Applications

DomainSpecific

Languages

HeterogeneousHardware

DSLInfrastructure

Page 24: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Heterogeneous Hardware

Heterogeneous HW for energy & area efficiency I LP, threads, data-parallel engines, custom engines Q: what is the r ight balance of features in a chip? Q: what tools can generate best chip for an app/ domain?

Study: HW opt ions for H.264 encoding

1 .0

1 .5

2 .0

2 .5

3 .0

4 cores + I LP + SI MD + custom inst

ASI C

Area

1

1 0

1 0 0

1 0 0 0

4 cores + I LP + SI MD + custom inst

ASI C

Perform ance

Energy Savings

Page 25: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Architectural Support for Parallelism

Revisit architectural support for parallelism Which are the basic HW prim it ives needed? Challenges: sem ant ics, im plem entat ion, scalability,

vir tualizat ion, interact ions, granular ity ( fine-grain & bulk) , …

HW prim it ives Coherence & consistency, atom icity & isolat ion, m emory

part it ioning, data and cont rol m essaging, event m onitor ing

Runt im e synthesizes prim it ives into SW solut ions Stream ing system : m em part it ioning + bulk data m essaging TLS: isolat ion + fine-grain cont rol com m unicat ion Transact ional m em ory: atom icity + isolat ion + consistency Security: m em part it ioning + isolat ion Fault tolerance: isolat ion + checkpoint + bulk data m essaging

Page 26: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Example: HW Support for Fine-grain Parallelism

Parallel tasks with a few thousand inst ruct ions Crit ical to exploit in large-scale chips Tradeoff: load balance vs overheads vs locality

Software-only scheduling Per- thread task queues + task stealing Flexible algorithm s but high stealing overheads

0.0

0.3

0.5

0.8

1.0

1.3

1.5

1.8

3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8

SW - only HW - only ADM SW - only HW - only ADM

cg gt fold

Ex

ecu

tio

n T

ime

I dle

Overhead

Running

Overheads and scheduling get worse at larger scales

Page 27: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Example: HW Support for Fine-grain Parallelism

Hardware-only scheduling HW tasks queues + HW stealing protocol

Minim al overheads (bypass coherence protocol)

But fixes scheduling algorithm Opt imal approach varies across applicat ions

I mpract ical to support all opt ions in HW

0.0

0.3

0.5

0.8

1.0

1.3

1.5

1.8

3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8

SW - only HW - only ADM SW - only HW - only ADM

cg gt fold

Ex

ecu

tio

n T

ime

I dle

Overhead

Running

Wrong scheduling algorithm makes HW slower than SW

Page 28: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

Example: HW Support for Fine-grain Parallelism

Sim ple HW feature: asynchronous direct m essages Register- to- register, received with user- level interrupt

Fast m essaging for SW schedulers with flexible algorithm s E.g., gt fold scheduler t racks domain-specif ic dependencies

Also useful for fast barr iers, reduct ions, I PC, …

Bet ter perform ance, sim pler HW, m ore flexibilit y & uses

0.0

0.3

0.5

0.8

1.0

1.3

1.5

1.8

3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8 3 2 6 4 1 2 8

SW - only HW - only ADM SW - only HW - only ADM

cg gt fold

Ex

ecu

tio

n T

ime

I dle

Overhead

Running

Scalable scheduling with simple HW

Page 29: Towards Pervasive Parallelism - Hot Chips: A Symposium on ... › ... › HC21.24.331.Olukotun-Stanford-PPL.pdfFinding independent tasks 2. Mapping tasks to execution units 3. Implementing

PPL Summary

Goal: m ake parallel com put ing pract ical for the m asses

Technical approach

Dom ain specific languages ( DSLs)

Sim ple & portable program s

Heterogeneous hardw are

Energy and area efficient com put ing

Working on the SW & HW techniques that bridge them

More info at : ht tp:/ / ppl.stanford.edu