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
./configure --enable-optimizations should enable LTO #89536
Comments
|
When Python is configured with: ./configure --enable-optimizations PGO is enabled but not LTO. I recall that a few years ago, GCC with LTO had bugs. But now, GCC with LTO is reliable. I suggest to enable it by default in Python 3.11. Or did I miss a reason to not do that? |
|
IIRC activating lto is specially annoying on MacOS due to the need of some llvm components that are a bit hard to get. Let me dig a bit to see if I reproduce the problem |
|
Pablo:
Ah, I guess that you are referring to this requirement: Maybe configure can enable LTO on all platforms but macOS. |
Can you say more? We are currently using --with-lto with a vanilla Apple Command Line Tools (or Xcode) for macOS installer builds when building on macOS 10.15 High Sierra or higher. Perhaps this was just an issue on older versions. |
|
Yeah, I had problems in the past to get llvm-ar or some other component. I still need time to reproduce and to see if this still happens on new versions. |
|
I don't think you need llvm-ar anymore with the Apple Tool Chain but let me look into it as I have all the relevant previous macOS releases as VMs to test with. |
|
FWIW I agree that we should try adding LTO to --enable-optimizations now. |
|
Sorry, this slipped off my radar and I haven't gone back and checked older versions of macOS. But it certainly is true that at least with the current versions of the Apple Developer Tools (either the Command Line Tools or Xcode) for macOS 11 (Big Sur) and macOS 12 (Monterey), things just work. |
|
Can we use --lto=thin when availabe? |
|
One data point: when I enabled |
|
@methane san cc @ned-deily I would like to switch the default LTO policy to the thinLTO if available from Python3.12. AS-IS##TO-BE |
|
I like faster LTO by default. Because default LTO is slow. Random comments: I don't want to use LTO while profiling build (1st build in PGO). What about GCC? GCC supports |
|
I don't have an opinion yet. I plan to compare both options on macOS. |
+1
We may need to add the option for |
|
So. Can we enable LTO in Python 3.12? Is there a way to opt-out from LTO when |
|
Is it possible to disable LTO if it's known to not work properly / if the toolchain is too old? I'm thinking at Ned's toolchain to build Python on macOS for x86 CPU. |
vstinner commentedOct 5, 2021
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: