mitigating the compiler optimization phase-ordering problem using machine learning
DESCRIPTION
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?. - PowerPoint PPT PresentationTRANSCRIPT
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Mitigating the Compiler Optimization Phase-Ordering
Problem using Machine Learning
Sameer KulkarniJohn Cavazos
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
• Introduction to Phase Ordering
• Present State-of-the-Art• Proposed Solution
• Understand code• Predict optimization
• An example• Results• Questions
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
What is Phase Ordering? Change ordering of a given set
optimizationsOpt. 1
Opt. 2
Opt. 3
Opt. 4
Opt. 1
Opt. 3
Opt. 2
Opt. 4
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
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
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
• Introduction to Phase Ordering
• Present State-of-the-Art• Proposed Solution
• Understand code• Predict optimization
• An example• Results• Questions
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Present Solutions Developer’s intuition Using a static sequence using
search Pseudo Random Search (ML)
Hill Climbing, Genetic Algorithm
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Generation 1
Generation 2
Using Genetic Algorithms…
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Disadvantages of State-of-art One size fits all approach
Change in Compiler Change in Architecture Change in Code
Expensive Search
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
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
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
javac
mpega
udio jac
k
raytr
ace
jess
compr
ess
SOR
Serie
s
LUFac
tCry
pt
HeapS
ort
SpM
atmult
FFT
Avera
ge0.95
1
1.05
1.1
1.15
1.2
1.25Effects of static vs dynamic sequence
Best overall Sequence Best Sequence per benchmark
Spee
dup
norm
aliz
ed t
o O
3
SPECjvm 98 Grande
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
• Introduction to Phase Ordering
• Present State-of-the-Art• Proposed Solution
• Understand code• Predict optimization
• An example• Results• Questions
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Proposed Solution
Analyze Code
Predict best
optimization
End optimizati
ons?
Apply Optimizati
on
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Static Source Code Features Method level
information Instruction
Mix conditionals memory ops size locals space
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Static Source Code Features Method level
information Instruction
Mix conditionals memory ops size locals space
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Proposed Solution
Analyze Code
Predict best
optimization
End optimizati
ons?
Apply Optimizati
on
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Neural Network
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Proposed Solution
Analyze Code
Predict best
optimization
End optimizatio
ns?
Apply Optimizatio
n
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
Neuro Evolution of Augmented Topologies Evolutionary approach to ANNs Starts with a minimally connected
network
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Generation 1 Generation nGeneration 2
Using NEAT…
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
• Introduction to Phase Ordering
• Present State-of-the-Art• Proposed Solution
• Understand code• Predict optimization
• An example• Results• Questions
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
scimark.lu bencmark
Generated by default O3
Generated by NEAT
UNIVERSITY OF DELAWARE • Computer & Information Sciences Department
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
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
• Introduction to Phase Ordering
• Present State-of-the-Art• Proposed Solution
• Understand code• Predict optimization
• An example• Results• Questions
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
jess
jack
rayt
race
java
cco
mpr
ess
mpe
gaud
ioAv
g. S
PEC
jvm
98
fft(s
mal
l)m
onte
_car
lo sor lu
spar
seAv
g. S
PEC
jvm
2008
luin
dex
sunfl
owxa
lan
avro
ralu
sear
chpm
dAv
g. D
aCap
o
Aver
age
Aver
age
O3
SPECjvm 2008 DaCapo
10.012.014.016.018.020.022.024.0
Reduced Average Sequence LengthAv
erag
e Se
quen
ce L
engt
h
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Results on SpecJVM98Sp
eedu
p no
rmal
ized
ove
r O
3
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Results on SpecJVM2008Sp
eedu
p no
rmal
ized
ove
r O
3
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Results on DaCapoSp
eedu
p no
rmal
ized
ove
r O
3
UNIVERSITY OF DELAWARE • COMPUTER & INFORMATION SCIENCES DEPARTMENT
Mitigating the Compiler Optimization Phase-Ordering
Problem using Machine Learning
Thank you!