By Namita Dave Overview What are compiler optimizations Challenges with optimizations Current Solutions Machine learning techniques Structure of Adaptive compilers Introduction O ptimization ID: 572882
Download Presentation The PPT/PDF document "Machine Learning in Compiler Optimizatio..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Machine Learning in Compiler Optimization
By Namita DaveSlide2
Overview
What are compiler optimizations?
Challenges with optimizations
Current Solutions
Machine learning techniques
Structure of Adaptive compilersSlide3
Introduction
O
ptimization
refers to process of modifying to achieve maximum efficiency in terms of storage, cost or time.
Machine learning techniques can be effectively used for optimizing based on specifics of program and target platformSlide4
Challenges
Inherently hard Problems
Interactions between optimizationsSlide5
Inherently hard problems
Due to the interaction of compiler optimization with the hardware
Example – Register allocationSlide6
Interaction between optimizations
There can be positive or negative interactions
It depends in the order in which optimizations are applied
Positive Interaction Example
GCSE and
L
oop unrolling
Negative interaction example
Instruction scheduling and Register allocationSlide7
Instruction Scheduling vs
Register Allocation
z = x[
i
]
tmp
= x[i+1+n]
Pre pass Post PassSlide8
Current Solutions
Employ Heuristics
To decide whether to apply an optimization or not
Example – In lining decisions
Phase ordering
To decide the sequence of optimizations so as to minimize negative interactionsSlide9
Typical Optimizing compilerSlide10
Problem?
Compiler Heuristics and Phase ordering is manual and predetermined
The solution needs to be dependent on specifics of program and the target platformSlide11
Solution
Using machine learning techniques, a near optimal solution can be developed.Slide12
Heuristic selection
Machine learning techniques like supervised classification, function approximation and function selection can be employed for heuristic selection
Example
Supervised classification can be used to predict best unroll loop factor
Genetic programming can be used for learning priority functionsSlide13
Automatic Phase Ordering
Unsupervised learning techniques can automate phase ordering
Based on the notion of similarity of programs
Offline training data can be used to identify a set of best phase orderings for similar programs
Based on feature vectors, similar programs can be found for a given new programSlide14
Structure of Adaptive compilerSlide15
Thank You