Presentation is loading. Please wait.

Presentation is loading. Please wait.

CISC673 – Optimizing Compilers1/34 Presented by: Sameer Kulkarni Dept of Computer & Information Sciences University of Delaware Phase Ordering.

Similar presentations


Presentation on theme: "CISC673 – Optimizing Compilers1/34 Presented by: Sameer Kulkarni Dept of Computer & Information Sciences University of Delaware Phase Ordering."— Presentation transcript:

1 CISC673 – Optimizing Compilers1/34 Presented by: Sameer Kulkarni Dept of Computer & Information Sciences University of Delaware Phase Ordering

2 CISC673 – Optimizing Compilers2/34 Optimization?? does it really work??

3 CISC673 – Optimizing Compilers3/34 No. of optimizations O64 = 264 (on last count) JikesRVM = 67

4 CISC673 – Optimizing Compilers4/34 Search space Consider a hypothetical case where we apply 40 optimizations O64 : 3.98 x 10 47 Jikes: 4.1 x 10 18

5 CISC673 – Optimizing Compilers5/34 Could take a while Considering the smaller problem, assume that running all the benchmarks take just 1 sec to run Jikes would take: 130.2 billion years Age of the universe 13 billion years

6 CISC673 – Optimizing Compilers6/34 Some basic Optimizations Constant Sub-expression Elimination Loop Unrolling Local Copy Prop Branch Optimizations...

7 CISC673 – Optimizing Compilers7/34 Example for(int i=0; i< 3;i++){ a = a + i + 1; } Loop Unrolling CSE

8 CISC673 – Optimizing Compilers8/34 Instruction Scheduling vs Register Allocation Maximizing Parallelism  IS Minimizing Register Spilling  RA

9 CISC673 – Optimizing Compilers9/34 Phase Ord. vs Opt Levels Opt Levels ~ Timing Constraints Phase ordering ~ code interactions

10 CISC673 – Optimizing Compilers10/34 Whimsical?? Opt X would like to go before Opt Y, but not always.

11 CISC673 – Optimizing Compilers11/34 Ideal Solution? Oracle  Perfect sequence at the very start Wise Man Solution  Given the present code predict the best optimization solution

12 CISC673 – Optimizing Compilers12/34 Wise Man ? Understand Compilers Optimizations Source Code

13 CISC673 – Optimizing Compilers13/34 Possible Solutions Pruning the search space Genetic Algorithms Estimating running times Precompiled choices

14 CISC673 – Optimizing Compilers14/34 Pruning Search space Fast and Efficient Searches for Effective Optimization Phase Sequences, Kulkarni et al. TACO 2005

15 CISC673 – Optimizing Compilers15/34 Optimization Profiling Fast and Efficient Searches for Effective Optimization Phase Sequences, Kulkarni et al. TACO 2005

16 CISC673 – Optimizing Compilers16/34 Genetic Algorithms Fast Searches for Effective Optimization Phase Sequences, Kulkarni et al. PLDI ‘04

17 CISC673 – Optimizing Compilers17/34 Exhaustive vs Heuristic [2]

18 CISC673 – Optimizing Compilers18/34 Disadvantages Benchmark Specific Architecture dependent Code disregarded

19 CISC673 – Optimizing Compilers19/34 Improvements Profiling the application Understand the code Understanding optimizations Continuous evaluation of transformations

20 CISC673 – Optimizing Compilers20/34 Proposed solution Input = Code Features Output = Running time Evolve  Neural Networks

21 CISC673 – Optimizing Compilers21/34 Proposed solution

22 CISC673 – Optimizing Compilers22/34 Experimental Setup Neural Network Evolver (ANJI) Training Set { javaGrande } Testing Set { SpecJVM, Da Capo }

23 CISC673 – Optimizing Compilers23/34 ANJI Mutating & generating n/w s Network  phase ordering Timing Information Scoring the n/w

24 CISC673 – Optimizing Compilers24/34 Training Phase Generations and Chromosomes Random chromosomes Back Propagation Add/Remove/Update hidden nodes

25 CISC673 – Optimizing Compilers25/34 Experimental Setup

26 CISC673 – Optimizing Compilers26/34 Network Evolution

27 CISC673 – Optimizing Compilers27/34 Network Evolution

28 CISC673 – Optimizing Compilers28/34 javaGrande Set of very small benchmarks Low running times Memory management Machine Architecture

29 CISC673 – Optimizing Compilers29/34 Testing SpecJVM’98 & Da Capo Champion n/w Running times

30 CISC673 – Optimizing Compilers30/34 Present Solution

31 CISC673 – Optimizing Compilers31/34 Implementation in GCC Milepost GCC Created for intelligent compilation Collecting source features Submitting features to common loc. Hooks into the Compilation process.

32 CISC673 – Optimizing Compilers32/34 Possible Use Case

33 CISC673 – Optimizing Compilers33/34 Structure for Phase Ordering ANJI network from Source features

34 CISC673 – Optimizing Compilers34/34 LLVM Open Source Compiler Modular Design Easy to work with All Optimizations are interchangeable

35 CISC673 – Optimizing Compilers35/34 Questions Most of the files and this presentation have been uploaded to http://www.cis.udel.edu/~skulkarn/ta.html http://www.cis.udel.edu/~skulkarn/ta.html


Download ppt "CISC673 – Optimizing Compilers1/34 Presented by: Sameer Kulkarni Dept of Computer & Information Sciences University of Delaware Phase Ordering."

Similar presentations


Ads by Google