310 likes | 502 Views
Mitigating the Compiler Optimization Phase-Ordering Problem using Machine Learning . Sameer Kulkarni John Cavazos. Introduction to Phase Ordering Present State-of-the-Art Proposed Solution Understand code Predict optimization An example Results Questions. What is Phase Ordering?.
E N D
Mitigating the Compiler Optimization Phase-Ordering Problem using Machine Learning Sameer Kulkarni John Cavazos
Introduction to Phase Ordering Present State-of-the-Art Proposed Solution • Understand code • Predict optimization An example Results Questions
What is Phase Ordering? Change ordering of a given set optimizations
Why is it important? • Plethora of optimizations to choose. • All interact with each other • Register Allocation & Instruction Scheduling • Loop Unrolling & CSE • Branch Optimization & Static Analysis
Introduction to Phase Ordering Present State-of-the-Art Proposed Solution • Understand code • Predict optimization An example Results Questions
Present Solutions • Developer’s intuition • Using a static sequence using search • Pseudo Random Search (ML) • Hill Climbing, • Genetic Algorithm
Using Genetic Algorithms… Generation 1 Generation 2
Disadvantages of State-of-art • One size fits all approach • Change in Compiler • Change in Architecture • Change in Code • Expensive Search
A simple experiment Select a set of optimizations, and set a sequence length Generate 500 random sequences Use each of the optimization sequence to compile and run a set of benchmarks
Introduction to Phase Ordering Present State-of-the-Art Proposed Solution • Understand code • Predict optimization An example Results Questions
Static Source Code Features • Method level information • Instruction Mix • conditionals • memory ops • size • locals space
Static Source Code Features • Method level information • Instruction Mix • conditionals • memory ops • size • locals space
Neuro Evolution of Augmented Topologies Evolutionary approach to ANNs Starts with a minimally connected network
Using NEAT… Generation n Generation 1 Generation 2
Introduction to Phase Ordering Present State-of-the-Art Proposed Solution • Understand code • Predict optimization An example Results Questions
scimark.lubencmark Generated by default O3 Generated by NEAT
Advantages • Source code agnostic • Customized optimization sequence • Train once, use every-time • Elegant stopping criteria • Optimization sequence length is not static • Saves time by intelligent selection
Introduction to Phase Ordering Present State-of-the-Art Proposed Solution • Understand code • Predict optimization An example Results Questions
Results on SpecJVM98 Speedup normalized over O3
Results on SpecJVM2008 Speedup normalized over O3
Results on DaCapo Speedup normalized over O3
Mitigating the Compiler Optimization Phase-Ordering Problem using Machine Learning Thank you!