gcc autovectorize

Burdick, Thomas Edward tburdi1 at uic.edu
Mon Dec 11 22:23:39 CET 2006


Sorry to double post, but I should also note that the sse instruction to
load aligned data is significantly faster than that which loads unaligned
data. I'm not sure of the exact cost difference, but I do remember reading
its much better to use aligned data if possible.

On Mon, December 11, 2006 3:18 pm, Burdick, Thomas Edward wrote:
>>From the website
>
> http://www.gnu.org/software/gcc/projects/tree-ssa/vectorization.html
>
> -ftree-vectorize
>
> then enable the simd extensions (maybe use cmake to check if these are
> available? or use a runtime check like they do in mplayer?)
>
> -msse or -msse2 or -msse3 or -maltivec
>
> Then if you want to see what loops are vectorized, and why if they are not
>
> -ftree-vectorizer-verbose=5
>
> It works fairly well on simple loops like I mentioned before. The problem
> loops are ones that can escape before some known end, or if there's an
> unknown end.
>
> The website has some good examples of what works and what doesn't. Even
> for the things that don't work, this doesn't mean that you can't use the
> vector operations, it just means they won't be automatically done for you.
>
> GCC has some fairly generic functions that work with sse/altivec and
> possibly others. They are gcc specific though. I'm curious to know if
> gnome uses the simd instructions at all?
>
> -Tom
>
> On Mon, December 11, 2006 3:09 pm, Boudewijn Rempt wrote:
>> On Monday 11 December 2006 17:01, Tom Burdick wrote:
>>> I thought it worthy of mentioning, that in all of the newest GCC's (4.x
>>> and
>>> higher) there is an autovectorizing option. I've been using this in a
>>> project of my own and its made certain loops significantly faster. I'd
>>> suggest possibly trying krita with the flags this way to see what gcc
>>> vectorizes or not. Notably, it will automatically take a loop like
>>>
>>> for(int i = 0; i < 64; i++) {
>>> 	a[i]  = b[i]*c[i];
>>> }
>>>
>>> and instead use whatever simd instructions you have to eliminate a good
>>> number of iterations.
>>>
>>> If you've already tried this out, or are already using the simd
>>> instructions disregard!
>>
>> That's a good point, we don't do this. What do we need to do to enable
>> it?
>>
>> --
>> Boudewijn Rempt
>> http://www.valdyas.org/fading/index.cgi
>> _______________________________________________
>> kimageshop mailing list
>> kimageshop at kde.org
>> https://mail.kde.org/mailman/listinfo/kimageshop
>>
>
>
> _______________________________________________
> kimageshop mailing list
> kimageshop at kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop
>




More information about the kimageshop mailing list