Benchmarking LLVM's Automatic Loop Vectorizer

Posted by Michael Larabel on October 27, 2012

Yesterday I wrote about an automatic loop vectorizer having been committed to LLVM this week. I've now carried out some benchmarks of this automatic loop vectorizer in conjunction with the Clang compiler to see the performance impact of this still experimental but promising feature.

As mentioned in Friday's article, the LLVM auto loop vectorizer is still deemed experimental and "far from being ready", thus is currently not enabled by default. This feature will premiere with LLVM 3.2 in December and can be enabled by passing the -mllvm -vectorize flags through the Clang C/C++ compiler.

While ultimately the automatic loop vectorizer should be a performance win, one of the Apple engineers working on this LLVM code wrote, "At the moment the vectorizer will vectorize anything it can, because we do not have a 'cost-model' to estimate the profitability of vectorization. Implementing a cost model is a high-priority for us, and until this is ready you should expect to see slowdowns on many loops. Another area which we need to improve is the memory dependence check. At the moment we have a very basic memory legality check which can be improved. Additionally, there are a number of cases where we generate poor vector code or suffer from a phase-rdering problem. Once we solve these problems we can continue to implement additional features."

Using the latest LLVM/Clang SVN code as of Friday, I carried out some early benchmarks of the automatic loop vectorizer when running some open-source Phoronix Test Suite / OpenBenchmarking.org tests. The only difference between test runs was setting the CFLAGS/CXXFLAGS for -mllvm -vectorize.

For some of the benchmarks, there was no measurable change in performance when the automatic loop vectorizer for LLVM was enabled.

The most common case, however, was actually a performance drop when the LLVM auto loop vectorizer was enabled. As mentioned, there isn't yet any cost-model for LLVM to determine when to vectorize a loop or not, plus other performance tuning of this newly-committed code is still needed.

Of the benchmarks run for this initial testing, the only test profile showing a positive improvement out of the automatic loop vectorizer was PostgreSQL.

More benchmarks and other system information/logs from the system during this initial LLVM auto loop vectorizer benchmarking can be found on OpenBenchmarking.org via the 1210264-RA-LLVMLOOPV66 result file.

Discuss this article in our forums, IRC channel, or email the author. You can also follow our content via RSS and on social networks like Facebook, Identi.ca, and Twitter (@Phoronix and @MichaelLarabel). Subscribe to Phoronix Premium to view our content without advertisements, view entire articles on a single page, and experience other benefits.
Latest Hardware Reviews
  1. Sumo Lounge Emperor
  2. Gallium3D Continues Improving OpenGL For Older Radeon GPUs
  3. 15-Way Open vs. Closed Source NVIDIA/AMD Linux GPU Comparison
  4. Nouveau vs. NVIDIA Linux Comparison Shows Shortcomings
Latest Software Articles
  1. The Cost Of Ubuntu Disk Encryption
  2. Btrfs vs. EXT4 vs. XFS vs. F2FS On Linux 3.10
  3. AMD Radeon R600 GPU LLVM 3.3 Back-End Testing
  4. F2FS File-System Shows Regressions On Linux 3.10
Latest Linux News
  1. Mageia 3 Released, Still Using Legacy GRUB
  2. NetBSD 6.1 Brings In More Features
  3. Using Six Monitors With AMD's Open-Source Linux Driver
  4. Benchmarking The Intel P-State, CPUfreq Changes
  5. FreeBSD Still Working On Next-Gen Package Manager
  6. DNF Still Advancing As Experimental Yum For Fedora
  7. Logitech Begins Supporting Linux Users
  8. Modern Intel Gallium3D Driver Still Being Toyed With
  9. Linux 3.10 Kernel Benchmarks On A Core i7 Laptop
  10. GCC 4.8.1 Compiler Due To Be Out Next Week
  11. Linux 3.10 Kernel Benchmarks For Intel Ivy Bridge
Latest Forum Talk
  1. The Cost Of Ubuntu Disk Encryption
  2. DRM Moves Ahead With HTML5 Specification
  3. Mageia 3 Released, Still Using Legacy GRUB
  4. Logitech Begins Supporting Linux Users
  5. Logitech supports linux!
  6. Btrfs vs. EXT4 vs. XFS vs. F2FS On Linux 3.10
  1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Motherboards
  5. Peripherals
  6. Processors
  7. Software
  8. Operating Systems
  9. All Articles
  1. Linux Benchmarking
  2. OpenBenchmarking.org
  3. Phoronix Test Suite