GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-114809: Add support for macOS multi-arch builds with the JIT enabled by savannahostrowski · Pull Request #131751 · python/cpython

Conversation

@savannahostrowski

@savannahostrowski savannahostrowski commented Mar 26, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This work patches up #115742.

  • Issue: JIT & macOS fat builds #114809

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ronaldoussoren and others added 9 commits February 20, 2024 21:17
@ronaldoussoren
First draft of supporting fat builds on macOS with the experimental JIT
efd5863
@savannahostrowski
merge conflict
4f493cd
@savannahostrowski
fix up merge
a55268e
@savannahostrowski
add fix for CI?;
bce7980
@savannahostrowski
Fix up to make generic
b606b48
@savannahostrowski
Fix up conditions
a382a44
@savannahostrowski
Save state before merge
ff3d363
@savannahostrowski
Merge main and fix conflicts
3bc2820
@savannahostrowski
Fix event loop binding error for _CORES in FAT builds
348f2b6
@savannahostrowski
savannahostrowski requested review from brandtbucher, corona10 and erlend-aasland as code owners March 26, 2025 04:54
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 26, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 26, 2025
JIT & macOS fat builds #114809
Closed
@blurb-it
📜🤖 Added by blurb_it.
4b31a30
@savannahostrowski

savannahostrowski commented Mar 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Hmmmmm, will investigate why everything is failing tomorrow.

"It worked on my machine", a tale as old as time.
"I typo'd and left out a single character causing every job to fail", a tale as old as time

brianschubert and tianon reacted with laugh emoji
All reactions
  • 😄 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski added 2 commits March 25, 2025 22:27
@savannahostrowski
Try using weakref?
4564bc4
@savannahostrowski
Merge branch 'og_fat_build' of https://github.com/savannahostrowski/c…
2d381ca
…python into og_fat_build
savannahostrowski
savannahostrowski commented Mar 26, 2025
View reviewed changes
Comment thread Tools/jit/_llvm.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski added 3 commits March 26, 2025 19:14
@savannahostrowski
Remove weakref and lazily instantiate cores
49f86a1
@savannahostrowski
use Runner
467ffe1
@savannahostrowski
Merge branch 'main' into og_fat_build
fd858bc
brandtbucher
brandtbucher approved these changes Apr 9, 2025
View reviewed changes

@brandtbucher brandtbucher left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks, looks good! Just the few things we discussed offline:

  • Maybe trying to get this in CI.
  • Indentation nitpick for preprocessor directives in jit_stencils.h.
  • The possibility of just using the second code path in build.py for single-arch builds too.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 9, 2025
savannahostrowski added 5 commits April 10, 2025 20:32
@savannahostrowski
Remove conditional and fix indentation in stencils
58649ff
@savannahostrowski
Merge branch 'og_fat_build' of https://github.com/savannahostrowski/c…
182612c
…python into og_fat_build
@savannahostrowski
Merge branch 'main' into og_fat_build
30a4d99
@savannahostrowski
CI updates
b172a41
@savannahostrowski
Merge branch 'og_fat_build' of https://github.com/savannahostrowski/c…
18e77f2
…python into og_fat_build
savannahostrowski added 3 commits April 10, 2025 20:46
@savannahostrowski
Remove extra space
de3f896
@savannahostrowski
Fix condition typo
7c22761
@savannahostrowski
undo
c54250b
@savannahostrowski
savannahostrowski force-pushed the og_fat_build branch from 4b518e5 to c54250b Compare April 11, 2025 04:53
brandtbucher
brandtbucher reviewed Apr 11, 2025
View reviewed changes
Comment thread .github/workflows/jit.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski and others added 2 commits April 11, 2025 12:44
@savannahostrowski @brandtbucher
Update jit.yml
c21573f
Co-authored-by: Brandt Bucher <[email protected]>
@savannahostrowski
Merge branch 'main' into og_fat_build
4332f10
@ned-deily

ned-deily commented Apr 16, 2025

Copy link
Copy Markdown
Member

@savannahostrowski Thanks for working on this! I'll review and test this in the next day or two.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher

brandtbucher commented Apr 16, 2025

Copy link
Copy Markdown
Member

Thanks @ned-deily! It would be great if we could have the JIT built-but-off (--enable-experimental-jit=yes-off) in the 3.14 betas like we talked about at the sprint, and this is an important step towards that... since I think the release builds are Universal2, right?

The remaining tests seem to be failing because the external introspection and remote exec features doesn't work on fat builds, and this PR switches the JIT CI over to Universal2 to make sure we don't break releases. The existing tests don't skip themselves on these builds, and are just failing.

@pablogsal, is it intended that fat builds aren't supported by the internal introspection and remote exec features? The error message we're running into here says 32-bit Mach-O binaries are not supported, which leads me to think this is just an oversight (both parts of this particular universal build are 64 bits). If I understand correctly, this also means that Universal2 macOS release builds don't support these features, which seems like a shame.

I think the correct thing to do here is for the search_section_in_file functions to decode FAT_MAGIC and FAT_CIGAM headers correctly, since the included architectures are enumerated there. Or, just assume that they're 64-bit, since we don't even support any 32-bit macOS platforms anyways.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher

brandtbucher commented Apr 24, 2025

Copy link
Copy Markdown
Member

@savannahostrowski, I spoke to @pablogsal and he'll look into the universal issue separately. Let's roll back the CI change and land that later after the feature is fixed for universal builds.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Apr 24, 2025

Copy link
Copy Markdown
Member

I think I can get something today today or tomorrow if you want to wait until then

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher

brandtbucher commented Apr 24, 2025

Copy link
Copy Markdown
Member

Yep, we're fine waiting.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Apr 25, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fastest gun in the west folks: #132892

brandtbucher reacted with hooray emoji savannahostrowski reacted with heart emoji
All reactions
  • 🎉 1 reaction
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Apr 25, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The other test needs #132852 to reuse the implementation

brandtbucher reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal pablogsal mentioned this pull request Apr 25, 2025
gh-91048: Refactor _testexternalinspection and add Windows support #132852
Merged
@pablogsal

pablogsal commented Apr 25, 2025

Copy link
Copy Markdown
Member

Both are landed. Rebasing should fix the CI

brandtbucher reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher
Merge branch 'main' into og_fat_build
dd5f196
ned-deily
ned-deily approved these changes Apr 29, 2025
View reviewed changes

@ned-deily ned-deily left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. With these additions, I was able to produce a python.org-style macOS universal2 installer containing both traditional (GIT-enabled) and free-treaded release builds both with optional JIT (yes-off). Installer smoke tests of all four options on both Apple Silicon (running current macOS 15.4) and Intel Macs (with macOS 11.7.10) did not show any obvious regressions.

The only unexpected issue was the JIT build's use of pthread_jit_write_protect_np (added in #126195). That function is only available as of macOS 11, which is when Apple Silicon Mac support was introduced. The macOS installer build supports a range of operating system releases through the use of Apple's preferred method of weak-linking and run-time testing for a feature's availability. We've tried to cover a very broad range of releases and architecture, occasionally upping the lower bound. For 3.13, we have been supporting down to macOS 10.13 but, for various reasons, have been planning to bump that to at least 10.15 for 3.14 and it likely wouldn't affect too many users if we went to macOS 11 (which was the next feature release after 10.15) instead. For b1, I'll plan to target macOS 11+ and make a final recommendation as part of a macOS support policy PEP during the beta phase. There is more than one approach we could take should we decide such support is needed but my initial reaction is that it won't be. (Also, note that this is only an issue when building to support a range of operating systems with one universal binary. Building with the jit enabled for, say, just macOS 10.15 with a macOS 10.15 SDK should work as is.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

savannahostrowski reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@brandtbucher

brandtbucher commented Apr 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Thanks @ned-deily!

LGTM. With these additions, I was able to produce a python.org-style macOS universal2 installer containing both traditional (GIT-enabled) and free-treaded release builds both with optional JIT (yes-off). Installer smoke tests of all four options on both Apple Silicon (running current macOS 15.4) and Intel Macs (with macOS 11.7.10) did not show any obvious regressions.

One thing I forgot to mention is that I'm planning on making it an error in 3.14 to pass both --enable-experimental-jit and --disable-gil to ./configure (it doesn't do what you think; it builds the JIT, but never actually uses it at runtime).

So we would only pass --enable-experimental-jit=yes-off to the traditional GIL-enabled build. Is that an issue at all?

The only unexpected issue was the JIT build's use of pthread_jit_write_protect_np (added in #126195). That function is only available as of macOS 11, which is when Apple Silicon Mac support was introduced. The macOS installer build supports a range of operating system releases through the use of Apple's preferred method of weak-linking and run-time testing for a feature's availability. We've tried to cover a very broad range of releases and architecture, occasionally upping the lower bound. For 3.13, we have been supporting down to macOS 10.13 but, for various reasons, have been planning to bump that to at least 10.15 for 3.14 and it likely wouldn't affect too many users if we went to macOS 11 (which was the next feature release after 10.15) instead. For b1, I'll plan to target macOS 11+ and make a final recommendation as part of a macOS support policy PEP during the beta phase. There is more than one approach we could take should we decide such support is needed but my initial reaction is that it won't be. (Also, note that this is only an issue when building to support a range of operating systems with one universal binary. Building with the jit enabled for, say, just macOS 10.15 with a macOS 10.15 SDK should work as is.)

Thanks for the explanation. If it turns out to be too much trouble, we can use the "older" mprotect calls to do the same thing. Apparently MAP_JIT/pthread_jit_write_protect_np is faster if you're constantly flipping permissions on the JIT pages, but that's not something we do in 3.14, so it's not a huge loss to go back if needed.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brandtbucher brandtbucher mentioned this pull request Apr 30, 2025
GH-133171: Prevent combinations of --disable-gil and --enable-experimental-jit (for now) #133179
Merged
@savannahostrowski
Merge branch 'main' into og_fat_build
cdc4bfb
@savannahostrowski

savannahostrowski commented Apr 30, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Thanks @ned-deily for the review and @pablogsal for the quick turnaround on the test fixes!

(This is also my last CPython contribution as Savannah Ostrowski, as I'm getting married this weekend, so it feels doubly special 🥹)

brandtbucher, hugovk, and tianon reacted with hooray emoji tianon reacted with heart emoji
All reactions
  • 🎉 3 reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@savannahostrowski
savannahostrowski merged commit 26c0248 into python:main Apr 30, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 30, 2025
This was referenced Aug 10, 2025
Stack overflow error from recursion with 3.14.0rc1 on MacOS #137573
Closed
Minimum macos system requirement for 3.14.0rc1? #137749
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brandtbucher brandtbucher brandtbucher approved these changes
@ned-deily ned-deily ned-deily approved these changes
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@corona10 corona10 Awaiting requested review from corona10 corona10 is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@savannahostrowski @ned-deily @brandtbucher @pablogsal @ronaldoussoren
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.