3/6/20161 WHIRL SSA: A New Optimization Infrastructure for Open64 Keqiao Yang, Zhemin Yang Parallel Processing Institute, Fudan University, Shanghai Hui.

Slides:



Advertisements
Similar presentations
8. Static Single Assignment Form Marcus Denker. © Marcus Denker SSA Roadmap  Static Single Assignment Form (SSA)  Converting to SSA Form  Examples.
Advertisements

School of EECS, Peking University “Advanced Compiler Techniques” (Fall 2011) SSA Guo, Yao.
Context-Sensitive Interprocedural Points-to Analysis in the Presence of Function Pointers Presentation by Patrick Kaleem Justin.
Architecture-dependent optimizations Functional units, delay slots and dependency analysis.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
SSA.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Some Properties of SSA Mooly Sagiv. Outline Why is it called Static Single Assignment form What does it buy us? How much does it cost us? Open questions.
Stanford University CS243 Winter 2006 Wei Li 1 Register Allocation.
Components of representation Control dependencies: sequencing of operations –evaluation of if & then –side-effects of statements occur in right order Data.
Stanford University CS243 Winter 2006 Wei Li 1 SSA.
Program Representations. Representing programs Goals.
Assembly Code Verification Using Model Checking Hao XIAO Singapore University of Technology and Design.
University of Houston Extending Global Optimizations in the OpenUH Compiler for OpenMP Open64 Workshop, CGO ‘08.
Semi-Sparse Flow-Sensitive Pointer Analysis Ben Hardekopf Calvin Lin The University of Texas at Austin POPL ’09 Simplified by Eric Villasenor.
6/9/2015© Hal Perkins & UW CSEU-1 CSE P 501 – Compilers SSA Hal Perkins Winter 2008.
TM Pro64™: Performance Compilers For IA-64™ Jim Dehnert Principal Engineer 5 June 2000.
Recap from last time We were trying to do Common Subexpression Elimination Compute expressions that are available at each program point.
Generating Code From DAGs Directed Ascyclic Graph (DAG) A tree structure such that nodes may have more than one parent Multiple parents are allowed so.
Representing programs Goals. Representing programs Primary goals –analysis is easy and effective just a few cases to handle directly link related things.
Feedback: Keep, Quit, Start
Next Section: Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis (Wilson & Lam) –Unification.
Cpeg421-08S/final-review1 Course Review Tom St. John.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Advanced Compilers CMPSCI 710.
Improving code generation. Better code generation requires greater context Over expressions: optimal ordering of subtrees Over basic blocks: Common subexpression.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
A High Performance Application Representation for Reconfigurable Systems Wenrui GongGang WangRyan Kastner Department of Electrical and Computer Engineering.
Previous finals up on the web page use them as practice problems look at them early.
Range Analysis. Intraprocedural Points-to Analysis Want to compute may-points-to information Lattice:
Intraprocedural Points-to Analysis Flow functions:
Improving Code Generation Honors Compilers April 16 th 2002.
Recap from last time: live variables x := 5 y := x + 2 x := x + 1 y := x y...
Global optimization. Data flow analysis To generate better code, need to examine definitions and uses of variables beyond basic blocks. With use- definition.
Schedule Midterm out tomorrow, due by next Monday Final during finals week Project updates next week.
Direction of analysis Although constraints are not directional, flow functions are All flow functions we have seen so far are in the forward direction.
Loop Induction Variable Canonicalization. Motivation Background: Open64 Compilation Scheme Loop Induction Variable Canonicalization Project Tracing and.
Pointer analysis. Pointer Analysis Outline: –What is pointer analysis –Intraprocedural pointer analysis –Interprocedural pointer analysis Andersen and.
From last class. The above is Click’s solution (PLDI 95)
Precision Going back to constant prop, in what cases would we lose precision?
CSE P501 – Compiler Construction
Predicated Static Single Assignment (PSSA) Presented by AbdulAziz Al-Shammari
1 CS 201 Compiler Construction Introduction. 2 Instructor Information Rajiv Gupta Office: WCH Room Tel: (951) Office.
Cleaning up the CFG Eliminating useless nodes & edges C OMP 512 Rice University Houston, Texas Fall 2003 Copyright 2003, Keith D. Cooper & Linda Torczon,
Unified Parallel C at LBNL/UCB Compiler Optimizations in the Berkeley UPC Translator Wei Chen the Berkeley UPC Group.
ESEC/FSE-99 1 Data-Flow Analysis of Program Fragments Atanas Rountev 1 Barbara G. Ryder 1 William Landi 2 1 Department of Computer Science, Rutgers University.
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
1 Control Flow Graphs. 2 Optimizations Code transformations to improve program –Mainly: improve execution time –Also: reduce program size Can be done.
Single Static Assignment Intermediate Representation (or SSA IR) Many examples and pictures taken from Wikipedia.
1 ”MCUDA: An efficient implementation of CUDA kernels for multi-core CPUs” John A. Stratton, Sam S. Stone and Wen-mei W. Hwu Presentation for class TDT24,
Global Register Allocation Based on
MPCS – Advanced java Programming
For Example: User level quicksort program Three address code.
Topic 10: Dataflow Analysis
Factored Use-Def Chains and Static Single Assignment Forms
Control Flow Analysis CS 4501 Baishakhi Ray.
Intermediate Representations
CS 201 Compiler Construction
Intermediate Representations
Code Optimization Overview and Examples Control Flow Graph
Static Single Assignment Form (SSA)
Topic 5a Partial Redundancy Elimination and SSA Form
Dominator Tree First BB is the root node, each node
Pointer analysis.
EECS 583 – Class 7 Static Single Assignment Form
EECS 583 – Class 7 Static Single Assignment Form
Intermediate Code Generation
The SGI Pro64 Compiler Infrastructure
CSE P 501 – Compilers SSA Hal Perkins Autumn /31/2019
Presentation transcript:

3/6/20161 WHIRL SSA: A New Optimization Infrastructure for Open64 Keqiao Yang, Zhemin Yang Parallel Processing Institute, Fudan University, Shanghai Hui Shi, Yiran Wang Global Delivery China Center, Hewlett-Packard, Shanghai

WHIRL SSA - Open64 Workshop /6/2016 Agenda Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work

WHIRL SSA - Open64 Workshop /6/2016 Motivation No explicit data flow information on WHIRL –HSSA used in Pre_OPT and Main_OPT Data flow analysis in LNO and IPA –Depends on DU manager provided by Pre_OPT –Incomplete in presence of aliases –Difficult to update DU manager –Becomes imprecise due to the updates  WHIRL SSA: a better way to facilitate the data flow analysis on WHIRL

WHIRL SSA - Open64 Workshop /6/2016 Goal A better “DU manager” –Factored UD chain Reduced traversing overhead –Keeping alias information Handle both direct and indirect access Eliminate ‘incomplete DU/UD chain’ Easy to use –STL-style iterator to traverse the DU/UD chain A flexible Infrastructure –Available from H WHIRL to L WHIRL –Lightweight, demand-driven –Precise and updatable

WHIRL SSA - Open64 Workshop /6/2016 Challenges No explicit CFG –High level structured control flow, e.g. DO_LOOP Update of the SSA information –To deal with LNO/IPA transformation of WHIRL Ease incremental implementation

WHIRL SSA - Open64 Workshop /6/2016 Agenda Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work

WHIRL SSA - Open64 Workshop /6/2016 Design Decisions Stored in side data tructure –No new operators introduced to WHIRL –No changes to the existing components Alias –Alias are represented by χ and μ –Virtual Symbol Live-range of versions doesn’t overlap Available from H WHIRL to L WHIRL –H WHIRL: High level SCF available –L WHIRL: Target information exposed

WHIRL SSA - Open64 Workshop /6/2016 PHI Placement For SCF, φ nodes are mapped on the root WN For GOTO-LABEL, φ nodes are placed on the LABEL

WHIRL SSA - Open64 Workshop /6/2016 An Example (tempo highlights)

WHIRL SSA - Open64 Workshop /6/2016 Agenda Motivation Overview Implementation Uses WHIRL SSA Current Status and Future Work

WHIRL SSA - Open64 Workshop /6/2016 Components Overview Major components

WHIRL SSA - Open64 Workshop /6/2016 SSA Manager Manage the SSA information –Interface to access the SSA information –Manage the SSA nodes (φ, χ, μ) –Manage the maps to look up the SSA nodes Use hash_map, key is WHIRL node’s map_id and value is index to the table –Manage the WHIRL SSA symbol table –Build DU on demand

WHIRL SSA - Open64 Workshop /6/2016 SSA Emitter SSA information is converted from Pre_OPT/Main_OPT emitter –Instead of constructing from WHIRL directly for rapid implementation –Pre_OPT emitter: H WHIRL SSA –Main_OPT emitter: L WHIRL SSA The standalone SSA constructor is under development

WHIRL SSA - Open64 Workshop /6/2016 SSA Updater Update SSA within a small region Requirements on the region –Single Entry, Multiple Exits –Control flow in/out of the region is not changed No new entry/exit introduced by the transformation Steps –Build new CFG within the region –Insert φ, χ and μ nodes –Rename variables, the version starts from the current max value in current PU –Merge the region back by renaming the versions in entry and exit nodes or inserting assignments

WHIRL SSA - Open64 Workshop /6/2016 Agenda Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work

WHIRL SSA - Open64 Workshop /6/2016 Uses of H WHIRL SSA In LNO –Most transformations in LNO will change the CFG Difficult to maintain the SSA information –But, LNO transformations only change the CFG within a small region (like a DO-LOOP or the BLOCK contains the DO-LOOP) Satisfy the SSA updater’s requirements Able to keep the data flow information up-to-date

WHIRL SSA - Open64 Workshop /6/2016 Uses of H WHIRL SSA In IPA –Context-sensitive and flow-sensitive call graph –Benefit to inter-procedural alias analysis Possible to build a scalable, context-sensitive and flow-sensitive alias analyzer with the help of WHIRL SSA

WHIRL SSA - Open64 Workshop /6/2016 Uses of L WHIRL SSA LWOPT: Low Whirl OPTimizer –Target-specific optimizations Target-specific information exposed –ABI, such as parameter passing and return value –PREGs are created by register promotion –Move transformations from CG EBO to LWOPT Better data flow analysis High level operators available, like ADD, SUB Type information available, I1, I2, I4, I8

WHIRL SSA - Open64 Workshop /6/2016 Agenda Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work

WHIRL SSA - Open64 Workshop /6/2016 Current Status Completed –WHIRL SSA Manager, SSA based DU manager –Pre_OPT Emitter –Reader/Writer –Utilities ir_b2a, whirl2c, etc Ongoing –SSA verifier –SSA updater Get the branch from Open64 SVN –

WHIRL SSA - Open64 Workshop /6/2016 Future Work Standalone SSA Constructor –Build SSA on top of WHIRL Remove dependency on Pre_OPT/Main_OPT emitter –Encapsulate CFG/SSA builder as utilities Invoked on demand Enable optimizations based on WHIRL SSA –LNO –IPA –L WHIRL optimizer –Register TN SSA in CG?

WHIRL SSA - Open64 Workshop /6/2016 Acknowledgements Thanks to Fred Chow and Sun Chan who spent a lot of time in discussions with us and who provided a lot of suggestions, design review and code review. Thanks to Xiaomi An for help with applying WHIRL SSA to flow-sensitive alias analysis Thanks to Min Zhao for help with extending SSA to L WHIRL

WHIRL SSA - Open64 Workshop /6/2016 Any questions? Thank you very much!

WHIRL SSA - Open64 Workshop /6/2016 Backup Slides

WHIRL SSA - Open64 Workshop /6/2016 SSA Representation Associate WN with SSA by map_id –Access the SSA information by map_id

WHIRL SSA - Open64 Workshop /6/2016 DU Representation Based on underlying SSA information –Built-in UD chain in SSA –Construct DU chain on demand