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

gh-118306: Update JIT compilation to use LLVM 18 #118307

Merged
merged 32 commits into from Apr 29, 2024

Conversation

savannahostrowski
Copy link
Contributor

@savannahostrowski savannahostrowski commented Apr 26, 2024

This PR updates the LLVM version used for JIT compilation from 16 to 18.

Main changes, other than the basic 16 --> 18 string updates 😊 :

  • Handled some new instructions that were previously not surfaced in LLVM 16 across OS binary formats
  • Updated properties where JSON parser had changed

Known Issues:

@savannahostrowski
Copy link
Contributor Author

It looks like test_traceback and test_tracemalloc are failing in aarch64 linux jobs. However, those also seem to be failing in other JIT CI runs as well?

@brandtbucher
Copy link
Member

brandtbucher commented Apr 26, 2024

Thanks for taking on this project... it ended up being quite a bit more work for you than I originally thought!

I'd like to benchmark this and peek around at the generated code to make sure we don't see any significant performance degradations. I'm expecting a small slowdown on aarch64-apple-darwin since we need to insert trampolines there now... but we'll see how bad it really is.

It looks like test_traceback and test_tracemalloc are failing in aarch64 linux jobs. However, those also seem to be failing in other JIT CI runs as well?

Yup, see GH-118275.

.github/workflows/jit.yml Outdated Show resolved Hide resolved
.github/workflows/jit.yml Show resolved Hide resolved
Python/jit.c Outdated Show resolved Hide resolved
Tools/jit/README.md Outdated Show resolved Hide resolved
Tools/jit/_schema.py Outdated Show resolved Hide resolved
Tools/jit/_stencils.py Outdated Show resolved Hide resolved
@brandtbucher
Copy link
Member

Also, thanks for digging up the related LLVM issues!

@brandtbucher brandtbucher self-assigned this Apr 26, 2024
@brandtbucher brandtbucher added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Apr 26, 2024
@savannahostrowski
Copy link
Contributor Author

I think we might be missing some tests or checks for x86_64 Linux jobs. The CI is passing but when I compile in a Codespace (not local dev container...which is Arm in my case), I get other unhandled instructions (e.g. HoleKind_R_X86_64_32, HoleKind_R_X86_64_32S and HoleKind_R_X86_64_PLT32). I'll dig into this over the weekend and patch things up but we may want to investigate adding more coverage here.

@brandtbucher
Copy link
Member

I get other unhandled instructions (e.g. HoleKind_R_X86_64_32, HoleKind_R_X86_64_32S and HoleKind_R_X86_64_PLT32).

Hm, I wonder if Fedora uses a patched LLVM with different defaults or something...

@brandtbucher
Copy link
Member

Can you try adding -fpic to the list of args for the Linux targets? Position-independent code (which lets us reference symbols more than 32 bits away) is the default on the other platforms, but based on your description it seems like it isn't for Fedora. Adding that option might fix it.

@savannahostrowski
Copy link
Contributor Author

Ah! Okay, that did work for the Codespace. Also, checked in the local dev container as well. Thanks for the tip!

@brandtbucher
Copy link
Member

Nice, looks like it's also a slight performance improvement (if anything).

@brandtbucher brandtbucher enabled auto-merge (squash) April 29, 2024 18:53
@brandtbucher
Copy link
Member

Doc failure isn't us: #118401

@brandtbucher
Copy link
Member

Free-threading failures look like flukes too. Gonna re-run once the JIT tests finish.

@brandtbucher brandtbucher enabled auto-merge (squash) April 29, 2024 20:46
@brandtbucher brandtbucher merged commit 8b56d82 into python:main Apr 29, 2024
61 checks passed
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants