K3: Language Design for Building Multi-Platform Domain-Specific - - PowerPoint PPT Presentation

k3 language design for building multi platform domain
SMART_READER_LITE
LIVE PREVIEW

K3: Language Design for Building Multi-Platform Domain-Specific - - PowerPoint PPT Presentation

DSRs Language Design Annotations Closing K3: Language Design for Building Multi-Platform Domain-Specific Runtimes P.C. Shyamshankar with Zachary Palmer and Yanif Ahmad Department of Computer Science, The Johns Hopkins University First


slide-1
SLIDE 1

DSRs Language Design Annotations Closing

K3: Language Design for Building Multi-Platform Domain-Specific Runtimes

P.C. Shyamshankar with Zachary Palmer and Yanif Ahmad

Department of Computer Science, The Johns Hopkins University

First International Workshop on Cross-Model Language Design and Implementation

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 1 / 25

slide-2
SLIDE 2

DSRs Language Design Annotations Closing

What are Domain-Specific Runtimes?

Runtimes: Systems that underlie an application’s execution.

◮ Data Management ◮ Execution Management ◮ Integrity Management

Domain Specific Runtimes:

◮ Hadoop ◮ Pregel ◮ LINQ

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 2 / 25

slide-3
SLIDE 3

DSRs Language Design Annotations Closing

A Language for Building Domain-Specific Runtimes

Translate high-level domain-specific information into low-level implementation decisions.

◮ Describe application logic flexibly. ◮ Represent domain-specific information at a high level. ◮ Recognize existing runtime patterns. ◮ Revisit implementation decisions over time.

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 3 / 25

slide-4
SLIDE 4

DSRs Language Design Annotations Closing

Applications

◮ DBToaster (SQL) <http://www.dbtoaster.org/> ◮ Dyna (Weighted Logic Programming)

<http://www.dyna.org/>

◮ BLOG (Probabilistic Graphical Models)

<http://bayesianlogic.cs.berkeley.edu/>

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 4 / 25

slide-5
SLIDE 5

DSRs Language Design Annotations Closing

Building Domain Specific Runtimes Language Design Annotations: Exploiting Domain Specific Information Closing

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 5 / 25

slide-6
SLIDE 6

DSRs Language Design Annotations Closing

Simple Control Flow

Triggers carry out small step computation. They:

◮ Perform side-effecting functional style computation. ◮ Only contain acyclic control flow. ◮ Can send messages to other triggers.

trigger fibonacci(n:int, a:int, b:int) {} = if n == 1 then send(sink, a) else send(fibonacci, n - 1, b, a + b)

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 6 / 25

slide-7
SLIDE 7

DSRs Language Design Annotations Closing

Complex Control Flow

Large step computation is done using message passing.

◮ Triggers are invoked on receiving a message. ◮ Message passing is asynchronous. ◮ Message processing is governed by a scheduler. ◮ Flexible enough to capture most execution patterns.

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 7 / 25

slide-8
SLIDE 8

DSRs Language Design Annotations Closing

Collection Management

The K3 collection model is based on structural recursion.

◮ Basic collection transformers provide bounded iteration. ◮ More complex transformations are provided through

annotations, and are subject to depth-based analyses.

◮ Collection access operators provide the ability to mutate all or

parts of the collection.

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 8 / 25

slide-9
SLIDE 9

DSRs Language Design Annotations Closing

Mutable State

K3 maintains a deep value-based semantics of mutability by default.

◮ Particular implementations can choose which approaches to

use (copy-on-write, etc.), to provide this mutability.

◮ Pointer-based semantics are available on demand, for

annotation writers, etc.

◮ Mutability of collections is determined at multiple

granularities:

◮ The entire collection, ◮ Parts of the collection (restructurability), ◮ Individual elements,

◮ Mutation operations ensure that the relevant integrity

constraints are satisfied.

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 9 / 25

slide-10
SLIDE 10

DSRs Language Design Annotations Closing

Building Domain Specific Runtimes Language Design Annotations: Exploiting Domain Specific Information Closing

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 10 / 25

slide-11
SLIDE 11

DSRs Language Design Annotations Closing

Exploiting Domain Specific Information

K3 uses a system of annotations to encode, and make use of domain specific information. Annotations can:

◮ Be attached to any part of a K3 program. ◮ Be acted upon by any part of the toolchain.

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 11 / 25

slide-12
SLIDE 12

DSRs Language Design Annotations Closing

Categorization of Annotations

◮ Data structure annotations specify properties about a

collection, and facilitate declarative data structures.

◮ Sorted, Layout*, . . .

◮ Control annotations specify properties of a piece of code, and

facilitate adaptive execution.

◮ Logging, Profiling, . . .

◮ Hint Annotations describe possible optimizations.

◮ Layout*, Locking, . . .

◮ Constraint Annotations describe correctness properties of the

program, and require code to be generated to check them.

◮ FunDep, Unique, . . . P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 12 / 25

slide-13
SLIDE 13

DSRs Language Design Annotations Closing

Data Control and Execution Integrity Efficiency Assurances Scalability (Constraint) (Hint) (Constraint) (Hint) Functional Layout, and Fault tolerance, Degrees of dependencies compression checkpointing parallelism Sortedness Indexes, views Service-level Vectorization Orderedness Allocation, GC agreements Scheduling Referential Data placement Auditing and Autotuning integrity and replication compliance heuristics Concurrency Lock granularity Access control Profiling

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 13 / 25

slide-14
SLIDE 14

DSRs Language Design Annotations Closing

Components of a Data Structure Annotation

A user-defined data structure annotation should contain specifications of:

◮ Requirements from other annotations on the collection. ◮ Per-collection data structures. ◮ Schema extensions. ◮ Method definitions. ◮ Method hooks (method.pre, method.post, . . . ).

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 14 / 25

slide-15
SLIDE 15

DSRs Language Design Annotations Closing

A Simple Data Structure Annotation: Index

◮ Other required annotations:

None

◮ Per-collection data: An

auxiliary lookup data structure.

◮ Schema extensions: None ◮ Method definitions: lookup ◮ Method hooks: Post hooks

for the maintenance of the auxiliary data structure.

11 7 13 5 9 5 7 11 9 13

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 15 / 25

slide-16
SLIDE 16

DSRs Language Design Annotations Closing

Composing Annotations: B+Trees

3 5

1

2 3 4 5 6 7

  • Insert
  • Update
  • Delete
  • Lookup

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 16 / 25

slide-17
SLIDE 17

DSRs Language Design Annotations Closing

A Collection Of Blocks

3 5 1 2 3 4 5 6 7

declare b : Collection(Collection(t))

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 17 / 25

slide-18
SLIDE 18

DSRs Language Design Annotations Closing

Adding Tree Linkage

3 5 1 2 3 4 5 6 7

declare b : Collection(Collection(t)) @ { Tree }

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 18 / 25

slide-19
SLIDE 19

DSRs Language Design Annotations Closing

Managing Overflow and Underflow

3 5 1 2 3 4 5 6 7

declare b : Collection( Collection(t) @ { Capacity(k), Fill(k), OverflowHandler, UnderflowHandler } ) @ { Tree(Capacity(k)) }

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 19 / 25

slide-20
SLIDE 20

DSRs Language Design Annotations Closing

Providing a B+Tree Interface

3 5

1

2 3 4 5 6 7

  • Insert
  • Update
  • Delete
  • Lookup

declare b : Collection( Collection(t) @ { Capacity(k), Fill(k), OverflowHandler, UnderflowHandler } ) @ { Tree(Capacity(k)), BPTree }

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 20 / 25

slide-21
SLIDE 21

DSRs Language Design Annotations Closing

Extending the B+Tree

We can extend the existing B+Tree with other behaviors, such as:

◮ Cache consciousness, with

an annotation describing fractal layouts of collections.

◮ Concurrency, through

annotations providing logging or locking. declare b : Collection( Collection(t) @ { Capacity(k), Fill(k), OverflowHandler, UnderflowHandler } ) @ { Tree(Capacity(k)), BPTree FractalLayout, Logged }

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 21 / 25

slide-22
SLIDE 22

DSRs Language Design Annotations Closing

Building Domain Specific Runtimes Language Design Annotations: Exploiting Domain Specific Information Closing

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 22 / 25

slide-23
SLIDE 23

DSRs Language Design Annotations Closing

Implementation Status

K3 currently has:

◮ A functional core, with value-based mutation. ◮ A simple distributed execution model. ◮ An initial model of data structure and control annotations.

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 23 / 25

slide-24
SLIDE 24

DSRs Language Design Annotations Closing

Next Steps

◮ Language Features:

◮ Effect System - Guiding parallelization decisions. ◮ Depth analysis of annotation methods - User-defined collection

transformations.

◮ Scalability and Performance:

◮ Optimizer Model. ◮ Eventually-consistent distributed data structures. P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 24 / 25

slide-25
SLIDE 25

DSRs Language Design Annotations Closing

The End

◮ <http://damsl.cs.jhu.edu/> ◮ <http://cs.jhu.edu/~shyam/>

P.C. Shyamshankar The Johns Hopkins University K3: Language Design for Building Multi-Platform Domain-Specific Runtimes 25 / 25