Skip to content

Use full LTO for all builds#343

Merged
mdboom merged 1 commit intofaster-cpython:mainfrom
Fidget-Spinner:full_lto
Jan 13, 2025
Merged

Use full LTO for all builds#343
mdboom merged 1 commit intofaster-cpython:mainfrom
Fidget-Spinner:full_lto

Conversation

@Fidget-Spinner
Copy link
Copy Markdown
Contributor

@Fidget-Spinner Fidget-Spinner commented Jan 11, 2025

Closes #342

GCC defaults to full LTO with --with-lto=yes passed. Clang defaults to ThinLTO with --with-lto=yes passed. You need --with-lto=full to enable full LTO.

run: |
cd cpython
./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=yes' || '' }} ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} ${{ inputs.nogil == true && '--disable-gil' || '' }}
./configure ${{ inputs.pgo == true && '--enable-optimizations --with-lto=full' || '' }} ${{ inputs.tier2 == true && '--enable-experimental-jit=interpreter' || '' }} ${{ inputs.jit == true && '--enable-experimental-jit=yes' || '' }} ${{ inputs.nogil == true && '--disable-gil' || '' }}
Copy link
Copy Markdown
Contributor Author

@Fidget-Spinner Fidget-Spinner Jan 12, 2025

Choose a reason for hiding this comment

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

This is a bit tricky. Apple Clang defaults to ThinLTO on recent versions as well. So after this commit, we would need to be careful when benchmarking and make sure it's comparing to a recent CPython commit (and not an old one prior to this commit).

I'm still in favour of this change anyways, because full LTO produces more reproducible benchmarking results, based on our experience in python/cpython#122580

@mdboom
Copy link
Copy Markdown
Contributor

mdboom commented Jan 13, 2025

We can merge this and then re-run all of the baselines (3.10, 3.11, 3.13) on macOS, and then backfill all of the comparisons.

Copy link
Copy Markdown
Contributor

@mdboom mdboom left a comment

Choose a reason for hiding this comment

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

LGTM

@mdboom mdboom merged commit 204029f into faster-cpython:main Jan 13, 2025
@Fidget-Spinner Fidget-Spinner deleted the full_lto branch January 15, 2025 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clang builds not using full LTO

2 participants