gcc autovectorize

Cyrille Berger cberger at cberger.net
Mon Dec 11 22:22:46 CET 2006


> 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!

well I have tried and never found the option to pass gcc to make it
understand to use the simd instructions ;)

The only problem is that it will only benefit our user that build krita
themselves (mostly gentoo users), and those of them which use the
relevant gcc option (only gentoo users). Two problems:
1) those options are dangerous, unfortunately very often they will make
most C++ application even more buggy and crashy than they allready are
(and as krita is far to have achieve a full level of stability, this is
a bit annoying)
2) most of our user don't build krita themselves, and therefor use the
distribution option for compilation, and most distribution doesn't build
with those optimization (if they even build with mmx instructions
enabled)

So the plan is to make a direct usuage of simd instructions and to offer
a run time check like, for instance, the gimp and mplayer do. But we
have yet to decide the API to achieve that goal. There was a discution
about this, but no decision was taken :'(

That's said, nothing prevent us to write our loop in such a way that the
autovector of gcc transform them to use simd. Except that I would like
to have the possiblity to ask user which report crash to easily disable
those optimizations.

-- 
Cyrille Berger


More information about the kimageshop mailing list