1 / 24

Overview

Overview. Motivations Basic static and dynamic optimization methods ADAPT Dynamo. Motivations for Dynamic Optimization. Object Oriented Languages results in delayed binding, reduces scope optimizations DLLs limit static compile-time optimizations

vic
Download Presentation

Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Overview • Motivations • Basic static and dynamic optimization methods • ADAPT • Dynamo

  2. Motivations for Dynamic Optimization • Object Oriented Languages results in delayed binding, reduces scope optimizations • DLLs limit static compile-time optimizations • Java JIT and dynamic binary translators are impractical for heavyweight static compiler optimization

  3. Motivations for Dynamic Optimization • Computer system vendors are totally reliant on software vendors to enable optimizations to take advantage of their hardware • Software is now commonly installed on a network file system server and run on machines of varying configurations

  4. Some Traditional Dynamic Optimization Techniques • Compile-Time Multiversioning • Multiple versions of code sections are generated at compile-time • Most appropriate variant is selected at runtime based upon characteristics of the input data and/or machine environment • No runtime information can be exploited during code generation • Multiple variants can cause code explosion • Thus typically only a few versions are created

  5. Some Traditional Dynamic Optimization Techniques Dynamic Feedback • Similar to Compile-Time Multiversioning • Multiple versions generated at compile-time • No runtime information can be exploited during code generation • Only a few versions created to prevent code explosion • Chooses variant by sampling • Measures execution times for variants and selects the fastest

  6. Some Traditional Dynamic Optimization Techniques • Dynamic Compilation • Generates new code variants during program executions • Takes advantage of runtime information • More overhead than the other methods • To reduce overheads • Dynamic compilation is staged at compile-time • Dynamic compilation only be applied to code sections that may benefit from it

  7. ADAPT(Automated De-Coupled Adaptive Program Transformation)Michael J. Voss and Rudolf EigenmannPurdue University

  8. Overview of ADAPT • ADAPT tries to combine the features of the other methods • Uses a source-to-source compiler to perform optimizations • Dynamic selection mechanism selects best code variant to run and does code generation (similar to JIT)

  9. Intervals • Optimization occurs at the granularity of intervals • Single entry, single exit • Typically loop nests • Source-to-source compiler replaces intervals with an if-else block that selects between a call to the Dynamic Selector and the default static version

  10. Compiler Component • ADAPT can use off-the-shelf compilers • Set different optimization flags or compilers to produce different variants • Loop distribution • Tiling • Unrolling • Automatic Parallelization

  11. ADAPT Components • The Inspector monitors the runtime environment • Timings • Each interval • Each optimized variant of the interval • Machine configuration • Used to maintain and prioritize the Optimization Queue

  12. ADAPT Components • The Optimization Queue is a priority queue that orders interval descriptors by execution time • Used to minimize overheads by avoiding insignificant intervals • The Dynamic Selector chooses variants to run • Variants become “stale” after a period of time and are removed

  13. Sample Walkthrough • Source-to-source compilation • Start with static version and run • Inspector tracks intervals for frequent use • Optimized variants of the frequently used intervals and other runtime information are generated • When an interval takes sufficiently long time, the Dynamic Selector is called and chooses the best variant • If the variant takes too long, go back to the static version

  14. Dynamo:A Transparent DynamicOptimization SystemHP LabsVasanth Bala, Evelyn Duesterwald,Sanjeev Banerjia

  15. Overview of Dynamo • Takes in binary instruction codes • Optimizes the code dynamically without code annotations or binary means • Transparent operation: • Accepts and optimizes legacy code • Runs like a hybrid user DLL and a virtual machine

  16. Program Dynamo’s Interpreter CPU How Dynamo Starts • Dynamo takes over, takes snapshot of registers and environment stack. • Dynamo activates the “interpreter” • Intercepts and scans the native code from the program like a filter

  17. How Dynamo Works In cache Already? Potential Code Fragment Code Fragment no Start trace yes Optimize And link with Other code fragments Fragment Cache End trace

  18. Code Fragments • The interpreter can create and optimize code fragments • Code fragments are code traces • Code trace starts when a certain piece of code is executed many times • Program most likely to follow the same path while tracing

  19. Code Fragments • Code fragments consist of: • Start which is the line of code after a taken backward branch • End which is a backward taken branch or another branch leading to another fragment • Easy to optimize code fragment • One entrance, multiple exits • Requires one iteration of a backward and forward data flow analysis

  20. Optimizations of Fragments • Remove branches expressing fall-throughs only • Keeps conditional branches Optimizations include: Constant Propagation Copy Propagation Loop Invariant Strength Reduction Branch, load, assignment redundancy A A C B C D D

  21. Linking Cached Fragments • Conditional branches and exits may lead to links to other fragments in cache which speeds up Dynamo. • If no fragments exist, start another trace. A C B D D true E F false G Start tracing again

  22. Cache Management • New fragment entries require to create links between existing fragments • Deletion of fragment requires removal of all links which is slow • Cache may get filled up with fragments • Flush when a lot of new code is being traced • Means you have entered a new section of the program

  23. Performance • Single PA-8000 processor • SpecInt95 benchmarks, compiled with • O2, O4, O2+P, O4+P with/without Dynamo • O2 + Dynamo ran as well as O4 native • O4 + P ran as well with or without Dynamo • Overhead of Dynamo was 1.5% of the execution time with SpecInt95.

  24. Conclusion • ADAPT and Dynamo are • Opposite approaches of • Internal representation, single-exit-single-entry or single-entry-multiple-exits • Dynamo use binary code and ADAPT uses source-to-source high level code • Both use standard compilers, no special annotations, and utilize runtime info • ADAPT can allow programmers to customize the selection of optimizations.

More Related