Cost Semantics for Space Usage in a Parallel Language
Daniel Spoonhower
Carnegie Mellon University (Joint work with Guy Blelloch & Robert Harper)
Cost Semantics for Space Usage in a Parallel Language Daniel - - PowerPoint PPT Presentation
Cost Semantics for Space Usage in a Parallel Language Daniel Spoonhower Carnegie Mellon University (Joint work with Guy Blelloch & Robert Harper) DAMP 16 Jan 2007 Understanding How Programs Compute Interested in intensional behavior of
Carnegie Mellon University (Joint work with Guy Blelloch & Robert Harper)
◮ more than just final result ◮ e.g. time & space required
16 Jan 2007 DAMP ’07 Cost Semantics for Space 2
◮ more than just final result ◮ e.g. time & space required
16 Jan 2007 DAMP ’07 Cost Semantics for Space 2
◮ more than just final result ◮ e.g. time & space required
16 Jan 2007 DAMP ’07 Cost Semantics for Space 2
◮ pairs < e1 || e2 > may evaluate in parallel ◮ schedule determined by compiler & run-time
16 Jan 2007 DAMP ’07 Cost Semantics for Space 4
16 Jan 2007 DAMP ’07 Cost Semantics for Space 5
◮ define execution costs for high-level language ◮ account for parallelism & space
◮ make parallelism explicit ◮ translate to lower-level language ◮ prove costs are preserved at each step ◮ consider scheduler, GC implementation
16 Jan 2007 DAMP ’07 Cost Semantics for Space 6
◮ define execution costs for high-level language ◮ account for parallelism & space
◮ make parallelism explicit ◮ translate to lower-level language ◮ prove costs are preserved at each step ◮ consider scheduler, GC implementation
16 Jan 2007 DAMP ’07 Cost Semantics for Space 6
◮ i.e. execution model for high-level language
◮ e.g. steps of evaluation, upper bound on space
16 Jan 2007 DAMP ’07 Cost Semantics for Space 7
◮ i.e. execution model for high-level language
◮ e.g. steps of evaluation, upper bound on space
16 Jan 2007 DAMP ’07 Cost Semantics for Space 7
◮ includes functions, pairs, and booleans
◮ denoted < e1 || e2 >
◮ values are labeled to make sharing explicit
16 Jan 2007 DAMP ’07 Cost Semantics for Space 8
◮ yields two graphs: computation and heap ◮ sequential, unique result per program
16 Jan 2007 DAMP ’07 Cost Semantics for Space 9
16 Jan 2007 DAMP ’07 Cost Semantics for Space 10
16 Jan 2007 DAMP ’07 Cost Semantics for Space 10
◮ nodes shared with
◮ edges run in
16 Jan 2007 DAMP ’07 Cost Semantics for Space 11
◮ nodes shared with
◮ edges run in
16 Jan 2007 DAMP ’07 Cost Semantics for Space 11
◮ relate execution costs to source code ◮ later: simulate runtime behavior
◮ considered maximum heap size in example ◮ impact of GC: measure overhead, latency
16 Jan 2007 DAMP ’07 Cost Semantics for Space 12
◮ relate execution costs to source code ◮ later: simulate runtime behavior
◮ considered maximum heap size in example ◮ impact of GC: measure overhead, latency
16 Jan 2007 DAMP ’07 Cost Semantics for Space 12
◮ “implementation” = lower-level semantics
◮ e.g. environment trimming, tail calls ◮ can guide concrete implementation on hardware
16 Jan 2007 DAMP ’07 Cost Semantics for Space 13
◮ “implementation” = lower-level semantics
◮ e.g. environment trimming, tail calls ◮ can guide concrete implementation on hardware
◮ several (non-)deterministic versions ◮ can incorporate specific scheduling algorithms
16 Jan 2007 DAMP ’07 Cost Semantics for Space 13
◮ parallel construct for in-progress computations
16 Jan 2007 DAMP ’07 Cost Semantics for Space 14
◮ parallel construct for in-progress computations
◮ declarations simulate a call “stack” ◮ allows unbounded parallelism, e.g.
1
2
1 and d′ 2)
16 Jan 2007 DAMP ’07 Cost Semantics for Space 14
◮ ordering must respect control dependencies
16 Jan 2007 DAMP ’07 Cost Semantics for Space 15
◮ ordering must respect control dependencies
◮ Ni ⊆ Ni+1, and ◮ for all n ∈ Ni+1, pred(n) ⊆ Ni.
16 Jan 2007 DAMP ’07 Cost Semantics for Space 15
16 Jan 2007 DAMP ’07 Cost Semantics for Space 16
◮ roots = edges that
16 Jan 2007 DAMP ’07 Cost Semantics for Space 17
16 Jan 2007 DAMP ’07 Cost Semantics for Space 18
16 Jan 2007 DAMP ’07 Cost Semantics for Space 18
16 Jan 2007 DAMP ’07 Cost Semantics for Space 18
16 Jan 2007 DAMP ’07 Cost Semantics for Space 18
16 Jan 2007 DAMP ’07 Cost Semantics for Space 18
◮ necessary to simulate GC decisions
16 Jan 2007 DAMP ’07 Cost Semantics for Space 18
16 Jan 2007 DAMP ’07 Cost Semantics for Space 19
◮ DF and BF traversals of cost graph g
◮ abstract presentation: no queues, &c.
16 Jan 2007 DAMP ’07 Cost Semantics for Space 19
16 Jan 2007 DAMP ’07 Cost Semantics for Space 21
16 Jan 2007 DAMP ’07 Cost Semantics for Space 23
16 Jan 2007 DAMP ’07 Cost Semantics for Space 25
16 Jan 2007 DAMP ’07 Cost Semantics for Space 25
16 Jan 2007 DAMP ’07 Cost Semantics for Space 27
◮ upper bounds based on size and depth of DAG
◮ constant overhead independent of program
◮ formalize “safe for space” as cost semantics
16 Jan 2007 DAMP ’07 Cost Semantics for Space 28
◮ full-scale implementation, predict & measure
◮ killer app?
◮ static discipline to help control (or at least
◮ e.g. distinguish implementations of quicksort
16 Jan 2007 DAMP ’07 Cost Semantics for Space 29
◮ traditionally, easy to reason about result ◮ . . . but hard to reason about performance
◮ related parallelism & space usage to source ◮ proved costs preserved by implementation ◮ considered effects of scheduler, collector
16 Jan 2007 DAMP ’07 Cost Semantics for Space 30