Auto-Vectorizer in Visual Studio 2012 – Cookbook

If you’ve not read previous posts in this series about auto-vectorization, you may want to begin at the beginning. This post presents a cookbook, aimed to help you get your C++ loops auto-vectorized.  Please use this as you experiment with Visual Studio 2012, and post any feedback as comments to this post.  We will use…

4

Auto-Vectorizer in Visual Studio 2012 – How Much Faster?

  If you’ve not read previous posts in this series about auto-vectorization, you may want to begin at the beginning. This post explains how to measure the benefits of auto-vectorization – how much it speeds up your code.  (To find out whether any particular loop was successfully vectorized, please see the earlier post called Did-It-Work?)…

8

Auto-Vectorizer in Visual Studio 2012 – Did It Work? – The Movie

  If you’ve not read previous posts in this series about auto-vectorization, you may want to begin at the beginning. In the most recent post, I explained how to request a report from the compiler that lists which loops in your program were auto-vectorized, and which not, with reasons.  This post is a video that…

0

Auto-Vectorizer in Visual Studio 2012 – Aliasing

If you’ve not read previous posts in this series about auto-vectorization, you may want to begin at the beginning. This post explains “aliasing”. The topic came up as an aside in a previous post.  Now it’s time to explain what it means, why it complicates the life of the auto-vectorizer, and limits the speedup the…

1

Auto-Vectorizer in Visual Studio 2012 – Did It Work?

  If you’ve not read previous posts in this series about auto-vectorization, you may want to begin at the beginning. This post will explain how to find out which loops in your C++ program were auto-vectorized.   Here is an example program, stored in a file called Source.cpp, with which to experiment: int main() {   const…

23

Auto-Vectorizer in Visual Studio 2012 – Rules for Loop Body

  If you haven’t read previous posts in this series about auto-vectorization, you may want to begin at the beginning. In the last post, we explained the rules for C++ loop headers that make your code amenable to auto-vectorization; we might say, make it auto-vectorizer-friendly.  Prompted by an online question from NitPick (our astute reader,…

39

Auto-Vectorizer in Visual Studio 2012 – Rules for Loop Header

If you haven’t read previous posts in this series about auto-vectorization, you may want to begin at the beginning. In this post, we look at those C++ loop patterns that the auto-vectorizer recognizes. We will start by explaining its rules for loop headers (defined below). Throughout this post, we will talk about what the auto-vectorizer…

33

Auto-Vectorizer in Visual Studio 2012 – How it Works

  I assume you have read previous posts in this blog about auto-vectorization, starting with auto-vectorization-overview. In this post, we will look at how the auto-vectorizer works. Here is a tiny program that calculates the cube of each element in array b, setting the answer into a matching array called a. Of course, this program…

18

Auto-Vectorizer in Visual Studio 2012 – Overview

This post will introduce and explain a new compiler feature in Visual Studio 2012, called auto-vectorization.  (A previous post – what is vectorization? – provides background) The Visual Studio 2012 auto-vectorizer tries to make loops in your code run faster by automatically vectorizing your code – that’s to say, using the SSE instructions available in all current mainline…

10