On Sun, Mar 28, 2010 at 10:37:07PM +0100, Артем Шинкаров wrote: > Hi, > > I have a project in mind which I'm going to propose to the GCC in terms of > Google Summer of Code. My project is not on the list of project ideas > (http://gcc.gnu.org/wiki/SummerOfCode) that is why it would be very > interesting > for me to hear any opinions and maybe even to find a mentor. > > > 1. Project idea > > A brief project idea is to create an abstract layer for vectorized > computations. This would allow to write a portable vectorized code. > > > 2. State of the art > > Nowadays most of processors have a support for SIMD computations. However, the > problem is that each hardware has a different set of SIMD instructions: Intel > MMX+SSE+AVX, PowerPC Altivec, ARM iWMMXt, and so on. GCC supports most of > architecture-specific instructions providing built-in functions. It is > considerably convenient to use these functions when you want to optimize some > piece of code. The problem starts when you want to make this code portable. > It is not a very common task, and of course GCC has a vectorizer. > Unfortunately, there are many examples which show that it is relatively simple > for a human to find a right place in the code and vectorize it, but it is > extremely hard for the compiler to do the same. As a result we end up with the > code which is not using the capabilities of the architecture. > It would be much easier for the programmer to use an abstract layer to > implement a vectorized code. A compiler should deal with the portability > issues > dispatching the code from the abstract layer to the particular architecture. > My > experience shows that there are no such a library for C/C++ that could solve > the problem. There are some attempts like: http://libsimd.sourceforge.net/ but > it is only a small part of the idea, and unfortunately the development is > suspended. Or maybe I am wrong and everything is already written?
Note, the powerpc and cell compilers have the notion of a vector keyword that is followed by a type (powerpc needs -maltivec and/or -mvsx to enable it). So you can write: vector float sum (vector float a, vector float b) { return a+b; } Now, ideally, it would be useful to have sytax so you could change the vector size, and the compiler would do the conversion to/from hw types to abstract types. -- Michael Meissner, IBM 4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA meiss...@linux.vnet.ibm.com