On Tue 25 Sep 2018 09:36:02 PM CDT, heyjoe wrote:
Hi,
‘Gentoo’s GCC optimization’
(GCC optimization - Gentoo wiki) article says that
command
Code:
gcc -### -march=native /usr/include/stdlib.h
“will show the compiler directives for building the header file, but
without actually performing the steps and instead showing them on the
screen (-###)”.
Looking its output I noticed something strange (the architecture is
detected correctly as ivybridge):
Code:
… --param “l1-cache-size=32” --param “l1-cache-line-size=64”
–param “l2-cache-size=8192” …
but the actual L2 cache size available in the physical CPU is smaller:
Code:
~]: lscpu | grep -i cache
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
According to man gcc
the ‘–param name=value’ are constants, i.e not
something detected from the hardware.
So I wonder:
- Should I set explicitly ‘–param “l2-cache-size=256”’?
OR
- What negative effect could one expect if one allows gcc to set a
cache which is not physically available?
Hi
I would surmise a bug, picking the L3 cache for that particular cpu
(or cpu’s with L3 cache?)…
I see it here with openSUSE Leap 15.0;
lscpu |egrep "Model name|cache"
Model name: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
gcc -### -march=native /usr/include/stdlib.h
......
gcc version 7.3.1 20180323 [gcc-7-branch revision 258812] (SUSE Linux)
......
--param "l1-cache-size=32" --param "l1-cache-line-size=64" --param "l2-cache-size=3072"
I don’t see the error with AMD cpu’s (or cpu’s with no L3 cache)
lscpu |egrep "Model name|cache"
Model name: Intel(R) Core(TM)2 Duo CPU T6500 @ 2.10GHz
L1d cache: 32K
L1i cache: 32K
L2 cache: 2048K
gcc -### -march=native /usr/include/stdlib.h
.....
gcc version 4.8.5 (SUSE Linux)
.....
--param "l1-cache-size=32" --param "l1-cache-line-size=64" --param
"l2-cache-size=2048"
–
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
SLES 15 | GNOME Shell 3.26.2 | 4.12.14-25.16-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!