[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: amd64 arch and optimization flags?



On Thu, 06 Feb 2014 00:47:54 +0100, Julian Taylor wrote:

> On 06.02.2014 00:39, Jaromír Mikeš wrote:
>> 
>> Hi all,
>> 
>> I would like to add some optimization flags for amd64 arch in some
>> packages (mostly LV2 nad LADSPA plugins).
>> I found these as candidates for amd64 arch:
>> 
>> -msse -msse2 -mfpmath=sse
> 
> this is enabled by default on amd64
> 
>> -ffast-math
> 
> this is dangerous it changes results, sometimes significantly (e.g. for
> complex numbers), only use if you don't care about correctness or have
> verified its still correct.

IME, audio processing software can get away with it. Csound and its 400+ 
library of opcodes has been built with this option and I have had no 
complaints yet.

What is dangerous about this options? I see a warning in the gcc docs, 
but how can I know if my program relies "on a precise definition of IEEE 
floating point"?

> 
>> -ftree-vectorize
> 
> this does sometimes slow programs down, usually only programs doing
> numeric work profit from it, these usually enable it by themselves.
> It is enabled by the -O3 optimization level.
> it is mostly safe to use if you follow the C standard strictly (i.e. no
> unaligned access of aliased variables)

Audio processing software tend to be about numeric work ;)

It is probably better to pass -O3 to performance critical code.

> 
>> -mtune=generic
> 
> should be the default, but you can safely change that to something else.
> generic in gcc < 4.9 is I think pentium4 which is a very old chip.
> 
> gcc-4.9 will change the default of it to bulldozer/intel-core btw:
> http://gcc.gnu.org/gcc-4.9/changes.html

My experience is that -mtune=generic provides a great boost over no -
mtune, at least on i386 when I tested it.

I have just tested again on amd64 and it makes no difference.


-- 
Saludos,
Felipe Sateler


Reply to: