Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
May 3, 2021

Conversation

ronaldoussoren
Copy link
Contributor

@ronaldoussoren ronaldoussoren commented Nov 1, 2020

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
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
Copy link
Member

vstinner commented Nov 2, 2020

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
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).

Copy link
Member

@ned-deily ned-deily left a comment

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.

Copy link
Member

@vstinner vstinner left a comment

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

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
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

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
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 bedevere-bot removed the needs backport to 3.9 only security fixes label May 3, 2021
@bedevere-bot
Copy link

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

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

@bedevere-bot bedevere-bot removed the needs backport to 3.8 only security fixes label May 3, 2021
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