90 likes | 247 Views
Optimizing Compilers CISC 673 Spring 2009 Feedback Directed Optimization. John Cavazos University of Delaware. Feedback-Directed Optimization (FDO). Exploit information gathered at run-time to optimize execution “selective optimization”: what to optimize “FDO” : how to optimize.
E N D
Optimizing CompilersCISC 673Spring 2009Feedback Directed Optimization John Cavazos University of Delaware
Feedback-Directed Optimization (FDO) • Exploit information gathered at run-time to optimize execution • “selective optimization”: what to optimize • “FDO” :how to optimize
Advantages of FDO • Can exploit dynamic information that cannot be inferred statically • System can change and revert decisions when conditions change • Runtime binding allows more flexible systems
Challenges for automatic online FDO • Compensate for profiling overhead • Compensate for runtime transformation overhead • Account for partial profile available and changing conditions
Clients of Profiling Information • Inlining, unrolling, method dispatch • Dispatch tables, Garbage Collection • Pretching • Misses, Hardware performance monitors [Adl-Tabatabai et al.’04] • Code layout
Code Layout Motivation • Instruction memory critical to program performance • Cache line conflicts are one cause of misses • Particularly for direct-mapped caches • Page faults • Default code layout for most compilers is bad • Instructions placed in source order • Procedures placed according to source file listing • Compilers can rearrange code to reduce misses • More performance and less power for free
Procedure Positioning • “Closest is best” strategy: if procedure calls another frequently, we want two procedures close to one another. Increases chances they will land on the same page, reducing working set. • Construct a weighted call graph • Node = procedure • Edge from A B means procedure A calls B (perhaps multiple times) • Weight on edge is the total number of dynamic calls • Using the weighted call graph to build the link order for the procedures
Merging Nodes 1) The heaviest weight edge is one connecting procedures A and D. They are merged. Edge weights are updated. 2) The next edge chosen is the one between C and F.