190 likes | 330 Views
Featherweight X10: A Core Calculus for Async -Finish Parallelism. Jonathan K. Lee, Jens Palsberg Presented By- Vasvi Kakkad. Outline. Introduction Featherweight X10 May-Happen-in-Parallel Analysis Type Inference Context-insensitive Analysis. Introduction. Two key constructs of X10
E N D
Featherweight X10: A Core Calculus for Async-Finish Parallelism Jonathan K. Lee, Jens Palsberg Presented By- VasviKakkad
Outline • Introduction • Featherweight X10 • May-Happen-in-Parallel Analysis • Type Inference • Context-insensitive Analysis
Introduction • Two key constructs of X10 • Async • Finish • Goal: May-happen-in-parallel (MHP) • Identify pairs of statement that happen in parallel • Use of Type system • Context sensitive analysis
Prior work • Intra-procedural MHP for X10 by Agarwal • First determines what can not happen in parallel • Take complement • No correctness proof • Inter-procedural analysis of concurrent programs by Barik/Sarkar • Different from MHP
Example – Intraprocedural Analysis void main() { S0: finish { S1: async { S13: finish { S5: ... S6: async S11 S7: async S12 } S8: ... } S2: ... } S3: ... }
Example – Modular Inter-procedural Analysis void f() { async S5 } void main() { S1: finish { asyncS3 f() } S2: finish { f() asyncS4 } }
Featherweight X10 • Subset of X10 • While-loop, assignments, and a single one-dimensional integer array • Methods and method calls, and • The async and finish statements • Informal semantics • Async - || • Finish - ▷
Semantics • Semantic Structures • A ∈ Array = N -> Z • Tree: T ::= T ⊳ T | T ∥ T | <s> | √ • State = Program X Array X Tree
MHP Analysis • Use of Type System for • Modular, Context-sensitive MHP Analysis • Every program has a type • Can derive MHP information for all program • 3 – abstract domain • 9 – helper functions • 12 – type rules
MHP Analysis – Abstract domains • LabelSet = P(Label) • A, B, O, R • LabelPairSet = P(Label X Label) • M • TypeEnv = MethodName -> (LabelPairSet X LabelPairSet) • E
MHP Analysis – Type Rules • Type judgment 1) ⊦ p : E 2) p, E, R ⊦ T : M 3) p, E, R ⊦ s : M, O • Provides soundness and correctness proof
Type Inference • Problem: given a program p, find E such that ⊦ p : E • 2 steps • Rephrase inference problem as constraint problem • Solve the constraint problem
Type Inference • Constraints • Two levels: level – 1 and level - 2 • Valuations • D – domain of valuation • Maps each r and o variable in C to a subset of L • Maps each m variable in C to a subset of L X L • Constraint generation • Type and constraints are equivalent • Theorem: ⊦ p : E if and only if there exists a solution φ of C(p) where φ extends E.
Type Inference • Solving constraints • Iterative data flow analysis algorithm • F : D -> D • F : λφ ∈ D.λv. φ(rhs) • F - monotone function from finite lattice D to itself • F has least fixed point and coincide with the solution of C(p)
Context-insensitive Analysis • Merges information from different call sites • More conservative • Produces additional label pairs in MHP sets • Requires more time and space • Number of increased pairs – for async bodies in different methods
Example – Modular Inter-procedural Analysis void f() { async S5 } void main() { S1: finish { asyncS3 f() } S2: finish { f() asyncS4 } }
Conclusion • Core calculus for async-finish parallelism • Using Type system for modular, context-sensitive, MHP analysis • Type inference is straightforward • Generate and solve constraints in polynomial time • Faster and uses less space than context-insensitive • Good basis for type system and static analysis