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

Re: Compiling with -mtune?



Neil Williams wrote:

> On Thu, 2008-05-22 at 01:12 -0400, Felipe Sateler wrote:
>> Hi. Csound, a package I maintain, supports enabling a set of gcc
>> optimizations via a build option. Code generated with those options can be
>> significantly faster (I've seen improvements of over 2x). However, this
>> option means adding a -mtune option to gcc. Obviously, the only sane option
>> for a debian package is -mtune=generic (which is apparently only available on
>> x86 and amd64). However I read in the info pages for gcc:
>> 
>> > Produce code optimized for the most common IA32/AMD64/EM64T processors.
>> 
>> Does this mean that setting -mtune=generic is the same as setting -mtune to
>> the most popular processor? If so, can/should I use that option?
> 
> Only for the supported architectures or you'll get a build failure on
> ARM, powerpc, mips, sparc etc.

Of course. I already noted that it was only available on x86 and amd64.

> 
> To check the arch, always test against the HOST architecture. Native
> builds set HOST == BUILD but if the package is ever cross-built, your
> debian/rules must allow building an ARM package on amd64 (HOST=ARM,
> BUILD=amd64) and *NOT* enable -mtune.
> 
> DEB_HOST_ARCH_CPU=... -qDEB_HOST_ARCH_CPU)
> 
> This holds true for any architecture-specific checks in any package -
> always, always check the HOST value - BUILD is almost always the wrong
> variable to use.

I think csound is unlikely to be cross-built. Sound synthesis is a pretty
cpu-intensive task. If I enable it then I should only enable it on the
appropriate environments. However there is still the question: is it reasonable
to enable this option on supported archs?

-- 

  Felipe Sateler


Reply to: