From: Laurent GUERBY <laurent@guerby.net>
To: Loic Dachary <loic@dachary.org>
Cc: Kevin Greenan <kmgreen2@gmail.com>,
Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: GCC -msse2 portability question
Date: Sun, 23 Mar 2014 23:34:30 +0100 [thread overview]
Message-ID: <1395614070.15058.140.camel@pc2> (raw)
In-Reply-To: <532F3B0E.2050204@dachary.org>
On Sun, 2014-03-23 at 20:50 +0100, Loic Dachary wrote:
> Hi Laurent,
>
> In the context of optimizing erasure code functions implemented by
> Kevin Greenan (cc'ed) and James Plank at
> https://bitbucket.org/jimplank/gf-complete/ we ran accross a question
> you may have the answer to: can gcc -msse2 (or -msse* for that matter
> ) have a negative impact on the portability of the compiled binary
> code ?
>
> In other words, if a code is compiled without -msse* and runs fine on
> all intel processors it targets, could it be that adding -msse* to the
> compilation of the same source code generate a binary that would fail
> on some processors ? This is assuming no sse specific functions were
> used in the source code.
>
> In gf-complete, all sse specific instructions are carefully protected
> to not be run on a CPU that does not support them. The runtime
> detection is done by checking CPU id bits ( see
> https://bitbucket.org/jimplank/gf-complete/pull-request/7/probe-intel-sse-features-at-runtime/diff#Lsrc/gf_intel.cT28 )
>
> The corresponding thread is at:
>
> https://bitbucket.org/jimplank/gf-complete/pull-request/4/defer-the-decision-to-use-a-given-sse/diff#comment-1479296
>
> Cheers
>
Hi Loic,
The GCC documentation is here with lists of architecture supporting
sse/sse2:
http://gcc.gnu.org/onlinedocs/gcc-4.8.2/gcc/i386-and-x86-64-Options.html#i386-and-x86-64-Options
So unless you want to run your code a very very old x86 32 bit processor
"-msse" shouldn't be an issue. "-msse2" is similar.
-mtune=xxx with xxx being a recent arch could be interesting for you
because it keeps compatibility with the generic arch while tuning
resulting code on the specific arch (for example the current fashionable
arch like corei7).
For alibrary you can choose the code you execute a load/run time
for a specific function by using the STT_GNU_IFUNC feature :
http://vger.kernel.org/~davem/cgi-bin/blog.cgi/2010/02/07
http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Function-Attributes.html#index-g_t_0040code_007bifunc_007d-attribute-2529
I believe recent GLIBC use this feature to tune
some performance/arch sensitive functions.
Sincerely,
Laurent
next prev parent reply other threads:[~2014-03-23 22:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-23 19:50 GCC -msse2 portability question Loic Dachary
2014-03-23 22:34 ` Laurent GUERBY [this message]
2014-03-24 21:27 ` Loic Dachary
2014-03-25 9:43 ` Laurent GUERBY
2014-03-25 9:56 ` Loic Dachary
2014-03-25 11:22 ` Laurent GUERBY
2014-03-25 14:44 ` Milosz Tanski
2014-03-25 18:45 ` Loic Dachary
2014-03-24 1:40 ` Sage Weil
2014-03-25 19:08 ` Loic Dachary
[not found] ` <CA+AFVBhpOZEPehsd4qHCBr4aRzv60ZW8LzRwKsduUrZmLV1wxQ@mail.gmail.com>
2014-03-25 19:21 ` Loic Dachary
2014-03-25 19:46 ` Milosz Tanski
[not found] ` <CA+AFVBgOEz8_fv9H-8_kOuVSJNL3KQ+36b5kscfjnRMs09DZ6Q@mail.gmail.com>
[not found] ` <53327E59.7060408@dachary.org>
[not found] ` <CANP1eJG9xoCPkFs19KXG1RPUqc-D3aO_0SBOM=4WWFRN2JtX=g@mail.gmail.com>
2014-03-26 18:24 ` Loic Dachary
[not found] ` <CANP1eJErc4qnRhtOCs=Cnh6VNtihLVcZxB1PSCQjpH0sFDBuWA@mail.gmail.com>
2014-03-26 22:13 ` Loic Dachary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395614070.15058.140.camel@pc2 \
--to=laurent@guerby.net \
--cc=ceph-devel@vger.kernel.org \
--cc=kmgreen2@gmail.com \
--cc=loic@dachary.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.