Skip to content

gh-146475: Block Apple LLVM 21 from passing JIT tool version check#146478

Open
ashutoshk314 wants to merge 2 commits intopython:mainfrom
ashutoshk314:fix-jit-apple-llvm21-check
Open

gh-146475: Block Apple LLVM 21 from passing JIT tool version check#146478
ashutoshk314 wants to merge 2 commits intopython:mainfrom
ashutoshk314:fix-jit-apple-llvm21-check

Conversation

@ashutoshk314
Copy link
Copy Markdown

@ashutoshk314 ashutoshk314 commented Mar 26, 2026

Fixes #146475

The JIT is incompatible with Apple LLVM 21, but the tool version
check was passing it through. This change blocks Apple LLVM 21
from passing the check.

@python-cla-bot
Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@bedevere-app
Copy link
Copy Markdown

bedevere-app bot commented Mar 26, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f29015ef58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

) -> bool:
output = await _run(name, ["--version"], echo=echo)
_llvm_version_pattern = re.compile(rf"version\s+{llvm_version}\.\d+\.\d+\S*\s+")
_llvm_version_pattern = re.compile(rf"(?<!Apple )LLVM version\s+{llvm_version}\.\d+\.\d+\S*\s+")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Accept clang version strings in tool check

_check_tool_version() now only matches outputs containing LLVM version, but the JIT tool lookup also validates clang in _find_tool(), and upstream clang --version reports clang version 21.x.y (not LLVM version). In environments with LLVM 21 clang, this makes the version check fail and run("clang", ...) eventually raise Can't find clang-21!, breaking JIT stencil builds even with a correct compiler installed.

Useful? React with 👍 / 👎.

@@ -59,7 +59,7 @@ async def _check_tool_version(
name: str, llvm_version: str, *, echo: bool = False
) -> bool:
output = await _run(name, ["--version"], echo=echo)
_llvm_version_pattern = re.compile(rf"version\s+{llvm_version}\.\d+\.\d+\S*\s+")
_llvm_version_pattern = re.compile(rf"(?<!Apple )LLVM version\s+{llvm_version}\.\d+\.\d+\S*\s+")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On my mac I had to add LLVM and clang to match the string. Can you please check?

Suggested change
_llvm_version_pattern = re.compile(rf"(?<!Apple )LLVM version\s+{llvm_version}\.\d+\.\d+\S*\s+")
_llvm_version_pattern = re.compile(rf"(?<!Apple )(LLVM|clang) version\s+{llvm_version}\.\d+\.\d+\S*\s+")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

$ /Library/Developer/CommandLineTools/usr/bin/llvm-objdump --version
Apple LLVM version 21.0.0
  Optimized build.
...

$ /Library/Developer/CommandLineTools/usr/bin/clang --version
Apple clang version 21.0.0 (clang-2100.0.123.102)
Target: arm64-apple-darwin25.4.0
...

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.

Yep, I'm on MacOS as well and checked that we do need clang in the regex.

@bedevere-app
Copy link
Copy Markdown

bedevere-app bot commented Mar 27, 2026

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Copy link
Copy Markdown
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

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

@ashutoshk314 Can you please sign the CLA?

@Fidget-Spinner I saw the issue but is Apple LLVM 21 incompatible because their fork has diverged/is missing features/etc? What about it makes it incompatible?

@@ -59,7 +59,7 @@ async def _check_tool_version(
name: str, llvm_version: str, *, echo: bool = False
) -> bool:
output = await _run(name, ["--version"], echo=echo)
_llvm_version_pattern = re.compile(rf"version\s+{llvm_version}\.\d+\.\d+\S*\s+")
_llvm_version_pattern = re.compile(rf"(?<!Apple )LLVM version\s+{llvm_version}\.\d+\.\d+\S*\s+")
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.

Yep, I'm on MacOS as well and checked that we do need clang in the regex.

@@ -0,0 +1,2 @@
Block Apple LLVM 21 from passing the JIT tool version check, as the JIT is
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.

We should include at least some details about why it's incompatible IMO.

@Fidget-Spinner
Copy link
Copy Markdown
Member

@Fidget-Spinner I saw the issue but is Apple LLVM 21 incompatible because their fork has diverged/is missing features/etc? What about it makes it incompatible?

IIUC, it produces different relocations than normal clang. I can't confirm, as I don't have a macOS AArch64 machine.

@savannahostrowski
Copy link
Copy Markdown
Member

@Fidget-Spinner The reason I'm asking is because I was able to successfully build with the JIT enabled and have all the tests pass? I'm a bit confused here on what specifically doesn't work.

Maybe @kumaraditya303 can shed more light on why this was an issue?

@kumaraditya303
Copy link
Copy Markdown
Contributor

can shed more light on why this was an issue?

/var/folders/gl/y19dp_px79j44r3kss8lm4h40000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r03-924f3b.s:881:1: error: starting new .cfi frame before finishing the previous one
; %bb.0:
^
/var/folders/gl/y19dp_px79j44r3kss8lm4h40000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r03-924f3b.s:892:1: error: starting new .cfi frame before finishing the previous one
; %bb.0:
^
/var/folders/gl/y19dp_px79j44r3kss8lm4h40000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r03-924f3b.s:903:1: error: starting new .cfi frame before finishing the previous one
; %bb.0:
^

During the compilation with apple clang, I was getting the above error. I haven't looked at the root cause of this.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT might accidentally use Apple LLVM 21 on macOS

6 participants