A Framework for Unrestricted Whole-Program Optimization - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

A Framework for Unrestricted Whole-Program Optimization

Description:

Whole-Program Optimization ... Obtain an optimizable whole-program representation. Increase ... PBE offers unrestricted and practical whole-program optimization ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 17
Provided by: ResearchM53
Category:

less

Transcript and Presenter's Notes

Title: A Framework for Unrestricted Whole-Program Optimization


1
A Framework for UnrestrictedWhole-Program
Optimization
  • Spyridon Triantafyllis, Matthew J. Bridges,
    Easwaran Raman, Guilherme Ottoni, David I. August
  • The Liberty Research Group
  • Department of Computer Science
  • Princeton University

2
Procedure-Based Compilation
  • Procedure-Based Compilation
  • Pros
  • Well Known
  • Cons
  • Can not exploit opportunities that cross
    procedures

g()
h()
f(a,b,c)
if (EOB)
zxy f(x,y,5)
f(1,2,3)
fill B
dab
z
ret
3
Interprocedural Analysis
  • Interprocedural Analysis
  • Sharir78 Morel78 Reps95
  • Pros
  • Increases available information
  • Enables some optimization across procedure
    boundaries
  • Cons
  • Has to analyze the entire program
  • Optimizations need to respect the procedure
    boundary

g()
h()
f(a,b,c)
if (EOB)
zxy f(x,y,5)
f(1,2,3)
fill B
dab
z
ret
4
Interprocedural Analysis Interprocedural Opti
  • Interprocedural Analysis
  • Sharir78 Morel78 Reps95
  • Pros
  • Increases available information
  • Enables some optimization across procedure
    boundaries
  • Cons
  • Has to analyze the entire program
  • Optimizations need to respect the procedure
    boundary
  • Most optimizations will still be intraprocedural

g()
h()
f(a,b,c,z)
if (EOB)
zxy f(x,y,5,z)
f(1,2,3,2)
fill B
dz
z
ret
5
Inlining
  • Inlining
  • Scheifler 77 Hwu89 Chang92
  • Pros
  • Increases optimization scope
  • Enables specialization
  • Doesnt require opti to understand
    interprocedural concerns
  • Cons
  • Hard limit on procedure size
  • Unnecessary code growth

g()
zxy
if (EOB)
fill B
f(a,b,c)
if (EOB)
dz
fill B
h()
dab
jump
f(1,2,3)
z
ret
6
Partial Inlining
  • Partial Inlining
  • Suganuma03Way00
  • Pros
  • Can alleviate some code growth
  • Cons
  • Gains are limited

g()
zxy
f()
fill B
if (EOB)
f()
return
f(a,b,c)
if (EOB)
dz

h()
fill B
dab
jump
f(1,2,3)
ret
z
7
Why Procedures?
  • Procedures
  • Calling convention boundary
  • Single-Entry, Single-Exit
  • Pros
  • Implicit correlated edges - context sensitivity
  • Natural unit for divide conquer compilation
  • Cons
  • Optimized for software-engineering
  • Restricts optimization

if (EOB)
zxy
fill B
dab
dz
z
ret
We dont have to use procedures!
8
The Whole-Program CFG
  • Retain useful traits of procedures
  • Correlated edges
  • Compilation unit
  • Goal Obtain an optimizable whole-program
    representation
  • Increase optimization scope
  • Allow all opti to operate on increased scope
    without change
  • Targeted code growth

if (EOB)
zxy
fill B
dab
z
jump
9
The Whole-Program CFG
  • Retain useful traits of procedures
  • Correlated edges
  • Compilation unit
  • Goal Obtain an optimizable whole-program
    representation
  • Increase optimization scope
  • Allow all opti to operate on increased scope
    without change
  • Targeted code growth

Represent calls and returns as special
control-flow transitions Sharir78
10
Whole-Program Optimizations
  • Optimization destroys the programs procedural
    structure!
  • Example Superblock Formation Hwu92
  • Unconventional call structures!
  • Many-to-many call lt-gt return relation
  • Must rediscover structure for summary edges

A
(1
B
B
(2
G
D
C
C
H
)2
E
E
)1
)1
F
F
11
Analyzing the Whole-Program CFG
  • Context-Sensitive
  • Interprocedural AnalysisSharir78
  • meet over all realizable paths
  • Identify Entry-Exit Pairs (EEP)
  • Correlated call return arcs
  • Allows use of summary edges
  • Blocks may belong to more than one EEP

A
(1
B
B
(2
G
D
C
C
H
)2
E
E
)1
)1
F
F
12
Determining a Compilation Unit Region Formation
  • Region Formation Hank95
  • arbitrarily shaped, compiler-selected compilation
    unit

A
(1
B
  • Region Selection
  • Select seed add neighbors
  • (profile, structure, dataflow )

B
(2
G
D
  • Success Criteria
  • Optimizability vs. compile time
  • Few too small or too big regions
  • Intra-region transitions inter-region
    transitions
  • Encapsulation
  • Make regions independently optimizable

C
C
H
)2
E
E
)1
)1
F
F
Compiler is free to select its own optimization
units!
13
Evaluation Framework The Velocity Compiler
Frontend
Frontend
Frontend
  • Evaluation
  • Inliner Opti. ported from IMPACT
  • Targeting Itanium 2

Procedures
Procedures
Procedures
Inlining
WCFG
DetermineCompilation Unit
Region Form.
Regions
Procedures
Superblock
Superblock
Superblock
Classical ILP Optimizer
Classical ILP Optimizer
Classical ILP Optimizer
Optimize Compilation Unit
Scheduling
Scheduling
Scheduling
Executable
Executable
Executable
Baseline
Inlining
PBE
14
Code Growth
1.45
1.23
Code Size
15
Speedup - Train Input
1.07
16
Conclusion
  • Procedure boundaries restrict optimization!
  • Ways to deal with procedures exist, but limited
  • Interprocedural analysis opti Scales badly,
    not always possible
  • Inlining Unnecessary Code growth
  • Procedures are not the right compilation unit
  • PBE offers unrestricted and practical
    whole-program optimization
  • An expanded form of interprocedural analysis
  • New region formation framework and heuristics
  • An interprocedural region encapsulation method
Write a Comment
User Comments (0)
About PowerShow.com