
On 12/10/2010 00:46, Jeremy Maitin-Shepard wrote:
Recent versions of compilers are starting to support automatic loop vectorization, which can be utilized with minimal, if any, code changes. I imagine that as a library author you are more inclined to look for a library solution to this optimization problem, whereas compiler authors are more likely to try to implement it as part of the optimizer, but it seems to me that implementing it in the compiler is generally preferable.
Implementing automatic vectorization in compilers is certainly worthwhile. Other people are working on this, as this is not really our area of expertise. We consider our approach complimentary; both approaches benefit different applications. To produce good vectorized code, you need to design your code in a way that is vectorizable. By making the vectorization explicit, it becomes clear what you need to do to make it work, and what the problems that prevent vectorization are. It can require concessions or reorganizing your code, something an optimizer will not do. Also, auto-vectorization technology is not at a level where it can compete with explicit vectorization. Even with an ideal setup where everything should be vectorizable, there is a very large gap between using explicit vectorization or just automatic vectorization, as can be demonstrated for example by this benchmark: <http://eigen.tuxfamily.org/index.php?title=Benchmark>