260 likes | 375 Views
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. Motivation Overview Implementation Uses of WHIRL SSA
E N D
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
Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work Agenda WHIRL SSA - Open64 Workshop 2010
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 Motivation WHIRL SSA - Open64 Workshop 2010
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 Goal WHIRL SSA - Open64 Workshop 2010
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 Challenges WHIRL SSA - Open64 Workshop 2010
Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work Agenda WHIRL SSA - Open64 Workshop 2010
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 Design Decisions WHIRL SSA - Open64 Workshop 2010
For SCF, φ nodes are mapped on the root WN For GOTO-LABEL, φ nodes are placed on the LABEL PHI Placement WHIRL SSA - Open64 Workshop 2010
An Example (tempo highlights) WHIRL SSA - Open64 Workshop 2010
Motivation Overview Implementation Uses WHIRL SSA Current Status and Future Work Agenda WHIRL SSA - Open64 Workshop 2010
Major components Components Overview WHIRL SSA - Open64 Workshop 2010
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 SSA Manager WHIRL SSA - Open64 Workshop 2010
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 SSA Emitter WHIRL SSA - Open64 Workshop 2010
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 SSA Updater WHIRL SSA - Open64 Workshop 2010
Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work Agenda WHIRL SSA - Open64 Workshop 2010
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 Uses of H WHIRL SSA WHIRL SSA - Open64 Workshop 2010
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 Uses of H WHIRL SSA WHIRL SSA - Open64 Workshop 2010
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 Uses of L WHIRL SSA WHIRL SSA - Open64 Workshop 2010
Motivation Overview Implementation Uses of WHIRL SSA Current Status and Future Work Agenda WHIRL SSA - Open64 Workshop 2010
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 https://svn.open64.net/svnroot/open64/branches/open64-ssa Current Status WHIRL SSA - Open64 Workshop 2010
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? Future Work WHIRL SSA - Open64 Workshop 2010
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 Acknowledgements WHIRL SSA - Open64 Workshop 2010
Any questions?Thank you very much! WHIRL SSA - Open64 Workshop 2010
Backup Slides WHIRL SSA - Open64 Workshop 2010
Associate WN with SSA by map_id Access the SSA information by map_id SSA Representation WHIRL SSA - Open64 Workshop 2010
DU Representation • Based on underlying SSA information • Built-in UD chain in SSA • Construct DU chain on demand WHIRL SSA - Open64 Workshop 2010