1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

Optimizing Mesa Performance With Compiler Flags

Mesa

Published on 27 January 2013 09:00 PM EST
Written by Michael Larabel in Mesa
24 Comments

Compiler tuning can lead to performance improvements for many computational benchmarks by toying with the CFLAGS/CXXFLAGS, but is there much gain out of optimizing your Mesa build? Here's some benchmark results.

On Thursday for the Intel Mesa DRI driver was a new patch by Intel's Eric Anholt for attempting to default the driver compilation process to using -march=core2. This change is mainly to benefit 32-bit systems where SSE support can't be assumed by default, but with the i965 driver, more often than not it can be assumed an Intel Core 2 processor or newer is in use. (The older Intel processors are generally using the i915 driver.) By setting the -march=core2 flag, for i386 builds SSE would now be used for floating-point math and cmov instructions, plus other performance optimizations.

Eric noted that for 32-bit builds, the GLbenchmark offscreen performance went up by about 0.76% by defaulting to the Core2 optimizations. This patch was ultimately rejected since it turns out there's still some old Pentium 4s that could be found in an i965 driver configuration where things might break.

Curious to see what other performance changes could come from some basic compiler tuning, I did some Mesa benchmarks this weekend. This is on a high-end Ivy Bridge system and using x86_64 software, but was inspired by seeing Eric's patch earlier in the week. This is just some weekend benchmarking out of curiosity, although the drivers should be ideal where they are not CPU bottlenecked, but past testing has shown this isn't always the case for the Mesa/Gallium3D drivers.

By default, Mesa doesn't toy with the -march switch and it uses an -O2 optimization level. In this article, are benchmarks of -O1, -O2, -O3, and then -O3 while also passing -march=native. The -march=native will apply the CPU micro-architecture optimizations for the Intel Core i7 "Ivy Bridge" processor being used. GCC Link-Time Optimizations were also tested. While GCC 4.7.2 built out Mesa and glxinfo was still querying information correctly from the newly-built Mesa stack with LTO, when it came to running any OpenGL games/applications, they failed with the GCC LTO build.

The Intel HD 4000 graphics were then used with these different Mesa 9.1-devel builds for a variety of benchmarks from an Ubuntu 13.04 desktop paired with the Linux 3.8 kernel. Results in full, system logs, and other details are on OpenBenchmarking.org in the 1301279-FO-MESACOMPI30 result file.

Overall though, there wasn't much in the way of exciting performance changes... For the Intel HD 4000 graphics on Mesa 9.1-devel with the different CFLAGS/CXXFLAGS, the compile-time changes didn't yield much difference in the end for the OpenGL frame-rate.

Nexuiz was the only case where there was a significant difference as a result of the optimization level, but that is a difference of just a couple frames.

The Prey game, which is powered by id Tech 4, didn't even get any rise out of the Ivy Bridge optimizations or -O3 optimization level from GCC 4.7.2.

For those interested, more of these Mesa 9.1-devel benchmark results can be found on OpenBenchnarking.org.

About The Author
Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via and or contacted via .
Latest Linux Hardware Reviews
  1. CompuLab Intense-PC2: An Excellent, Fanless, Mini PC Powered By Intel's i7 Haswell
  2. From The Atom 330 To Haswell ULT: Intel Linux Performance Benchmarks
  3. AMD Radeon R9 285 Tonga Performance On Linux
  4. Apotop Wi-Copy
Latest Linux Articles
  1. AMD Moves Forward With Unified Linux Driver Strategy, New Kernel Driver
  2. MSI: Update Your BIOS From The Linux Desktop
  3. NVIDIA vs. AMD 2D Linux Drivers: Catalyst Is Getting Quite Good At 2D
  4. 15-Way GPU Comparison With Mesa 10.3 + Linux 3.17
Latest Linux News
  1. Ubuntu 16.04 Might Be The Distribution's Last 32-Bit Release
  2. Imagination Releases Full ISA Documentation For PowerVR Rogue GPUs
  3. Features GNOME Developers Want In The Linux Kernel
  4. GTK+ Gains Experimental Overlay Scrollbars
  5. Phoronix Test Suite 5.4 M3 Is Another Hearty Update
  6. GParted 0.20 Improves Btrfs Support
  7. EXT4 In Linux 3.18 Has Clean-ups, Bug Fixes
  8. Emacs 24.4 Has Built-In Web Browser, Improved Multi-Monitor Support
  9. NVIDIA's NVPTX Support For GCC Is Close To Being Merged
  10. KDE's KWin On Wayland Begins Using Libinput
Latest Forum Discussions
  1. HOPE: The Ease Of Python With The Speed Of C++
  2. Users/Developers Threatening Fork Of Debian GNU/Linux
  3. Bye bye BSD, Hello Linux: A Sys Admin's Story
  4. Updated and Optimized Ubuntu Free Graphics Drivers
  5. NVIDIA Presents Its Driver Plans To Support Mir/Wayland & KMS On Linux
  6. AMD Is Restructuring Again, Losing 7% Of Employees
  7. Open-Source AMD Fusion E-350 Support Takes A Dive
  8. Upgrade to Kaveri, very slow VDPAU performance