LLVM Gets An Automatic Loop Vectorizer
A loop vectorizer has been committed to LLVM 3.2 that's capable of automatically vectorizing small loops.
After a few weeks of discussions about a new loop vectorizer for LLVM, Apple's Nadav Rotem shared this week that a new implementation has been committed.
While it's been committed, the feature is currently disabled by default and when using the Clang C/C++ front-end the -mllvm -vectorize switches must be set for turning on this automatic loop vectorizer.
Nadav mentions, "The loop vectorizer is far from being 'ready', and this feature should be considered as 'highly experimental'. The work on the loop vectorizer had just began, and there is lots of work ahead...We currently know of a number of areas where we can improve. 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."
The recent LLVM loop vectorizer discussions began in this thread at the beginning of October. "We are starting to work on an LLVM loop vectorizer. There's number of different projects that already vectorize LLVM IR. For example Hal's BB-Vectorizer, Intel's OpenCL Vectorizer, Polly, ISPC, AnySL, just to name a few. I think that it would be great if we could collaborate on the areas that are shared between the different projects. I think that refactoring LLVM in away that would expose target information to IR-level transformations would be a good way to start. Vectorizers, as well as other IR-level transformations, require target-specific information, such as the cost of different instruction or the availability of certain features. Currently, llvm-based vectorizers do not make use of this information, or just hard-code target information. A loop vectorizer would need target information. After we have some basic target information infrastructure in place we can start discussing the vectorizer itself."
LLVM 3.2 is planned for release in mid-December.
Latest Linux News
Latest Articles & Reviews
Most Viewed News This Week