Presentation is loading. Please wait.

Presentation is loading. Please wait.

Support for Program Analysis as a First-Class Design Constraint in Legion Michael Bauer 02/22/17.

Similar presentations


Presentation on theme: "Support for Program Analysis as a First-Class Design Constraint in Legion Michael Bauer 02/22/17."— Presentation transcript:

1 Support for Program Analysis as a First-Class Design Constraint in Legion
Michael Bauer 02/22/17

2 Software Composability Challenges
The biggest problem faced by real applications Domain-Specific Languages and Libraries (DSL) METIS BoxLib Singe This is NOT sustainable! Low-Level Hardware Runtimes

3 The Legion Vision Composable Software METIS BoxLib Singe
Domain-Specific Languages and Libraries METIS BoxLib Singe Requirement 1: Need to infer inter-DSL computational and data dependences Legion Programming Model Legion C++ Runtime / Regent Language and Compiler Both need program analysis! Requirement 2: Need to be able to transform program to target different machines Low-Level Hardware Runtimes

4 Requirement 1: Reasoning about Dependences
A common data model Field Space DSL A: Want data in SOA in Memory 1 DSL B: Want data in AOS in Memory 2 Common data model: logical regions Relations of index spaces and fields No implied placement or layout Can be partitioned into sub-regions Partitions can be disjoint or aliased Support for recursive partitioning Support for multiple partitions Region Tree An acceleration data structure for dependence analysis Index Space N S P s1 sn g1 gn p1 pn

5 Requirement 1: Reasoning about Dependences
Pointers and Aliasing Domain-Specific Languages and Libraries Pointers in Legion are references to locations in logical regions (valid globally) All pointers indicate the name(s) of one or more sub-regions they point into r2, …, rn} A new point in the design space Trade-off: enable efficient program analysis while minimizing loss of expressivity Beware undecidability! No pointers Singe Stronger Program Analysis Legion Programming Model Bounded Pointers More Expressivity Unbounded C-style pointers Low-Level Hardware Runtimes

6 Requirement 1: Reasoning about Dependences
A common model of computation Sequential program task_A(piece[0], , , ); task_A(piece[1], , , ); task_B(piece[0], , , ); task_B(piece[1], , , ); p0 s0 g0 A Legion program is a tree of tasks Tasks are functions with explicit region arguments Executed with apparently sequential semantics Implicit parallelism p1 s1 g1 T p0 s0 g0 p1 s1 g1 T T T Region Requirements Logical Region Fields Privileges (read-only, read-write, reduce) T T T T Dependence Graph Legion / Regent

7 Requirement 1: Reasoning about Dependences
Why are sequential semantics so important? Consider this scenario: Who creates this dependence? Three options: Programmer (explicit): breaks abstractions, humans mess it up Libraries (implicit): creates cross- product explosion for library implementations Programming System (implicit) Sequential semantics are better for both humans and DSL composability Combustion DSL Launch task: WRITE region ‘r’ Legion Program Visualization DSL Launch task: READ region ‘r’

8 The Legion Mapping Interface
Separating Mechanism and Policy Legion / Regent Legion Program Legion Mapper Program Analysis! Insert needed synchronization and data movement Machine-Independent Specification Defines application correctness Programmatic interface for performing machine-specific and app-specific mapping Only impacts performance, never correctness All heuristics go here!

9 Requirement 2: Program Transformation
Execution can change from run to run depending on machine Transforming to a Target Machine Legion Program DSL A Processor 1 Processor 2 Time DSL B DSL C Graph dynamically scheduled to overlap compute and communication Libraries asynchronously launch tasks in program order Legion computes dynamic dependence graph Takeaway 1: Legion can extract parallelism that is non-obvious to humans Takeaway 2: Legion can hide latency in ways that are non-obvious to humans

10 Program Analysis: Debugging
Bigger programs need smarter tools Is there use of un-initialized data? Why did this code run slow? Is there a bug in the programming system? Hint: gdb will not save you Solution: construct powerful analysis tools Legion Spy: graph analysis Legion Prof: profiling analysis

11 Program Analysis: Partitioning
Capturing Higher-Level Program Invariants Pennant Partitioning Code Pennant Irregular Mesh Compute index spaces with set arithmetic and projections Assertions on the correctness of the partitioning can be discharged statically

12 Programming Model and Analysis Co-Design
A simple equation These must be co-designed Expressive High-Level Programming Models Powerful Programming Systems High Performance Performance Portability Programmability Static Analysis Dynamic Analysis Synthesis Formal Methods There will be many interesting points in this space

13 Conclusion Support for Program Analysis is Important
Support for program analysis should be a first- class design constraint in order to construct programming systems capable of dealing with highly complex applications Legion is a new point in the design space of program analysis – expressivity trade-off Questions for later: How does your programming system support program analysis? What program analyses and transformations do you do today / plan to do in the future?

14


Download ppt "Support for Program Analysis as a First-Class Design Constraint in Legion Michael Bauer 02/22/17."

Similar presentations


Ads by Google