Upload
basil-nash
View
40
Download
4
Embed Size (px)
DESCRIPTION
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. - PowerPoint PPT Presentation
Citation preview
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
Optimizing CompilersCISC 673
Spring 2009
Feedback Directed Optimization
John CavazosUniversity of Delaware
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
Feedback-Directed Optimization (FDO)
Exploit information gathered at run-time to optimize execution “selective optimization”: what to
optimize “FDO” : how to optimize
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
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
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
Challenges for automatic online FDO
Compensate for profiling overhead
Compensate for runtime transformation overhead
Account for partial profile available and changing conditions
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
Clients of Profiling Information
Inlining, unrolling, method dispatch Dispatch tables, Garbage
Collection Pretching
Misses, Hardware performance monitors [Adl-Tabatabai et al.’04]
Code layout
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
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
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
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
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
Example Call Graph
UUNIVERSITYNIVERSITY OFOF D DELAWARE ELAWARE • • C COMPUTER & OMPUTER & IINFORMATION NFORMATION SSCIENCES CIENCES DDEPARTMENTEPARTMENT
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.