300 likes | 330 Views
The Renaissance of Compiler Development. Com piler optimizations motivated by embedded systems Tibor Gyimóthy University of Szeged. Open Source Laboratory at the University of Szeged. Beszédes Árpád Ferenc Rudolf Gergely Tamás Gyimóthy Tibor Jász Judit Havasi Ferenc Kiss Ákos.
E N D
The Renaissance of Compiler Development Compiler optimizations motivated by embedded systems Tibor Gyimóthy University of Szeged Software Technology Forum
Open Source Laboratory at the University of Szeged Software Technology Forum
Beszédes Árpád Ferenc Rudolf Gergely Tamás Gyimóthy Tibor Jász Judit Havasi Ferenc Kiss Ákos Lóki Gábor Patrik Kluba Siket István Siket Péter Sógor Zoltán Tóth Gábor Vidács László Open Source Laboratory at the University of Szeged Software Technology Forum
The Dragon book Software Technology Forum
Good quality compilers Software Technology Forum
New challenges:embedded processors Software Technology Forum
Low energy computation • System-wide optimizations are required for energy-saving. • Software design has significant impact on the energy consumption of the processor. • Accurate energy models of the hardware modules are required for power analysis at system level. Software Technology Forum
Low energy computation(cont.) • Instruction level optimizations include reordering instructions to reduce switching,reduction of memory operands etc. • The register relabeling technique reorders the register labels of the generated code. A sample trace and a power model are used to obtain new labels (The Pennsylvania State University). Software Technology Forum
Low energy computation(cont.) • ARM is the most popular processor for the embedded domain. • The 32 bit ARM processor also supports the 16 bit Thumb instruction set. • By using Thumb code the I-cache activity (energy) can be reduced. • However,the restricted Thumb instruction set may lead to the loss in performance. • Profile guided algorithms were proposed for generating mixed ARM and Thumb code (The University of Arizona) Software Technology Forum
Low energy computation(cont.) • System-level power optimizing data-flow transformations are applied for multimedia applications(IMEC,Leuven,Belgium) • Main aim is to reduce the power consumption due to data storage and transfers (significant part of the total power budget of the system). • Performance and code size must be taken into account as well. Software Technology Forum
Low energy computation(cont.) • Tradional compiler approaches focusing only on speed are not sufficient for multimedia applications. • The power cost model is linear with respect to the acces frequency and the dependence on the memory size is determined by a polynomial function. • Code transformations are applied to the original source code (C). • The method reduces the size of the array signals and the acceses to array signals. • Very large power savings can be achived without introducing significant performance penalties. Software Technology Forum
Low energy computation(cont.) • Closely related to the code size reduction • Executing fewer instructions • Accessing external memory less frequently • Agressive code size optimization techniques • Post-link time optimizations Software Technology Forum
Code size reductions in GCC • A survey paper in ACM Computing Surveys,2003 • Magic switches & patches • Local factoring • Sequence abstraction • CSiBE- Code Size Benchmark • GCC improvement for Symbian Software Technology Forum
Magic switches & patches • Function inlining • Tree-to-rtl extension • Optimizing large jump tables • Extending move and compare parallelization • Crossjumping cleanup Software Technology Forum
Local factoring • Code motion techniques • Strategy: • Move identical instructions from basic blocks to their common predecessor and successor • Data and register dependence must not be altered • Implemented: • Code hoisting • moving the code to an earlier place in the execution path • Code sinking • moving the code to a later execution place Software Technology Forum
Code Hoisting Software Technology Forum
Code sinking Software Technology Forum
Sequence abstraction • Sequence Abstraction • Works on SESE code fragments • Strategy: • Find region of identical instructions which can be turned into procedures • Replace all occurrences with calls to the newly created subroutine Software Technology Forum
Sequence abstraction(cont) Software Technology Forum
Sequence abstraction • RTL implementation: • Compilation unit: function • No need to create a procedure, create only a call to a labelled representative code region Software Technology Forum
CSiBE-GCC Code Size Benchmark • www.inf.u-szeged.hu/CSiBE • Introduced in 2003 • ‘de facto’ a standard size benchmark for GCC • Continuous monitoring the impact of the new patches on the code size • New version: compilation time and performance • More and more GCC developers are using CSiBE in their daily work Software Technology Forum
CSiBE(cont) Software Technology Forum
CSiBE(cont) Software Technology Forum
CSiBE(cont) Software Technology Forum
Overall tendency of the code size 1.3% 1.3% 4.3% 5.1% 4.3% 5.1% 7.2% 7.2% Software Technology Forum
GCC improvement for Symbian • The official Symbian build is based on GCC 2.9, from the year 1998. • The GCC 2.95.3 was extended to support the Symbian target. • The modified compiler reduces the code size and improves the performance as well (5-10%). Software Technology Forum
Post-link time optimization • Interprocedural versions of the classical compiler optimization techniques are used for binary-rewriting of machine code(whole system optimization,Squeeze—Debray et al,ATOM—Univ.of Szeged). • Techniques: • Interprocedural control flow analysis,constant propagation,register liveness analysis • Redundant code-elimination • Unreachable-code elimination • Dead-code elimination • Strength-code elimination • Local factoring • Procedural abstraction Software Technology Forum
Some open issues in the GCC development • There is a need for effective size optimization methods on Tree-SSA level. • The sequence abstraction approach can be extended to the unit-at time level. • The post-link time optimization methods can be integrated into GCC. Software Technology Forum
Conclusions • Open source software is widely used in the industry • There is a need for machine–level programmers • Challenge:many people will use their programs Software Technology Forum
Effective compilers for embedded processors Software Technology Forum