public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] gentoo on the i7
@ 2010-04-10 22:06 luis jure
  2010-04-11  2:20 ` [gentoo-user] " Kerin Millar
  0 siblings, 1 reply; 8+ messages in thread
From: luis jure @ 2010-04-10 22:06 UTC (permalink / raw
  To: gentoo-user


hello list,

after many years without a hardware upgrade, i'll be receiving my new
computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo. 

i'm pretty excited, i imagine that at first i'll be shocked at the
difference with the ancient machine i'm using now.

now my question: searching a bit for the best compilation flags for
this processor, i found this at gentoo-wiki:

CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
CXXFLAGS="${CFLAGS}"
(http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)

on the other hand, a thread at http://forums.gentoo.org says that the
wiki page is outdated, and that -march=native should do the job without
any further tweaks like -msse4 etc.

any ideas from the list?

best,

lj



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

* [gentoo-user] Re: gentoo on the i7
  2010-04-10 22:06 [gentoo-user] gentoo on the i7 luis jure
@ 2010-04-11  2:20 ` Kerin Millar
  2010-04-11 10:43   ` zeerak.w
  0 siblings, 1 reply; 8+ messages in thread
From: Kerin Millar @ 2010-04-11  2:20 UTC (permalink / raw
  To: gentoo-user

On 10/04/2010 23:06, luis jure wrote:
>
> hello list,
>
> after many years without a hardware upgrade, i'll be receiving my new
> computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo.
>
> i'm pretty excited, i imagine that at first i'll be shocked at the
> difference with the ancient machine i'm using now.
>
> now my question: searching a bit for the best compilation flags for
> this processor, i found this at gentoo-wiki:
>
> CHOST="x86_64-pc-linux-gnu"
> CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
> CXXFLAGS="${CFLAGS}"
> (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)
>
> on the other hand, a thread at http://forums.gentoo.org says that the
> wiki page is outdated, and that -march=native should do the job without
> any further tweaks like -msse4 etc.

That is correct; -march=native will indeed do the job. The CFLAGS 
example you cite is clearly an interpretation of the flags that the 
native target would result in anyway.

With respect to my Intel Xeon E3113, -march=native appears to equate to:

-march=core2 -mtune=core2 -msahf -msse4.1 --param l1-cache-size=32 
--param l1-cache-line-size=64

In short, use "native" and let the compiler take care of the details.

Cheers,

--Kerin




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

* Re: [gentoo-user] Re: gentoo on the i7
  2010-04-11  2:20 ` [gentoo-user] " Kerin Millar
@ 2010-04-11 10:43   ` zeerak.w
  2010-04-11 11:27     ` Mick
  2010-04-11 12:07     ` Kerin Millar
  0 siblings, 2 replies; 8+ messages in thread
From: zeerak.w @ 2010-04-11 10:43 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

On Sun, Apr 11, 2010 at 03:20:50AM +0100, Kerin Millar wrote:
> On 10/04/2010 23:06, luis jure wrote:
> >
> > hello list,
> >
> > after many years without a hardware upgrade, i'll be receiving my new
> > computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo.
> >
> > i'm pretty excited, i imagine that at first i'll be shocked at the
> > difference with the ancient machine i'm using now.
> >
> > now my question: searching a bit for the best compilation flags for
> > this processor, i found this at gentoo-wiki:
> >
> > CHOST="x86_64-pc-linux-gnu"
> > CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
> > CXXFLAGS="${CFLAGS}"
> > (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)
> >
> > on the other hand, a thread at http://forums.gentoo.org says that the
> > wiki page is outdated, and that -march=native should do the job without
> > any further tweaks like -msse4 etc.
> 
> That is correct; -march=native will indeed do the job. The CFLAGS 
> example you cite is clearly an interpretation of the flags that the 
> native target would result in anyway.
> 
> With respect to my Intel Xeon E3113, -march=native appears to equate to:
> 
> -march=core2 -mtune=core2 -msahf -msse4.1 --param l1-cache-size=32 
> --param l1-cache-line-size=64
> 
> In short, use "native" and let the compiler take care of the details.
> 
> Cheers,
> 
> --Kerin
> 
> 

There's a thread in Installing Gentoo where a dev (can't remember which), that says native isn't the best option, but the best option indeed is to specify your arch. See these threads:
http://forums.gentoo.org/viewtopic-t-821639.html
http://forums.gentoo.org/viewtopic-t-821370.html 

-- 
Zeerak Waseem

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

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

* Re: [gentoo-user] Re: gentoo on the i7
  2010-04-11 10:43   ` zeerak.w
@ 2010-04-11 11:27     ` Mick
  2010-04-11 13:12       ` Kerin Millar
  2010-04-11 12:07     ` Kerin Millar
  1 sibling, 1 reply; 8+ messages in thread
From: Mick @ 2010-04-11 11:27 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 4015 bytes --]

On Sunday 11 April 2010 11:43:26 zeerak.w@gmail.com wrote:
> On Sun, Apr 11, 2010 at 03:20:50AM +0100, Kerin Millar wrote:
> > On 10/04/2010 23:06, luis jure wrote:
> > > hello list,
> > >
> > > after many years without a hardware upgrade, i'll be receiving my new
> > > computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo.
> > >
> > > i'm pretty excited, i imagine that at first i'll be shocked at the
> > > difference with the ancient machine i'm using now.
> > >
> > > now my question: searching a bit for the best compilation flags for
> > > this processor, i found this at gentoo-wiki:
> > >
> > > CHOST="x86_64-pc-linux-gnu"
> > > CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
> > > CXXFLAGS="${CFLAGS}"
> > > (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)
> > >
> > > on the other hand, a thread at http://forums.gentoo.org says that the
> > > wiki page is outdated, and that -march=native should do the job without
> > > any further tweaks like -msse4 etc.
> >
> > That is correct; -march=native will indeed do the job. The CFLAGS
> > example you cite is clearly an interpretation of the flags that the
> > native target would result in anyway.
> >
> > With respect to my Intel Xeon E3113, -march=native appears to equate to:
> >
> > -march=core2 -mtune=core2 -msahf -msse4.1 --param l1-cache-size=32
> > --param l1-cache-line-size=64
> >
> > In short, use "native" and let the compiler take care of the details.
> >
> > Cheers,
> >
> > --Kerin
> 
> There's a thread in Installing Gentoo where a dev (can't remember which),
>  that says native isn't the best option, but the best option indeed is to
>  specify your arch. See these threads:
>  http://forums.gentoo.org/viewtopic-t-821639.html
> http://forums.gentoo.org/viewtopic-t-821370.html

OK, but:

$ gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep 
"/usr/libexec/gcc/.*cc1"
 "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.4/cc1" "-E" "-quiet" 
"/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" "-march=core2" "-mcx16" "-msahf" 
"--param" "l1-cache-size=32" "--param" "l1-cache-line-size=64" "-mtune=core2"

the above shows that it uses smaller cache sizes than what my cpu has 
according to lshw:
==========================================
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i7 CPU       Q 720  @ 1.60GHz
          vendor: Intel Corp.
          physical id: 5
          bus info: cpu@0
          version: CPU Version
          slot: U2E1
          size: 931MHz
          capacity: 4096MHz
          width: 64 bits
          clock: 133MHz
          capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 
apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht 
tm pbe syscall nx rdtscp x86-64 constant_tsc arch_perfmon pebs bts rep_good 
xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 
ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm ida tpr_shadow vnmi 
flexpriority ept vpid cpufreq
        *-cache:0
             description: L1 cache
             physical id: 6
             slot: L1 Cache
             size: 128KiB
             capacity: 128KiB
             capabilities: asynchronous internal write-through data
        *-cache:1
             description: L2 cache
             physical id: 7
             slot: L2 Cache
             size: 1MiB
             capacity: 1MiB
             capabilities: burst internal write-through unified
        *-cache:2
             description: L3 cache
             physical id: 8
             slot: L3 Cache
             size: 6MiB
             capacity: 8MiB
             capabilities: burst internal write-back
==========================================

Now, in my current cflags I have:

CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"

Perhaps I should stick with march=core2 and additionally be adding "--param" 
and the L0, L1, L2 cache sizes?
-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* [gentoo-user] Re: gentoo on the i7
  2010-04-11 10:43   ` zeerak.w
  2010-04-11 11:27     ` Mick
@ 2010-04-11 12:07     ` Kerin Millar
  1 sibling, 0 replies; 8+ messages in thread
From: Kerin Millar @ 2010-04-11 12:07 UTC (permalink / raw
  To: gentoo-user

On 11/04/2010 11:43, zeerak.w@gmail.com wrote:

[snip]

>> In short, use "native" and let the compiler take care of the details.
>>
>> Cheers,
>>
>> --Kerin
>>
>>
>
> There's a thread in Installing Gentoo where a dev (can't remember which), that says native isn't the best option, but the best option indeed is to specify your arch. See these threads:
> http://forums.gentoo.org/viewtopic-t-821639.html
> http://forums.gentoo.org/viewtopic-t-821370.html

The developer in question does not substantiate the claim that it is 
"better" which, unfortunately, renders his remark meaningless.

However, I should have pointed out that it's a bad choice for those who 
intend to use distcc.

Cheers,

--Kerin




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

* [gentoo-user] Re: gentoo on the i7
  2010-04-11 11:27     ` Mick
@ 2010-04-11 13:12       ` Kerin Millar
  2010-04-11 13:51         ` Mark Knecht
  2010-04-11 13:51         ` Mick
  0 siblings, 2 replies; 8+ messages in thread
From: Kerin Millar @ 2010-04-11 13:12 UTC (permalink / raw
  To: gentoo-user

On 11/04/2010 12:27, Mick wrote:
> On Sunday 11 April 2010 11:43:26 zeerak.w@gmail.com wrote:
>> On Sun, Apr 11, 2010 at 03:20:50AM +0100, Kerin Millar wrote:
>>> On 10/04/2010 23:06, luis jure wrote:
>>>> hello list,
>>>>
>>>> after many years without a hardware upgrade, i'll be receiving my new
>>>> computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo.
>>>>
>>>> i'm pretty excited, i imagine that at first i'll be shocked at the
>>>> difference with the ancient machine i'm using now.
>>>>
>>>> now my question: searching a bit for the best compilation flags for
>>>> this processor, i found this at gentoo-wiki:
>>>>
>>>> CHOST="x86_64-pc-linux-gnu"
>>>> CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
>>>> CXXFLAGS="${CFLAGS}"
>>>> (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)
>>>>
>>>> on the other hand, a thread at http://forums.gentoo.org says that the
>>>> wiki page is outdated, and that -march=native should do the job without
>>>> any further tweaks like -msse4 etc.
>>>
>>> That is correct; -march=native will indeed do the job. The CFLAGS
>>> example you cite is clearly an interpretation of the flags that the
>>> native target would result in anyway.
>>>
>>> With respect to my Intel Xeon E3113, -march=native appears to equate to:
>>>
>>> -march=core2 -mtune=core2 -msahf -msse4.1 --param l1-cache-size=32
>>> --param l1-cache-line-size=64
>>>
>>> In short, use "native" and let the compiler take care of the details.
>>>
>>> Cheers,
>>>
>>> --Kerin
>>
>> There's a thread in Installing Gentoo where a dev (can't remember which),
>>   that says native isn't the best option, but the best option indeed is to
>>   specify your arch. See these threads:
>>   http://forums.gentoo.org/viewtopic-t-821639.html
>> http://forums.gentoo.org/viewtopic-t-821370.html
>
> OK, but:
>
> $ gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep
> "/usr/libexec/gcc/.*cc1"
>   "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.4/cc1" "-E" "-quiet"
> "/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" "-march=core2" "-mcx16" "-msahf"
> "--param" "l1-cache-size=32" "--param" "l1-cache-line-size=64" "-mtune=core2"
>
> the above shows that it uses smaller cache sizes than what my cpu has
> according to lshw:

Hmm. Well, as far as I'm aware, Nehalem - like my Wolfdale-based 
processor - has 64KB of L1 cache per core, with 32KB serving as an 
instruction cache and 32KB serving as a data cache. My tentative 
supposition would be that gcc is taking into account the size of the 
instruction cache. As for the cache line size, that's measured in bytes, 
and is indeed 64B on the majority of (if not all) x86 processors, 
Nehalem included.

However, the result you're getting from lshw does seem somewhat 
contradictory. gcc uses a cpuid instruction to determine the appropriate 
values, but you might also like to check using sysfs:

$ paste <(cat /sys/devices/system/cpu/cpu0/cache/index?/type) <(cat 
/sys/devices/system/cpu/cpu0/cache/index?/size) | sed -re 's/\W+/: /'

On my system that results in the following:

Data: 32K
Instruction: 32K
Unified: 6144K

> Perhaps I should stick with march=core2 and additionally be adding "--param"
> and the L0, L1, L2 cache sizes?

I would suggest to leave it alone. At least, not without raising it with 
a gcc developer or someone with a formal understanding of CPU architecture.

Cheers,

--Kerin




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

* Re: [gentoo-user] Re: gentoo on the i7
  2010-04-11 13:12       ` Kerin Millar
@ 2010-04-11 13:51         ` Mark Knecht
  2010-04-11 13:51         ` Mick
  1 sibling, 0 replies; 8+ messages in thread
From: Mark Knecht @ 2010-04-11 13:51 UTC (permalink / raw
  To: gentoo-user

On Sun, Apr 11, 2010 at 6:12 AM, Kerin Millar <kerframil@gmail.com> wrote:
<SNIP>
>
> $ paste <(cat /sys/devices/system/cpu/cpu0/cache/index?/type) <(cat
> /sys/devices/system/cpu/cpu0/cache/index?/size) | sed -re 's/\W+/: /'
>
> On my system that results in the following:
>
> Data: 32K
> Instruction: 32K
> Unified: 6144K
>

Interesting how they change across the processor families:

i5-661: (2 cores, hyperthreaded)

Data: 32K
Instruction: 32K
Unified: 256K
Unified: 4096K

i7-920: (4 cores, hyperthreaded)

Data: 32K
Instruction: 32K
Unified: 256K
Unified: 8192K

i7-980x (6 cores, hyperthreaded)

Data: 32K
Instruction: 32K
Unified: 256K
Unified: 12288K

So on these newer processors I suspect that these values are for each
hyperthread - i.e. repeated internally for each virtual core

Data: 32K
Instruction: 32K
Unified: 256K
(possibly shared between physical core and it's associated hyperthread?)

and then the final value:

Unified: 4096K
Unified: 8192K
Unified: 12288K

is 2048K/physical pair and shared between all the 2-thread cores in the chip.

- Mark



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

* Re: [gentoo-user] Re: gentoo on the i7
  2010-04-11 13:12       ` Kerin Millar
  2010-04-11 13:51         ` Mark Knecht
@ 2010-04-11 13:51         ` Mick
  1 sibling, 0 replies; 8+ messages in thread
From: Mick @ 2010-04-11 13:51 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: Text/Plain, Size: 3821 bytes --]

On Sunday 11 April 2010 14:12:08 Kerin Millar wrote:
> On 11/04/2010 12:27, Mick wrote:
> > On Sunday 11 April 2010 11:43:26 zeerak.w@gmail.com wrote:
> >> On Sun, Apr 11, 2010 at 03:20:50AM +0100, Kerin Millar wrote:
> >>> On 10/04/2010 23:06, luis jure wrote:
> >>>> hello list,
> >>>>
> >>>> after many years without a hardware upgrade, i'll be receiving my new
> >>>> computer next week: intel i7 920 cpu, 6 GB ram, asus p6t mobo.
> >>>>
> >>>> i'm pretty excited, i imagine that at first i'll be shocked at the
> >>>> difference with the ancient machine i'm using now.
> >>>>
> >>>> now my question: searching a bit for the best compilation flags for
> >>>> this processor, i found this at gentoo-wiki:
> >>>>
> >>>> CHOST="x86_64-pc-linux-gnu"
> >>>> CFLAGS="-march=core2 -msse4 -mcx16 -msahf -O2 -pipe"
> >>>> CXXFLAGS="${CFLAGS}"
> >>>> (http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel)
> >>>>
> >>>> on the other hand, a thread at http://forums.gentoo.org says that the
> >>>> wiki page is outdated, and that -march=native should do the job
> >>>> without any further tweaks like -msse4 etc.
> >>>
> >>> That is correct; -march=native will indeed do the job. The CFLAGS
> >>> example you cite is clearly an interpretation of the flags that the
> >>> native target would result in anyway.
> >>>
> >>> With respect to my Intel Xeon E3113, -march=native appears to equate
> >>> to:
> >>>
> >>> -march=core2 -mtune=core2 -msahf -msse4.1 --param l1-cache-size=32
> >>> --param l1-cache-line-size=64
> >>>
> >>> In short, use "native" and let the compiler take care of the details.
> >>>
> >>> Cheers,
> >>>
> >>> --Kerin
> >>
> >> There's a thread in Installing Gentoo where a dev (can't remember
> >> which), that says native isn't the best option, but the best option
> >> indeed is to specify your arch. See these threads:
> >>   http://forums.gentoo.org/viewtopic-t-821639.html
> >> http://forums.gentoo.org/viewtopic-t-821370.html
> >
> > OK, but:
> >
> > $ gcc -### -march=native -E /usr/include/stdlib.h 2>&1 | grep
> > "/usr/libexec/gcc/.*cc1"
> >   "/usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.4/cc1" "-E" "-quiet"
> > "/usr/include/stdlib.h" "-D_FORTIFY_SOURCE=2" "-march=core2" "-mcx16"
> > "-msahf" "--param" "l1-cache-size=32" "--param" "l1-cache-line-size=64"
> > "-mtune=core2"
> >
> > the above shows that it uses smaller cache sizes than what my cpu has
> > according to lshw:
> 
> Hmm. Well, as far as I'm aware, Nehalem - like my Wolfdale-based
> processor - has 64KB of L1 cache per core, with 32KB serving as an
> instruction cache and 32KB serving as a data cache. My tentative
> supposition would be that gcc is taking into account the size of the
> instruction cache. As for the cache line size, that's measured in bytes,
> and is indeed 64B on the majority of (if not all) x86 processors,
> Nehalem included.
> 
> However, the result you're getting from lshw does seem somewhat
> contradictory. gcc uses a cpuid instruction to determine the appropriate
> values, but you might also like to check using sysfs:
> 
> $ paste <(cat /sys/devices/system/cpu/cpu0/cache/index?/type) <(cat
> /sys/devices/system/cpu/cpu0/cache/index?/size) | sed -re 's/\W+/: /'
> 
> On my system that results in the following:
> 
> Data: 32K
> Instruction: 32K
> Unified: 6144K

I am getting this:

Data: 32K
Instruction: 32K
Unified: 256K
Unified: 6144K

> > Perhaps I should stick with march=core2 and additionally be adding
> > "--param" and the L0, L1, L2 cache sizes?
> 
> I would suggest to leave it alone. At least, not without raising it with
> a gcc developer or someone with a formal understanding of CPU architecture.

OK, let's see if they visit this M/L and want to say something about it.
-- 
Regards,
Mick

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

end of thread, other threads:[~2010-04-11 14:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-10 22:06 [gentoo-user] gentoo on the i7 luis jure
2010-04-11  2:20 ` [gentoo-user] " Kerin Millar
2010-04-11 10:43   ` zeerak.w
2010-04-11 11:27     ` Mick
2010-04-11 13:12       ` Kerin Millar
2010-04-11 13:51         ` Mark Knecht
2010-04-11 13:51         ` Mick
2010-04-11 12:07     ` Kerin Millar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox