The SGI Pro 64 Compiler Infrastructure A Tutorial

  • Slides: 22
Download presentation
The SGI Pro 64 Compiler Infrastructure - A Tutorial Guang R. Gao (U of

The SGI Pro 64 Compiler Infrastructure - A Tutorial Guang R. Gao (U of Delaware) J. Dehnert (SGI) J. N. Amaral (U of Alberta) R. Towle (SGI) /Gao/Pro 64 -Intro

Acknowledgement The SGI Compiler Development Teams – The MIPSpro/Pro 64 Development Team University of

Acknowledgement The SGI Compiler Development Teams – The MIPSpro/Pro 64 Development Team University of Delaware – CAPSL Compiler Team These individuals contributed directly to this tutorial A. Douillet (Udel) S. Chan (Intel) Z. Hu (Udel) S. Liu (HP) S. Mantripragada (SGI) M. Murphy (SGI) D. Stephenson (SGI) H. Yang (Udel) 1/22/2022 F. Chow (Equator) W. Ho (Routefree) K. Lesniak (SGI) R. Lo (Routefree) C. Murthy (SGI) G. Pirocanac (SGI) D. Whitney (SGI) 2

What is Pro 64? • A suite of optimizing compiler tools for Linux/ Intel

What is Pro 64? • A suite of optimizing compiler tools for Linux/ Intel IA-64 systems • C, C++ and Fortran 90/95 compilers • Conforming to the IA-64 Linux ABI and API standards • Open to all researchers/developers in the community • Compatible with HP Native User Environment 1/22/2022 3

Who Might Want to Use Pro 64? • Researchers : test new compiler analysis

Who Might Want to Use Pro 64? • Researchers : test new compiler analysis and optimization algorithms • Developers : retarget to another architecture/system • Educators : a compiler teaching platform 1/22/2022 4

Outline • Background and Motivation • Part I: An overview of the SGI Pro

Outline • Background and Motivation • Part I: An overview of the SGI Pro 64 compiler infrastructure • Part II: The Pro 64 code generator design • Part III: Using Pro 64 in compiler research & development • SGI Pro 64 support • Summary 1/22/2022 5

PART I: Overview of the Pro 64 Compiler 1/22/2022 6

PART I: Overview of the Pro 64 Compiler 1/22/2022 6

Outline • Logical compilation model and component flow • WHIRL Intermediate Representation • Inter-Procedural

Outline • Logical compilation model and component flow • WHIRL Intermediate Representation • Inter-Procedural Analysis (IPA) • Loop Nest Optimizer (LNO) and Parallelization • Global optimization (WOPT) • Feedback • Design for debugability and testability 1/22/2022 7

Logical Compilation Model driver (sgicc/sgif 90/sgi. CC) back end (be, as) front end +

Logical Compilation Model driver (sgicc/sgif 90/sgi. CC) back end (be, as) front end + IPA (gfec/gfecc/mfef 90) Src (. c/. C/. f) WHIRL (. B/. I) Data Path 1/22/2022 linker (ld) obj (. o) a. out/. so Fork and Exec 8

Components of Pro 64 Front end Interprocedural Analysis and Optimization Loop Nest Optimization and

Components of Pro 64 Front end Interprocedural Analysis and Optimization Loop Nest Optimization and Parallelization Global Optimization Code Generation 1/22/2022 9

Data Flow Relationship Between Modules Lower to High W. -IPA. B Local IPA Main

Data Flow Relationship Between Modules Lower to High W. -IPA. B Local IPA Main IPA -O 3 LNO Inliner gfec . I gfecc lower I/O (only for f 90) f 90 Take either path Very high WHIRL High WHIRL Mid WHIRL -O 0 -phase: w=off -O 2/O 3 WHIRL C . w 2 c. c. w 2 c. h WHIRL fortran . w 2 f. f Lower all Lower Mid W CG Main opt Low WHIRL 1/22/2022 10

Front Ends • C front end based on gcc • C++ front end based

Front Ends • C front end based on gcc • C++ front end based on g++ • Fortran 90/95 front end from MIPSpro 1/22/2022 11

Intermediate Representation IR is called WHIRL • Tree structured, with references to symbol table

Intermediate Representation IR is called WHIRL • Tree structured, with references to symbol table • Maps used for local or sparse annotation • Common interface between components • Multiple languages, multiple targets • Same IR, 5 levels of representation • Continuous lowering during compilation • Optimization strategy tied to level 1/22/2022 12

IPA Main Stage Analysis – alias analysis – array section – code layout Optimization

IPA Main Stage Analysis – alias analysis – array section – code layout Optimization (fully integrated) – inlining – cloning – dead function and variable elimination – constant propagation 1/22/2022 13

IPA Design Features • User transparent – No makefile changes – Handles DSOs, unanalyzed

IPA Design Features • User transparent – No makefile changes – Handles DSOs, unanalyzed objects • Provide info (e. g. alias analysis, procedure properties) smoothly to: – loop nest optimizer – main optimizer – code generator 1/22/2022 14

Loop Nest Optimizer/Parallelizer • • All languages (including Open. MP) Loop level dependence analysis

Loop Nest Optimizer/Parallelizer • • All languages (including Open. MP) Loop level dependence analysis Uniprocessor loop level transformations Automatic parallelization 1/22/2022 15

Loop Level Transformations • Based on unified cost model • Heuristics integrated with software

Loop Level Transformations • Based on unified cost model • Heuristics integrated with software pipelining • Loop vector dependency info passed to CG – Loop Fission – Loop Fusion – Loop Unroll and Jam – Loop Peeling – Loop Tiling – Vector Data Prefetching – Loop Interchange 1/22/2022 16

Parallelization • Automatic Array privatization Doacross parallelization Array section analysis • Directive based Open.

Parallelization • Automatic Array privatization Doacross parallelization Array section analysis • Directive based Open. MP Integrated with automatic methods 1/22/2022 17

Global Optimization Phase • SSA is unifying technology • Use only SSA as program

Global Optimization Phase • SSA is unifying technology • Use only SSA as program representation • All traditional global optimizations implemented • Every optimization preserves SSA form • Can reapply each optimization as needed 1/22/2022 18

Pro 64 Extensions to SSA • Representing aliases and indirect memory operations (Chow et

Pro 64 Extensions to SSA • Representing aliases and indirect memory operations (Chow et al, CC 96) • Integrated partial redundancy elimination (Chow et al, PLDI 97; Kennedy et al, CC 98, TOPLAS 99) • Support for speculative code motion • Register promotion via load and store placement (Lo et al, PLDI 98) 1/22/2022 19

Feedback Used throughout the compiler • Instrumentation can be added at any stage •

Feedback Used throughout the compiler • Instrumentation can be added at any stage • Explicit instrumentation data incorporated where inserted • Instrumentation data maintained and checked for consistency through program transformations. 1/22/2022 20

Design for Debugability (DFD) and Testability (DFT) • DFD and DFT built-in from start

Design for Debugability (DFD) and Testability (DFT) • DFD and DFT built-in from start • Can build with extra validity checks • Simple option specification used to: – Substitute components known to be good – Enable/disable full components or specific optimizations – Invoke alternative heuristics – Trace individual phases 1/22/2022 21

Where to Obtain Pro 64 Compiler and its Support • SGI Source download http:

Where to Obtain Pro 64 Compiler and its Support • SGI Source download http: //oss. sgi. com/projects/Pro 64/ • University of Delaware Pro 64 Support Group http: //www. capsl. udel. edu/~pro 64@capsl. udel. edu 1/22/2022 22