Meta Optimization Improving Compiler Heuristics with Machine Learning Mark Stephenson, Una-May O’Reilly, Martin Martin, and Saman Amarasinghe MIT Computer.

Slides:



Advertisements
Similar presentations
Representing Hypothesis Operators Fitness Function Genetic Programming
Advertisements

P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
Architecture-dependent optimizations Functional units, delay slots and dependency analysis.
Using Parallel Genetic Algorithm in a Predictive Job Scheduling
Code Generation Steve Johnson. May 23, 2005Copyright (c) Stephen C. Johnson The Problem Given an expression tree and a machine architecture, generate.
CPSC 502, Lecture 15Slide 1 Introduction to Artificial Intelligence (AI) Computer Science cpsc502, Lecture 15 Nov, 1, 2011 Slide credit: C. Conati, S.
Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Mitigating the Compiler Optimization Phase- Ordering Problem using Machine Learning.
Biologically Inspired AI (mostly GAs). Some Examples of Biologically Inspired Computation Neural networks Evolutionary computation (e.g., genetic algorithms)
Online Performance Auditing Using Hot Optimizations Without Getting Burned Jeremy Lau (UCSD, IBM) Matthew Arnold (IBM) Michael Hind (IBM) Brad Calder (UCSD)
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
Imagine that I am in a good mood Imagine that I am going to give you some money ! In particular I am going to give you z dollars, after you tell me the.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science John Cavazos Architecture and Language Implementation Lab Thesis Seminar University.
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Genetic Algorithms Overview Genetic Algorithms: a gentle introduction –What are GAs –How do they work/ Why? –Critical issues Use in Data Mining –GAs.
Evolutionary algorithms
Adapting Convergent Scheduling Using Machine Learning Diego Puppin*, Mark Stephenson †, Una-May O’Reilly †, Martin Martin †, and Saman Amarasinghe † *
Cristian Urs and Ben Riveira. Introduction The article we chose focuses on improving the performance of Genetic Algorithms by: Use of predictive models.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Improved Gene Expression Programming to Solve the Inverse Problem for Ordinary Differential Equations Kangshun Li Professor, Ph.D Professor, Ph.D College.
Study on Genetic Network Programming (GNP) with Learning and Evolution Hirasawa laboratory, Artificial Intelligence section Information architecture field.
1 Advance Computer Architecture CSE 8383 Ranya Alawadhi.
ART – Artificial Reasoning Toolkit Evolving a complex system Marco Lamieri Spss training day
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
Genetic algorithms Charles Darwin "A man who dares to waste an hour of life has not discovered the value of life"
The Generational Control Model This is the control model that is traditionally used by GP systems. There are a distinct number of generations performed.
Predictive Design Space Exploration Using Genetically Programmed Response Surfaces Henry Cook Department of Electrical Engineering and Computer Science.
1/27 Discrete and Genetic Algorithms in Bioinformatics 許聞廉 中央研究院資訊所.
Evolving Virtual Creatures & Evolving 3D Morphology and Behavior by Competition Papers by Karl Sims Presented by Sarah Waziruddin.
Genetic Algorithms Introduction Advanced. Simple Genetic Algorithms: Introduction What is it? In a Nutshell References The Pseudo Code Illustrations Applications.
1 Machine Learning: Lecture 12 Genetic Algorithms (Based on Chapter 9 of Mitchell, T., Machine Learning, 1997)
Genetic Algorithms Siddhartha K. Shakya School of Computing. The Robert Gordon University Aberdeen, UK
Doshisha Univ., Kyoto, Japan CEC2003 Adaptive Temperature Schedule Determined by Genetic Algorithm for Parallel Simulated Annealing Doshisha University,
Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or.
Exact and heuristics algorithms
Improving Compiler Heuristics with Machine Learning Mark Stephenson Una-May O’Reilly Martin C. Martin Saman Amarasinghe Massachusetts Institute of Technology.
Optimization Problems
Automated discovery in math Machine learning techniques (GP, ILP, etc.) have been successfully applied in science Machine learning techniques (GP, ILP,
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
CISC Machine Learning for Solving Systems Problems Presented by: Eunjung Park Dept of Computer & Information Sciences University of Delaware Solutions.
Evolving RBF Networks via GP for Estimating Fitness Values using Surrogate Models Ahmed Kattan Edgar Galvan.
1 Autonomic Computer Systems Evolutionary Computation Pascal Paysan.
1 Contents 1. Basic Concepts 2. Algorithm 3. Practical considerations Genetic Algorithm (GA)
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science John Cavazos J Eliot B Moss Architecture and Language Implementation Lab University.
Agenda  INTRODUCTION  GENETIC ALGORITHMS  GENETIC ALGORITHMS FOR EXPLORING QUERY SPACE  SYSTEM ARCHITECTURE  THE EFFECT OF DIFFERENT MUTATION RATES.
Genetic Programming Using Simulated Natural Selection to Automatically Write Programs.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
Multi-cellular paradigm The molecular level can support self- replication (and self- repair). But we also need cells that can be designed to fit the specific.
Genetic Algorithms An Evolutionary Approach to Problem Solving.
Genetic Algorithm(GA)
Genetic Algorithm. Outline Motivation Genetic algorithms An illustrative example Hypothesis space search.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
Presented By: Farid, Alidoust Vahid, Akbari 18 th May IAUT University – Faculty.
Genetic (Evolutionary) Algorithms CEE 6410 David Rosenberg “Natural Selection or the Survival of the Fittest.” -- Charles Darwin.
1 Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm 3. Practical considerations.
Multi-variable non linear function deduction using Genetic Programming
Optimizing Compilers Background
Improving Compiler Heuristics with Machine Learning
CSC 380: Design and Analysis of Algorithms

Genetic Algorithms, Search Algorithms
Improving Compiler Heuristics with Machine Learning
Genetic Programming Applied to Compiler Optimization
Genetic Programming Applied to Compiler Optimization
Machine Learning: UNIT-4 CHAPTER-2
Rohan Yadav and Charles Yuan (rohany) (chenhuiy)
CSC 380: Design and Analysis of Algorithms
Coevolutionary Automated Software Correction
Presentation transcript:

Meta Optimization Improving Compiler Heuristics with Machine Learning Mark Stephenson, Una-May O’Reilly, Martin Martin, and Saman Amarasinghe MIT Computer Architecture Group Presented by Utku Aydonat

Motivation Compiler writers are faced with many challenges: –Many compiler problems are NP-hard –Modern architectures are inextricably complex Simple models can’t capture architecture intricacies –Micro-architectures change quickly

Motivation Heuristics alleviate complexity woes –Find good approximate solutions for a large class of applications –Find solutions quickly Unfortunately… –They require a lot of trial-and-error tweaking to achieve suitable performance –Fine tuning is a tedious process

Priority Functions A single priority or cost function often dictates the efficacy of a heuristic Priority Function: A function of the factors that affect a given problem Priority functions rank the options available to a compiler heuristic

Priority Functions Graph coloring register allocation (selecting nodes to spill) List scheduling (identifying instructions in worklist to schedule first) Hyperblock formation (selecting paths to include) Data Prefetching (inserting prefetch instructions)

List Scheduling

Machine Learning They propose using machine learning techniques to automatically search the priority function space –Feedback directed optimization –Find a function that works well for a broad range of applications –Needs to be applied only once

Generic Programming Modeled after Darwinism (Survival of the Fittest). Parse trees of operators and operands describe the potential priority functions. A population is a collection of parse trees for one generation. After testing, several members of the population are selected for reproduction via crossover, which swaps a random node from each of 2 parse trees. Other parse trees are selected for mutation, in which a random node is replaced by a random expression.

Generic Programming

Genetic Programming Create initial population (initial solutions) Evaluation Selection END Generation of variants (mutation and crossover) Generations < Limit?

Generic Programming The system selects the smaller of several expressions that are equally fit so that the parse trees do not grow exponentially. Tournament selection is used repeatedly to select parse trees for crossover. –Choose N expressions at random from the population and select the one with the highest fitness. Dynamic subset selection (DSS) is used to reduce fitness evaluations to achieve suitable solution.

Meta Optimization Just as with Natural Selection, the fittest individuals are more likely to survive and reproduce. Expressions creating fastest code are the fittest. Create 399 random expressions based on parameters. It also seeded with the compiler writer’s best guesses

Meta Optimization

Find predictable regions of control flow Prioritize paths based on several characteristics –The priority function we want to optimize Add paths to hyperblock in priority order Case Study I: Hyperblock Formation

Hyperblock Formation

Case Study I: IMPACT’s Function Favor frequently Executed paths Favor short paths Favor parallel paths Penalize paths with hazards

Hyperblock Formation What are the important characteristic of a hyperblock formation priority function? IMPACT uses four characteristics Extract all the characteristics you can think of and have a machine learning algorithm find the priority function

Hyperblock Formation x1 Maximum ops over pathsx2 Dependence height x3 Number of pathsx4 Number of operations x5 Does path have subroutine calls?x6 Number of branches x7 Does path have unsafe calls?x8 Path execution ratio x9 Does path have pointer derefs?x10 Average ops executed in path x11 Issue width of processorx12 Average predictability of branches in path …xN Predictability product of branches in path

Hyperblock Results Compiler Specialization compress g721encodeg721decode huff_dec huff_enc rawcaudiorawdaudio toast mpeg2dec Average Speedup Train data setAlternate data set

Hyperblock Results A General Purpose Priority Function

Cross Validation Testing General Purpose Applicability

Case Study II: Register Allocation A General Purpose Priority Function

Register Allocation Results Cross Validation

Case Study III: Prefetching A General Purpose Priority Function

Prefecthing Results Cross Validation

Conclusion Machine learning techniques can identify effective priority functions ‘Proof of concept’ by evolving three well known priority functions Human cycles v. computer cycles

My Conclusions Heuristics to improve heuristics –How to choose population size, mutation rate, tournament size? Does it guarantee better results? Requires a lot of experiments for the results to converge. –Do we have that opportunity? It is very effective for optimizing a specific application space.

Thank you!

(add (sub (mul exec_ratio_mean ) ) (mul (cmul (not has_pointer_deref) (mul num_paths) (mul (add (sub (mul (div num_ops dependence_height) ) exec_ratio) (sub (mul (cmul has_unsafe_jsr predict_product_mean ) (sub num_ops_max)) (sub (mul dependence_height_mean num_branches_max) num_paths))))))) GP Hyperblock Solutions General Purpose Intron that doesn’t affect solution

(add (sub (mul exec_ratio_mean ) ) (mul (cmul (not has_pointer_deref) (mul num_paths) (mul (add (sub (mul (div num_ops dependence_height) ) exec_ratio) (sub (mul (cmul has_unsafe_jsr predict_product_mean ) (sub num_ops_max)) (sub (mul dependence_height_mean num_branches_max) num_paths))))))) GP Hyperblock Solutions General Purpose Favor paths that don’t have pointer dereferences

GP Hyperblock Solutions General Purpose (add (sub (mul exec_ratio_mean ) ) (mul (cmul (not has_pointer_deref) (mul num_paths) (mul (add (sub (mul (div num_ops dependence_height) ) exec_ratio) (sub (mul (cmul has_unsafe_jsr predict_product_mean ) (sub num_ops_max)) (sub (mul dependence_height_mean num_branches_max) num_paths))))))) Favor highly parallel (fat) paths

GP Hyperblock Solutions General Purpose (add (sub (mul exec_ratio_mean ) ) (mul (cmul (not has_pointer_deref) (mul num_paths) (mul (add (sub (mul (div num_ops dependence_height) ) exec_ratio) (sub (mul (cmul has_unsafe_jsr predict_product_mean ) (sub num_ops_max)) (sub (mul dependence_height_mean num_branches_max) num_paths))))))) If a path calls a subroutine that may have side effects, penalize it

Case Study I: IMPACT’s Algorithm A B C E F G 4k24k 4k22k2k 25 28k D 10 Pathexechazopsdeppr A-B-D-F-G~ ~0 A-B-F-G A-C-F-G A-C-E-F-G A-C-E-G~ ~0

Case Study I: IMPACT’s Algorithm A B C E F G 4k24k 4k22k2k 25 28k D 10 Pathexechazopsdeppr A-B-D-F-G~ ~0 A-B-F-G A-C-F-G A-C-E-F-G A-C-E-G~ ~0