Copyright © 2001 Stephen A. Edwards All rights reserved ESUIF: An Open Esterel Compiler Stephen A. Edwards Department of Computer Science Columbia University,

Slides:



Advertisements
Similar presentations
Static Single-Assignment ? ? Introduction: Over last few years [1991] SSA has been Stablished as… Intermediate program representation.
Advertisements

Automatic Parallelization Nick Johnson COS 597c Parallelism 30 Nov
A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Software & Services Group, Developer Products Division Copyright© 2010, Intel Corporation. All rights reserved. *Other brands and names are the property.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
Declarative sensor networks David Chu Computer Science Division EECS Department UC Berkeley DBLunch UC Berkeley 2 March 2007.
Optimizations for Faster Simulation of Esterel Programs Dumitru POTOP-BUTUCARU Advisers: Gérard Berry – Esterel Technologies Robert de Simone – INRIA,
Analyzing and Verifying Esterel Programs Taisook Han , Division of Computer Science, KAIST.
Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.
Copyright © 2001 Stephen A. Edwards All rights reserved The Synchronous Language Esterel Prof. Stephen A. Edwards.
ISBN Chapter 3 Describing Syntax and Semantics.
Fast Paths in Concurrent Programs Wen Xu, Princeton University Sanjeev Kumar, Intel Labs. Kai Li, Princeton University.
Trace-Based Automatic Parallelization in the Jikes RVM Borys Bradel University of Toronto.
Chapter 5: Threads Overview. Multithreading Models. Threading Issues. Thread Pools. Java ThreadLocal. Pthreads. Solaris 2 Threads. Java Threads.
Copyright © 2001 Stephen A. Edwards All rights reserved Research Areas Stephen A. Edwards.
Remote Procedure Call in SR Programming Language By Tze-Kin Tsang 3/20/2000.
CS 536 Spring Intermediate Code. Local Optimizations. Lecture 22.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
ISBN Chapter 10 Implementing Subprograms.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
Tentative Schedule 20/12 Interpreter+ Code Generation 27/12 Code Generation for Control Flow 3/1 Activation Records 10/1 Program Analysis 17/1 Register.
Microprocessors Introduction to ia64 Architecture Jan 31st, 2002 General Principles.
Data Flow Analysis Compiler Design October 5, 2004 These slides live on the Web. I obtained them from Jeff Foster and he said that he obtained.
Compiling Esterel into Static Discrete-Event Code Stephen A. Edwards Columbia University Computer Science Department New York, USA
1 Static vs dynamic SAGAs Ivan Lanese Computer Science Department University of Bologna/INRIA Italy.
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Concurrency, Threads, and Events Robbert van Renesse.
Copyright © 2001 Stephen A. Edwards All rights reserved Esterel and Other Projects Prof. Stephen A. Edwards Columbia University, New York
Intermediate Code. Local Optimizations
VB in Context Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh Pittsburgh, Pa 15260
Einsterel: A Compiled Event-Driven Simulator for Esterel.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
Describing Syntax and Semantics
Copyright © 2001 Stephen A. Edwards All rights reserved More About the Project Prof. Stephen A. Edwards.
Building An Interpreter After having done all of the analysis, it’s possible to run the program directly rather than compile it … and it may be worth it.
Center for Embedded Computer Systems University of California, Irvine and San Diego SPARK: A Parallelizing High-Level Synthesis.
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
Query Processing Presented by Aung S. Win.
Optimization software for apeNEXT Max Lukyanov,  apeNEXT : a VLIW architecture  Optimization basics  Software optimizer for apeNEXT  Current.
CS 363 Comparative Programming Languages
1 Advance Computer Architecture CSE 8383 Ranya Alawadhi.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee C Language Part 2.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
An introduction to Esterel and its compilation
“Software” Esterel Execution (work in progress) Dumitru POTOP-BUTUCARU Ecole des Mines de Paris
© S. Ramesh / Kavi Arya / Krithi Ramamritham 1 IT-606 Embedded Systems (Software) S. Ramesh Kavi Arya Krithi Ramamritham KReSIT/ IIT Bombay.
Algorithms & FlowchartsLecture 10. Algorithm’s CONCEPT.
Chapter 3 Part II Describing Syntax and Semantics.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
 Control Flow statements ◦ Selection statements ◦ Iteration statements ◦ Jump statements.
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
Semantic Analysis II Type Checking EECS 483 – Lecture 12 University of Michigan Wednesday, October 18, 2006.
® July 21, 2004GC Summer School1 Cycles to Recycle: Copy GC Without Stopping the World The Sapphire Collector Richard L. Hudson J. Eliot B. Moss Originally.
Copyright © Curt Hill Flow of Control A Quick Overview.
Engineering Computing I Chapter 3 Control Flow. Chapter 3 - Control Flow The control-flow of a language specify the order in which computations are performed.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Welcome! Simone Campanoni
An Efficient Compilation Framework for Languages Based on a Concurrent Process Calculus Yoshihiro Oyama Kenjiro Taura Akinori Yonezawa Yonezawa Laboratory.
C-- by Aksel Gresvig. Outline ● What is C--? How does it work? ● What C-- is not ● Relationship to C ● What does it look like? Examples ● Elements of.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
CS203 – Advanced Computer Architecture
Assignments A sample main program for Project 2 phase 2 is contained in: It reads.
Implementing Subprograms
Semantics In Text: Chapter 3.
Control Flow Analysis (Chapter 7)
Loop-Level Parallelism
Presentation transcript:

Copyright © 2001 Stephen A. Edwards All rights reserved ESUIF: An Open Esterel Compiler Stephen A. Edwards Department of Computer Science Columbia University, New York

Copyright © 2001 Stephen A. Edwards All rights reserved Not Another One…  My research agenda is to push Esterel compilation technology much farther  We still don’t have a technique that builds fast code for all large programs  No decent Esterel compiler available in source form

Copyright © 2001 Stephen A. Edwards All rights reserved Quick History of Esterel Compilers  Automata-based V1, V2, V3 (INRIA/CMA) [Berry, Gonthier 1992] Excellent for small programs with few states Don’t scale well  Netlist-based V4, V5 (INRIA/CMA) Scales very nicely Produces slow code for sequential programs  Executables for these available at  Not open-source

Copyright © 2001 Stephen A. Edwards All rights reserved Quick History of Esterel Compilers  Control-flow-graph based EC [Edwards 1999, 2000, 2002] Produces very efficient code for acyclic programs  Discrete-event based SAXO-RT [Weil et al. 2000] Produces efficient code for acyclic programs  Both proprietary & unlikely to ever be released  Neither has V5’s ability to analyze static cycles Many valid programs are rejected

Copyright © 2001 Stephen A. Edwards All rights reserved ESUIF  New, open-source compiler being developed at Columbia University  Based on SUIF 2 infrastructure (Stanford University)  Divided into many little passes  Common database represents program throughout

Copyright © 2001 Stephen A. Edwards All rights reserved Open, Flexible Architecture  Common database used throughout SUIF 2 database Esterel Source ECL Source C Source Passes: Dismantlers, optimization Front-ends

Copyright © 2001 Stephen A. Edwards All rights reserved SUIF 2 Database  Main component of the SUIF 2 system:  User-customizable persistent, object-oriented database  Written in C++  Not the most efficient, but very flexible

Copyright © 2001 Stephen A. Edwards All rights reserved SUIF 2 Database  Database schema written in their own “hoof” language  Automatically translated into C++ class New : public SuifObject { public: int get_x(); void set_x(int the_value); ~New(); void print(…); static const Lstring get_class_name(); … } concrete New { int x; } hoof C++

Copyright © 2001 Stephen A. Edwards All rights reserved Three Intermediate Representations  Front end generates AST-like database One-to-one mapping between classes and Esterel statements  Dismantled into concurrent IC-like statements Described next  Scheduling produces C code SUIF 2 has complete schema for C

Copyright © 2001 Stephen A. Edwards All rights reserved Intermediate Representation  Goal: simpler semantics than IC [Gonthier 1988]  Slightly lower-level  More symmetry between strong and weak abort IC uses awkward implicit exceptions for weak abort  More division between concurrency and exception handling

Copyright © 2001 Stephen A. Edwards All rights reserved IR Primitives  var := expr  if (expr) { stmts } else { stmts }  Label:  goto Label  resume (state-var) { stmts }  pause  trapScope (Handler-Label) T1,…,Tn { stmts }  fork L1, …, Ln  join  thread (exit-var, Join-Label) { stmts }  exitAt n

Copyright © 2001 Stephen A. Edwards All rights reserved Pause and Resume  Idea: single pair of primitives that implement ability to suspend and resume sequences of instructions  Semantics: pause sends control just past its enclosing resume resume sends control to just after the last-executed pause  Trivial translation into a C switch statement  Simple enumeration of states (just pause statements)  Strong and weak abort just tests before and after

Copyright © 2001 Stephen A. Edwards All rights reserved Translating Strong Abort abort pause; pause when S goto Surface Depth: if (S) { goto Terminate } resume { Surface: pause goto Terminate } pause goto Depth Terminate: Strong preemption: Predicate tested before body is resumed Control initially sent directly into the body This pause suspends and resumes the abort statement

Copyright © 2001 Stephen A. Edwards All rights reserved First Reaction abort pause; pause when S goto Surface Depth: if (S) { goto Terminate } resume { Surface: pause goto Terminate } pause goto Depth Terminate:

Copyright © 2001 Stephen A. Edwards All rights reserved Second Reaction abort pause; pause when S goto Surface Depth: if (S) { goto Terminate } resume { Surface: pause goto Terminate } pause goto Depth Terminate:

Copyright © 2001 Stephen A. Edwards All rights reserved Translating Weak Abort abort pause; pause when S goto Surface Depth: resume { Surface: pause goto Terminate } if (S) { goto Terminate } pause goto Depth Terminate: Weak preemption: Predicate tested after body has a chance to run

Copyright © 2001 Stephen A. Edwards All rights reserved Dismantling  Multiple passes dismantle AST-like Esterel into the IR  Each dismantles a single Esterel statement  Most are trivial

Copyright © 2001 Stephen A. Edwards All rights reserved Parallel, Trap, and Exit  Translation of exit differs depending on parallel behavior trap T inDoes not terminate siblings exit TNo prioritization of exits end trap T inTerminates siblings stmts || exit TMust worry about trap priorities end

Copyright © 2001 Stephen A. Edwards All rights reserved Parallel, Trap, and Exit  Translation is tedious, but not difficult  Uses Berry and Gonthier’s encoding of exit levels: 0 = terminate 1 = pause 2 = exit innermost trap 3 = exit next innermost trap 4 = etc.

Copyright © 2001 Stephen A. Edwards All rights reserved Ideas for Code Generation  ESUIF does not currently have a back-end  I am considering a few possibilities

Copyright © 2001 Stephen A. Edwards All rights reserved Static Unrolling  Cyclic programs can always be evaluated by unrolling: lfp(F) = F(  ) n  Three-valued evaluation costly, not clear with control-flow  Theorem (suggested to me by Berry)  Proof: F is monotonic, lfp does not contain  If a program is causal, then two- and three-valued evaluation will produce the same result

Copyright © 2001 Stephen A. Edwards All rights reserved Program Dependence Graph  Program Dependence Graph [Ferrante et al., TOPLAS 1987] is concurrent Represents only control and data dependencies Natural for Esterel because it represents concurrency present A then emit B else emit C end; emit D; present B then emit E end A C B D B E Data dependence Control dependence

Copyright © 2001 Stephen A. Edwards All rights reserved Program Dependence Graph  Idea: Represent Esterel program as a program dependence graph Unroll to resolve cycles (duplicate code)  Generate code that conforms to the program dependence graph  Some PDGs do not require additional predicates when sequentialized [Ferrante et al., Steensgaard]  Heuristics will have to be used to insert a minimum number of predicates in most cases

Copyright © 2001 Stephen A. Edwards All rights reserved Discrete-Event Approaches  Weil et al. [CASES 2000] have taken this approach  Successful, but scheduler could be better  Does not handle statically cyclic programs  Techniques such as French et al. [DAC 1995] schedule as much as possible beforehand, but allow some dynamic behavior  Idea: Generate an unrolled schedule and invoke unduplicated basic blocks more than once per reaction (solves causality and schizophrenia)

Copyright © 2001 Stephen A. Edwards All rights reserved Conclusions  ESUIF compiler under development at Columbia Front-end completed Most dismantlers written Work beginning on back-end  New intermediate representation pause and resume primitives  Some new ideas for code generation Static unrolling with two-valued evaluation Program Dependence Graph Event-driven Approaches

Copyright © 2001 Stephen A. Edwards All rights reserved For More Information  Visit my website