Re: 3dnow, mmx, k6-2 optimizing?

2004-09-17 Thread Puna Tannehill
Interesting.  I just tried the settings you suggested, and it seems 
that -mcpu is depreciated for -mtune.  ALWAYS check the documentation 
first.  :-)  Here's the details:

http://gcc.gnu.org/onlinedocs/gcc-3.4.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options
Puna
Puna Tannehill wrote:
James Green wrote:
Hi Puna,
I had a k6-2 a few years back (before discovering BSD :) and did a lot
of Linux From Scratch work on it. I found that passing -march=i586
-mcpu=i686 produced by far the best results for pretty much any C/C++
code. Of course the code produced will not run on anything but a k6-2,
which as I understand it is a 686 core with 586 interface/timings, and
likewise if memory serves specifying only -march=i586 or -march=i686
(implying -mcpu=i586 or -mcpu=i686 respectively) won't run on the k6-2
either. Definitely a trade off between speed and (total lack of)
portablility. Again that was gcc-2.9x days...

Interesting.  Was there an option for -march=k6-2 at that time?  Were
the results based on a comparison of that setting and the ones you
mention above?
Do you happen to know if there is a particular benchmarking program that 
might be useful to testing different compiles in FreeBSD?

I've also seen recommendations using '586/mmx' and 'k7', but it seems
interesting that someone would create a 'k6-2' flag if there were not
significant and benefitial optimizations that would be applied.  Of
course, whether anyone coded for that particular processor is probably
extemely rare, so I can see how the -march -mcpu combination you
suggested would probably be a better choice.
Here are the relavent bits from dmesg (Compaq Presario 1692):
CPU: AMD-K6(tm) 3D processor (432.98-MHz 586-class CPU)
  Origin = "AuthenticAMD"  Id = 0x58c  Stepping = 12
  Features=0x8021bf
  AMD Features=0x8800
K6-family MTRR support enabled (2 registers)
As far as ports such as Xorg/Xfree86, I am not entirely clear on CFLAGS
inheritance, but AFAIK Xorg/Xfree don't gain much/anything from
optimisation over than your usual -O2 and friends. I understand that
this is down to whether they have been written to make use of these cpu
functions/optimisations.
On the other hand though, it is the specific applications that run under
X, such as mplayer that tend to be written to make use of mmx, sse,
3dnow etc. because for graphics it makes a _big_ difference. Generally
you find toggles in the Makefile to enable/force certain optimisation.
Definitely worth looking at.

According to the latest GCC, you can use -m3dnow -mmmx and it is of
some benefit when comiling XF86 (and hopefully Xorg).  I can't find the 
page offhand, but it was in the GCC Documentation, and I posted it in 
other responses of this same thread.  I haven't been
able to test it yet, as I'm still compiling Xorg as we speak.

Puna

On Mon, 2004-09-13 at 17:07, Puna Tannehill wrote:
I've been looking for possible flags, optimizations, really anything 
that would help me setup my laptop to use mmx and 3dnow.  I've 
updated /etc/make.conf to -march to the drum of a k6-2, but I'm not 
even sure if mmx and 3dnow are being taken into consideration for 
compiling and such, especially for Xorg.

I did some googling and found people who used CFLAGS like -mmmx and 
-m3dnow, but when I run with those options, they fail and said to be 
invalid.  they don't appear in 'man gcc' which should have been the 
first place i looked.  I'm not finding anything in terms of compiling 
or configuring Xorg to use 3dnow or mmx, or even how to check to see 
if they are automatically detected and used.

Any thoughts?
Puna
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-mobile
To unsubscribe, send any mail to 
"[EMAIL PROTECTED]"



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: 3dnow, mmx, k6-2 optimizing?

2004-09-13 Thread Vulpes Velox
On Mon, 13 Sep 2004 16:12:59 -0500
Puna Tannehill <[EMAIL PROTECTED]> wrote:

> > I don't know why those flags would not be working for you; I've
> > been using them for quite some time now on my Athlon (32-bit) box.
> >  One
> > oddity I just noticed very recently is that, with the recent
> > patches to"make", the CPUTYPE variable seems to be ignored now,
> > which is why I explicitly added the "-march" flag to CFLAGS. 
> > Also, note that I don't use "-mmmx -m3dnow" for kernel builds; you
> > don't want to be doing this, as it can easily break things in the
> > kernel, but for general builds and port builds, it's fine:

Hmm, really?  Not had much of a problem with it here and kernel
builds.

> > CPUTYPE?=athlon
> 
> I had that problem too.  The '?=' should be just '='.  I see in the 
> notes that '?=' is for compiling for different machine, but I don't
> do that so I just left is as 'CPUTYPE=' and it added the -march
> accordingly.
> 
> > CFLAGS= -O3 -pipe -march=athlon -mmmx -m3dnow

On a related question, any one know in what combination -mmmx, -msse,
and -m3dnow are useful in? I got bored once and tried all three on
5.3beta3 and ended up breaking a few things and ncurses was not
working right in all situations with it.

BTW was a little confused when reading the docs, are these for like
when are building for like 586 and want to include sse, 3dnow, or the
like? Or does the CPUTYPE not all ready take care of that?

> > # buildkernel variables settings
> > 
> > KERNCONF=CUSTOM
> > COPTFLAGS= -O3 -pipe -march=athlon
> 
> I see many people using a -O3, but I've never been able to use any 
> optimization levels above -O without compile errors, or having 
> problems with SSH.  Just out of curiosity, do you see a significant 
> different in performance with that level of optimization?

Never noticed much or any difference when I messed with it. Just had
thinks break in annoying ways. I've personally ran into lots of
problems with X stuff compiled with -O3. IIRC it would compile and ect
but generally fail on run time where with -02 it would general be
compile problems with later things... or something like that...
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: 3dnow, mmx, k6-2 optimizing?

2004-09-13 Thread Puna Tannehill
Conrad J. Sabatier wrote:
On Mon, 13 Sep 2004 12:23:18 -0500, Puna Tannehill <[EMAIL PROTECTED]>
wrote:

I've been looking for possible flags, optimizations, really anything 
that would help me setup my laptop to use mmx and 3dnow.  I've updated

/etc/make.conf to -march to the drum of a k6-2, but I'm not even sure 
if mmx and 3dnow are being taken into consideration for compiling and 
such, especially for Xorg.

I did some googling and found people who used CFLAGS like -mmmx and 
-m3dnow, but when I run with those options, they fail and said to be 
invalid.  they don't appear in 'man gcc' which should have been the 
first place i looked.  I'm not finding anything in terms of compiling 
or configuring Xorg to use 3dnow or mmx, or even how to check to see 
if they are automatically detected and used.

Any thoughts?
Puna

I don't know why those flags would not be working for you; I've been
using them for quite some time now on my Athlon (32-bit) box.  One
oddity I just noticed very recently is that, with the recent patches to
"make", the CPUTYPE variable seems to be ignored now, which is why I
explicitly added the "-march" flag to CFLAGS.  Also, note that I don't
use "-mmmx -m3dnow" for kernel builds; you don't want to be doing this,
as it can easily break things in the kernel, but for general builds
and port builds, it's fine:
CPUTYPE?=athlon
I had that problem too.  The '?=' should be just '='.  I see in the 
notes that '?=' is for compiling for different machine, but I don't do 
that so I just left is as 'CPUTYPE=' and it added the -march accordingly.

CFLAGS= -O3 -pipe -march=athlon -mmmx -m3dnow
# buildkernel variables settings
KERNCONF=CUSTOM
COPTFLAGS= -O3 -pipe -march=athlon
I see many people using a -O3, but I've never been able to use any 
optimization levels above -O without compile errors, or having 
problems with SSH.  Just out of curiosity, do you see a significant 
different in performance with that level of optimization?

Puna
It's working for me now, I'm not sure why it was failing before.
Puna
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: 3dnow, mmx, k6-2 optimizing?

2004-09-13 Thread Conrad J. Sabatier
On Mon, 13 Sep 2004 12:23:18 -0500, Puna Tannehill <[EMAIL PROTECTED]>
wrote:

> I've been looking for possible flags, optimizations, really anything 
> that would help me setup my laptop to use mmx and 3dnow.  I've updated
> 
> /etc/make.conf to -march to the drum of a k6-2, but I'm not even sure 
> if mmx and 3dnow are being taken into consideration for compiling and 
> such, especially for Xorg.
> 
> I did some googling and found people who used CFLAGS like -mmmx and 
> -m3dnow, but when I run with those options, they fail and said to be 
> invalid.  they don't appear in 'man gcc' which should have been the 
> first place i looked.  I'm not finding anything in terms of compiling 
> or configuring Xorg to use 3dnow or mmx, or even how to check to see 
> if they are automatically detected and used.
> 
> Any thoughts?
> 
> Puna

I don't know why those flags would not be working for you; I've been
using them for quite some time now on my Athlon (32-bit) box.  One
oddity I just noticed very recently is that, with the recent patches to
"make", the CPUTYPE variable seems to be ignored now, which is why I
explicitly added the "-march" flag to CFLAGS.  Also, note that I don't
use "-mmmx -m3dnow" for kernel builds; you don't want to be doing this,
as it can easily break things in the kernel, but for general builds
and port builds, it's fine:

CPUTYPE?=athlon
CFLAGS= -O3 -pipe -march=athlon -mmmx -m3dnow

# buildkernel variables settings

KERNCONF=CUSTOM
COPTFLAGS= -O3 -pipe -march=athlon

-- 
Conrad J. Sabatier <[EMAIL PROTECTED]> -- "In Unix veritas"
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: 3dnow, mmx, k6-2 optimizing?

2004-09-13 Thread Puna Tannehill
Erik Trulsson wrote:
On Mon, Sep 13, 2004 at 12:23:18PM -0500, Puna Tannehill wrote:
I've been looking for possible flags, optimizations, really anything 
that would help me setup my laptop to use mmx and 3dnow.  I've updated 
/etc/make.conf to -march to the drum of a k6-2, but I'm not even sure 
if mmx and 3dnow are being taken into consideration for compiling and 
such, especially for Xorg.

I did some googling and found people who used CFLAGS like -mmmx and 
-m3dnow, but when I run with those options, they fail and said to be 
invalid.  they don't appear in 'man gcc' which should have been the 
first place i looked.  I'm not finding anything in terms of compiling 
or configuring Xorg to use 3dnow or mmx, or even how to check to see 
if they are automatically detected and used.

Any thoughts?

You do not say which version of FreeBSD or GCC you are using.
Gcc 2.95 (which is what FreeBSD 4.x ships with) do not know about MMX
or 3Dnow, and will not take advantage of them.
Gcc 3.4 (which is what FreeBSD 5.x comes with) does know about MMX and
3DNow and will take advantage of them when invoked correctly.
The switches you mention (-mmx and -m3dnow) are valid for gcc 3.4 but
not for gcc 2.95.
Apologies!  I'm running v5.3-BETA3 with GCC v3.4.2.
You can look at the GCC documentation found at
http://gcc.gnu.org/onlinedocs/ to find out what options are supported
by which versions of GCC.
mmm, documentation...  Thank you!  I have added the options to CFLAGS 
in /etc/make.conf and am currently rebuilding world without any stops 
yet.  Although, there is probably little or nothing outside of X 
windows that those options might help optimize.  But I'll be 
rebuilding Xorg and XFCE right after I'm done with the world.

For those who are following, here are the pages that I found most 
useful as reference materials:

Intel 386 and AMD x86-64 Options:
http://gcc.gnu.org/onlinedocs/gcc-3.4.1/gcc/i386-and-x86-64-Options.html#i386%20and%20x86-64%20Options
X86 Built-in Functions:
http://gcc.gnu.org/onlinedocs/gcc-3.4.1/gcc/X86-Built-in-Functions.html#X86%20Built-in%20Functions
Puna
---
"Pinky, are you pondering what I'm pondering?"
"I think so Brain, but burlap chaffs me so..."
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: 3dnow, mmx, k6-2 optimizing?

2004-09-13 Thread Erik Trulsson
On Mon, Sep 13, 2004 at 12:23:18PM -0500, Puna Tannehill wrote:
> I've been looking for possible flags, optimizations, really anything 
> that would help me setup my laptop to use mmx and 3dnow.  I've updated 
> /etc/make.conf to -march to the drum of a k6-2, but I'm not even sure 
> if mmx and 3dnow are being taken into consideration for compiling and 
> such, especially for Xorg.
> 
> I did some googling and found people who used CFLAGS like -mmmx and 
> -m3dnow, but when I run with those options, they fail and said to be 
> invalid.  they don't appear in 'man gcc' which should have been the 
> first place i looked.  I'm not finding anything in terms of compiling 
> or configuring Xorg to use 3dnow or mmx, or even how to check to see 
> if they are automatically detected and used.
> 
> Any thoughts?

You do not say which version of FreeBSD or GCC you are using.
Gcc 2.95 (which is what FreeBSD 4.x ships with) do not know about MMX
or 3Dnow, and will not take advantage of them.
Gcc 3.4 (which is what FreeBSD 5.x comes with) does know about MMX and
3DNow and will take advantage of them when invoked correctly.
The switches you mention (-mmx and -m3dnow) are valid for gcc 3.4 but
not for gcc 2.95.

You can look at the GCC documentation found at
http://gcc.gnu.org/onlinedocs/ to find out what options are supported
by which versions of GCC.



-- 

Erik Trulsson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


3dnow, mmx, k6-2 optimizing?

2004-09-13 Thread Puna Tannehill
I've been looking for possible flags, optimizations, really anything 
that would help me setup my laptop to use mmx and 3dnow.  I've updated 
/etc/make.conf to -march to the drum of a k6-2, but I'm not even sure 
if mmx and 3dnow are being taken into consideration for compiling and 
such, especially for Xorg.

I did some googling and found people who used CFLAGS like -mmmx and 
-m3dnow, but when I run with those options, they fail and said to be 
invalid.  they don't appear in 'man gcc' which should have been the 
first place i looked.  I'm not finding anything in terms of compiling 
or configuring Xorg to use 3dnow or mmx, or even how to check to see 
if they are automatically detected and used.

Any thoughts?
Puna
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"