IBM Haifa researchers' contribution to GCC helps compilers generate better code
IBM Haifa Labs News Center
GCC, the GNU Compiler Collection, is a compiler that takes a program's source code and converts it into binary instructions that can be understood by a computer. Almost all open-source software is built using GCC.
The latest release of GCC 4.0 contains key contributions from the IBM Haifa Labs in the area of auto-vectorization. This feature economizes processor operations by finding pieces of code in which a single instruction can be applied to multiple data elements. By mapping up to 16 scalar operations to a single vector operation, this optimization boosts the compiler's performance for everything from video games to supercomputing.
What is GCC?
The GNU Compiler Collection (GCC) is a set of progamming language compilers produced as part of the GNU Project. GCC is free software created using an open development environment. It functions as a standard compiler for the open source Unix-like operating systems, along with certain other operating systems, such as Mac OS X. A worldwide community of developers cooperates to ensure that GCC and the GNU system work on multiple architectures and diverse environments, and to more thoroughly test and extend the features of GCC.
"GCC carries special significance in the world of open source software," notes Ayal Zaks, manager of the Compiler Technologies group at the IBM Haifa Lab. "Work on this compiler represents an entire philosophy of cooperation and community for software development." GCC's role in open source programming has been compared to the role of free press in a democratic society.
Since 1987, many volunteers from academia and the private sector have been working to continuously improve the functionality and quality of the GCC compiler. Some of the compiler's key components were, and continue to be, developed at IBM Research laboratories.
The new GCC 4.0
Significant changes and improved infrastructure for GCC 4.0 have enabled developers to build new and more powerful optimization engines. These optimizations can take several forms, but in general, they provide ways that the compiler can look at an entire program and boost performance. The new GCC platform uses an intermediate language that enables the addition of optimizations. Most of the new GCC optimizations are built on top of this 'middle' ground.
One optimization being introduced is called autovectorization. This optimization, contributed primarily by researchers at the IBM Haifa Lab, enables GCC to generate code with vector instructions that run on the new IBM PowerPC. Depending on how much of the code can be vectorized and relevant data sizes, the new optimization was able to make GCC up to 20 times faster in tests that were carried out.
In keeping with the philosophy of community work for the GCC, the auto-vectorization led by Haifa researchers also includes additions that resulted from close cooperation with individuals at the IBM T.J.Watson and Rochester locations. Additional contributions resulted from our work with Apple Computer, Red Hat, SUSE, and Ecole des Mines de Paris (ENSMP).
Vector machines were introduced in the 1970's, to increase processor utilization by accelerating the initiation of operations, and keeping the instruction pipeline full. To take advantage of vector hardware, programs can be rewritten to use vector operations on whole arrays instead of operations on individual array elements one at a time. Vectorization occurs when loops of instructions are rewritten in vector form. When vectorization is applied automatically by a compiler, it is referred to as autovectorization.
Essentially, autovectorization identifies parts of the code that can use a single instruction instead of multiple numbers of instructions. Compiler performance can be enhanced roughly by a factor of 4, 8, or 16 times, depending on the application on which it is used. In general, this optimization was found to be especially good for gaming, graphics, and multimedia applications.
IBM optimizations to GCC
Autovectorization is just one of the optimizations contributed by groups in IBM. Aside from additional optimizations contributed by IBM Watson and IBM Boeblingen, Haifa researchers supplied GCC 4.0 with a feature known as modulo scheduling. This optimization focuses on reordering instructions, especially those in loop-intensive programs, so they are executed in the most optimal fashion. Instruction scheduling is crucial in preventing expensive pipeline stalls during runtime. This work follows the seminal work of Haifa researchers on GCC's interblock scheduler back in 1997, a scheduler widely known since then as the "Haifa Scheduler".
"Within the GCC community, we see our role as active initiators in demonstrating how to get maximum leverage from the new architectural improvements," notes Zaks. "There is something very rewarding in leading significant optimizations through cooperation with the open source community and at the same time enabling performance improvements on IBM platforms," adds Dorit Naishlos, leader of the autovectorization project at the IBM Haifa Labs. The groups plans to continue providing GCC with optimizations and new features that will benefit the entire open source community.
For more information see: