Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
COMPILER OPTIMIZATION-SPACE
EXPLORATION
T. Spyridon, M. Vachharajani, N. Vachharajani, D.
August


Presenter: Tanzir Musab...
 Group of people from Princeton University, NJ
 Published in International Symposium on Code
  Generation and Optimizati...
OUTLINE
 Introduction
 Problems

 Some solutions

 Their solution – Optimization-Space Exploration

 Experiments and ...
INTRODUCTION - PROCESSORS
 Become more complex
 Incorporate additional computation resources

 Compiler can no longer r...
INTRODUCTION - COMPILERS
   As a consequences
     Compiler becomes complex
     Use optimizations aggressively
     H...
OUTLINE
 Introduction
 Problems

 Some solutions

 Their solution – Optimization-Space Exploration

 Experiments and ...
PROBLEMS - PREDICTIVE HEURISTICS?
 Modern compilers employ predictive heuristics
 Tries to determine a priori the benefi...
OUTLINE
 Introduction
 Problems

 Some Solutions

 Their Solution – Optimization-Space Exploration

 Experiments and ...
SOME SOLUTIONS – ITERATIVE COMPILATION
 Compiling a program multiple times with different
  optimization configurations
...
OUTLINE
 Introduction
 Problems

 Some Solutions

 Their Solution – Optimization-Space Exploration

 Experiments and ...
THEIR SOLUTION – OPTIMIZATION-SPACE
EXPLORATION
 General and practical version of iterative
  compilation
 Explores the ...
THEIR SOLUTION – OPTIMIZATION-SPACE
EXPLORATION
   To address the compile time:
     It uses the experience of the compi...
SINGLE FIXED CONFIGURATION
 A set of fixed heuristics is applied to each code
  segment
 Only one version of the code ex...
OSE OVER MANY CONFIGURATIONS
 OSE compiler simultaneously applies multiple
  transformation sequences on each code segmen...
OSE – LIMITING THE SEARCH SPACE
   Optimization Space
       Derived from a set of optimization parameters
   Optimizat...
OSE – LIMITING THE SEARCH SPACE
   Optimization Parameters
       Heuristic to disable software pipelining
       Allow...
COMPILER CONSTRUCTION-TIME PRUNING
  Limit the total number of configurations that will be
   considered at compile time
...
OSE – LIMITING THE SEARCH SPACE
       Characterizing Configuration Correlations
          build a optimization configur...
OSE – LIMITING THE SEARCH SPACE
   Compile-time search
     Do a breadth first search on the optimization
      configur...
OSE – LIMITING THE SEARCH SPACE
   Limit the OSE application
     To hot code segments
     Hot code segments are ident...
EVALUATION
     OSE Compiler Algorithm
1.   Profile the code
2.   For each Function:
3.     Compile to the high level IR
...
COMPILE TIME PERFORMANCE ESTIMATION
   Model Based on:
     Ideal Cycle Count – T
     Data cache performance, Lambda, ...
OUTLINE
 Introduction
 Problems

 Some solutions

 Their solution – Optimization-Space Exploration

 Experiments and ...
RESULTS
RESULTS
OUTLINE
 Introduction
 Problems

 Some solutions

 Their solution – Optimization-Space Exploration

 Experiments and ...
CONCLUSION
 OSE doe not incur the prohibitive compile-time
  costs of other iterative compilation approaches
 Compile ti...
Compiler Optimization-Space Exploration
Upcoming SlideShare
Loading in …5
×

Compiler Optimization-Space Exploration

771 views

Published on

  • Be the first to comment

  • Be the first to like this

Compiler Optimization-Space Exploration

  1. 1. COMPILER OPTIMIZATION-SPACE EXPLORATION T. Spyridon, M. Vachharajani, N. Vachharajani, D. August Presenter: Tanzir Musabbir
  2. 2.  Group of people from Princeton University, NJ  Published in International Symposium on Code Generation and Optimization: Feedback-Directed and Runtime Optimization  Year 2003.
  3. 3. OUTLINE  Introduction  Problems  Some solutions  Their solution – Optimization-Space Exploration  Experiments and Results  Conclusion
  4. 4. INTRODUCTION - PROCESSORS  Become more complex  Incorporate additional computation resources  Compiler can no longer rely on simple instruction count to guide optimization  It has to balance resource utilization, register usage and dependences
  5. 5. INTRODUCTION - COMPILERS  As a consequences  Compiler becomes complex  Use optimizations aggressively  Have to use predictive heuristics in order to decide where and to what extend optimizations should be applied
  6. 6. OUTLINE  Introduction  Problems  Some solutions  Their solution – Optimization-Space Exploration  Experiments and Results  Conclusion
  7. 7. PROBLEMS - PREDICTIVE HEURISTICS?  Modern compilers employ predictive heuristics  Tries to determine a priori the benefits of certain optimization  Are tuned by compiler writers to give the highest average performance  Resulting optimization decisions remain suboptimal for many individual code segments  Leaving significant potential performance gains unrealized
  8. 8. OUTLINE  Introduction  Problems  Some Solutions  Their Solution – Optimization-Space Exploration  Experiments and Results  Conclusion
  9. 9. SOME SOLUTIONS – ITERATIVE COMPILATION  Compiling a program multiple times with different optimization configurations  After applying several optimizations the predictive heuristics are eliminated  Results are not directly applicable to modern- purpose architectures and applications  Incur large compile time
  10. 10. OUTLINE  Introduction  Problems  Some Solutions  Their Solution – Optimization-Space Exploration  Experiments and Results  Conclusion
  11. 11. THEIR SOLUTION – OPTIMIZATION-SPACE EXPLORATION  General and practical version of iterative compilation  Explores the space of optimization configurations through multiple compilations
  12. 12. THEIR SOLUTION – OPTIMIZATION-SPACE EXPLORATION  To address the compile time:  It uses the experience of the compiler writer to prune the number of configurations that should be explored  Uses a performance estimator to not evaluate the code by execution  Selects a custom configuration for each code segment  Selects next optimization configuration by examining the previous configurations characteristics
  13. 13. SINGLE FIXED CONFIGURATION  A set of fixed heuristics is applied to each code segment  Only one version of the code exists at any given time  That version is passed from transformation to transformation
  14. 14. OSE OVER MANY CONFIGURATIONS  OSE compiler simultaneously applies multiple transformation sequences on each code segment  Each version is optimized using a different optimization configuration.  The compiler emits the fittest version as determined by the performance evaluator
  15. 15. OSE – LIMITING THE SEARCH SPACE  Optimization Space  Derived from a set of optimization parameters  Optimization Parameters  Optimization level  High Level Optimization (HLO) level  Micro-architecture type  Coalesce adjacent loads and stores  HLO phase order  Loop unroll limit  Update dependencies after unrolling  Perform software pipelining
  16. 16. OSE – LIMITING THE SEARCH SPACE  Optimization Parameters  Heuristic to disable software pipelining  Allow control speculation during software pipelining  Software pipeline outer loops  Enable if-conversion heuristic for software pipelining  Software pipeline loops with early exists  Enable if conversion  Enable non-standard predication  Enable pre-scheduling  Scheduler ready criterion
  17. 17. COMPILER CONSTRUCTION-TIME PRUNING  Limit the total number of configurations that will be considered at compile time  Construct a set S with at most N configurations  S is chosen by determining the impact on a representative set of code segments C as follows:  S’ = default configuration + configurations with non-default parameters  a) run C compiled with S’ on real hardware and retain in S’ only the valuable configurations  b) consider the combination of configurations in S’ as S’’ repeat a) for S’’ and retain only the best N configurations  repeat b) until no new configurations can be generated or the speedup does not improve
  18. 18. OSE – LIMITING THE SEARCH SPACE  Characterizing Configuration Correlations  build a optimization configuration tree  critical configurations = conf. at the same level 1. Construct O = set of m most important configurations in S for all code segments in C 2. Choose all oi in O as the successor of the root node. 3. For each configurations oi in O: 4. Construct Ci = {cj: argmax(pj,k) = i} k=1…m 5. Repeat steps 3, 4 to find oi successors limiting the code segments to Ci and configurations to SO.
  19. 19. OSE – LIMITING THE SEARCH SPACE  Compile-time search  Do a breadth first search on the optimization configuration tree  Choose the configuration that yields the best estimated performance
  20. 20. OSE – LIMITING THE SEARCH SPACE  Limit the OSE application  To hot code segments  Hot code segments are identified through profiling or hardware performance counters during a program run
  21. 21. EVALUATION  OSE Compiler Algorithm 1. Profile the code 2. For each Function: 3. Compile to the high level IR 4. Optimize using HLO 5. For each Function: 6. If the function is hot: 7. Perform OSE on second HLO and CG 8. Emit the function using the best configuration 9. If the function is not hot use the standard configuration
  22. 22. COMPILE TIME PERFORMANCE ESTIMATION  Model Based on:  Ideal Cycle Count – T  Data cache performance, Lambda, L  Instruction cache performance, I  Branch mis-prediction, B
  23. 23. OUTLINE  Introduction  Problems  Some solutions  Their solution – Optimization-Space Exploration  Experiments and Results  Conclusion
  24. 24. RESULTS
  25. 25. RESULTS
  26. 26. OUTLINE  Introduction  Problems  Some solutions  Their solution – Optimization-Space Exploration  Experiments and Results  Conclusion
  27. 27. CONCLUSION  OSE doe not incur the prohibitive compile-time costs of other iterative compilation approaches  Compile time is limited in three ways  OCE is capable of delivering significant performance benefits, while keeping compile times reasonable  It gets more than 20% performance improvement in some cases for SPEC codes

×