Bug 1749576

Summary: [Amazon RHEL8.2 FEAT] Python3 - Enable "Expensive" Optimizations
Product: Red Hat Enterprise Linux 8 Reporter: Jon Masters <jcm>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: bgray, cstratak, dshaks, frival, jfeeney, jshortt, kabbott, perfbz, pviktori, torsava, vstinner
Target Milestone: rcKeywords: FutureFeature, TestCaseNotNeeded
Target Release: 8.2   
Hardware: aarch64   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3-3.6.8-18.el8 Doc Type: Release Note
Doc Text:
The profile guided optimizations, previously enabled only for the x86_64 architecture, have been also enabled for the aarch64, ppc64le and s390x architectures.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:07:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1732354, 1749568, 1776957    

Description Jon Masters 2019-09-05 22:15:51 UTC
Description of problem:

Our current Python3 packages are built without "Expensive" (e.g. LTO, PGO) optimizations enabled. There's a section in specfile that looks like this:

$ grep -A7 Expensive python3.spec
# Expensive optimizations (mainly, profile-guided optimizations)
%ifarch %{ix86} x86_64
%bcond_without optimizations
%else
# On some architectures, the optimized build takes tens of hours, possibly
# longer than Koji's 24-hour timeout. Disable optimizations here.
%bcond_with optimizations
%endif

Where apparently we don't turn on these performance optimizations for aarch64, but only for x86, however allegedly the perf benefit would be 30%! We should thus consider urgently enabling these performance features if the builds aren't negatively impacted in terms of build time, etc.

Comment 3 Victor Stinner 2019-09-24 13:33:07 UTC
# On some architectures, the optimized build takes tens of hours, possibly
# longer than Koji's 24-hour timeout. Disable optimizations here.
%bcond_with optimizations

A solution for that is to backport the following change from Python 3.8 (upstream) to Python 3.6 (downstream):

* https://bugs.python.org/issue36044
* https://github.com/python/cpython/commit/4e16a4a3112161a5c6981c0588142d4a4673a934
* https://github.com/python/cpython/commit/e1b900247227dad49d8231f1d028872412230ab4

In short: the PGO build runs only a few tests rather than the full Python test suite to train the compiler, so the build is way faster.

Comment 9 errata-xmlrpc 2020-04-28 16:07:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1764