Summary for the PIPS tutorial given at PPoPP 2010
The design of hardware platforms has to meet several constraints such as execution time, energy consumption and system cost. In the recent years, Moore's Law has made many innovative architectural designs a reality, resulting in increasingly complex and heterogeneous target systems, and soaring programming costs.
To keep up with this situation, today's compilers must handle whole applications, redefine functional boundaries regardless of the APIs used, and target different processors simultaneously, yet their development cost must remain under control.
The PIPS compiler framework was designed in 1988 at MINES ParisTech to research interprocedural parallelization. It was based on core ideas that are still relevant today. The PIPS framework:
- supports entire Fortran 77 and C applications, while handling call sites, function definitions and missing library source code;
- is easily extensible, via text declarations of all analyses, transformations and key data structures;
- ensures global consistency of the various analyses and transformations thanks to these declarations (the Pipsmake algorithm);
- uses dynamic typing to support automatic consistency check, allocation / deallocation, copy, iterators and persistance for any object, however complex (the NewGen tool and runtime with XML back-end);
- uses linear algebra as a powerful underlying proof mechanism (the Linear library) based on the polytope model.
After 20 years of development and constant improvement, PIPS is a robust source-to-source compiler, providing a large set of program analyses and transformations with around 300 phases. Instead of reimplementing a source-to-source compiler instrastructure from scratch whenever a new programming technology appears, we focused on refactoring libraries, while taking advantage of PIPS extensible consistency manager, Pipsmake, to add new functionalities over time. Moreover, transformations and analyses can be combined in various ways for new purposes, and newcomers to PIPS immediately benefit from past contributions.
Recent developments in PIPS have focused on the inlining of library functions, outlining of key code parts and automatic generation of data communications. They include automatic code distribution, OpenMP-to-MPI code translation, automatic C and Fortran to CUDA translation, code modelization for graphic IDEs, genetic algorithm-based optimizations through Python scripting, SIMD (SSE, VMX...) portable code generation and code optimization for FPGA-based accelerators. Former activities include interprocedural parallelization, property instrumentation (aliasing, uninitialized variable and buffer overflow detections), code refactoring, etc.
PIPS is written mainly in C, has around 15 active contributors and its source code (456 KLOC) is available under the GPL v3 license. It can be downloaded from http://www.pips4u.org.
This tutorial aims to:
- briefly survey the functionalities available in PIPS, using examples;
- describe key internal data structures;
- show how to declare a new transformation within pipsmake;
- present how to implement this transformation within the PIPS infrastructure using only a few lines of C code, thanks to
- Newgen-based data structures and iterators, and existing PIPS libraries.
This presentation is based on the real-life experience of people having used PIPS for less than a year, using SVN to contribute from several different geographical locations, as well as source code documentation generated by Doxygen.
This tutorial is relevant to people interested in GPU or FPGA-based, hardware accelerators, hardware FPGA configuration, distributed code generation for scientific or MPSoC embedded computing, quickly developing a compiler for an exotic processor (Larrabee...), and more generally to all people interested in experimenting with new program transformations, verifications and/or instrumentations.