Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-42235: [macOS] Use LTO/PGO in build-installer.py with new enough compilers#23079

Merged
ned-deily merged 4 commits into
python:masterpython/cpython:masterfrom
ronaldoussoren:bpo-42235ronaldoussoren/cpython:bpo-42235Copy head branch name to clipboard
May 3, 2021
Merged

bpo-42235: [macOS] Use LTO/PGO in build-installer.py with new enough compilers#23079
ned-deily merged 4 commits into
python:masterpython/cpython:masterfrom
ronaldoussoren:bpo-42235ronaldoussoren/cpython:bpo-42235Copy head branch name to clipboard

Conversation

@ronaldoussoren

@ronaldoussoren ronaldoussoren commented Nov 1, 2020

Copy link
Copy Markdown
Contributor

This PR enables --with-optimizations in build-installer.py when using a new enough compiler.

For now "new enough" is gated on being on macOS 10.15 or later, as that's what I've tested with.

https://bugs.python.org/issue42235

With recent enough compilers we can build binaries with
LTO/PGO on macOS. This patch enables this when building on
macOS 10.15 or later (Xcode 11 or later).
@ronaldoussoren

Copy link
Copy Markdown
Contributor Author

Note that this PR requires #22855 to be actually useful, as that introduces "universal2" as a new set of universal arch, and that's the only set of architectures that can actually be build on 10.15 (when using the current Xcode 12 beta).

I've marked this PR as "DO-NO-MERGE" because I don't want to merge this before #22855.

@vstinner

vstinner commented Nov 2, 2020

Copy link
Copy Markdown
Member

I've marked this PR as "DO-NO-MERGE" because I don't want to merge this before #22855.

I started to use draft PRs rather than using this label, to prevent mistakes.

@ronaldoussoren

Copy link
Copy Markdown
Contributor Author

@ned-deily I've been pretty conservative in this PR by only enabling the optimisations on macOS 10.15 or later. That's because I expect that we'll end up building installers with the latest version of Xcode. Both because the latest version is needed to build for arm64, and because newer compilers tend to have improved code generation.

BTW. I haven't tested yet what the performance improvement is. I think it would be interesting to run pyperformance with and without LTO+PGO to see how much it will buy us on macOS (although I'd assume there would be similar gains as on other platforms).

Comment thread Mac/BuildScript/build-installer.py Outdated
Comment thread Mac/BuildScript/build-installer.py

@ned-deily ned-deily left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in principle. Will test later.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. @ned-deily already approved this PR, so @ronaldoussoren please merges it ;-)

I didn't check if macOS 10.15 supports LTO+PGO, but I trust @ronaldoussoren who knows macOS way better than me :-D

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Dec 16, 2020
@ned-deily

Copy link
Copy Markdown
Member

Still awaiting testing by me.

@ned-deily ned-deily removed the stale Stale PR or inactive for long period of time. label Dec 16, 2020
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jan 16, 2021
@ned-deily ned-deily removed the stale Stale PR or inactive for long period of time. label Jan 16, 2021
@ned-deily ned-deily merged commit e08059e into python:master May 3, 2021
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @ronaldoussoren for the PR, and @ned-deily for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 3, 2021
…compilers (pythonGH-23079)

With recent enough compilers we can build binaries with
LTO/PGO on macOS. This patch enables this when building on
macOS 10.15 or later (Xcode 11 or later).
(cherry picked from commit e08059e)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
@bedevere-bot

Copy link
Copy Markdown

GH-25831 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 3, 2021
…compilers (pythonGH-23079)

With recent enough compilers we can build binaries with
LTO/PGO on macOS. This patch enables this when building on
macOS 10.15 or later (Xcode 11 or later).
(cherry picked from commit e08059e)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
@bedevere-bot

Copy link
Copy Markdown

GH-25832 is a backport of this pull request to the 3.8 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.