public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Performance Issues and processor arquitecture!
       [not found] <256710.37200.qm@web31901.mail.mud.yahoo.com>
@ 2011-01-11 15:41 ` Ian Lance Taylor
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Lance Taylor @ 2011-01-11 15:41 UTC (permalink / raw)
  To: Marcelo Pugliesi; +Cc: GCC Help

Marcelo Pugliesi <mpugliesi2@yahoo.com.br> writes:

> Well, I'm compiling the kernel 2.6.34 or 2.6.36 for Ubuntu 10.10 64bits. I have 
> a core i7 860 processor, accessing the menuconfig, right at processor family, if 
> I check the family Core2/Xeon I have less performance from my kernel than if I 
> use the option Pentium 4! No matter if I use the GCC version 4.4.4 or 4.5.1!
> My question then is simple, Why I have a superior performance when using Pentium 
> 4 architecture if the GCC documentation tells me I should use the Core2/Xeon for 
> a better result?

I don't know what the kernel build does.  What do the actual command
lines look like (I think you can see them via make V=1).  Specifically,
which of the -march, -mtune, and -mcpu options does the kernel set?

How are you measuring kernel performance?

All compiler tuning is only heuristic in nature, so it is possible that
the kernel is failing the heuristics in some way.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Performance Issues and processor arquitecture!
  2011-01-14  4:06 Marcelo Pugliesi
@ 2011-01-14  8:56 ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2011-01-14  8:56 UTC (permalink / raw)
  To: Marcelo Pugliesi; +Cc: GCC Help

On 14 January 2011 04:06, Marcelo Pugliesi wrote:
> Hello everybody, I will try to explain as best as possible to make my question!
>
> Well, I'm compiling the kernel 2.6.34 or 2.6.36 for Ubuntu 10.10 64bits. I have
> a core i7 860 processor, accessing the menuconfig, right at processor family, if
> I check the family Core2/Xeon I have less performance from my kernel than if I
> use the option Pentium 4! No matter if I use the GCC version 4.4.4 or 4.5.1!
> My question then is simple, Why I have a superior performance when using Pentium
> 4 architecture if the GCC documentation tells me I should use the Core2/Xeon for
> a better result?
>
> I found this topic : [GCC] Compiling for a generic x86 architecture
> (http://cboard.cprogramming.com/c-programming/127502-%5Bgcc%5D-compiling-generic-x86-architecture-2.html)
>
>
> Where cyberfish said:
>
> "mtune=... does NOT affect the instruction sets used, or machines the executable
> is run on.
>
> For that (eg, enabling SSE), you'll need march=....
>
> If you do march=core2 for example (on a new GCC), it will use all the
> instruction sets available to Core 2 CPUs. march=x also sets mtune=x. The
> executable won't run on older CPUs.
>
> If you ONLY use mtune=core2, it will generate code that runs the best on a Core
> 2, but will still only use instructions available to all x86 CPUs (eg, no SSE),
> hence it will still run on old CPUs, just a little slower.
>
> As a real world example, I think a few years ago some Linux distribution decides
> to use -march=pentium3 -mtune=pentium4, or something like that. That means, the
> code is guaranteed to run on a P3, but optimized for a P4, since they predict
> most people will be running for a P4.
>
> If you don't use any flag, GCC will assume -march=i386 (lowest x86).
>
> If you want GCC to use all instruction sets on your CPU, and optimize for your
> CPU (because, for example, the code will only be run on your machine), you can
> do -march=native (which also sets mtune=native). Only available in newer GCC (it
> was introduced in 4.3 or 4.4 I THINK).
>
> -m32 and -m64 are only for generating 32-bit code on a 64-bit machine, or
> generating 64-bit code on a 32-bit machine, respectively. GCC defaults to 32-bit
> on 32-bit, and 64-bit on 64-bit."
>
> So, the menuconfig processor family just change de mtune flag, and doesn't
> affect the march flag?
>
> Can someone please give me an answer about this, please?

Someone already did
http://gcc.gnu.org/ml/gcc-help/2011-01/msg00125.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Performance Issues and processor arquitecture!
@ 2011-01-14  4:06 Marcelo Pugliesi
  2011-01-14  8:56 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Pugliesi @ 2011-01-14  4:06 UTC (permalink / raw)
  To: GCC Help

Hello everybody, I will try to explain as best as possible to make my question!

Well, I'm compiling the kernel 2.6.34 or 2.6.36 for Ubuntu 10.10 64bits. I have 
a core i7 860 processor, accessing the menuconfig, right at processor family, if 
I check the family Core2/Xeon I have less performance from my kernel than if I 
use the option Pentium 4! No matter if I use the GCC version 4.4.4 or 4.5.1!
My question then is simple, Why I have a superior performance when using Pentium 
4 architecture if the GCC documentation tells me I should use the Core2/Xeon for 
a better result?

I found this topic : [GCC] Compiling for a generic x86 architecture 
(http://cboard.cprogramming.com/c-programming/127502-%5Bgcc%5D-compiling-generic-x86-architecture-2.html)


Where cyberfish said:

"mtune=... does NOT affect the instruction sets used, or machines the executable 
is run on.

For that (eg, enabling SSE), you'll need march=....

If you do march=core2 for example (on a new GCC), it will use all the 
instruction sets available to Core 2 CPUs. march=x also sets mtune=x. The 
executable won't run on older CPUs.

If you ONLY use mtune=core2, it will generate code that runs the best on a Core 
2, but will still only use instructions available to all x86 CPUs (eg, no SSE), 
hence it will still run on old CPUs, just a little slower.

As a real world example, I think a few years ago some Linux distribution decides 
to use -march=pentium3 -mtune=pentium4, or something like that. That means, the 
code is guaranteed to run on a P3, but optimized for a P4, since they predict 
most people will be running for a P4.

If you don't use any flag, GCC will assume -march=i386 (lowest x86). 

If you want GCC to use all instruction sets on your CPU, and optimize for your 
CPU (because, for example, the code will only be run on your machine), you can 
do -march=native (which also sets mtune=native). Only available in newer GCC (it 
was introduced in 4.3 or 4.4 I THINK).

-m32 and -m64 are only for generating 32-bit code on a 64-bit machine, or 
generating 64-bit code on a 32-bit machine, respectively. GCC defaults to 32-bit 
on 32-bit, and 64-bit on 64-bit."

So, the menuconfig processor family just change de mtune flag, and doesn't 
affect the march flag?

Can someone please give me an answer about this, please?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-14  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <256710.37200.qm@web31901.mail.mud.yahoo.com>
2011-01-11 15:41 ` Performance Issues and processor arquitecture! Ian Lance Taylor
2011-01-14  4:06 Marcelo Pugliesi
2011-01-14  8:56 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).