-
Notifications
You must be signed in to change notification settings - Fork 349
Move llvmlite to LLVM 20 #1092
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
Move llvmlite to LLVM 20 #1092
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Hi, I found time to try and work on getting llvmlite to build with a version of llvm that's in Debian. I took this pull request and rebased it against 0.44.0, and then collapse the branch into a single diff to apply to the a Debian 0.44.0 version of the llvmlite package. I pushed what I've manage to get done to https://github.com/detrout/llvmlite/tree/llvm19 I noticed there's a bunch of code removed this pull request in a migration from passmanager to newpassmanager, though the llvmlite HEAD branch currently has both passmanager and newpassmanager modules. I don't know if it's intended to remove passmanager or not? The merged code almost works (at least on Debian unstable on a x86 cpu with python 3.13.2 and llvm-19.1.7) it's down to two test failures. I did try running the build under arm64 using qemu and funny story, all the tests passed. |
|
I'd also managed to run the two test failures in pdb, and for the llvmlite.tests.test_binding.TestObjectFile.test_object_file I found a possibly useful thing that there was a .text segment that had no contents. Though there were other text segments like (I think) .ltext that had some contents |
|
I am deep into places I don't understand and could use help. This is the test failure from test_binding.py::TestObjectFile.test_object_file() on an older x86_64 cpu I figured out how to print the assembly code. This is with llvm-19 and there's a .section section that the llvm-15 version doesn't use This is what was generated from llvm 15.0.7 from conda. |
|
Hi @detrout, thanks for looking into this! The pull request is due a rebase/merge of main for a long time now. The time I created this pull request all tests were passing which obviously isn't the case right now. May I know what are you trying to do with these changes? Meanwhile let me try running the tests again locally. |
|
What's going on is Debian is coming close to a freeze and our release team dropped our llvm-15 for having too many unfixed bugs. which then removed llvmlite, and that removes numba, and that breaks a whole bunch of scientific python packages. We do have llvm-19 and I when I saw this pull request and thought I'd take a stab at merging it. What I did was to take the original pull request and rebase it against the 0.44.0 release of llvmlite, to try and get something that might be reasonable for Debian to ship. So that's why I was aiming for the release version of llvmlite instead of HEAD. At this point I made progress more out of stubbornness than any deep understanding of llvm. Though I'm learning bits as I try to figure out whats going on. I pushed my updated debian package to https://salsa.debian.org/diane/llvmlite Though unlike the github version that has a flattened version of the llvm-19 compatibility patch. |
I'm not sure if this helps but llvmlite v0.44 do support LLVM 16 out of the box https://llvmlite.readthedocs.io/en/latest/release-notes.html |
|
It seems that the minimum version available in Debian testing is llvm-18 |
|
@detrout I looked the assembly assertion error and also reproduced it locally. It doesn't look like anything is wrong, just a slight update in the code layout I'm not exactly sure why. You can just update the test and move on |
|
I added 2 commits to deal with the test failures with llvm-19 at https://github.com/detrout/llvmlite/commits/llvm19/ what would you like next? try to rebase that change set against HEAD? |
For this PR? I don't think a rebase is required, I did merge the main branch into it. We would have to wait for the reviews to move forward. Right now numba/numba#9676 is the first hurdle before this can be merged. |
I'm happy to hear Debian's planning to ship an updated llvmlite+llvm release! 😄
I think this should work in principle, but I'd suggest rebasing this against HEAD instead. This PR precedes a few others where we improved support for LLVM opaque pointers. Without them, some of the code paths in Numba may not work with LLVM 17+. Alternatively, you could cherry-pick these PRs onto the 0.44 release, which I believe should work as the changes are mostly self-contained. The relevant PRs are #1159, #1158 and #1160 (merged in this order). Please let me know if you'd like some help with this. |
|
@yashssh Will numba/numba#9676 also be needed in Numba for it to work with LLVM >= 17? Would @detrout need to grab that and incorporate it into the Debian sources? |
Yes that's correct. @detrout if you are cherrypicking the changes on top of last release you will also need #1163 in addition to what Ricardo mentioned (perhaps it's easier to rebase on top of main). numba/numba#9676 introduces a switch to use either the Legacy or the New pass manager in Numba(defaulting to the new PM). That merge request is supposed to be followed by another code cleanup change that drops support for the legacy pass manager entirely in Numba. Post those changes we can merge this change in llvmlite. For simplifying things I have consolidated all required Numba changes in this draft pull request, which should allow you to move forward in Numba with a single patch. |
|
My first stab at building debianianized numba 0.61.0 with this patched version of llvmlite 0.44 didn't work and I need to figure out why. Thank you all for highlighting more pull requests that might be needed, hopefully I'll have some time soon to try and start plugging them together. |
|
@detrout we have rebased the required llvmlite LLVM19 changes on top of last release (v0.44) #1182 combined with necessary numba changes numba/numba#10011 should allow you to build and test everything with LLVM19. You might still have to add workarounds for the x86 failures you saw. |
|
llvmlite build on x86_64 and on arm64 (under qemu) with the recommend numba patch numba/numba#10011 and https://github.com/numba/numba/commit/1e2fb1d1c81880a645345991eb48e39b578e119d.patch I was able to get numba to build using llvmlite 0.44 with llvm-19. it built and ran it's tests under x86_64 but I got a timeout error for arm64 under qemu.... Though I know that numba tests take forever. |
List of changes in this MR - Delete legacy pass manager code - Delete typed pointer code - Update APIs that needs updating for llvm19 - Update refprune pass and its tests
|
I have rebased the changes on top of main since #1091 was merged. |
All CI - azure and GHA are functional now. |
|
The |
esc
left a comment
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.
These changes are needed to simplify the build scripts.
Co-authored-by: Emergency Self-Construct <[email protected]>
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.
👍 I've reviewed the C++ changes and the main merge to pick up CMake migration.
One minor issue is that this is missing OrcDebugging. So just this oneliner sklam@688a910
…setup Co-authored-by: Emergency Self-Construct <[email protected]>
LLVM20 splitted out Orc debugging into a separate component.
|
Conda packages and wheels produced by this PR have been tested against Two Windows (win-64) jobs - the conda builder and the wheel builder are currently failing due to known gha issues. Fixes are proposed in numba#10193 and numba#10194, with passing validation runs. |
|
Based on the tests in numba/numba#10146 -- this is now ready to merge. |
esc
left a comment
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.
all good now
Depends and contains changes introduced with #1091List of changes in this MR
StandardIntrumentationschecks function analysis invalidation in module passes as well: https://reviews.llvm.org/D146160TargetParser.getHostCPUFeatures()returns aStringMap: [llvm][TargetParser] Return StringMap from getHostCPUFeatures llvm/llvm-project#97824CodeGenOpt::Levelturned into an enum class: [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes llvm/llvm-project#66295TODO:
and pass timer featureshave to be added(edited by @gmarkall to link to relevant review for dropping initialization APIs)