Skip to content

RFC python3: support profile-optimized build

Markus Lehtonen openembedded-core 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest10 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10python3-native: support profile optimized buildmeta/recipes-devtools/python/python3-native_3.5.2.bb meta/recipes-devtools/python/python3/000-cross-compile.patch+9 -90 replies
2/10python3: fix depends of python-testsmeta/recipes-devtools/python/python-3.5-manifest.inc+1 -10 replies
3/10python3: add python-profile-opt3 recipemeta/recipes-devtools/python/python-profile-opt3 meta/recipes-devtools/python/python-profile-opt3_3.5.2.bb meta/recipes-devtools/python/python3/Makefile-add-install_generate_profile-target.patch +2 more+178 -200 replies
4/10python-pgo-image: profiling for python3meta/recipes-devtools/images/python-pgo-image.bb+44 -110 replies
5/10python3: remove two setup.py cross-compile hacksmeta/recipes-devtools/python/python3/python3-setup.py-no-host-headers-libs.patch meta/recipes-devtools/python/python3/setup.py-find-libraries-in-staging-dirs.patch meta/recipes-devtools/python/python3_3.5.2.bb+0 -650 replies
6/10python3: support profile optimized buildmeta/recipes-devtools/python/python3_3.5.2.bb+20 -00 replies
7/10python3: fix profile-optimized build of modulesmeta/recipes-devtools/python/python3/Use-correct-CFLAGS-for-extensions-when-cross-compili.patch meta/recipes-devtools/python/python3_3.5.2.bb+57 -00 replies
8/10python-pgo-image: exclude tests from the python3 profile targetmeta/recipes-devtools/images/python-pgo-image.bb+5 -00 replies
9/10python3: add python3-tools subpackagemeta/recipes-devtools/python/python-3.5-manifest.inc meta/recipes-devtools/python/python3_3.5.2.bb+10 -30 replies
10/10python-pgo-image: change python3 profile target to pybenchmeta/recipes-devtools/images/python-pgo-image.bb+6 -50 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 00/10] python3: support profile-optimized build

This patchset implements profile-guided-optimization (PGO) for Python 3. The implementation is very similar to my previous patchset for Python 2.7.

PGO for python3-native is one simple patch. PGO for target python3 is more complicated and follows the lines of Python 2.7:
1. add new python-profile-opt3 recipe that is a special version of python3 with profile instrumentation enabled
2. add new do_profile3 in python-pgo-image for running the python3 profile task in the target
3. enable usage of profile data in python3 do_compile

Configration variables for controlling the feature are:

PYTHON3_PROFILE_OPT          - set to "1" to enable PGO on python3
PYTHON3_PROFILE_TASK         - profile task to run for python3
PYTHON3_NATIVE_PROFILE_OPT   - set to "1" to enable PGO on python3-native
PYTHON3_NATIVE_PROFILE_TASK  - profile task to run for python3-native

Benchmark results from my i7-3770K are found below. python3-native:

  pystone:          118288 -> 138026 pystones/s     (+17%)
  pybench avg:      3428   -> 3118 ms               (-9%)
  regrtest time:    598    -> 550 s                 (-8%)

python3 (target):

  pystone:          1531   -> 1616 pystones/s       (+5.5%)
  pybench avg:      215901 -> 207498 ms             (-3.9%)
  regrtest time:    8355   -> 8157                  (-2.4%)

Again, these are just ballpark figures from few test runs.

The following changes since commit ccf50ba2e045b7b690a10633710872845a63943f:

python-pgo-image: enable sstate for do_profile (2017-01-24 15:23:49 +0200)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib marquiz/fixes-9338-py3
http://git.openembedded.org/openembedded-core-contrib/log/?h=marquiz/fixes-9338-py3

Markus Lehtonen (10):
python3-native: support profile optimized build
python3: fix depends of python-tests
python3: add python-profile-opt3 recipe
python-pgo-image: profiling for python3
python3: remove two setup.py cross-compile hacks
python3: support profile optimized build
python3: fix profile-optimized build of modules
python-pgo-image: exclude tests from the python3 profile target
python3: add python3-tools subpackage
python-pgo-image: change python3 profile target to pybench

 meta/recipes-devtools/images/python-pgo-image.bb   |  61 +++++++++--
 .../python/python-3.5-manifest.inc                 |  10 +-
 meta/recipes-devtools/python/python-profile-opt3   |   1 +
 .../python/python-profile-opt3_3.5.2.bb            |  15 +++
 .../python/python3-native_3.5.2.bb                 |   9 ++
 .../python/python3/000-cross-compile.patch         |   9 --
 ...efile-add-install_generate_profile-target.patch |  25 +++++
 ...-CFLAGS-for-extensions-when-cross-compili.patch |  56 +++++++++++
 .../python3-setup.py-no-host-headers-libs.patch    |  33 ------
 ...name-libpython3-to-libpython-profile-opt3.patch | 111 +++++++++++++++++++++
 .../setup.py-find-libraries-in-staging-dirs.patch  |  30 ------
 meta/recipes-devtools/python/python3_3.5.2.bb      |  74 ++++++++++----
 12 files changed, 325 insertions(+), 109 deletions(-)
 create mode 120000 meta/recipes-devtools/python/python-profile-opt3
 create mode 100644 meta/recipes-devtools/python/python-profile-opt3_3.5.2.bb
 create mode 100644 meta/recipes-devtools/python/python3/Makefile-add-install_generate_profile-target.patch
 create mode 100644 meta/recipes-devtools/python/python3/Use-correct-CFLAGS-for-extensions-when-cross-compili.patch
 delete mode 100644 meta/recipes-devtools/python/python3/python3-setup.py-no-host-headers-libs.patch
 create mode 100644 meta/recipes-devtools/python/python3/rename-libpython3-to-libpython-profile-opt3.patch
 delete mode 100644 meta/recipes-devtools/python/python3/setup.py-find-libraries-in-staging-dirs.patch
Signature · 1 line
2.10.2