Constructing an Optimisation Phase Using Grammatical Evolution. Brad Alexander and Michael Gratton

Similar documents
Genetic Algorithms. Kang Zheng Karl Schober

Introduction to Evolutionary Computation

ADAPTATION OF REPRESENTATION IN GP

Santa Fe Trail Problem Solution Using Grammatical Evolution

Automated Program Repair through the Evolution of Assembly Code

Computer Science, UCL, London

Mutations for Permutations

Hugh Leather, Edwin Bonilla, Michael O'Boyle

Introduction to Genetic Algorithms. Based on Chapter 10 of Marsland Chapter 9 of Mitchell

Multi-Objective Pipe Smoothing Genetic Algorithm For Water Distribution Network Design

A Genetic Algorithm for Graph Matching using Graph Node Characteristics 1 2

Genetic improvement of software: a case study

Genetic Algorithms and Genetic Programming. Lecture 9: (23/10/09)

Multiobjective Job-Shop Scheduling With Genetic Algorithms Using a New Representation and Standard Uniform Crossover

Evolutionary Computation

Introduction to Genetic Algorithms

Reducing Graphic Conflict In Scale Reduced Maps Using A Genetic Algorithm

Test Case Generation for Classes in Objects-Oriented Programming Using Grammatical Evolution

Artificial Intelligence Application (Genetic Algorithm)

Genetic Programming Prof. Thomas Bäck Nat Evur ol al ut ic o om nar put y Aling go rg it roup hms Genetic Programming 1

ATHENA Manual. Table of Contents...1 Introduction...1 Example...1 Input Files...2 Algorithms...7 Sample files...8

Software Vulnerability

CHAPTER 5 ENERGY MANAGEMENT USING FUZZY GENETIC APPROACH IN WSN

Compiler Construction 2010/2011 Loop Optimizations

A GENETIC ALGORITHM FOR CLUSTERING ON VERY LARGE DATA SETS

Robust Gene Expression Programming

Genetic Algorithms: Setting Parmeters and Incorporating Constraints OUTLINE OF TOPICS: 1. Setting GA parameters. 2. Constraint Handling (two methods)

Genetic Programming. Genetic Programming. Genetic Programming. Genetic Programming. Genetic Programming. Genetic Programming

Lecture 6: Genetic Algorithm. An Introduction to Meta-Heuristics, Produced by Qiangfu Zhao (Since 2012), All rights reserved

EVOLVING LEGO. Exploring the impact of alternative encodings on the performance of evolutionary algorithms. 1. Introduction

Overcompressing JPEG images with Evolution Algorithms

JEvolution: Evolutionary Algorithms in Java

A Memetic Genetic Program for Knowledge Discovery

Evolutionary Computation. Chao Lan

Artificial Neural Network based Curve Prediction

CHAPTER 6 REAL-VALUED GENETIC ALGORITHMS

Heuristic Optimisation

METAHEURISTIC. Jacques A. Ferland Department of Informatique and Recherche Opérationnelle Université de Montréal.

Computational Intelligence

Genetic Improvement Programming

Genetic L-System Programming: Breeding and Evolving Artificial Flowers with Mathematica

A Case Study on Grammatical-based Representation for Regular Expression Evolution

Fast Searches for Effective Optimization Phase Sequences

Heuristic Optimisation

Distinguishing genotype and phenotype in genetic programming

Evolving Variable-Ordering Heuristics for Constrained Optimisation

Evolutionary Algorithms. CS Evolutionary Algorithms 1

GENETIC ALGORITHM with Hands-On exercise

Coevolution of Simulator Proxies and Sampling Strategies for Petroleum Reservoir Modeling

3DUDOOHO*UDPPDWLFDO(YROXWLRQ

Optimal Facility Layout Problem Solution Using Genetic Algorithm

Outline. Motivation. Introduction of GAs. Genetic Algorithm 9/7/2017. Motivation Genetic algorithms An illustrative example Hypothesis space search

Approach Using Genetic Algorithm for Intrusion Detection System

Application of Genetic Algorithms to CFD. Cameron McCartney

Multi Expression Programming. Mihai Oltean

A Systematic Study of Automated Program Repair: Fixing 55 out of 105 Bugs for $8 Each

Introduction to Optimization

CS5401 FS2015 Exam 1 Key

Woody Plants Model Recognition by Differential Evolution

Evolving SQL Queries for Data Mining

Introduction to Optimization

CHAPTER 5. CHE BASED SoPC FOR EVOLVABLE HARDWARE

Automating Test Driven Development with Grammatical Evolution

HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS

ML phylogenetic inference and GARLI. Derrick Zwickl. University of Arizona (and University of Kansas) Workshop on Molecular Evolution 2015

Genetic Programming. and its use for learning Concepts in Description Logics

Genetic Algorithms for Solving. Open Shop Scheduling Problems. Sami Khuri and Sowmya Rao Miryala. San Jose State University.

How Santa Fe Ants Evolve

Hybridization EVOLUTIONARY COMPUTING. Reasons for Hybridization - 1. Naming. Reasons for Hybridization - 3. Reasons for Hybridization - 2

Evaluating Heuristic Optimization Phase Order Search Algorithms

Evolutionary design for the behaviour of cellular automaton-based complex systems

Evolving Human Competitive Research Spectra-Based Note Fault Localisation Techniques

Compiler Construction 2016/2017 Loop Optimizations

Data Mining Chapter 8: Search and Optimization Methods Fall 2011 Ming Li Department of Computer Science and Technology Nanjing University

Genetic Algorithms for Vision and Pattern Recognition

Optimization of Benchmark Functions Using Genetic Algorithm

Genetic Algorithms. Chapter 3

Vulnerability of machine learning models to adversarial examples

Suppose you have a problem You don t know how to solve it What can you do? Can you use a computer to somehow find a solution for you?

Crew Scheduling Problem: A Column Generation Approach Improved by a Genetic Algorithm. Santos and Mateus (2007)

Kyrre Glette INF3490 Evolvable Hardware Cartesian Genetic Programming

Machine Evolution. Machine Evolution. Let s look at. Machine Evolution. Machine Evolution. Machine Evolution. Machine Evolution

METAHEURISTICS Genetic Algorithm

Genetic Algorithms. PHY 604: Computational Methods in Physics and Astrophysics II

Applied Cloning Techniques for a Genetic Algorithm Used in Evolvable Hardware Design

Telecommunication and Informatics University of North Carolina, Technical University of Gdansk Charlotte, NC 28223, USA

The Genetic Algorithm for finding the maxima of single-variable functions

Genetic programming. Lecture Genetic Programming. LISP as a GP language. LISP structure. S-expressions

Solving the Symbolic R egr es sion Pr oblem w ith T re e -A djunc t Gr ammar Guided Genetic Pr ogr amming: T he Compar ative Re sults

Genetic Algorithms. Genetic Algorithms

Autotuning. John Cavazos. University of Delaware UNIVERSITY OF DELAWARE COMPUTER & INFORMATION SCIENCES DEPARTMENT

Job Shop Scheduling Problem (JSSP) Genetic Algorithms Critical Block and DG distance Neighbourhood Search

An empirical study of the efficiency of learning boolean functions using a Cartesian Genetic Programming approach

1. Introduction. 2. Motivation and Problem Definition. Volume 8 Issue 2, February Susmita Mohapatra

DERIVATIVE-FREE OPTIMIZATION

Evolving Efficient Security Systems Under Budget Constraints Using Genetic Algorithms

A Comparison of Several Linear Genetic Programming Techniques

Introduction to Compilers

GA is the most popular population based heuristic algorithm since it was developed by Holland in 1975 [1]. This algorithm runs faster and requires les

Chapter 14 Global Search Algorithms

Transcription:

Constructing an Optimisation Phase Using Grammatical Evolution Brad Alexander and Michael Gratton

Outline Problem Experimental Aim Ingredients Experimental Setup Experimental Results Conclusions/Future Work

Problem Optimising compilers work in a complex design space. Difficult for the author of the optimiser configure well for all applications. Static design is always a compromise. A Solution: automatically adapt the optimiser to the set of programs it compiles! Problem: the design space is huge and chaotic however, can search this space using heuristic methods. Problem

Phase seqencing Loop Invariant Hoisting Common Subexpression Elimination Dead Code Elimination Block Reordering

Phase seqencing Common Subexpression Elimination Loop Invariant Hoisting Dead Code Elimination Block Reordering

Phase seqencing Common Subexpression Elimination Block Reordering Dead Code Elimination Loop Invariant Hoisting

Phase seqencing Dead Code Elimination Block Reordering Common Subexpression Elimination Loop Invariant Hoisting

Phase seqencing Dead Code Elimination Block Reordering Common Subexpression Elimination Loop Invariant Hoisting

Parameter Tuning Loop unroll factor: Loop tiling factor: 3 2

Parameter Tuning Loop unroll factor: Loop tiling factor: 4 3

Evolution of Control Code Register Allocation

Evolution of Control Code if( reg_size > & spill_cost ) Register Allocation

Evolution of Control Code Register Allocation if( reg_size > & spill_cost )

Experimental Aim All current work assumes that optimisation phases are pre-existing and atomic or parametric. Currently no work on the construction of these phases from smaller components. Aim of this experiment is a proof of concept: To attempt to build a safe, substantial, and effective optimisation phase using heuristic search. We use Grammatical Evolution (GE) a form of Genetic Programming (GP). The genotype to phenotype encoding in GE constrains the population to syntactically correct individuals. Experimental Aim

Experimental Application Evolution of a phase of a compiler mapping a functional language (Adl) to a hardware definition language (Bluespec). The target phase is the Data Movement Optimiser (DMO) that reduces data flowing through a functional intermediate form (point-free code). There is an extant hand-written DMO that: was non-trivial to construct. can be used as a source of building blocks. can be used as a benchmark The DMO is written in Stratego, a term-rewriting language consisting of rewrite rules and strategies for their application. Experimental Aim

Ingredients Three ingredients in any GP exercise: 1. The language grammar consisting of: terminals non terminals 2. The evolutionary framework. 3. The evaluation function We look at these in turn. Ingredients

The Language Grammar (1) All individuals are expressed in Stratego Terminals Consist of simple rewrite rules e.g. CompIntoMap: f* g* (f g)* MapIntoComp: (f g)* f* g* RemoveId: id f f grouped together using the left choice (<+) operator e.g. CompIntoMap <+ RemoveId Semantics: try applying CompIntoMap to current node and, if that fails, try applying RemoveId. We use the same terminals as the handwritten DMO Ingredients

The Language Grammar (2) Actual terminals include: pushdownmap pushdowncomp simp leftassociate (vectorise) (fuse loops) (apply simplifying rules) (left associate binary composition) In most contexts, the order of rules within a group is of minor consequence If they can be applied they eventually will be applied. These terminals have little impact without strategies to apply them. Ingredients

The Language Grammar (3) Non-terminals are strategies for rule application. These take strategies or rule-groups as parameters and apply the them to the target AST in some order. Examples include: bottomup(s) : apply s to the current sub-tree bottomup innermost(s) : apply s to the current sub-tree bottomup until it can no longer be applied (fixpoint strategy) s ; t : apply s to current sub-tree followed by t repeatuntilcycle(s) : apply s to the current sub-tree until a result seen before in this invocation is detected. Example: bottomup(leftassociate;innermost(simp)) Ingredients

The Evolutionary Framework We used LibGE in our experiments. A popular framework for developing GE applications. LibGE (based on LibGA) takes: A grammar definition and, A fitness function Some parameter settings and handles: Population initialisation, application of the fitness function to individuals, application of genetic operators, collection of statistics and, genotype to phenotype mapping. The mapping works by using 8-bit numbers in the genotype string to select productions in the language grammar. Ingredients

Fitness Function(1) Fitness is calculated by running evolved optimisers against up to six benchmark programs and their data against a dynamic cost-model. Benchmarks needed to be carefully chosen to require multiple strategies and have a gradual gradient of difficulty. Fitness calculated relative to cost of hand-coded DMO on each benchmark i (cost_opt i ): Average fitness evaluation takes 5 seconds. Zero fitness for timeout or stack-overflow error. Ingredients

Hand Coded Benchmark: Fitness Function(2) Ingredients

Experimental Setup All grammar elements pre-compiled into stratego libraries for faster running. Several runs conducted to tune fitness function. Final two runs: Population approximately 250 individuals Run for 80 generations and 63 generations respectively. LibGE settings: Max tree depth 15. Read of genome can wrap-around twice. Mostly default LibGA settings (for GE): Roulette wheel selection, 90% probability of crossover, 1% mutation probability, 1% replacement ratio and elitism switched on. Experimental Setup

Experimental Results (1) Both runs evolved individuals at least as good as the handwritten DMO s on the benchmarks. Experimental Results

Experimental Results (2) Robustness Take the fittest individuals and expose them to thirty benchmarks and measure their performances. Most did not generalise well but the fittest did slightly better than hand coded optimiser. Correctness 500 fittest individuals collected and tested. None produced semantic errors. Code Size Best individuals very large with much redundancy. Experimental Results

Conclusions and Future Work Evolving a non-trivial optimisation phase is feasible Good results for effectiveness, robustness and correctness. Future work includes: Pushing evolutionary process down to individual rules Controlling code-size and efficiency. Extending work to rewriting systems in other languages. Conclusions