Florida State University Automatic Tuning of Libraries and Applications, LACSI 2006 In Search of Near-Optimal Optimization Phase Orderings Prasad A. Kulkarni.

Slides:



Advertisements
Similar presentations
Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
Advertisements

P3 / 2004 Register Allocation. Kostis Sagonas 2 Spring 2004 Outline What is register allocation Webs Interference Graphs Graph coloring Spilling Live-Range.
Chapter 9 Code optimization Section 0 overview 1.Position of code optimizer 2.Purpose of code optimizer to get better efficiency –Run faster –Take less.
1 CS 201 Compiler Construction Machine Code Generation.
Computer Architecture Lecture 7 Compiler Considerations and Optimizations.
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Chapter 10 Code Optimization. A main goal is to achieve a better performance Front End Code Gen Intermediate Code source Code target Code user Machine-
Register Allocation CS 671 March 27, CS 671 – Spring Register Allocation - Motivation Consider adding two numbers together: Advantages: Fewer.
Zhiguo Ge, Weng-Fai Wong, and Hock-Beng Lim Proceedings of the Design, Automation, and Test in Europe Conference, 2007 (DATE’07) April /4/17.
The Assembly Language Level
Constraint Programming for Compiler Optimization March 2006.
Optimal Instruction Scheduling for Multi-Issue Processors using Constraint Programming Abid M. Malik and Peter van Beek David R. Cheriton School of Computer.
Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
Code Compaction of an Operating System Kernel Haifeng He, John Trimble, Somu Perianayagam, Saumya Debray, Gregory Andrews Computer Science Department.
Dynamic Bayesian Networks (DBNs)
1 S. Tallam, R. Gupta, and X. Zhang PACT 2005 Extended Whole Program Paths Sriraman Tallam Rajiv Gupta Xiangyu Zhang University of Arizona.
VLIW Compilation Techniques in a Superscalar Environment Kemal Ebcioglu, Randy D. Groves, Ki- Chang Kim, Gabriel M. Silberman and Isaac Ziv PLDI 1994.
Electrical Engineering & Computer Science - University of Kansas Colloquium / 55 Exhaustive Phase Order Search Space Exploration and Evaluation by Prasad.
Cpeg421-08S/final-review1 Course Review Tom St. John.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
Addressing Optimization for Loop Execution Targeting DSP with Auto-Increment/Decrement Architecture Wei-Kai Cheng Youn-Long Lin* Computer & Communications.
Data Partitioning for Reconfigurable Architectures with Distributed Block RAM Wenrui Gong Gang Wang Ryan Kastner Department of Electrical and Computer.
1 Using A Multiscale Approach to Characterize Workload Dynamics Characterize Workload Dynamics Tao Li June 4, 2005 Dept. of Electrical.
1 Liveness analysis and Register Allocation Cheng-Chia Chen.
Introducing Hashing Chapter 21 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Architectural and Compiler Techniques for Energy Reduction in High-Performance Microprocessors Nikolaos Bellas, Ibrahim N. Hajj, Fellow, IEEE, Constantine.
Indexing Debapriyo Majumdar Information Retrieval – Spring 2015 Indian Statistical Institute Kolkata.
Maria-Cristina Marinescu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology A Synthesis Algorithm for Modular Design of.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Managing Multi-Configuration Hardware via Dynamic Working Set Analysis By Ashutosh S.Dhodapkar and James E.Smith Presented by Kyriakos Yioutanis.
Computer & Information Sciences - University of Delaware Colloquium / 55 Exhaustive Phase Order Search Space Exploration and Evaluation by Prasad Kulkarni.
Optimization software for apeNEXT Max Lukyanov,  apeNEXT : a VLIW architecture  Optimization basics  Software optimizer for apeNEXT  Current.
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Purpose  This training module provides an overview of optimization techniques used in.
Florida State University Symposium on Code Generation and Optimization Exhaustive Optimization Phase Order Space Exploration Prasad A. Kulkarni.
Dept. of Computer and Information Sciences : University of Delaware John Cavazos Department of Computer and Information Sciences University of Delaware.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
1 Code optimization “Code optimization refers to the techniques used by the compiler to improve the execution efficiency of the generated object code”
Compilers for Embedded Systems Ram, Vasanth, and VJ Instructor : Dr. Edwin Sha Synthesis and Optimization of High-Performance Systems.
Synopsys University Courseware Copyright © 2012 Synopsys, Inc. All rights reserved. Compiler Optimization and Code Generation Lecture - 1 Developed By:
CISC Machine Learning for Solving Systems Problems John Cavazos Dept of Computer & Information Sciences University of Delaware
Chapter# 6 Code generation.  The final phase in our compiler model is the code generator.  It takes as input the intermediate representation(IR) produced.
CSCI1600: Embedded and Real Time Software Lecture 33: Worst Case Execution Time Steven Reiss, Fall 2015.
Retargetting of VPO to the tms320c54x - a status report Presented by Joshua George Advisor: Dr. Jack Davidson.
Power Analysis of Embedded Software : A Fast Step Towards Software Power Minimization 指導教授 : 陳少傑 教授 組員 : R 張馨怡 R 林秀萍.
Addressing Instruction Fetch Bottlenecks by Using an Instruction Register File Stephen Hines, Gary Tyson, and David Whalley Computer Science Dept. Florida.
Exploiting Instruction Streams To Prevent Intrusion Milena Milenkovic.
Register Allocation CS 471 November 12, CS 471 – Fall 2007 Register Allocation - Motivation Consider adding two numbers together: Advantages: Fewer.
High Performance Embedded Computing © 2007 Elsevier Lecture 10: Code Generation Embedded Computing Systems Michael Schulte Based on slides and textbook.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
©SoftMoore ConsultingSlide 1 Code Optimization. ©SoftMoore ConsultingSlide 2 Code Optimization Code generation techniques and transformations that result.
Advanced Computer Systems
High-level optimization Jakub Yaghob
Code Optimization.
Optimization Code Optimization ©SoftMoore Consulting.
Data Compression.
Presented by: Sameer Kulkarni
CSCI1600: Embedded and Real Time Software
Machine-Independent Optimization
Stephen Hines, David Whalley and Gary Tyson Computer Science Dept.
Detailed Analysis of MiBench benchmark suite
Christophe Dubach, Timothy M. Jones and Michael F.P. O’Boyle
In Search of Near-Optimal Optimization Phase Orderings
8 Code Generation Topics A simple code generator algorithm
Optimization 薛智文 (textbook ch# 9) 薛智文 96 Spring.
Intermediate Code Generation
Lecture 4: Instruction Set Design/Pipelining
CSE P 501 – Compilers SSA Hal Perkins Autumn /31/2019
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Florida State University Automatic Tuning of Libraries and Applications, LACSI 2006 In Search of Near-Optimal Optimization Phase Orderings Prasad A. Kulkarni David B. Whalley Gary S. Tyson Jack W. Davidson

Florida State University Automatic Tuning of Libraries and Applications, LACSI Optimization Phase Ordering Optimizing compilers apply several optimization phases to improve the performance of applications. Optimization phases interact with each other. Determining the order of applying optimization phases to obtain the best performance has been a long standing problem in compilers.

Florida State University Automatic Tuning of Libraries and Applications, LACSI Exhaustive Phase Order Evaluation Determine the performance of all possible orderings of optimization phases. Exhaustive phase order evaluation involves generating all distinct function instances that can be produced by changing optimization phase orderings (CGO ’06) determining the dynamic performance of each distinct function instance for each function (LCTES ’06)

Florida State University Automatic Tuning of Libraries and Applications, LACSI Outline Experimental framework Exhaustive phase order space enumeration Accurately determining dynamic performance Analyzing the DAG of function instances Conclusions

Florida State University Automatic Tuning of Libraries and Applications, LACSI Outline Experimental framework Exhaustive phase order space enumeration Accurately determining dynamic performance Analyzing the DAG of Function instances Conclusions

Florida State University Automatic Tuning of Libraries and Applications, LACSI Experimental Framework We used the VPO compilation system established compiler framework, started development in 1988 comparable performance to gcc –O2 VPO performs all transformations on a single representation (RTLs), so it is possible to perform most phases in an arbitrary order. Experiments use all the 15 available optimization phases in VPO. Target architecture was the StrongARM SA-100 processor.

Florida State University Automatic Tuning of Libraries and Applications, LACSI Benchmarks Used two programs from each of the six MiBench categories, 244 total functions. CategoryProgramDescription auto bitcounttest processor bit manipulation abilities qsortsort strings using the quicksort sorting algorithm network dijkstraDijkstra’s shortest path algorithm patriciaconstruct patricia trie for IP traffic telecomm fftfast fourier transform adpcmcompress 16-bit linear PCM samples to 4-bit consumer jpegimage compression / decompression tiff2bwconvert color tiff image to b & w image security shasecure hash algorithm blowfishsymmetic block cipher with variable length key office stringsearchsearches for given words in phrases ispellfast spelling checker

Florida State University Automatic Tuning of Libraries and Applications, LACSI Outline Experimental framework Exhaustive phase order space enumeration Accurately determining dynamic performance Analyzing the DAG of function instances Conclusions

Florida State University Automatic Tuning of Libraries and Applications, LACSI Exhaustive Phase Order Enumeration Exhaustive enumeration is difficult compilers typically contain many different optimization phases optimizations may be successful multiple times for each function / program On average, we would need to evaluate different phase orders per function.

Florida State University Automatic Tuning of Libraries and Applications, LACSI Re-stating the Phase Ordering Problem Many different orderings of optimization phases produce the same code. Rather than considering all attempted phase sequences, the phase ordering problem can be addressed by enumerating all distinct function instances that can be produced by any combination of optimization phases.

Florida State University Automatic Tuning of Libraries and Applications, LACSI Naive Optimization Phase Order Space a b c d a bc dadadad bcbcbc All combinations of optimization phase sequences are attempted. L2 L1 L0

Florida State University Automatic Tuning of Libraries and Applications, LACSI Eliminating Consecutively Applied Phases A phase just applied in our compiler cannot be immediately active again. a b c d bc dadada cbbc L2 L1 L0

Florida State University Automatic Tuning of Libraries and Applications, LACSI Eliminating Dormant Phases Get feedback from the compiler indicating if any transformations were successfully applied in a phase. L2 L1 L0 a b c d bc dadad cb

Florida State University Automatic Tuning of Libraries and Applications, LACSI Detecting Identical Function Instances Some optimization phases are independent example: branch chaining & register allocation Different phase sequences can produce the same code r[2] = 1; r[2] = 1; r[3] = r[4] + r[2]; r[3] = r[4] + r[2];  instruction selection r[3] = r[4] + 1; r[3] = r[4] + 1; r[2] = 1; r[2] = 1; r[3] = r[4] + r[2]; r[3] = r[4] + r[2];  constant propagation r[2] = 1; r[2] = 1; r[3] = r[4] + 1; r[3] = r[4] + 1;  dead assignment elimination r[3] = r[4] + 1; r[3] = r[4] + 1;

Florida State University Automatic Tuning of Libraries and Applications, LACSI Detecting Equivalent Function Instances sum = 0; for (i = 0; i < 1000; i++ ) sum += a [ i ]; Source Code r[10]=0; r[12]=HI[a]; r[12]=r[12]+LO[a]; r[1]=r[12]; r[9]=4000+r[12]; L3 r[8]=M[r[1]]; r[10]=r[10]+r[8]; r[1]=r[1]+4; IC=r[1]?r[9]; PC=IC<0,L3; Register Allocation before Code Motion r[11]=0; r[10]=HI[a]; r[10]=r[10]+LO[a]; r[1]=r[10]; r[9]=4000+r[10]; L5 r[8]=M[r[1]]; r[11]=r[11]+r[8]; r[1]=r[1]+4; IC=r[1]?r[9]; PC=IC<0,L5; Code Motion before Register Allocation r[32]=0; r[33]=HI[a]; r[33]=r[33]+LO[a]; r[34]=r[33]; r[35]=4000+r[33]; L01 r[36]=M[r[34]]; r[32]=r[32]+r[36]; r[34]=r[34]+4; IC=r[34]?r[35]; PC=IC<0,L01; After Mapping Registers

Florida State University Automatic Tuning of Libraries and Applications, LACSI Resulting Search Space Merging equivalent function instances transforms the tree to a DAG. L2 L1 L0 a b c c d a d a d

Florida State University Automatic Tuning of Libraries and Applications, LACSI Techniques to Make Searches Faster Kept a copy of the program representation of the unoptimized function instance in memory to avoid repeated disk accesses. Enumerated the space in a depth-first order keeping in memory the program representation after each active phase to reduce number of phases applied. Reduced search time by at least a factor of 5 to 10. Able to completely enumerate 234 out of 244 functions in our benchmark suite, most in a few minutes, and the remainder in a few hours.

Florida State University Automatic Tuning of Libraries and Applications, LACSI Search Space Static Statistics FunctionInstsBlkLoopInstancesLenCFLeaves main(t)1, ,882, ,164 parse_sw…(j)1, , ,057 askmode(i) , skiptoword(i) , ,834 start_in…(j) , treeinit(i) , pfx_list…(i) ,269, ,660 main(f) ,789, ,214 sha_tran…(h) , ,262 initckch(i) ,075, ,988 main(p) , pat_insert(p) ,088, , average ,

Florida State University Automatic Tuning of Libraries and Applications, LACSI Outline Experimental framework Exhaustive phase order space enumeration Accurately determining dynamic performance Analyzing the DAG of function instances Conclusions

Florida State University Automatic Tuning of Libraries and Applications, LACSI Finding the Best Dynamic Function Instance On average, there were 174,575 distinct function instances for each studied function. Executing all distinct function instances would be too time consuming. Many embedded development environments use simulation instead of direct execution. Is it possible to infer dynamic performance of one function instance from another?

Florida State University Automatic Tuning of Libraries and Applications, LACSI Quickly Obtaining Dynamic Frequency Measures Two different instances of the same function having identical control-flow graphs will execute each block the same number of times. Statically estimate the number of cycles required to execute each basic block. dynamic frequency measure =  static cycles * block frequency)

Florida State University Automatic Tuning of Libraries and Applications, LACSI Dynamic Frequency Statistics FunctionInstances CFLeaves % from optimal BatchWorst main(t)2,882, , parse_sw…(j)180,762532, askmode(i)232, skiptoword(i)439, , start_in…(j)8, treeinit(i)8, pfx_list…(i)1,269, , main(f)2,789, , sha_tran…(h)548,812985, initckch(i)1,075,278324, main(p)14, pat_insert(p)1,088,108713, …. average174,

Florida State University Automatic Tuning of Libraries and Applications, LACSI Correlation - Dynamic Frequency Measures & Processor Cycles For leaf function instances Pearson’s correlation coefficient – 0.96 performing 4.38 executions will get within 98% of optimal, and 21 within 99.6% of optimal

Florida State University Automatic Tuning of Libraries and Applications, LACSI Outline Experimental framework Exhaustive phase order space enumeration Accurately determining dynamic performance Analyzing the DAG of function instances Conclusions

Florida State University Automatic Tuning of Libraries and Applications, LACSI Analyzing the DAG of Function Instances Can analyze the DAG of function instances to learn properties about the optimization phase order space. Can be used to improve Conventional compilation Searches for effective optimization phase orderings

Florida State University Automatic Tuning of Libraries and Applications, LACSI Outline Experimental framework Exhaustive phase order space enumeration Accurately determining dynamic performance Analyzing the DAG of function instances Conclusions

Florida State University Automatic Tuning of Libraries and Applications, LACSI Conclusions First work to show that the optimization phase order space can often be completely enumerated (at least for the phases in our compiler). Demonstrated how a near-optimal phase ordering can be obtained in a short period of time. Used phase interaction information from the enumerated phase order space to achieve a much faster compiler that still generated comparable code.