“Software” Esterel Execution (work in progress) Dumitru POTOP-BUTUCARU Ecole des Mines de Paris

Slides:



Advertisements
Similar presentations
School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) SSA Guo, Yao.
Advertisements

Models of Concurrency Manna, Pnueli.
Compilation 2011 Static Analysis Johnni Winther Michael I. Schwartzbach Aarhus University.
White Box and Black Box Testing Tor Stålhane. What is White Box testing White box testing is testing where we use the info available from the code of.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Some Properties of SSA Mooly Sagiv. Outline Why is it called Static Single Assignment form What does it buy us? How much does it cost us? Open questions.
© S. Ramesh / Kavi Arya / Krithi Ramamritham IT-606 Embedded Systems (Software) S. Ramesh Kavi Arya Krithi Ramamritham KReSIT/ IIT Bombay.
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.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
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.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
CS412/413 Introduction to Compilers Radu Rugina Lecture 16: Efficient Translation to Low IR 25 Feb 02.
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
CS 536 Spring Global Optimizations Lecture 23.
Esterel Overview Roberto Passerone ee249 discussion section.
A High Performance Application Representation for Reconfigurable Systems Wenrui GongGang WangRyan Kastner Department of Electrical and Computer Engineering.
4/25/08Prof. Hilfinger CS164 Lecture 371 Global Optimization Lecture 37 (From notes by R. Bodik & G. Necula)
Chapter 8 . Sequence Control
Compiling Esterel into Static Discrete-Event Code Stephen A. Edwards Columbia University Computer Science Department New York, USA
Expressing Giotto in xGiotto and related schedulability problems Class Project Presentation Concurrent Models of Computation for Embedded Software University.
Prof. Fateman CS 164 Lecture 221 Global Optimization Lecture 22.
Copyright © 2001 Stephen A. Edwards All rights reserved Esterel and Other Projects Prof. Stephen A. Edwards Columbia University, New York
Overview of program analysis Mooly Sagiv html://
Improving Code Generation Honors Compilers April 16 th 2002.
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Einsterel: A Compiled Event-Driven Simulator for Esterel.
Describing Syntax and Semantics
A Mystery Esterel –small no type inference, subtyping, … no recursion, functions, … no pointers, malloc, GC, … no complex data structures, libraries,
Copyright © 2001 Stephen A. Edwards All rights reserved ESUIF: An Open Esterel Compiler Stephen A. Edwards Department of Computer Science Columbia University,
Prof. Bodik CS 164 Lecture 16, Fall Global Optimization Lecture 16.
Maria-Cristina Marinescu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology High-level Specification and Efficient Implementation.
A Complexity Measure THOMAS J. McCABE Presented by Sarochapol Rattanasopinswat.
Abstract Interpretation (Cousot, Cousot 1977) also known as Data-Flow Analysis.
1 ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis.
Compiling ESTEREL circuits into finite states machines BRES Yannis Stage de DEA d’Informatique 1998/1999.
Compositional correctness of IP-based system design: Translating C/C++ Models into SIGNAL Processes Rennes, November 04, 2005 Hamoudi Kalla and Jean-Pierre.
1 Software Testing. 2 Path Testing 3 Structural Testing Also known as glass box, structural, clear box and white box testing. A software testing technique.
An introduction to Esterel and its compilation
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Controlling Execution Programming Right from the Start with Visual Basic.NET 1/e 8.
1 M. Tudruj, J. Borkowski, D. Kopanski Inter-Application Control Through Global States Monitoring On a Grid Polish-Japanese Institute of Information Technology,
© S. Ramesh / Kavi Arya / Krithi Ramamritham 1 IT-606 Embedded Systems (Software) S. Ramesh Kavi Arya Krithi Ramamritham KReSIT/ IIT Bombay.
Semantics In Text: Chapter 3.
A System to Generate Test Data and Symbolically Execute Programs Lori A. Clarke Presented by: Xia Cheng.
1 Control Flow Analysis Topic today Representation and Analysis Paper (Sections 1, 2) For next class: Read Representation and Analysis Paper (Section 3)
13 Aug 2013 Program Verification. Proofs about Programs Why make you study logic? Why make you do proofs? Because we want to prove properties of programs.
Theory and Practice of Software Testing
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.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Finding bugs with a constraint solver daniel jackson. mandana vaziri mit laboratory for computer science issta 2000.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
Credible Compilation With Pointers Martin Rinard and Darko Marinov Laboratory for Computer Science Massachusetts Institute of Technology.
Weakest Precondition of Unstructured Programs
COMP541 Sequential Logic – 2: Finite State Machines
Activity Diagrams.
Selection Statements.
Optimizations for Faster Execution of Esterel Programs
Presentation transcript:

“Software” Esterel Execution (work in progress) Dumitru POTOP-BUTUCARU Ecole des Mines de Paris

loop emit S ; pause end

»loop emit S ; pause end Start

loop »emit S ; pause end Start

loop emit S ; »pause end Start

loop emit S ; pause end Start

»loop emit S ; pause end Resume

loop emit S ; »pause end Resume

loop »emit S ; pause end Resume

loop emit S ; »pause end Resume

loop emit S ; pause end Resume

Overview Building an Intermediate Representation Giving it a (proper) meaning, based on existing semantics Some interesting classes of programs Simulation and tentative optimization

What Esterel Esterel v5 (with data) In this paper, examples without data

signal S  in emit S ; pause || present S then pause end

signal S  in emit S ; pause 1 || 3 present S then pause 2 end

Organizing Actions in a Graph »signal S  in emit S ; pause 1 || 3 present S then pause 2 end · start

Organizing Actions in a Graph signal S  in »emit S ; pause 1 || 3 »present S then pause 2 end   fork start enter 3 · ·

Organizing Actions in a Graph signal S + in emit S ; »pause 1 || 3 »present S then pause 2 end   fork S start enter 3 · ·

Organizing Actions in a Graph signal S + in emit S ; »pause 1 || 3 present S then »pause 2 end   fork S S start F T enter 3 · ·

Organizing Actions in a Graph signal S + in emit S ; pause 1 || 3 present S then »pause 2 end  p fork S S enter 1 start F T enter 3 · ·

Organizing Actions in a Graph signal S + in emit S ; pause 1 || 3 present S then pause 2 end p p fork S S enter 1 enter 2 start F T enter 3 · ·

Organizing Actions in a Graph signal S in emit S ; pause 1 || 3 present S then pause 2 end fork S S enter 1 enter 2 pause(1) term(2) pause(2) pause start F T enter 3 pause · join

Organizing Actions in a Graph »signal S in emit S ; pause 1 || 3 present S then pause 2 end term fork active 2 exit 1 exit 2 term(1) inactive(2) term(2) resume active 1 inactive(1) T T F F exit 3 term · fork S S enter 1 enter 2 pause(1) term(2) pause(2) pause start F T enter 3 pause join

Organizing Actions in a Graph signal S - in emit S ; »pause 1 || 3 present S then »pause 2 end   term fork active 2 exit 1 exit 2 term(1) inactive(2) term(2) resume active 1 inactive(1) T T F F exit 3 term · · F fork S S enter 1 enter 2 pause(1) term(2) pause(2) pause start F T enter 3 pause join

Organizing Actions in a Graph signal S - in emit S ; pause 1 || 3 present S then »pause 2 end t  term fork active 2 exit 1 exit 2 term(1) inactive(2) term(2) resume active 1 inactive(1) T T F F exit 3 term · · F fork S S enter 1 enter 2 pause(1) term(2) pause(2) pause start F T enter 3 pause join

Organizing Actions in a Graph signal S - in emit S ; pause 1 || 3 present S then pause 2 end t t term fork active 2 exit 1 exit 2 term(1) inactive(2) term(2) resume active 1 inactive(1) T T F F exit 3 term · · F fork S S enter 1 enter 2 pause(1) term(2) pause(2) pause start F T enter 3 pause join

Organizing Actions in a Graph signal S in emit S ; pause 1 || 3 present S then pause 2 end term fork active 2 exit 1 exit 2 term(1) inactive(2) term(2) resume active 1 inactive(1) T T F F exit 3 term · fork S S enter 1 enter 2 pause(1) term(2) pause(2) pause start F T enter 3 pause join

Intermediate format Vertices – represent computation –test –fork –join (parallel branch termination synchronizing) –emit –state/memory update action Edges – control flow and signal dependencies S S

State representation issues no state encoding decision yet intuitive semantics: –one boolean variable per pause and composed statement –all false, in the beginning –enter sets it to 1, exit sets it to 0 several possible encoding techniques optimization issues

Semantics 1.SOS rules (using Cannot auxiliary functions) - dynamic 2.CCFG-like semantics on the intermediate graph 3.Translation to Constructive Circuits – fine grained, static

SOS rules p’p’’ k, E’ E p’p 0, E’ E p’;qp;·qp;·q , E’ E k   {  } – completion code E:  S v  {0,1,  } – input event E’ – emitted signal or  p’, p’’ are terms over statement p

SOS rules signal S  in p’ endsignal S - in p’ end ,, E S  Cannot(p’) signal S  in p’ endsignal S + in p’’ end ,, E p’p’’ E  (S,  ) ,S,S CONSTRUCTIVE

CCFG-based semantics goal is sequential code generation graph interpreted as a classical flowchart limited class of programs related to intermediate representation of Stephen Edwards and of the CNET group graph acyclicity required lesser grain static

CCFG-based semantics signal S ,  in p’ endsignal S - in p’ end ,, E signal S ,  in p’ endsignal S ,+ in p’’ end ,, E p’p’’ E  (S,  ) ,S,S S  Cannot ’ (p’) signal S , + in p’ endsignal S + in p’ end ,, E S  Cannot ’ (p’)

S  Cannot(p’) CCFG view –all the signal emission statements have been ruled out by executed tests Constructive view –all the signal emission statements have been ruled out by either: executed tests not yet executed tests for which the test condition is already computed so that we can prune one of the test branches.

Acyclicity Can be defined on both intermediate graph and associated circuit Simple (cheap) correctness criteria for big programs Basis of static scheduling Problem: graph acyclicity is not the same as circuit acyclicity –what is a compilable program

Acyclicity discrepancy signal S in [ nothing || present I then nothing else present S then pause else pause end end present ]; emit S end signal fork S S I F T F T term(1) term(2) pause(2) term pause start

Acyclicity discrepancy signal S in [ nothing || present I then nothing else present S then pause else pause end end present ]; emit S end signal fork S S I F T F T term(1) term(2) pause(2) term pause start

Acyclicity discrepancy signal S in [ nothing || present I then nothing else present S then pause else pause end end present ]; emit S end signal S F T F T term pause start

Acyclicity discrepancy Possible solutions: –splitting the synchronizers with problems, and so borrow some expressive power from circuit semantics –duplicate cycle code based on the trigger or the problem test (improve the CCFG model)

acyclic circuit Compilable Program Classes acyclic CCFG

acyclic circuit Compilable Program Classes acyclic CCFG

Static analysis Graph arc removal in the circuit Results hold in CCFG, if the result is acyclic Problem: causality Some particular simplifications proved, like erasing dependencies based on state incompatibility

Static analysis What I would like to do fork S S I F T F T term(1) term(2) pause(2) term pause start ·

Static analysis What I would like to do fork S S I F T F T term(1) term(2) pause(2) term pause start ·

Static analysis What I would like to do fork S S I F T F T term(1) term(2) pause(2) term pause start ·

acyclic after simplif. acyclic circuit Compilable Program Classes acyclic CCFG

correct programs acyclic after simplif. Compilable Program Classes acyclic circuit acyclic CCFG

Cyclic specifications Proving correctness – not my goal Execution (Simulation)

Cyclic specifications 3-valued simulation Resynthesis of cyclic parts

3-valued simulation expensive, if applied to the entire circuit (Esterel simulation compiler) can be restricted to the nodes/arcs in SCCs, and maybe more doesn’t need expensive analysis at compile time doesn’t prove correctness knowledge about correctness can improve simulation (loop unrolling, no error handling code)

Implementation in progress…

The Esterel Langu p || q p ; q pause loop p end signal S in p end emit S present S then p else q end suspend p when S exit T trap T in p end

term Execution signal S in emit S ; pause || present S then pause end join fork S S update state update state pause(1) term(2) pause(2) pause start join fork active 1 update state update state term(1) inactive(2) term(2) resume active 2 inactive(1) T F T T F F update state update state term pause

Giving it a (proper) meaning Dynamic SOS rules (Gerard Berry, Can/Must predicates) Direct Concurrent Control-Flow Graph Execution? Translation to Constructive Circuits –nodes are increasing constructive functions and they can be evaluated several times, in order to obtain partial results (finer grain). –A signal is present once it has been emitted (weak synchronization, possible cycles) –Berry’s circuit translation (with non-essential changes)

Direct Concurrent Control-Flow Graph Execution –nodes are atomic operations that map Boolean inputs into Boolean outputs exactly once in an instant –all signal emission statements are either executed or tested out before signal tests (strong synchronization, acyclicity required) –related to Stephen Edwards’ and CNET’s compilers (?)

Concurrent Control-Flow Graph –good for sequential execution –restricts the class of accepted programs Constructive Circuit –good for circuit generation –implements the exact semantics of Esterel (proof in work)

Static analysis Graph arc removal in the circuit Results hold in CCFG, if the result is acyclic Basic idea: precompute Cannot –for signal arcs coming to a test: may be refined to use some form of synchronization –for control arcs Generalizes existing techniques, like graph coloring