Building with -msse

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Building with -msse

Russ Allbery-2
gnubg supports optionally building with SSE support for increased speed in
the analytical engine.  I have to date kept this disabled to not generate
binaries that might not run on all otherwise-supported Debian systems.

However, a user mentioned that he thinks all chips that fall into the
amd64 architecture have SSE and hence adding -msse would be safe for the
amd64 build.  Is that correct?  And in general are there any guidelines
about things like this?  I assume that using -msse for the i386 build is
still out since we still support 486 chips.

(I don't think the performance gain warrants the complexity of building
two binaries, although it is noticable.)

--
Russ Allbery ([hidden email])               <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Paul Wise via nm
On Sun, Apr 27, 2008 at 10:05 AM, Russ Allbery <[hidden email]> wrote:

>  However, a user mentioned that he thinks all chips that fall into the
>  amd64 architecture have SSE and hence adding -msse would be safe for the
>  amd64 build.  Is that correct?

http://en.wikipedia.org/wiki/X86-64 says:

"SSE and SSE2 are available in 32-bit mode in modern x86 processors;
however, if they're used in 32-bit programs, those programs will only
work on systems with processors that support them. This is not an
issue in 64-bit programs, as all processors that support AMD64 support
SSE and SSE2, so using SSE and SSE2 instructions instead of x87
instructions does not reduce the set of machines on which the programs
will run."

--
bye,
pabs

http://wiki.debian.org/PaulWise


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Faidon Liambotis-2
In reply to this post by Russ Allbery-2
Russ Allbery wrote:
> However, a user mentioned that he thinks all chips that fall into the
> amd64 architecture have SSE and hence adding -msse would be safe for the
> amd64 build.  Is that correct?  And in general are there any guidelines
> about things like this?  I assume that using -msse for the i386 build is
> still out since we still support 486 chips.
AFAIK, the amd64 gcc enables those extension by default.

Regards,
Faidon


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Russ Allbery-2
Faidon Liambotis <[hidden email]> writes:
> Russ Allbery wrote:

>> However, a user mentioned that he thinks all chips that fall into the
>> amd64 architecture have SSE and hence adding -msse would be safe for the
>> amd64 build.  Is that correct?  And in general are there any guidelines
>> about things like this?  I assume that using -msse for the i386 build is
>> still out since we still support 486 chips.

> AFAIK, the amd64 gcc enables those extension by default.

Yeah, that was one of the things that was confusing me.  It looks like
gnubg also has some custom code that's enabled based on a configure
argument as well.

Also, it looks like it probes at runtime for SSE, so I may be able to
build with that on i386 as well.

--
Russ Allbery ([hidden email])               <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Bernd Eckenfels
In article <[hidden email]> you wrote:
> Also, it looks like it probes at runtime for SSE, so I may be able to
> build with that on i386 as well.

If it probes, it is most likely loading an optimized asm module, and you
dont need the SSE switch at all.

Gruss
Bernd


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Goswin von Brederlow-2
In reply to this post by Russ Allbery-2
Russ Allbery <[hidden email]> writes:

> Faidon Liambotis <[hidden email]> writes:
>> Russ Allbery wrote:
>
>>> However, a user mentioned that he thinks all chips that fall into the
>>> amd64 architecture have SSE and hence adding -msse would be safe for the
>>> amd64 build.  Is that correct?  And in general are there any guidelines
>>> about things like this?  I assume that using -msse for the i386 build is
>>> still out since we still support 486 chips.
>
>> AFAIK, the amd64 gcc enables those extension by default.
>
> Yeah, that was one of the things that was confusing me.  It looks like
> gnubg also has some custom code that's enabled based on a configure
> argument as well.

You should talk to upstream and have it default to on for amd64.

And check if there is any sse3 support. That one needs cpu suport on
amd64 too.

> Also, it looks like it probes at runtime for SSE, so I may be able to
> build with that on i386 as well.

MfG
        Goswin


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Kurt Roeckx
In reply to this post by Russ Allbery-2
On Sat, Apr 26, 2008 at 07:05:17PM -0700, Russ Allbery wrote:
> gnubg supports optionally building with SSE support for increased speed in
> the analytical engine.  I have to date kept this disabled to not generate
> binaries that might not run on all otherwise-supported Debian systems.
>
> However, a user mentioned that he thinks all chips that fall into the
> amd64 architecture have SSE and hence adding -msse would be safe for the
> amd64 build.  Is that correct?

There is no need to enable -msse on amd64.  It has always been on by
default.

> And in general are there any guidelines
> about things like this?  I assume that using -msse for the i386 build is
> still out since we still support 486 chips.

If you want to have different optimizations depending on the cpu,
there are a two options I know of:
- When you hace shared libraries you can put them in directories like
  /usr/lib/i686/sse/.  The dynamic linker whould pick it up for
  you in that case.  (I have no idea if it looks at i686/sse or not,
  but it looks at various other dirs, I can't find documentation for it.)
- Use runtime detection of the cpu and select the best option yourself.

> (I don't think the performance gain warrants the complexity of building
> two binaries, although it is noticable.)

It all depends if you think the performance gain is worth it.


Kurt


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Bernd Zeimetz-4
In reply to this post by Goswin von Brederlow-2

> And check if there is any sse3 support. That one needs cpu suport on
> amd64 too.

Are there amd64 machines which do *not* support sse3?


--
 Bernd Zeimetz                           Debian GNU/Linux Developer
 GPG Fingerprint: 06C8 C9A2 EAAD E37E 5B2C BE93 067A AD04 C93B FF79


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Steinar H. Gunderson
In reply to this post by Bernd Eckenfels
On Sun, Apr 27, 2008 at 07:17:14AM +0200, Bernd Eckenfels wrote:
>> Also, it looks like it probes at runtime for SSE, so I may be able to
>> build with that on i386 as well.
> If it probes, it is most likely loading an optimized asm module, and you
> dont need the SSE switch at all.

If you use gcc inline assembler and want to use SSE registers in constraints
(or use SSE intrinsics), you'll need -msse even if you write all the SSE code
yourself. It's not an unusual situation.

/* Steinar */
--
Homepage: http://www.sesse.net/


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Goswin von Brederlow-2
In reply to this post by Bernd Zeimetz-4
Bernd Zeimetz <[hidden email]> writes:

>> And check if there is any sse3 support. That one needs cpu suport on
>> amd64 too.
>
> Are there amd64 machines which do *not* support sse3?

processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 4
model name      : AMD Athlon(tm) 64 Processor 3200+
stepping        : 8
cpu MHz         : 2002.585
cache size      : 1024 KB
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow
bogomips        : 4008.05
TLB size        : 1024 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp

Does any Athlon64 support sse3?

MfG
        Goswin


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Goswin von Brederlow-2
In reply to this post by Kurt Roeckx
Kurt Roeckx <[hidden email]> writes:

> On Sat, Apr 26, 2008 at 07:05:17PM -0700, Russ Allbery wrote:
>> gnubg supports optionally building with SSE support for increased speed in
>> the analytical engine.  I have to date kept this disabled to not generate
>> binaries that might not run on all otherwise-supported Debian systems.
>>
>> However, a user mentioned that he thinks all chips that fall into the
>> amd64 architecture have SSE and hence adding -msse would be safe for the
>> amd64 build.  Is that correct?
>
> There is no need to enable -msse on amd64.  It has always been on by
> default.
>
>> And in general are there any guidelines
>> about things like this?  I assume that using -msse for the i386 build is
>> still out since we still support 486 chips.
>
> If you want to have different optimizations depending on the cpu,
> there are a two options I know of:
> - When you hace shared libraries you can put them in directories like
>   /usr/lib/i686/sse/.  The dynamic linker whould pick it up for
>   you in that case.  (I have no idea if it looks at i686/sse or not,
>   but it looks at various other dirs, I can't find documentation for it.)

It doesn't. But one could add /usr/lib/sse via
/etc/ld.so.conf.d/package-sse when package-sse gets installed with
some check that the system actualy does have sse support.

> - Use runtime detection of the cpu and select the best option yourself.

Always better. Someone might want to share /usr between systems with
and without sse.

MfG
        Goswin


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Bernd Zeimetz-4
In reply to this post by Goswin von Brederlow-2

> Does any Athlon64 support sse3?

yes, since Venice Stepping E3 and San Diego Stepping E4.

But thanks for the reminder, there were indeed CPUs before that.

--
 Bernd Zeimetz                           Debian GNU/Linux Developer
 GPG Fingerprint: 06C8 C9A2 EAAD E37E 5B2C BE93 067A AD04 C93B FF79


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Kurt Roeckx
In reply to this post by Goswin von Brederlow-2
On Sun, Apr 27, 2008 at 04:06:40PM +0200, Goswin von Brederlow wrote:

> Kurt Roeckx <[hidden email]> writes:
> > If you want to have different optimizations depending on the cpu,
> > there are a two options I know of:
> > - When you hace shared libraries you can put them in directories like
> >   /usr/lib/i686/sse/.  The dynamic linker whould pick it up for
> >   you in that case.  (I have no idea if it looks at i686/sse or not,
> >   but it looks at various other dirs, I can't find documentation for it.)
>
> It doesn't. But one could add /usr/lib/sse via
> /etc/ld.so.conf.d/package-sse when package-sse gets installed with
> some check that the system actualy does have sse support.

It's not because it has or doesn't have sse when you installed it, that
the hosts that is going run it is actually going to be the same.  If sse
is important for some libraries, it shouldn't be that hard to change
the dynamic linker to look there.


Kurt


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Bastian Blank
In reply to this post by Kurt Roeckx
On Sun, Apr 27, 2008 at 02:02:24PM +0200, Kurt Roeckx wrote:
> - When you hace shared libraries you can put them in directories like
>   /usr/lib/i686/sse/.  The dynamic linker whould pick it up for
>   you in that case.  (I have no idea if it looks at i686/sse or not,
>   but it looks at various other dirs, I can't find documentation for it.)

| /usr/lib/i686/sse2: (hwcap: 0x0008000004000000)

The documentation is the source.

Bastian

--
There's a way out of any cage.
                -- Captain Christopher Pike, "The Menagerie" ("The Cage"),
                   stardate unknown.


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Russ Allbery-2
In reply to this post by Steinar H. Gunderson
"Steinar H. Gunderson" <[hidden email]> writes:
> On Sun, Apr 27, 2008 at 07:17:14AM +0200, Bernd Eckenfels wrote:

>> If it probes, it is most likely loading an optimized asm module, and
>> you dont need the SSE switch at all.

> If you use gcc inline assembler and want to use SSE registers in
> constraints (or use SSE intrinsics), you'll need -msse even if you write
> all the SSE code yourself. It's not an unusual situation.

After further investigation, it looks like gnubg does runtime probing, but
if you tell it to use SSE, it also adds -msse to the build flags.  Will
building with -msse break the binaries on i386 chips without SSE all by
itself, even if gnubg doesn't run any of its SSE code unless SSE is
actually detected?

--
Russ Allbery ([hidden email])               <http://www.eyrie.org/~eagle/>


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Building with -msse

Steinar H. Gunderson
On Sun, Apr 27, 2008 at 12:36:05PM -0700, Russ Allbery wrote:
> After further investigation, it looks like gnubg does runtime probing, but
> if you tell it to use SSE, it also adds -msse to the build flags.  Will
> building with -msse break the binaries on i386 chips without SSE all by
> itself, even if gnubg doesn't run any of its SSE code unless SSE is
> actually detected?

-msse might very well make GCC generate SSE assembler from regular C code,
yes.

/* Steinar */
--
Homepage: http://www.sesse.net/


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]