Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
AMD FX-8120 Bulldozer and CFlags
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mosaik
n00b
n00b


Joined: 06 Dec 2011
Posts: 3

PostPosted: Tue Dec 06, 2011 9:06 pm    Post subject: AMD FX-8120 Bulldozer and CFlags Reply with quote

Hello everyone,

Recently i switched to a AMD FX-8120 and i hoped i could use the full amd instruction set supported by gcc-4.6 upstream...
Gentoo safe flags told me to use the following (from http://en.gentoo-wiki.com/wiki/Safe_Cflags/AMD#AMD_FX-8xxx.2F6xxx.2F4xxx_.28Bulldozer.29)
Code:
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=bdver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"

This breaks more or less every package i try to emerge with the following error:
Code:

# emerge x11-libs/libX11
(...)
/bin/sh ../../libtool --silent --tag=CC   --mode=compile x86_64-pc-linux-gnu-gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xcms -I../../src -I../../include/X11  -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/include -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/include/X11 -I../../include -I../../include/X11 -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xcms -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xkb -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xlibi18n -I/var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src -D_BSD_SOURCE  -D_BSD_SOURCE -DHAS_FCHOWN -DHAS_STICKY_DIR_BIT     -DMALLOC_0_RETURNS_NULL -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing -Wbad-function-cast -Wformat=2 -Wold-style-definition -Wdeclaration-after-statement -O2 -pipe -fomit-frame-pointer -march=bdver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx -c -o LRGB.lo /var/tmp/portage/x11-libs/libX11-1.4.4/work/libX11-1.4.4/src/xcms/LRGB.c
{standard input}: Assembler messages:
{standard input}:408: Error: no such instruction: `vpcmov %xmm0,%xmm2,%xmm1,%xmm1'
make[3]: *** [HVC.lo] Fehler 1
(...)


This combinations is my minimal setup solving this Issue:
Code:

CFLAGS="-O2 -pipe -fomit-frame-pointer -march=btver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"
CXFLAGS={CFLAGS}
CHOST="x86_64-pc-linux-gnu"


Obviously is -march=btver1 (amd 14h) supported but not -march=bdver1 (amd 15h) ...

Could 2.6.37 a problem? I'm going with hardened-sources for a while but all compillations tested was running with the 'vanilla'-gcc-4.6.1.


Thanks for any ideas ...

Code:
Portage 2.1.10.11 (hardened/linux/amd64, gcc-4.6.1, glibc-2.12.2-r0, 2.6.37-hardened-r7 x86_64)
=================================================================
System uname: Linux-2.6.37-hardened-r7-x86_64-AMD_FX-tm-8120_Eight-Core_Processor-with-gentoo-2.0.2
Timestamp of tree: Tue, 06 Dec 2011 18:45:01 +0000
ccache version 2.4 [disabled]
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.1-r1, 3.1.3-r1
dev-util/ccache:          2.4-r9
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5, 4.5.3-r1, 4.6.1-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.12.2
Repositories: gentoo systemd ruby
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=bdver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=bdver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv"
FFLAGS=""
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_BZIP2_COMMAND="pbzip2"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/systemd /var/lib/layman/ruby"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="3dnow X acl alsa amd64 bash-completion berkdb bluetooth bzip2 cairo cdr cli cracklib crypt css cups cxx dbus dri dvd ffmpeg flac gdbm gmp gnutls gpm hardened iconv icu idn ios ipod java javascript jpeg jpeg2k justify kde lame libssh2 lyx lzma lzo mad mmap mmpap mmx modules mp3 mp4 mpeg mpi mudflap multilib mysql ncurses nls nptl nptlonly ogg opengl openmp pam pax_kernel pcre pdf png policykit pppd qt3support qt4 readline ruby session smp speex sse sse2 sse3 ssl ssse3 svg sysfs systemd tcpd test threads unicode upnp urandom vim vim-syntax xcomposite xorg xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fglrx" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Back to top
View user's profile Send private message
golagoda
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jun 2011
Posts: 105
Location: Australia

PostPosted: Tue Dec 06, 2011 11:26 pm    Post subject: Reply with quote

First off, gcc 4.6.2 is out if you'd like to upgrade - when you're using the testing versions it's best to make sure you're up to date with bugfixes, maybe it's fixed in that version.

Secondly, make sure your compiler is _actually_ set to the 4.6 one, so put 'gcc-config -l' into a terminal and make sure a * is next to the 4.6 one, if not set it to use 4.6 also by using gcc-config.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Wed Dec 07, 2011 1:35 pm    Post subject: Reply with quote

It's really weird to see that -march and -mtune don't use the same value.

Any status with the latest GCC 4.6.2 ?
Back to top
View user's profile Send private message
mosaik
n00b
n00b


Joined: 06 Dec 2011
Posts: 3

PostPosted: Wed Dec 07, 2011 11:34 pm    Post subject: Reply with quote

Updated to the latest gcc-4.6.2, but makes no difference... seams also completely independend from hardened-sources/compliler.

It's the implicit flag -mxop which breaks my code - dropped in by choosing -march=bdver1...
The other new flag from bdver1: -mfma4 is usable ...
Back to top
View user's profile Send private message
mosaik
n00b
n00b


Joined: 06 Dec 2011
Posts: 3

PostPosted: Thu Dec 08, 2011 4:24 pm    Post subject: Reply with quote

Updatingt to the latest glibc and binutils solved the problem!

Code:

# emerge --info
Portage 2.1.10.11 (hardened/linux/amd64, gcc-4.6.2, glibc-2.13-r4, 3.0.4-hardened-r5 x86_64)
=================================================================
System uname: Linux-3.0.4-hardened-r5-x86_64-AMD_FX-tm-8120_Eight-Core_Processor-with-gentoo-2.0.2
Timestamp of tree: Thu, 08 Dec 2011 15:15:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.1-r1, 3.1.3-r1
dev-util/ccache:          2.4-r9
dev-util/cmake:           2.8.4-r1
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.5, 4.5.3-r1, 4.6.2
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.82
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3182
Location: Gainesville, Florida

PostPosted: Fri Dec 09, 2011 8:09 am    Post subject: Reply with quote

Please keep us informed as to how it's going with the FX 8120. Have you tried this with a 3.1.x kernel yet?

Is -march=native no longer recommended? I thought using that pulled in all the usable flags for your cpu, no matter what kind it is.
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.27-r6, gcc-8.2.0-r3 kernel-4.18.15-gentoo USE=experimental
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3353

PostPosted: Fri Dec 09, 2011 12:47 pm    Post subject: Reply with quote

wrc1944 wrote:
Is -march=native no longer recommended? I thought using that pulled in all the usable flags for your cpu, no matter what kind it is.


My understanding is that "-march=native" only works for CPUs that the gcc version knew about when it was being written. In other words, it's a moving target, constantly behind on the bleeding edge CPUs, constantly catching up.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
wrc1944
Advocate
Advocate


Joined: 15 Aug 2002
Posts: 3182
Location: Gainesville, Florida

PostPosted: Fri Dec 09, 2011 4:00 pm    Post subject: Reply with quote

depontius,
Makes perfect sense. I guess this means in order to get full featured use out of Amd FX cpus one should check "man:gcc" for the currently installed gcc version. and either use -march="your cpu architecture", or manually edit make.conf cflags accordingly. For reference, if you use kde, you can open konqueror, type in man:gcc, and get the installed gcc man version in a nice easily readable browser view. If I was running any of the latest cpus, I would use gcc-4.6.2 (currently the latest version in Gentoo ~ARCH).
_________________
Main box- AsRock x370 Gaming K4
Ryzen 1700, 3.0GHz, 16GB GSkill Flare DDR4 3200mhz
Samsung SATA 1000GB, Radeon HD R7 350 2GB DDR5
Gentoo ~amd64 plasma, glibc-2.27-r6, gcc-8.2.0-r3 kernel-4.18.15-gentoo USE=experimental
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Mon Dec 12, 2011 12:08 am    Post subject: Reply with quote

I see that if you have a new CPU, then you should avoid -march=native and then use -march=corei7 or the specific arch for your CPU.
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Mon Dec 12, 2011 12:25 am    Post subject: Reply with quote

d2_racing wrote:
I see that if you have a new CPU, then you should avoid -march=native and then use -march=corei7 or the specific arch for your CPU.

Really? I updated to the latest toolchain (gcc-4.6.2 funtoo current) and -march=native has caused 0 issues so far on my FX-8150.
Back to top
View user's profile Send private message
d2_racing
Bodhisattva
Bodhisattva


Joined: 25 Apr 2005
Posts: 13047
Location: Ste-Foy,Canada

PostPosted: Mon Dec 12, 2011 3:49 am    Post subject: Reply with quote

Can you post your emerge --info then ?

From GCC 4.6.1 to 4.6.2 or 4.5.x to 4.6.2 ?
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Mon Dec 12, 2011 5:14 am    Post subject: Reply with quote

To list what -march=native outputs for my system: `echo "" | gcc -march=native -v -E - 2>&1 | grep cc1`
Code:
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.2/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=bdver1 -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mabm -mlwp -mno-fma -mfma4 -mxop -mno-bmi -mno-tbm -mavx -msse4.2 -msse4.1 --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver1

`emerge --info`
Code:

Portage 2.3.2 (default/linux/amd64/2008.0/desktop, gcc-4.6.2, glibc-2.13-r4, 3.1.4-ck x86_64)
=================================================================
System uname: Linux-3.1.4-ck-x86_64-AMD_FX-tm-8150_Eight-Core_Processor-with-gentoo-2.1.8
Timestamp of tree: Sun, 11 Dec 2011 17:00:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.1-r3
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1.8-r2
sys-apps/openrc:          0.8.3-r5
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1-r1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.6.2
sys-devel/gcc-config:     1.5
sys-devel/libtool:        2.4-r4
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo localhost
Installed sets:
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build n"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles mini-manifest news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="ftp://ftp.lug.udel.edu/pub/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/ http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ ftp://gentoo.cites.uiuc.edu/pub/gentoo/ http://mirror.datapipe.net/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed"
MAKEOPTS="-j9"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="git://github.com/funtoo/portage-mini-2011.git"
SYNC_USER="root"
USE="X a52 aac acl acpi alac alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dts dvd dvdr dvdread emboss encode esd exif fam firefox flac fortran fuse gdbm gdu gif gnome gpm gstreamer gtk hpcups hpijs iconv ipv6 jpeg lame lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg mudflap multilib nautilus ncurses nls nptl nptlonly nsplugin ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3 qt3support qt4 readline samba sdl session spell sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype udev unicode usb vdpau vorbis wavpack x264 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, SYNC_UMASK
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2571
Location: Edmonton, AB

PostPosted: Mon Dec 12, 2011 8:52 pm    Post subject: Reply with quote

I have: AMD FX(tm)-8150 Eight-Core Processor
And those CFLAGS suggested on wiki don't work:

Code:
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=bdver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"

nor are the one that you suggested.
 CFLAGS="-O2 -pipe -fomit-frame-pointer -march=btver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"


I'm not able to compile anything with these flags,
I'm using:
CFLAGS="-Os -pipe -mtune=i686"
and the only package that failed was "ffmpeg"

UPDATE!
I just added to my flags: -march=native and ffmpeg compiled just fine.
CFLAGS="-march=native -Os -pipe -mtune=i686"

do I need flags: '-Os"

Code:
echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=amdfam10 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=amdfam10

_________________
#Thelma
Back to top
View user's profile Send private message
golagoda
Tux's lil' helper
Tux's lil' helper


Joined: 18 Jun 2011
Posts: 105
Location: Australia

PostPosted: Tue Dec 13, 2011 2:55 am    Post subject: Reply with quote

Joseph_sys wrote:
I have: AMD FX(tm)-8150 Eight-Core Processor
And those CFLAGS suggested on wiki don't work:

Code:
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=bdver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"

nor are the one that you suggested.
 CFLAGS="-O2 -pipe -fomit-frame-pointer -march=btver1 -mtune=bdver1 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx"


I'm not able to compile anything with these flags,
I'm using:
CFLAGS="-Os -pipe -mtune=i686"
and the only package that failed was "ffmpeg"

UPDATE!
I just added to my flags: -march=native and ffmpeg compiled just fine.
CFLAGS="-march=native -Os -pipe -mtune=i686"

do I need flags: '-Os"

Code:
echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.3/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=amdfam10 -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=amdfam10

Updating binutils, gcc and glibc worked for the person who made the thread, maybe you should try that out if you haven't already.
Back to top
View user's profile Send private message
rufnut
Apprentice
Apprentice


Joined: 16 May 2005
Posts: 199

PostPosted: Fri Dec 30, 2011 10:16 am    Post subject: Reply with quote

Thought I would show some "gcc" compile and execute differences.
(Using sys-devel/gcc-4.6.2)

my current "CFLAGS" that seem fine for system and world. (edit: world is a bit unstable so be careful.)

Code:
CFLAGS="-march=bdver1 -mprefer-avx128 -mno-3dnow -ftree-vectorize -funroll-all-loops -fprefetch-loop-arrays --param prefetch-latency=300 -O3 -pipe -mtune=bdver1"


Code:
emerge nbench


Remember nbench is single threaded but gives us a reasonable indication.

Code:
# nbench

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :            1470  :      37.70  :      12.38
STRING SORT         :          716.48  :     320.14  :      49.55
BITFIELD            :      5.1879e+08  :      88.99  :      18.59
FP EMULATION        :             498  :     238.96  :      55.14
FOURIER             :           37674  :      42.85  :      24.07
ASSIGNMENT          :          60.512  :     230.26  :      59.72
IDEA                :           10916  :     166.96  :      49.57
HUFFMAN             :          3240.2  :      89.85  :      28.69
NEURAL NET          :          91.363  :     146.77  :      61.74
LU DECOMPOSITION    :          1972.7  :     102.19  :      73.79
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 136.579
FLOATING-POINT INDEX: 86.293
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : 8 CPU AuthenticAMD AMD FX(tm)-8120 Eight-Core Processor            3100MHz
L2 Cache            : 2048 KB
OS                  : Linux 3.1.5-zen+
C compiler          : x86_64-pc-linux-gnu-gcc
libc                :
MEMORY INDEX        : 38.032
INTEGER INDEX       : 31.391
FLOATING-POINT INDEX: 47.861
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.


Code:
CFLAGS="-O3 -pipe -march=native" emerge nbench


Code:
# nbench

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :          1445.5  :      37.07  :      12.17
STRING SORT         :          720.48  :     321.93  :      49.83
BITFIELD            :      4.7847e+08  :      82.07  :      17.14
FP EMULATION        :          450.04  :     215.95  :      49.83
FOURIER             :           37698  :      42.87  :      24.08
ASSIGNMENT          :          39.457  :     150.14  :      38.94
IDEA                :           10972  :     167.81  :      49.83
HUFFMAN             :          3374.6  :      93.58  :      29.88
NEURAL NET          :          79.648  :     127.95  :      53.82
LU DECOMPOSITION    :          1681.3  :      87.10  :      62.90
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 125.803
FLOATING-POINT INDEX: 78.174
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : 8 CPU AuthenticAMD AMD FX(tm)-8120 Eight-Core Processor            3100MHz
L2 Cache            : 2048 KB
OS                  : Linux 3.1.5-zen+
C compiler          : x86_64-pc-linux-gnu-gcc
libc                :
MEMORY INDEX        : 32.161
INTEGER INDEX       : 30.829
FLOATING-POINT INDEX: 43.359
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.


Code:
CFLAGS="-O2 -pipe -march=native" emerge nbench


Code:
# nbench

BYTEmark* Native Mode Benchmark ver. 2 (10/95)
Index-split by Andrew D. Balsa (11/97)
Linux/Unix* port by Uwe F. Mayer (12/96,11/97)

TEST                : Iterations/sec.  : Old Index   : New Index
                    :                  : Pentium 90* : AMD K6/233*
--------------------:------------------:-------------:------------
NUMERIC SORT        :          1468.2  :      37.65  :      12.37
STRING SORT         :          534.48  :     238.82  :      36.97
BITFIELD            :      4.7994e+08  :      82.33  :      17.20
FP EMULATION        :           226.4  :     108.64  :      25.07
FOURIER             :           34339  :      39.05  :      21.94
ASSIGNMENT          :          38.105  :     145.00  :      37.61
IDEA                :            8192  :     125.29  :      37.20
HUFFMAN             :          3427.8  :      95.05  :      30.35
NEURAL NET          :          58.753  :      94.38  :      39.70
LU DECOMPOSITION    :          1687.9  :      87.44  :      63.14
==========================ORIGINAL BYTEMARK RESULTS==========================
INTEGER INDEX       : 104.803
FLOATING-POINT INDEX: 68.561
Baseline (MSDOS*)   : Pentium* 90, 256 KB L2-cache, Watcom* compiler 10.0
==============================LINUX DATA BELOW===============================
CPU                 : 8 CPU AuthenticAMD AMD FX(tm)-8120 Eight-Core Processor            3100MHz
L2 Cache            : 2048 KB
OS                  : Linux 3.1.5-zen+
C compiler          : x86_64-pc-linux-gnu-gcc
libc                : libdl-2.13.so
MEMORY INDEX        : 28.807
INTEGER INDEX       : 24.323
FLOATING-POINT INDEX: 38.026
Baseline (LINUX)    : AMD K6/233*, 512 KB L2-cache, gcc 2.7.2.3, libc-5.4.38
* Trademarks are property of their respective holder.


I know which "CFLAGS" I am staying with, unless someone can better them?

Happy New Year

:idea:
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Mon Jan 02, 2012 6:45 am    Post subject: Reply with quote

Quote:
do I need flags: '-Os"


"-Os" to gcc means "use all optimizations that -O2 would apply,
excluding those that typically increase the size of compiled
binary code." It gives up some optimizations that are optimizations
in theory in order to keep more loops running entirely within
the cpu's instruction cache (icache).

If you have a loop that fully optimized is larger than an icache line,
then you are getting a cache flush and reload on every loop
iteration. This is expensive in cycles. A less optimized loop
that fits entirely in an icache line can be faster in practice.

If most loops in your application fit in the icache even fully optimized,
"-O3 -funroll-loops [etc]" may be faster over runs of the whole application,
and -Os is not a benefit.

What is the benefit of using "-mtune=i686" on this architecture (or is
that simply a holdover from a CFLAGS setting imported from an older
computer)?
_________________
TIA
Back to top
View user's profile Send private message
radulucian
Apprentice
Apprentice


Joined: 05 Jan 2004
Posts: 151
Location: Bucharest Romania

PostPosted: Sat Feb 11, 2012 3:31 pm    Post subject: Reply with quote

wrc1944 wrote:
Please keep us informed as to how it's going with the FX 8120. Have you tried this with a 3.1.x kernel yet?

Is -march=native no longer recommended? I thought using that pulled in all the usable flags for your cpu, no matter what kind it is.


Thanks to everyone for the info in this thread.

    Just installed fresh gentoo on the current kernel (3.2.2-hardened-r1)
    Upgraded to GCC-4.6.2 using march=btver1 (v14, as bdver1 indeed doesn't work)
    Then upgraded glibc and binutils as advised
    Then remerged GCC-4..6.2 with march=bdver1 (v15)
    Then emerge -e world to recompile everything with new march flag.


That worked for me.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum