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. Intel Xeon E5-1680 v3 & E5-2687W v3 Compared To The Core i7 5960X On Linux
  2. Intel 120GB 530 Series SSD Linux Performance
  3. Btrfs/EXT4/XFS/F2FS RAID 0/1/5/6/10 Linux Benchmarks On Four SSDs
  4. AMD's Windows Catalyst Driver Remains Largely Faster Than Linux Drivers
Latest Linux Articles
  1. NVIDIA vs. Nouveau Drivers With Linux 3.18 + Mesa 10.4-devel
  2. Is The Open-Source NVIDIA Driver Fast Enough For Steam On Linux Gaming?
  3. Linux 3.18 File-System Performance Minimally Changed But Possible Regressions
  4. AMD Radeon Gallium3D Is Catching Up & Sometimes Beating Catalyst On Linux
Latest Linux News
  1. There's New In-Fighting Over The Future Of Compiz
  2. GTK+ Inspector Gains More Features Ahead Of GNOME 3.16
  3. Clang 3.6 Will Hopefully Have OpenMP Support
  4. A Go Front-End Could Soon Be Landing In LLVM
  5. Linux 3.18-rc6 Released, A Worrisome Regression Remains
  6. HandBrake 0.10 Brings H.265 & VP8 Encoders
  7. Gngr: A New Web Browser Focused On Privacy
  8. Linux 3.18 Kernel: Not Much Change With Intel Haswell Performance
  9. More File-System Tests Of The Linux 3.18 Kernel
  10. Using NVIDIA's NVENC On Linux With FFmpeg
Latest Forum Discussions
  1. Roadmap to Catalyst 14.10 ?
  2. how to configure module phoromatic ?
  3. PulseAudio 6.0 Is Coming & Other Linux Audio Plans For The Future
  4. Debian Developer Resigns From The Systemd Maintainership Team
  5. Updated and Optimized Ubuntu Free Graphics Drivers
  6. Cant get working Kaveri APU - A10-7850k
  7. Script for Fan Speed Control
  8. Debian Init System Coupling Vote Results