Gentoolto: use built-in python lto/pgo?

Created on 19 Jul 2020  路  5Comments  路  Source: InBetweenNames/gentooLTO

I used these options with standard Gentoo ebuild:

export PROFILE_TASK="-m test -j $(nproc) --pgo-extended"
EXTRA_ECONF="--with-lto --enable-optimizations"

Most helpful comment

I did a couple tests regarding pgo for python-3.8.5-r1

Using emerge -uDvpU --with-bdeps=y @world:

| | -pgo | +pgo | --pgo-extended |
|---------------------|--------|--------|----------------|
| time | 14.56s | 13.03s | 12.48s |
| speedup
vs. -pgo
| 0% | 11.74% | 16.67% |

For --pgo-extended the following was using in the ebuild:

if use pgo; then
    emake profile-opt PROFILE_TASK="-m test -x test_gdb test_compileall -j $(nproc) --pgo-extended"
else

The full command used was time for i in {1..10}; do emerge -uDvpU --with-bdeps=y @world; done averaged over three consecutive runs.


dev-lang/python-3.8.5-r1::lto-overlay was built with the following:
USE="gdbm libressl ncurses pgo readline sqlite ssl xml -bluetooth -build -examples -hardened -ipv6 -test -tk -wininst" ABI_X86="(64)"
CFLAGS="-march=znver2 -O3 -flto=17 -flto-compression-level=9 -fgraphite-identity -floop-nest-optimize -fipa-pta -fno-semantic-interposition -fdevirtualize-at-ltrans -fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range -fexcess-precision=fast -pipe -fno-finite-math-only -Wl,-O1 -Wl,--as-needed -fwrapv -ffat-lto-objects"

All 5 comments

I'm all for enabling PGO via an easy way. What does --pgo-extended do?

--with-lto just manually adds -flto to CFLAGS, without any parallelization (may have changed in 3.9)

regarding the parallelization, I think it is intended upstream. they explicitly set lto-partition=none.

I did a couple tests regarding pgo for python-3.8.5-r1

Using emerge -uDvpU --with-bdeps=y @world:

| | -pgo | +pgo | --pgo-extended |
|---------------------|--------|--------|----------------|
| time | 14.56s | 13.03s | 12.48s |
| speedup
vs. -pgo
| 0% | 11.74% | 16.67% |

For --pgo-extended the following was using in the ebuild:

if use pgo; then
    emake profile-opt PROFILE_TASK="-m test -x test_gdb test_compileall -j $(nproc) --pgo-extended"
else

The full command used was time for i in {1..10}; do emerge -uDvpU --with-bdeps=y @world; done averaged over three consecutive runs.


dev-lang/python-3.8.5-r1::lto-overlay was built with the following:
USE="gdbm libressl ncurses pgo readline sqlite ssl xml -bluetooth -build -examples -hardened -ipv6 -test -tk -wininst" ABI_X86="(64)"
CFLAGS="-march=znver2 -O3 -flto=17 -flto-compression-level=9 -fgraphite-identity -floop-nest-optimize -fipa-pta -fno-semantic-interposition -fdevirtualize-at-ltrans -fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal-math -fno-math-errno -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fcx-limited-range -fexcess-precision=fast -pipe -fno-finite-math-only -Wl,-O1 -Wl,--as-needed -fwrapv -ffat-lto-objects"

@telans Thanks for investigating -- it seems like this is an easy way to get a nice performance boost.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prototype99 picture prototype99  路  3Comments

Peter-Levine picture Peter-Levine  路  15Comments

Althorion picture Althorion  路  10Comments

nivedita76 picture nivedita76  路  17Comments

jiblime picture jiblime  路  3Comments