Chia-Chiao Ho T OWARD OPTIMIZED CODE GENERATION THROUGH MODEL - BASED OPTIMIZATION 2010/9/24 1 CCU CSIE ESL Group Meeting Presentation Authors: Asma Charfi.

Slides:



Advertisements
Similar presentations
CPSC 388 – Compiler Design and Construction
Advertisements

FAA-Qualifiable Ada Subset Compiler V. Santhanam Boeing.
Model Driven Generative Programming Reza Azimi February 6, 2003 ECE1770: Trends in Middleware Systems.
TP4: S TATE M ACHINE D ESIGN P ATTERN  Definition  Infrastructure  Transition Code  Conclusion.
Zhiguo Ge, Weng-Fai Wong, and Hock-Beng Lim Proceedings of the Design, Automation, and Test in Europe Conference, 2007 (DATE’07) April /4/17.
1 Translation Validation: From Simulink to C Michael RyabtsevOfer Strichman Technion, Haifa, Israel Acknowledgement: sponsored by a grant from General.
Program Representations. Representing programs Goals.
M ODELLING AND A NALYZING BASED ON AADL OSATE VERSUS STOOD Farhana Rahman, Carleton University Yu Sun, University of Ottawa.
A Brief Introduction. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Fast Paths in Concurrent Programs Wen Xu, Princeton University Sanjeev Kumar, Intel Labs. Kai Li, Princeton University.
Modern Compiler Internal Representations Silvius Rus 1/23/2002.
Common Sub-expression Elim Want to compute when an expression is available in a var Domain:
Representing programs Goals. Representing programs Primary goals –analysis is easy and effective just a few cases to handle directly link related things.
Scheduling Reusable Instructions for Power Reduction J.S. Hu, N. Vijaykrishnan, S. Kim, M. Kandemir, and M.J. Irwin Proceedings of the Design, Automation.
Reference Book: Modern Compiler Design by Grune, Bal, Jacobs and Langendoen Wiley 2000.
Executable UML By Luca Pellicoro. Definitions Acronym: xtUML or xUML Technology where models (such as state diagrams and class diagrams) are automatically.
Recap from last time: live variables x := 5 y := x + 2 x := x + 1 y := x y...
Direction of analysis Although constraints are not directional, flow functions are All flow functions we have seen so far are in the forward direction.
UML class diagrams (1) UML = Unified Modeling Language We use only class diagrams, not other UML diagrams Purpose: –keep OO concepts separate from implementation.
Introduction & Overview CS4533 from Cooper & Torczon.
© 2008 IBM Corporation Behavioral Models for Software Development Andrei Kirshin, Dolev Dotan, Alan Hartman January 2008.
SOFTWARE REVERSE ENGINEERING
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.
Precision Going back to constant prop, in what cases would we lose precision?
Model-Driven User Requirements Specification using SysML Authors: Michel dos Santos Soares, Jos Vrancken Source: Journal of Software(JSW), Vol. 3, No.
CS 350 Operating Systems & Programming Languages Ethan Race Oren Rasekh Christopher Roberts Christopher Rogers Anthony Simon Benjamin Ramos.
1 Web Based Programming Section 6 James King 12 August 2003.
September 7, September 7, 2015September 7, 2015September 7, 2015 Azusa, CA Sheldon X. Liang Ph. D. Computer Science at Azusa Pacific University.
University of Kansas Electrical Engineering Computer Science Jerry James and Douglas Niehaus Information and Telecommunication Technology Center Electrical.
Automatic Identification of Concurrency in Handel-C Joseph C Libby, Kenneth B Kent, Farnaz Gharibian Faculty of Computer Science University of New Brunswick.
© 2009 IBM Corporation Verification of embedded system specifications using collaborative simulation of SysML and Simulink models Ryo Kawahara*, Hiroaki.
Introduction to MDA (Model Driven Architecture) CYT.
J-OCM is a system for monitoring distributed Java applications conforming to OMIS specification with J-OMIS extensions. It is used to: gather information.
Introduction to Compiler Construction Robert van Engelen COP5621 Compiler Construction Copyright Robert.
1 Fly – A Modifiable Hardware Compiler C. H. Ho 1, P.H.W. Leong 1, K.H. Tsoi 1, R. Ludewig 2, P. Zipf 2, A.G. Oritz 2 and M. Glesner 2 1 Department of.
Model Driven Development An introduction. Overview Using Models Using Models in Software Feasibility of MDA MDA Technologies The Unified Modeling Language.
1 Optimizing compiler tools and building blocks project Alexander Drozdov, PhD Sergey Novikov, PhD.
CPSC 871 John D. McGregor Module 7 Session 1 More UML.
Verification of behavioural elements of UML models using B Truong, Ninh-Thuan and Souquieres, Jeanine In Proceedings of the 2005 ACM Symposium on.
Paper written by Brian Berenbach Presentation by Matthew Merricks.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
Laboratory of Model Driven Engineering for Embedded Systems An Execution Framework for MARTE-based Models UML&AADL’2008 workshop Belfast, Northern Ireland.
Compiler Design Introduction 1. 2 Course Outline Introduction to Compiling Lexical Analysis Syntax Analysis –Context Free Grammars –Top-Down Parsing –Bottom-Up.
CIM LAB MEETING Presentation on UML Rakesh Mopidevi Kwangyeol Ryu.
Compiler Introduction 1 Kavita Patel. Outlines 2  1.1 What Do Compilers Do?  1.2 The Structure of a Compiler  1.3 Compilation Process  1.4 Phases.
Generating Software Documentation in Use Case Maps from Filtered Execution Traces Edna Braun, Daniel Amyot, Timothy Lethbridge University of Ottawa, Canada.
October 1st 2015 Alexis Fouché 1, Florian Noyrit 1, Sébastien Gérard 1, Maged Elaasar 2 SYSTEMATIC GENERATION OF STANDARD COMPLIANT TOOL SUPPORT OF DIAGRAMMATIC.
SAFEWARE System Safety and Computers Chap18:Verification of Safety Author : Nancy G. Leveson University of Washington 1995 by Addison-Wesley Publishing.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
SwA Co-Chair and Task Lead Strategy Session Agenda Technology, Tools and Product Evaluation Working Group Status Briefing Co-Chair(s) Michael Kass (NIST),
Software Development Introduction
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
UML Course Instructor: Rizwana Noor. Overview  Modeling  What is UML?  Why UML?  UML Diagrams  Use Case  Components  Relationships  Notations.
Andrey Karaulov, Alexander Strabykin Institute for System Programming Russian Academy of Sciences SYRCoSE: Spring Young Researchers Colloquium on Software.
Compiler Construction CPCS302 Dr. Manal Abdulaziz.
Chapter – 8 Software Tools.
Introduction To Software Development Environment.
Chapter 1 Introduction Samuel College of Computer Science & Technology Harbin Engineering University.
PRINCIPLES OF COMPILER DESIGN
Introduction to Compiler Construction
Language Translation Compilation vs. interpretation.
Systems Analysis and Design With UML 2
Entry Ticket: High and Low Level Languages
Behavioral Models for Software Development
A. P. Shah Institute of Technology
Computer Programming Machine and Assembly.
Towards Automatic Model Synchronization from Model Transformation
Introduction.
Intermediate Code Generating machine-independent intermediate form.
Presentation transcript:

Chia-Chiao Ho T OWARD OPTIMIZED CODE GENERATION THROUGH MODEL - BASED OPTIMIZATION 2010/9/24 1 CCU CSIE ESL Group Meeting Presentation Authors: Asma Charfi * Chokri Mraidha * Sébastien Gérard * François Terrier * Pierre Boulet ** * CEA, LIST, Laboratory of model driven engineering for embedded systems ** Université Lille 1, Sciences et Technologies Published on Design, Automation & Test in Europe Conference & Exhibition (DATE), 2010

O UTLINE Introduction Model-based Development For RTES Design Experimental Studies Exploiting UML Semantics For Optimization Conclusion 2010/9/24 2 CCU CSIE ESL Group Meeting Presentation

I NTRODUCTION Model-based Development (MBD) Using model to design systems Offer an higher level of abstraction 2010/9/24 3 CCU CSIE ESL Group Meeting Presentation

I NTRODUCTION ( CONT.) Real-Time and Embedded System (RTES) become more complex and along with limited resources. With automatic code generation tools, MBD brings: Increasing productivity Enhancing source code consistency Intending to improving the performance In this paper, we are going to examine the possibility of model-based optimization 2010/9/24 4 CCU CSIE ESL Group Meeting Presentation

O UTLINE Introduction Model-based Development For RTES Design Experimental Studies Exploiting UML Semantics For Optimization Conclusion 2010/9/24 5 CCU CSIE ESL Group Meeting Presentation

M ODEL - BASED D EVELOPMENT F OR RTES D ESIGN 3 Steps to develop a RTES 1. Building models Design with Unified Model Language (UML) 2. Code generation Compile models to C/C++, Java, etc. 3. Code Compilation and Optimization Use GCC Compiler and it’s Optimization Options. 2010/9/24 6 CCU CSIE ESL Group Meeting Presentation

R AISING THE LEVEL OF ABSTRACTION IN RTES DESIGN With UML, we can describe a basic system model. But RTES needs more specific descriptions for modeling and analysis. Modeling and Analysis of Real-Time and Embedded (MARTE) is an extended profile for UML, using for annotating models with required information Thus, it’s possible for automatic code generation. 2010/9/24 7 CCU CSIE ESL Group Meeting Presentation

G ENERATING CODE FROM UML MODELS Before adding Activities and Actions packages into UML2, Designer need to complete the code or it can’t be compiled. Now it’s possible to make code generation from UML2 models a fully automatable step. 2010/9/24 8 CCU CSIE ESL Group Meeting Presentation

C OMPILATION AND OPTIMIZATION GCC provides –O1, -O2, -O3 and other optimization options. In this paper, code size is the optimized target for RTES. –Os option is used here. Before GCC 4.0, Register transfer language (RTL) optimization is used. Low level optimization GCC 4.0 now using Static single assignment (SSA) optimization. High level optimization 2010/9/24 9 CCU CSIE ESL Group Meeting Presentation

O UTLINE Introduction Model-based Development For RTES Design Experimental Studies Exploiting UML Semantics For Optimization Conclusion 2010/9/24 10 CCU CSIE ESL Group Meeting Presentation

E XPERIMENTAL S TUDIES For showing relying only on compiler optimizations is not enough. There are two examples later demonstrate the shortages of compiler optimizations. 2010/9/24 11 CCU CSIE ESL Group Meeting Presentation

B UILDING STATE MACHINE DIAGRAM This paper uses Papyrus as their tool to design state machine diagram. 2010/9/24 12 CCU CSIE ESL Group Meeting Presentation

E XAMPLE 1: NO ENTRY TRANSITION 2010/9/24 13 CCU CSIE ESL Group Meeting Presentation

E XAMPLE 2: COMPLETION TRANSITION 2010/9/24 14 CCU CSIE ESL Group Meeting Presentation

G ENERATING THE C++ CODE FROM UML STATE MACHINE State Pattern A state is implemented as a class. State Table Transition A 2-D table describing the relation between states and events Nested Switch Case Statement having an outer case statement that selects the current state and an inner case statement that selects the appropriate behavior given the type of the received event 2010/9/24 15 CCU CSIE ESL Group Meeting Presentation

C OMPILING AND OPTIMIZING THE GENERATED CODE USING GCC With option –Os, GCC is not able to remove unreachable states. The authors uses a optimization tool to remove the unreachable states. The first example exists a state with no incoming transition. The second example shows a completion transition. Both can’t be optimized by the compiler in code size 2010/9/24 16 CCU CSIE ESL Group Meeting Presentation

O PTIMIZED R ESULTS Required Optimization Code Size(Before) Code Size(After) Optimization Rate Remove unreachable state bytes11393 bytes10.07% Remove transition originated from state that have a completion transition bytes26379 bytes45.90% 2010/9/24 17 CCU CSIE ESL Group Meeting Presentation

R ESULTS INTERPRETATION The semantics lost in code generation, thus large improvement after optimizing from model level in 3 implementations. 2010/9/24 18 CCU CSIE ESL Group Meeting Presentation

O UTLINE Introduction Model-based Development For RTES Design Experimental Studies Exploiting UML Semantics For Optimization Conclusion 2010/9/24 19 CCU CSIE ESL Group Meeting Presentation

B EFORE CODE GENERATION The model level optimization is higher than SSA in GCC optimization. The CFG is produced twice before the code generation and in compilation. 2010/9/24 20 CCU CSIE ESL Group Meeting Presentation

D URING CODE GENERATION The model debugging is unable to debug with removed state. 2010/9/24 21 CCU CSIE ESL Group Meeting Presentation

A FTER CODE GENERATION The UML semantics are visible to the compiler 2010/9/24 22 CCU CSIE ESL Group Meeting Presentation

O UTLINE Introduction Model-based Development For RTES Design Experimental Studies Exploiting UML Semantics For Optimization Conclusion 2010/9/24 23 CCU CSIE ESL Group Meeting Presentation

C ONCLUSION Due to the loss of some UML semantics during the code generation, the GCC is unable to do optimization in MBD way. The higher model-based optimization is useful in the experiment. The future work is to develop a complete tool to generate assembly code, instead of high level language. Avoid the unnecessary use of two high level languages. 2010/9/24 24 CCU CSIE ESL Group Meeting Presentation

T HANK Y OU F OR Y OUR A TTENTION ! 2010/9/24 25 CCU CSIE ESL Group Meeting Presentation

MARTE UML Profile for Modeling and Analysis of Real-Time and Embedded systems /9/24 26 CCU CSIE ESL Group Meeting Presentation

C ODE GENERATION PATTERNS State Pattern State Transition Table _table Nested Switch Case Statements or/niaz_doctor.pdf 2010/9/24 27 CCU CSIE ESL Group Meeting Presentation

RTL AND SSA Register transfer language r_language#RTL_in_GCC Static single assignment signment_form 2010/9/24 28 CCU CSIE ESL Group Meeting Presentation