[Top][All Lists]

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

Re: [Discuss-gnuradio] Question on processor micro-architecture and GNU

From: CEL
Subject: Re: [Discuss-gnuradio] Question on processor micro-architecture and GNU Radio
Date: Fri, 17 May 2019 13:24:58 +0000

Hi Ali,

well, since GNU Radio does high-rate realtime signal processing, code
optimization is important to us. 
So much, that we strive to separate the most CPU-intense algorithms
into a separate library[1] that contains hand-optimized code for
different architectures (e.g. NEON, MMX, SSE2, SSE4.2…).

-march=native doesn't affect us as FOSS project very much, because
while that is fine for you if you compile stuff for your own computer,
you can't do that when you're compiling code for someone else's
computer, which might not have the same CPU microarch as you.

So, if you're a project, and you're having a build system, which all
large projects have, you must *never* enforce -march=native in your
build system by default. Someone will take your build system and build
a binary, put it into a package and ship it out to the users. And that
doesn't work out, since the user doesn't have the same CPU as the
computer building the binary.
So, by definition, that flag is interesting only to the end-user that
compiles the code her/himself; those are, in large projects, a minority
of users.

> There seems to be conflicting opinions online, ranging from "it's
does nothing" to "it can break code".

Well, there's also opinions online that the earth is flat :D

A lot of time and money goes into optimization of the machine code
generated by compiler suites like clang/LLVM and GCC. Of course that
means that if you use -march=native on a x86_64 with AVX2 and SSE up to
4.2, then your vector multiplications are going to be faster; yay!
So, if you're compiling GNU Radio on your supercomputing cluster's
build nodes to run a HPC simulation on a lot of identical nodes, by all
means, use -march=native. 

I wouldn't expect breakage; that sounds like unfounded rumors.
Compilers are comparatively mature these days. That doesn't mean that
bugs do not happen, but I'd surprised if I were the one to discover
Of course, code compiled with -march=native is only for the machine it
was compiled on, not for any other machine. If you copy that executable
to your neighbor's PC, well, you're the one breaking the code, not the
compiler. The compiler was told that it can expect a machine that
supports exactly the ISA it sees on its own CPU.

Best regards,

[1] https://libvolk.org
On Thu, 2019-05-16 at 14:30 -0700, Ali Dormiani wrote:
> Hello all,
> I was wondering how the compiler option "-march=native" effects large FOOS 
> projects like GNU Radio.
> There seems to be conflicting opinions online, ranging from "it's does 
> nothing" to "it can break code".
> Would GNU Radio (and VOLK by extension) benefit from this compiler option for 
> AVX512 (or other advanced x68-64 ISA) compliant chips? 
> Thank you for your time,
> Ali
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: smime.p7s
Description: S/MIME cryptographic signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]