Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

firefox with -O3+lto+pgo on clang?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
14 posts • Page 1 of 1
Author
Message
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

firefox with -O3+lto+pgo on clang?

  • Quote

Post by papu » Mon Jun 07, 2021 11:04 am

i am interesting for testing this but i don't know how to configure a /etc/portage/env for that

what I would do is: quickpkg of two diferentes compilations and i try to test both firefox: normal and with O3-pgo-lto

are there anybody with knowlege for helping me?

thanks so much :roll:
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
fedeliallalinea
Administrator
Administrator
User avatar
Posts: 31985
Joined: Sat Mar 08, 2003 11:15 pm
Location: here
Contact:
Contact fedeliallalinea
Website

  • Quote

Post by fedeliallalinea » Mon Jun 07, 2021 11:14 am

I'm no expert but you can begin to read here while you wait for more answers.
Questions are guaranteed in life; Answers aren't.

"Those who would give up essential liberty to purchase a little temporary safety,
deserve neither liberty nor safety."
- Ben Franklin
https://www.news.admin.ch/it/nsb?id=103968
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

  • Quote

Post by papu » Mon Jun 07, 2021 11:25 am

fedeliallalinea wrote:I'm no expert but you can begin to read here while you wait for more answers.
i continue reading things...
mmm gento-lto may be is only for entire system and focalized to gcc , isen't it?
i only want do for firefox and with clang to not interfere with my gcc :)

:oops:
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
fedeliallalinea
Administrator
Administrator
User avatar
Posts: 31985
Joined: Sat Mar 08, 2003 11:15 pm
Location: here
Contact:
Contact fedeliallalinea
Website

  • Quote

Post by fedeliallalinea » Mon Jun 07, 2021 11:30 am

Why not use firefox-bin that is compiled with lto+gpo since 2018?
Questions are guaranteed in life; Answers aren't.

"Those who would give up essential liberty to purchase a little temporary safety,
deserve neither liberty nor safety."
- Ben Franklin
https://www.news.admin.ch/it/nsb?id=103968
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

  • Quote

Post by papu » Mon Jun 07, 2021 11:33 am

fedeliallalinea wrote:Why not use firefox-bin that is compiled with lto+gpo since 2018?

mmm ah , yes i see, but i prefer to have a compilation to see the diferences, the bin is not O3 sure O2 , and i am using pipewire without pulseaudio but i take a look
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

  • Quote

Post by papu » Mon Jun 07, 2021 2:16 pm

i think that activanting just pgo use flag on firefox clang have to use it despite the informative message that gcc will be used

Code: Select all

 - - pgo             : Add support for profile-guided optimization using gcc-4.5, for faster binaries.
                       This option will double the compile time.
then i just need to know a /etc/portage/env/ config to force clang to use O3 instead O2

may be some like?

Code: Select all

/etc/portage/O3-clang
CC="clang"
CXX="clang++"
CFLAGS="-march=native -O3 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j4"
but i think that firefox just force compilations with O2 on clang.
Last edited by papu on Mon Jun 07, 2021 9:46 pm, edited 1 time in total.
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
Josef.95
Advocate
Advocate
Posts: 4857
Joined: Mon Sep 03, 2007 9:46 am
Location: Germany

firefox with -O3+lto+pgo on clang?

  • Quote

Post by Josef.95 » Mon Jun 07, 2021 3:29 pm

papu,
I think the following should probably work (i have it not tested)
1) Enable in package.use www-client/firefox clang lto pgo
2) Set in /etc/portage/env/O3-clang CFLAGS="${CFLAGS} -O3"
and in /etc/portage/package.env www-client/firefox O3-clang
3) and then check it via: ebuild `equery w firefox` clean configure
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

Re: firefox with -O3+lto+pgo on clang?

  • Quote

Post by papu » Mon Jun 07, 2021 7:19 pm

Josef.95 wrote:papu,
I think the following should probably work (i have it not tested)
1) Enable in package.use www-client/firefox clang lto pgo
2) Set in /etc/portage/env/O3-clang CFLAGS="${CFLAGS} -O3"
and in /etc/portage/package.env www-client/firefox O3-clang
3) and then check it via: ebuild `equery w firefox` clean configure
oh thanks i try and this are my questions:


is pgo bloking lto on clang?
sudo emerge -1 firefox
https://dpaste.com/34MEGF6E2

Code: Select all

0:04.28 WARNING: Disabling LTO because --enable-profile-generate is specified

thanks so much!
Last edited by papu on Mon Jun 07, 2021 9:49 pm, edited 1 time in total.
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
alamahant
Advocate
Advocate
Posts: 4032
Joined: Sat Mar 23, 2019 12:12 pm

  • Quote

Post by alamahant » Mon Jun 07, 2021 7:30 pm

cat /etc/portage/env/clanglto-O3.conf

Code: Select all


CC="clang"
CXX="clang++"

LTO="-flto=thin"

COMMON_FLAGS="-march=native -O3 -pipe"
CFLAGS="${COMMON_FLAGS} ${LTO}"
CXXFLAGS="${COMMON_FLAGS} ${LTO}"
LDFLAGS="-Wl,-O2 -Wl,--as-needed"  

AR="llvm-ar"
NM="llvm-nm"
RANLIB="llvm-ranlib"
and
cat /etc/portage/package.env

Code: Select all

www-client/firefox clanglto-O3.conf
and

Code: Select all

USE="pgo lto" emerge -av firefox
I dont think that firefox can be built with gcc nowadays.so the above flags should also be applicable to clang also.
Just try it.......
:)
Top
Josef.95
Advocate
Advocate
Posts: 4857
Joined: Mon Sep 03, 2007 9:46 am
Location: Germany

  • Quote

Post by Josef.95 » Mon Jun 07, 2021 7:43 pm

papu,
yes, (from your configure output):

Code: Select all

    --enable-linker=lld             forcing ld=lld due to USE=clang and USE=lto
    --enable-lto=cross              +lto
    MOZ_PGO=1                       +pgo
    --disable-debug                 -debug
    --disable-debug-symbols         Gentoo default
    --enable-optimize=-O3           from CFLAGS
I think it looks good :)

/edit: I think try a build, and then check in firefox adress bar: about:buildconfig
Last edited by Josef.95 on Mon Jun 07, 2021 7:55 pm, edited 1 time in total.
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

  • Quote

Post by papu » Mon Jun 07, 2021 7:53 pm

error
Last edited by papu on Mon Jun 07, 2021 10:23 pm, edited 4 times in total.
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

  • Quote

Post by papu » Mon Jun 07, 2021 7:57 pm

Josef.95 wrote:papu,
yes, (from your configure output):

Code: Select all

    --enable-linker=lld             forcing ld=lld due to USE=clang and USE=lto
    --enable-lto=cross              +lto
    MOZ_PGO=1                       +pgo
    --disable-debug                 -debug
    --disable-debug-symbols         Gentoo default
    --enable-optimize=-O3           from CFLAGS
I think it looks good :)

/edit: I think try a build, and then check in firefox adress bar: about:buildconfig
then why this warning?

Code: Select all

0:04.28 WARNING: Disabling LTO because --enable-profile-generate is specified
these messages and configurations confuse me too much 8O

p.d: it's clear with pgo lto is desactivated (as the above message suggests), it not create lto code in firefox compilation , without pgo it create lto code, i don't know why...
I had understood that lto and pgo was compatible and also increase performance when both was activated.
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
Ionen
Developer
Developer
User avatar
Posts: 3013
Joined: Thu Dec 06, 2018 2:23 pm

  • Quote

Post by Ionen » Mon Jun 07, 2021 11:43 pm

You don't need to set anything in package.env to do that on firefox

1. ebuild setup clang stuff for you with USE=clang, trying to change that yourself will likely break things (default-* on clang often mess things up too)
2. with USE="lto pgo" upstream firefox actually _forces_ -O3 even if you've set -O2 (well, for C++.. but C is only third party bundled stuff -- in my about:buildconfig I see my -O2 but there's a -O3 after it, and you'll see it all over the build.log), and of course uses lto

On a side-note, when using gcc, be wary of -O3 with firefox. It has a poor history of runtime issues and ebuild currently adds a -fno-tree-loop-vectorize to workaround #2 above that always enables it.
Top
papu
l33t
l33t
Posts: 772
Joined: Fri Jan 25, 2008 3:04 pm
Location: Sota algun pi o alzina...

  • Quote

Post by papu » Wed Jun 09, 2021 5:22 pm

Ionen wrote:You don't need to set anything in package.env to do that on firefox

1. ebuild setup clang stuff for you with USE=clang, trying to change that yourself will likely break things (default-* on clang often mess things up too)
2. with USE="lto pgo" upstream firefox actually _forces_ -O3 even if you've set -O2 (well, for C++.. but C is only third party bundled stuff -- in my about:buildconfig I see my -O2 but there's a -O3 after it, and you'll see it all over the build.log), and of course uses lto

On a side-note, when using gcc, be wary of -O3 with firefox. It has a poor history of runtime issues and ebuild currently adds a -fno-tree-loop-vectorize to workaround #2 above that always enables it.
yes , i return to default settings is nonsense losing time with this , may be when i have a ryzen 4 :wink:

thanks so much to all!
~amd64 && systemd && plasma --cpu 7700 --ram 2x32GB --gpu RX 6600
Top
Post Reply

14 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic