U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Intelligent Compilation John Cavazos Computer & Information Sciences Department.

Slides:



Advertisements
Similar presentations
Efficient Program Compilation through Machine Learning Techniques Gennady Pekhimenko IBM Canada Angela Demke Brown University of Toronto.
Advertisements

7. Optimization Prof. O. Nierstrasz Lecture notes by Marcus Denker.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Instruction Scheduling John Cavazos University.
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Potential Languages of the Future Chapel,
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2011 More Control Flow John Cavazos University.
CPSC 502, Lecture 15Slide 1 Introduction to Artificial Intelligence (AI) Computer Science cpsc502, Lecture 15 Nov, 1, 2011 Slide credit: C. Conati, S.
Program Representations. Representing programs Goals.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Mitigating the Compiler Optimization Phase- Ordering Problem using Machine Learning.
Addressing Optimization for Loop Execution Targeting DSP with Auto-Increment/Decrement Architecture Wei-Kai Cheng Youn-Long Lin* Computer & Communications.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
CUDA Programming Lei Zhou, Yafeng Yin, Yanzhi Ren, Hong Man, Yingying Chen.
An Adaptive, Region-based Allocator for Java Feng Qian & Laurie Hendren 2002.
U NIVERSITY OF M ASSACHUSETTS, A MHERST D EPARTMENT OF C OMPUTER S CIENCE Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Compiler Optimization-Space Exploration Adrian Pop IDA/PELAB Authors Spyridon Triantafyllis, Manish Vachharajani, Neil Vachharajani, David.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science John Cavazos Architecture and Language Implementation Lab Thesis Seminar University.
Comparison of JVM Phases on Data Cache Performance Shiwen Hu and Lizy K. John Laboratory for Computer Architecture The University of Texas at Austin.
Building An Interpreter After having done all of the analysis, it’s possible to run the program directly rather than compile it … and it may be worth it.
CISC673 – Optimizing Compilers1/34 Presented by: Sameer Kulkarni Dept of Computer & Information Sciences University of Delaware Phase Ordering.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Dynamic Compilation II John Cavazos University.
Imperative Programming
Fast, Effective Code Generation in a Just-In-Time Java Compiler Rejin P. James & Roshan C. Subudhi CSE Department USC, Columbia.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2011 Course Overview John Cavazos University.
An Adaptive, Region-based Allocator for Java Feng Qian, Laurie Hendren {fqian, Sable Research Group School of Computer Science McGill.
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Oct Using Platform-Specific Performance Counters for Dynamic Compilation Florian Schneider and Thomas Gross ETH Zurich.
Adaptive Optimization with On-Stack Replacement Stephen J. Fink IBM T.J. Watson Research Center Feng Qian (presenter) Sable Research Group, McGill University.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Dept. of Computer and Information Sciences : University of Delaware John Cavazos Department of Computer and Information Sciences University of Delaware.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Register Allocation John Cavazos University.
CISC Machine Learning for Solving Systems Problems Presented by: Alparslan SARI Dept of Computer & Information Sciences University of Delaware
Group 4 Java Compiler Group Members: Atul Singh(Y6127) Manish Agrawal(Y6241) Mayank Sachan(Y6253) Sudeept Sinha(Y6483)
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2011 Dependence Analysis and Loop Transformations.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Static Single Assignment John Cavazos.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Overview of Compilers and JikesRVM John.
CISC Machine Learning for Solving Systems Problems John Cavazos Dept of Computer & Information Sciences University of Delaware
Programming Languages
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Dynamic Compilation I John Cavazos University.
380C lecture 19 Where are we & where we are going –Managed languages Dynamic compilation Inlining Garbage collection –Opportunity to improve data locality.
1 Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT) Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss (UMass),
CoCo: Sound and Adaptive Replacement of Java Collections Guoqing (Harry) Xu Department of Computer Science University of California, Irvine.
CISC Machine Learning for Solving Systems Problems Microarchitecture Design Space Exploration Lecture 4 John Cavazos Dept of Computer & Information.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
CISC Machine Learning for Solving Systems Problems Presented by: Eunjung Park Dept of Computer & Information Sciences University of Delaware Solutions.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2009 Method Profiling John Cavazos University.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science John Cavazos J Eliot B Moss Architecture and Language Implementation Lab University.
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2011 Data flow analysis John Cavazos University.
Learning A Better Compiler Predicting Unroll Factors using Supervised Classification And Integrating CPU and L2 Cache Voltage Scaling using Machine Learning.
Michael J. Voss and Rudolf Eigenmann PPoPP, ‘01 (Presented by Kanad Sinha)
RealTimeSystems Lab Jong-Koo, Lim
U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Optimizing Compilers CISC 673 Spring 2011 Yet More Data flow analysis John Cavazos.
1 The Garbage Collection Advantage: Improving Program Locality Xianglong Huang (UT), Stephen M Blackburn (ANU), Kathryn S McKinley (UT) J Eliot B Moss.
Automatic Feature Generation for Machine Learning Based Optimizing Compilation Hugh Leather, Edwin Bonilla, Michael O'Boyle Institute for Computing Systems.
Presented by: Sameer Kulkarni
Eugene Gavrin – MSc student
Code Generation.
Benjamin Goldberg Compiler Verification and Optimization
Reducing Training Time in a One-shot Machine Learning-based Compiler
Presented by: Divya Muppaneni
Predicting Unroll Factors Using Supervised Classification
Tour of common optimizations
Tour of common optimizations
Garbage Collection Advantage: Improving Program Locality
CSE P 501 – Compilers SSA Hal Perkins Autumn /31/2019
Optimizing Compilers CISC 673 Spring 2009 Course Overview
Rohan Yadav and Charles Yuan (rohany) (chenhuiy)
Tour of common optimizations
Presentation transcript:

U NIVERSITY OF D ELAWARE C OMPUTER & I NFORMATION S CIENCES D EPARTMENT Intelligent Compilation John Cavazos Computer & Information Sciences Department University of Delaware

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 2 The Optimization Problem

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 3 The Optimization Problem

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 4 The Optimization Problem

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 5 The Optimization Problem

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 6 The Optimization Problem

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 7 The Optimization Problem Intelligent Compilation

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 8 Architectural Characteristics Can use as machine learning features Example Mnemonic Description Avg Values FPU_IDL (Floating Unit Idle) VEC_INS (Vector Instructions) BR_INS (Branch Instructions) L1_ICH (L1 Icache Hits)

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 9 Domain Knowledge Generate training data from different domains Berkeley “motifs” can serve as starting point

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 10 Application of Machine Learning

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 11 Case Study: Method-Specific Compilation Use static code properties to characterize Java methods to control the optimizations applied

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 12 Method-Specific Compilation Details Intelligent Java JIT compiler Used simple code properties Extracted from a linear pass of code 26 features used to describe method Model controlled up to 20 optimizations Outperformed hand-tuned heuristics

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 13 Code Properties Used (inputs) Meaning Number of bytecodes Is syncronized, has exceptions, is leaf method Method Features Size Words allocated for locals space Locals Space Characteristics Declaration Fraction of Bytecodes Has array loads and stores primitive and long computations compares, branches, jsrs, switches, put, get, invoke, new, arraylength athrow, checkcast, monitor Is it declared final, static, private

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 14 Optimizations (outputs) Optimization Level Opt Level O0 Opt Level O1 Opt Level O2 Optimizations Controlled Branch Opts Low Constant Prop / Local CSE Reorder Code Copy Prop / Tail Recursion Static Splitting / Branch Opt Med Simple Opts Low While into Untils / Loop Unroll Branch Opt High / Redundant BR Simple Opts Med / Load Elim Expression Fold / Coalesce Global Copy Prop / Global CSE SSA

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 15 Generate Training Data For each method Evaluate many optimization settings Use fine-grained timers Record running time Record total time Levels 02 (20 optimizations) Evaluate 1000 random settings

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 16 Logistic Regression Variant of ordinary regression Inputs Continuous, discrete, or mix Outputs Restricted to between 0 and 1 Probability of optimization being beneficial

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 17 Compiler Heuristic Tuned Method bytecodes Compiler Heuristic Optimizer Jikes RVM Optimized method Feature extractor LR

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 18 Compiler Heuristic Tuned Method bytecodes Compiler Heuristic Optimizer Jikes RVM Optimized method Feature extractor LR

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 19 Compiler Heuristic Tuned Method bytecodes Compiler Heuristic Optimizer Jikes RVM Optimized method Feature extractor Feature Vector {108;25;0;0;0;0;1;0;0:2;0:0;0:0;0:0;0:0;0:0 0:12;0:0;0:08;0:0;0:0;0:0;0:2;0:32;0:08;0:0} LR

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 20 Compiler Heuristic Tuned Method bytecodes Compiler Heuristic Optimizer Jikes RVM Optimized method Feature extractor Feature Vector {108;25;0;0;0;0;1;0;0:2;0:0;0:0;0:0;0:0;0:0 0:12;0:0;0:08;0:0;0:0;0:0;0:2;0:32;0:08;0:0} LR

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 21 Compiler Heuristic Tuned Method bytecodes Compiler Heuristic Optimizer Jikes RVM Optimized method Feature extractor Feature Vector {108;25;0;0;0;0;1;0;0:2;0:0;0:0;0:0;0:0;0:0 0:12;0:0;0:08;0:0;0:0;0:0;0:2;0:32;0:08;0:0} {1;0;1;1;0;0;0;1;1;1;1;1;1;1;1;0;1;1;1;0} {1;0;1;1;0;0;0;1;1;1;1;1;1;1;1;0;1;1;1;0} Opt Flags LR

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 22 Experimental Results JikesRVM Highly-tuned Java JIT Compiler Benchmarks SPEC JVM 98 DaCapo benchmarks + 2 others Total Time (compilation + running time) Running Time (no compilation time)

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 23 SPEC JVM (Highest Opt Level) Total time improvements of 30%!

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 24 DaCapo (Highest Opt Level) Running time improvements over 50%!

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 25 % of O3 Applied to Hot Methods

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 26 % of O3 Applied to Hot Methods OPT compress jess raytrace db javac mpegaudio jack UNROLL Reorder BrchOpt

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 27 Single-Core Opts Still Important! Machine learning applied to auto-tuning Optimization Phase Ordering Speculative optimizations

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 28 Optimizations for Multi-Cores Auto-code partitioning and mapping Communication/computation overlap Task and Data placement/migration

U NIVERSITY OF D ELAWARE Computer & Information Sciences Department 29 Conclusion Using machine learning successful Out-performs hand-tuning Simple code features can drive optimizations ML determines which features are important Optimizations applied only when beneficial