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

Update JIT compilation to use LLVM 19 #123714

Closed
savannahostrowski opened this issue Sep 4, 2024 · 12 comments
Closed

Update JIT compilation to use LLVM 19 #123714

savannahostrowski opened this issue Sep 4, 2024 · 12 comments
Assignees
Labels
3.14 new features, bugs and security fixes build The build process and cross-build topic-JIT

Comments

@savannahostrowski
Copy link
Member

savannahostrowski commented Sep 4, 2024

The JIT currently uses LLVM 18. The final release of LLVM 19 is slated for September 17th. We should update to the latest version.

Linked PRs

@savannahostrowski
Copy link
Member Author

I'm going to start poking around at this.

@ZeroIntensity
Copy link
Member

I'm a little concerned about this. I was on a laptop a few weeks ago that had LLVM 17 installed, and I upgraded it to 18 to build the JIT -- it completely broke my system, and took several hours of debugging in a recovery shell to find the problem and fix it. Will we require LLVM 19, or just support it?

@picnixz picnixz added the build The build process and cross-build label Sep 5, 2024
@brandtbucher
Copy link
Member

Probably require, especially since the feature is optional and (still) experimental. We're also going to want to use some new features of 19, since it means we can get rid of some ugly hacks and will probably pave the way for easier performance improvements on our end (so it's not just updating our toolchain for the sake of updating).

BTW, multiple LLVM versions can typically be installed side-by-side, and our build process works correctly even if clang is an incompatible version but clang-18 exists (for example). Did just installing the new version break everything, or did you completely replace the existing 17 installation?

We should also hold off on this until LLVM 19 is available for all of the platforms we care about. IIRC, Homebrew support was way behind in the 18 cycle.

@brandtbucher
Copy link
Member

Also, if your machine was macOS, installing an incompatible LLVM on your PATH will probably break stuff (which is why Homebrew doesn't do it by default). The build scripts know how to find a Homebrew install that isn't on the user's PATH though.

@brandtbucher brandtbucher added the 3.14 new features, bugs and security fixes label Sep 5, 2024
@ZeroIntensity
Copy link
Member

Did just installing the new version break everything, or did you completely replace the existing 17 installation?

I'm not totally sure (I don't know much about package managers), probably the latter. FWIW, the machine was Arch.

@savannahostrowski
Copy link
Member Author

savannahostrowski commented Sep 6, 2024

@brandtbucher Yeah, I wouldn't want to merge the PR in until the installers catch up. It'll make the dev experience a lot more palatable than building LLVM from source 😅. I just kind of figured I'd get a head start trying to wrap my head around it since rc-4 should be pretty stable.

@picnixz
Copy link
Contributor

picnixz commented Sep 6, 2024

I'm not totally sure (I don't know much about package managers), probably the latter. FWIW, the machine was Arch.

Assuming that Arch is Arch Linux for you, IIRC, it does not support having two different versions of LLVMs living together (but I don't know if it's still the case and if you can just build it from source and isolate it). On the other hand, upgrading to LLVM 18 can break some of your system packages (I remember that there were some issues with LLVM 16 which broke Steam games, but I'm not surprised that it can break a rolling-release).

@ZeroIntensity
Copy link
Member

it does not support having two different versions of LLVMs living together

Yeah, I learned that the hard way. I'm not opposed to upgrading to LLVM 19 for the JIT, I just think we should keep compatibility in mind.

@brandtbucher
Copy link
Member

Hm, okay, definitely something to keep in mind then (though as a general improvement for the future, I don’t see it as a blocker for this particular issue).

I wonder if we can do something like we do for Homebrew, where there’s some sort of standard install location that’s not on the user’s PATH. Another option could be to let a user pass a path to their LLVM installation via a configure arg instead of us trying to find it. Or we could attempt to support a range of versions once the JIT is stable, which could work but seems like it has the potential to massively increase the complexity of the build scripts (and our testing matrix).

See also GH-115869 for related discussion about removing the LLVM dependency.

@picnixz
Copy link
Contributor

picnixz commented Sep 6, 2024

I wonder if we can do something like we do for Homebrew, where there’s some sort of standard install location that’s not on the user’s PATH

Should probably be possible according to https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm. For other non-rolling release distributions, multiple versions can co-exist together (I have multiple LLVM versions on openSUSE Leap).

@theoparis
Copy link

theoparis commented Oct 4, 2024

Can this be backported to 3.13 in time for the release? I am using Gentoo Linux and python 3.14/main isn't an option unless I patch the majority of gentoo's packages to support it. I have already updated to llvm 19 so if it can't be backported I'll have to disable the jit option for now.

@ZeroIntensity
Copy link
Member

I don't think we're going to even be merging this before the 3.13 release -- your best bet is to disable the JIT (it's experimental, anyway).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes build The build process and cross-build topic-JIT
Projects
None yet
Development

No branches or pull requests

5 participants